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

Functions

void set_initial_whitelist_size (int new_size)
 
int whitelist (redisContext *context, const char *actor, int type, const char *reason)
 
int is_ip_whitelisted (redisContext *context, const char *actor, char *reason)
 
int is_user_whitelisted (redisContext *context, const char *actor, char *reason)
 

Variables

int initial_whitelist_size = 1000
 

Detailed Description

Author
Aaron Bedra
Date
12/09/2014

Function Documentation

int is_ip_whitelisted ( redisContext *  context,
const char *  actor,
char *  reason 
)

Checks to see if an ip is on the Repsheet whitelist

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

Checks to see if a user is on the Repsheet whitelist

Parameters
contextthe Redis connection
actorthe user
reasonreturns the reason for whitelisting.
Returns
TRUE if yes, FALSE if no, DISCONNECTED if error
int whitelist ( redisContext *  context,
const char *  actor,
int  type,
const char *  reason 
)

Adds the actor to the Repsheet whitelist

Parameters
contextthe Redis connection
actorthe actors user data or ip address
typeIP or USER string to describe the reason for whitelisting
Returns
an integer result