librepsheet  6.2.0
TheRepsheetcorelogiclibrary
 All Data Structures Files Functions Pages
Functions
librepsheet.c File Reference
#include <stdlib.h>
#include <string.h>
#include "hiredis/hiredis.h"
#include "config.h"
#include "repsheet.h"

Functions

redisContext * get_redis_context (const char *host, int port, int timeout)
 
redisContext * repsheet_connect (const char *host, int port, int connect_timeout, int read_timeout)
 
int check_connection (redisContext *context)
 
int repsheet_reconnect (redisContext *context)
 
int actor_status (redisContext *context, const char *actor, int type, char *reason)
 

Detailed Description

Author
Aaron Bedra
Date
5/19/2014

Function Documentation

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

Top level API for determining the status of an actor

Parameters
contextthe Redis connection
actorthe IP address or user value of the actor
typeIP or USER
reasonreturn the reason if whitelisted, blacklisted, or marked.
Returns
an integer status
int check_connection ( redisContext *  context)

Tests the connection to ensure it is working properly

Parameters
contextthe Redis connection
Returns
an integer response with the connection status
redisContext* get_redis_context ( const char *  host,
int  port,
int  timeout 
)

This function establishes a connection to Redis with a connect time out

Parameters
hostthe hostname of the Redis server
portthe port number of the Redis server
timeoutthe length in milliseconds before the connection times out
Returns
a Redis connection
redisContext* repsheet_connect ( const char *  host,
int  port,
int  connect_timeout,
int  read_timeout 
)

This function establishes a connection to Redis with a connect and request time out

Parameters
hostthe hostname of the Redis server
portthe port number of the Redis server
connect_timeoutthe length in milliseconds before the connection times out
read_timeoutthe length in milliseconds before a request times out
Returns
a Redis connection
int repsheet_reconnect ( redisContext *  context)

Tests the connection to ensure it is working properly

Parameters
contextthe Redis connection
Returns
an integer response with the connection status