sessions.c File Reference

#include "services.h"
#include "pseudo.h"

Go to the source code of this file.

Defines

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

Functions

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)
void expire_exceptions (void)
Exceptionfind_host_exception (const char *host)
Exceptionfind_hostip_exception (const char *host, const char *hostip)
Sessionfindsession (const char *host)
void get_exception_stats (long *nrec, long *memuse)
void get_session_stats (long *nrec, long *memuse)
void load_exceptions ()
void save_exceptions ()
void save_rdb_exceptions ()

Variables

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


Define Documentation

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

Definition at line 58 of file sessions.c.

#define SAFE (  ) 

Value:

do {                                            \
    if ((x) < 0) {                                              \
        restore_db(f);                                          \
        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)

Definition at line 441 of file sessions.c.

#define SAFE (  ) 

Value:

do {                                    \
    if ((x) < 0) {                                      \
        if (!forceload)                                 \
            fatal("Read error on %s", ExceptionDBName); \
        nexceptions = i;                                \
        break;                                          \
    }                                                   \
} while (0)

Definition at line 441 of file sessions.c.


Function Documentation

int add_session ( char *  nick,
char *  host,
char *  hostip 
)

Definition at line 206 of file sessions.c.

References add_akill(), anope_cmd_global(), BUFSIZE, checkDefCon(), session_::count, DEFCON_REDUCE_SESSION, DefConSessionLimit, DefSessionLimit, find_hostip_exception(), findsession(), HASH, session_::hits, session_::host, kill_user(), exception_::limit, MaxSessionKill, session_::next, notice(), nsessions, session_::prev, s_OperServ, scalloc(), SessionAutoKillExpiry, SessionLimitDetailsLoc, SessionLimitExceeded, sessionlist, snprintf(), and sstrdup().

Referenced by do_nick().

void del_session ( const char *  host  ) 

Definition at line 266 of file sessions.c.

References alog(), anope_cmd_global(), session_::count, debug, findsession(), HASH, session_::host, LimitSessions, session_::next, nsessions, session_::prev, s_OperServ, and sessionlist.

Referenced by do_ghost(), do_kill(), and do_quit().

int do_exception ( User u  ) 

Definition at line 664 of file sessions.c.

References dotime(), exception_add(), ExceptionExpiry, exceptions, expire_exceptions(), LimitSessions, match_wild_nocase(), MaxSessionLimit, MOD_CONT, user_::nick, notice_lang(), process_numlist(), readonly, s_OperServ, scalloc(), stricmp(), strspn(), and syntax_error().

Referenced by AnopeInit().

int do_session ( User u  ) 

Definition at line 114 of file sessions.c.

References session_::count, DefSessionLimit, find_host_exception(), findsession(), session_::host, LimitSessions, MOD_CONT, session_::next, notice_lang(), s_OperServ, sessionlist, stricmp(), and syntax_error().

Referenced by AnopeInit().

int exception_add ( User u,
const char *  mask,
const int  limit,
const char *  reason,
const char *  who,
const time_t  expires 
)

Definition at line 510 of file sessions.c.

References exceptions, exception_::expires, exception_::limit, exception_::mask, nexceptions, NICKMAX, notice_lang(), exception_::num, exception_::reason, s_OperServ, srealloc(), sstrdup(), stricmp(), strscpy(), and exception_::time.

Referenced by do_exception().

void expire_exceptions ( void   ) 

Definition at line 329 of file sessions.c.

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

Referenced by do_exception(), and expire_all().

Exception* find_host_exception ( const char *  host  ) 

Definition at line 352 of file sessions.c.

References exceptions, match_wild_nocase(), and nexceptions.

Referenced by do_session().

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

Definition at line 367 of file sessions.c.

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

Referenced by add_session().

Session* findsession ( const char *  host  ) 

Definition at line 181 of file sessions.c.

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

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

void get_exception_stats ( long *  nrec,
long *  memuse 
)

Definition at line 87 of file sessions.c.

References exceptions, and nexceptions.

void get_session_stats ( long *  nrec,
long *  memuse 
)

Definition at line 70 of file sessions.c.

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

Referenced by do_stats().

void load_exceptions ( void   ) 

Definition at line 395 of file sessions.c.

References close_db(), EXCEPTION_VERSION, ExceptionDBName, exceptions, exception_::expires, fatal(), get_file_version(), exception_::limit, nexceptions, open_db(), read_buffer, read_int16(), read_int32(), read_string(), s_OperServ, SAFE, scalloc(), and exception_::time.

Referenced by init_secondary().

void save_exceptions ( void   ) 

Definition at line 454 of file sessions.c.

References close_db(), EXCEPTION_VERSION, ExceptionDBName, exceptions, nexceptions, open_db(), s_OperServ, SAFE, write_buffer, write_int16(), write_int32(), and write_string().

Referenced by save_databases().

void save_rdb_exceptions ( void   ) 

Definition at line 479 of file sessions.c.

References alog(), exceptions, nexceptions, rdb_clean_table(), rdb_close(), rdb_open(), rdb_save_exceptions(), and rdb_tag_table().

Referenced by save_databases().


Variable Documentation

Exception* exceptions = NULL

Definition at line 63 of file sessions.c.

int16 nexceptions = 0

Definition at line 64 of file sessions.c.

int32 nsessions = 0

Definition at line 61 of file sessions.c.

Session* sessionlist[1024]

Definition at line 60 of file sessions.c.


Generated on Sun Dec 30 09:26:59 2007 for Anope by  doxygen 1.5.1-20070107