Anope IRC Services  Version 1.8
Macros | Functions | Variables
sessions.c File Reference
#include "services.h"
#include "pseudo.h"
Include dependency graph for sessions.c:

Go to the source code of this file.

Macros

#define HASH(host)   (((host)[0]&31)<<5 | ((host)[1]&31))
 
#define SAFE(x)
 
#define SAFE(x)
 

Functions

void get_session_stats (long *nrec, long *memuse)
 
void get_exception_stats (long *nrec, long *memuse)
 
int do_session (User *u)
 
Sessionfindsession (const char *host)
 
int add_session (char *nick, char *host, char *hostip)
 
void del_session (const char *host)
 
void expire_exceptions (void)
 
Exceptionfind_host_exception (const char *host)
 
Exceptionfind_hostip_exception (const char *host, const char *hostip)
 
void load_exceptions ()
 
void save_exceptions ()
 
void save_rdb_exceptions ()
 
int exception_add (User *u, const char *mask, const int limit, const char *reason, const char *who, const time_t expires)
 
static int exception_del (const int index)
 
static int exception_del_callback (User *u, int num, va_list args)
 
static int exception_list (User *u, const int index, int *sent_header)
 
static int exception_list_callback (User *u, int num, va_list args)
 
static int exception_view (User *u, const int index, int *sent_header)
 
static int exception_view_callback (User *u, int num, va_list args)
 
int do_exception (User *u)
 

Variables

Sessionsessionlist [1024]
 
int32 nsessions = 0
 
Exceptionexceptions = NULL
 
int16 nexceptions = 0
 

Macro Definition Documentation

#define HASH (   host)    (((host)[0]&31)<<5 | ((host)[1]&31))

Definition at line 57 of file sessions.c.

Referenced by add_session(), and del_session().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
if (!forceload) \
fatal("Read error on %s", ExceptionDBName); \
break; \
} \
} while (0)
E char * ExceptionDBName
Definition: extern.h:509
E void E void E void fatal(const char *fmt,...) FORMAT(printf
int16 nexceptions
Definition: sessions.c:63
E int forceload
Definition: extern.h:780

Definition at line 440 of file sessions.c.

Referenced by load_exceptions(), and save_exceptions().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
log_perror("Write error on %s", ExceptionDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
anope_cmd_global(NULL, "Write error on %s: %s", ExceptionDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
return; \
} \
} while (0)
E char * ExceptionDBName
Definition: extern.h:509
E int WarningTimeout
Definition: extern.h:347
E void restore_db(dbFILE *f)
Definition: datafiles.c:318
E char * strerror(int errnum)
Definition: compat.c:123
static time_t lastwarn
Definition: datafiles.c:19
E void E void log_perror(const char *fmt,...) FORMAT(printf
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506

Definition at line 440 of file sessions.c.

Function Documentation

int add_session ( char *  nick,
char *  host,
char *  hostip 
)
void del_session ( const char *  host)
int do_exception ( User u)
int do_session ( User u)
int exception_add ( User u,
const char *  mask,
const int  limit,
const char *  reason,
const char *  who,
const time_t  expires 
)
static int exception_del ( const int  index)
static

Definition at line 549 of file sessions.c.

References nexceptions, and srealloc().

Referenced by do_exception(), and exception_del_callback().

static int exception_del_callback ( User u,
int  num,
va_list  args 
)
static

Definition at line 570 of file sessions.c.

References exception_del(), and nexceptions.

Referenced by do_exception().

static int exception_list ( User u,
const int  index,
int *  sent_header 
)
static

Definition at line 586 of file sessions.c.

References nexceptions, notice_lang(), and s_OperServ.

Referenced by do_exception(), and exception_list_callback().

static int exception_list_callback ( User u,
int  num,
va_list  args 
)
static

Definition at line 600 of file sessions.c.

References exception_list().

Referenced by do_exception().

static int exception_view ( User u,
const int  index,
int *  sent_header 
)
static
static int exception_view_callback ( User u,
int  num,
va_list  args 
)
static

Definition at line 636 of file sessions.c.

References exception_view().

Referenced by do_exception().

void expire_exceptions ( void  )

Definition at line 328 of file sessions.c.

References anope_cmd_global(), nexceptions, s_OperServ, srealloc(), and WallExceptionExpire.

Referenced by do_exception(), and expire_all().

Exception* find_host_exception ( const char *  host)

Definition at line 351 of file sessions.c.

References match_wild_nocase(), and nexceptions.

Referenced by do_session().

Exception* find_hostip_exception ( const char *  host,
const char *  hostip 
)

Definition at line 366 of file sessions.c.

References ircd, match_wild_nocase(), nexceptions, and ircdvars_::nickip.

Referenced by add_session().

Session* findsession ( const char *  host)

Definition at line 180 of file sessions.c.

References session_::host, session_::next, and stricmp().

Referenced by add_session(), del_session(), and do_session().

void get_exception_stats ( long *  nrec,
long *  memuse 
)

Definition at line 86 of file sessions.c.

References nexceptions.

Referenced by get_operserv_stats().

void get_session_stats ( long *  nrec,
long *  memuse 
)

Definition at line 69 of file sessions.c.

References session_::host, session_::next, and nsessions.

Referenced by do_stats().

void load_exceptions ( void  )
void save_exceptions ( void  )
void save_rdb_exceptions ( void  )

Variable Documentation

Exception* exceptions = NULL

Definition at line 62 of file sessions.c.

int16 nexceptions = 0
int32 nsessions = 0

Definition at line 60 of file sessions.c.

Referenced by add_session(), del_session(), and get_session_stats().

Session* sessionlist[1024]

Definition at line 59 of file sessions.c.