librepsheet  6.2.0
TheRepsheetcorelogiclibrary
 All Data Structures Files Functions Pages
Functions | Variables
blacklist.c File Reference
#include <string.h>
#include "repsheet.h"
#include "common.h"
#include "cidr.h"
#include "check_cidr.h"

Functions

void set_initial_blacklist_size (int new_size)
 
int blacklist (redisContext *context, const char *actor, int type, const char *reason)
 
int is_ip_blacklisted (redisContext *context, const char *actor, char *reason)
 
int is_user_blacklisted (redisContext *context, const char *actor, char *reason)
 

Variables

int initial_blacklist_size = 100
 

Detailed Description

Author
Aaron Bedra
Date
12/09/2014

Function Documentation

int blacklist ( redisContext *  context,
const char *  actor,
int  type,
const char *  reason 
)

Adds the actor to the Repsheet blacklist

Parameters
contextthe Redis connection
actorthe actors user data or ip address
typeIP or USER string to describe the reason for blacklisting
Returns
an integer result
int is_ip_blacklisted ( redisContext *  context,
const char *  actor,
char *  reason 
)

Checks to see if an ip is on the Repsheet blacklist

Parameters
contextthe Redis connection
actorthe IP address of the actor
reasonreturns the reason for blacklisting.
Returns
TRUE if yes, FALSE if no, DISCONNECTED if error
int is_user_blacklisted ( redisContext *  context,
const char *  actor,
char *  reason 
)

Checks to see if a user is on the Repsheet blacklist

Parameters
contextthe Redis connection
actorthe user
reasonreturns the reason for blacklisting.
Returns
TRUE if yes, FALSE if no, DISCONNECTED if error
void set_initial_blacklist_size ( int  new_size)

externally settable parameter

Parameters
new_sizeinitial size of expandable blacklist cache