Omega Security Services 0.7.3

eventhandler.h File Reference

Go to the source code of this file.

Data Structures

struct  ServCmds
struct  UserCmds
struct  SockEvent
struct  evh_channel
struct  Events

Defines

#define HASH(x, y)   hash_safe(x,y)
#define EVENT_UNLIMITED   -1
#define AddEvent(name, fnct)   AddEventEx(name, -1, -1, fnct)
#define AddTimedEvent(event, fnct, interval)   AddEventEx(event, interval, -1, fnct)
#define DelTimedEvent(event)   DelEvent(event, NULL)

Typedefs

typedef void cmd_fnct (int, char **)
typedef void HandleEvent (int)

Enumerations

enum  EventType {
  EVENT_READ = 0, EVENT_WRITE = 1, EVENT_ERROR = 2, EVENT_CONNECT = 3,
  EVENT_ENDBURST = 4, EVENT_NICK = 5, EVENT_QUIT = 6, EVENT_VERSION = 7,
  EVENT_SERVERCONN = 8, EVENT_SERVEREXIT = 9
}

Functions

void DelEvent (char *event, void *fnct)
int AddEventEx (char *, int, int, void *)
void Event (char *, int, void *)
void AddServCmd (char *, void(*fnct)(Link *, int, char **))
int HandleServCmd (char *, Link *, int, char **)
void DelServCmd ()
ServCmdsFindServCmd (char *cmd)
void catchCoreErr (int errcode, char *errstr)
void AddErrHandler (int errcode, void *fnct)
void AddUserCmd (char *, void(*fnct)(User *, int, char **))
int HandleUserCmd (char *, User *, int, char **)
void DelUserCmd (char *, void(*fnct)(User *, int, char **))
void HandleMsg (char *msgtype, char *source, char *dest, char *msg)
void AddModuleMessage (char *msg, void(*fnct)(char *src, char *dest, char *msg))
void RunTimedEvents ()
void destroy_event_list ()
void ev_housekeeping (int, char **)
void ev_connectuplink (int, char **)
void ev_ping (int, char **)

Variables

dlink_list UserCmdTable [1024]
dlink_list ServCmdTable [1024]
dlink_list sockevents
dlink_list err_handlers
HandleEventEventList [1024]
dlink_list events

Define Documentation

#define AddEvent (   name,
  fnct 
)    AddEventEx(name, -1, -1, fnct)

Definition at line 130 of file eventhandler.h.

Referenced by init_access(), init_modules(), and Run().

#define AddTimedEvent (   event,
  fnct,
  interval 
)    AddEventEx(event, interval, -1, fnct)

Definition at line 131 of file eventhandler.h.

Referenced by send_line(), and sock_getbyte().

#define DelTimedEvent (   event)    DelEvent(event, NULL)

Definition at line 132 of file eventhandler.h.

Referenced by ev_connectuplink().

#define EVENT_UNLIMITED   -1

Definition at line 7 of file eventhandler.h.

Referenced by Run().

#define HASH (   x,
 
)    hash_safe(x,y)

Definition at line 5 of file eventhandler.h.


Typedef Documentation

typedef void cmd_fnct(int, char **)

Definition at line 32 of file eventhandler.h.

typedef void HandleEvent(int)

Definition at line 91 of file eventhandler.h.


Enumeration Type Documentation

enum EventType

Socket/Select Events

Enumerator:
EVENT_READ 
EVENT_WRITE 
EVENT_ERROR 
EVENT_CONNECT 
EVENT_ENDBURST 
EVENT_NICK 
EVENT_QUIT 
EVENT_VERSION 
EVENT_SERVERCONN 
EVENT_SERVEREXIT 

Definition at line 16 of file eventhandler.h.


Function Documentation

void AddErrHandler ( int  errcode,
void *  fnct 
)
int AddEventEx ( char *  ,
int  ,
int  ,
void *   
)
void AddModuleMessage ( char *  msg,
void(*)(char *src, char *dest, char *msg)  fnct 
)
void AddServCmd ( char *  ,
void(*)(Link *, int, char **)  fnct 
)
void AddUserCmd ( char *  cmd,
void(*)(User *, int, char **)  fnct 
)

Okay instead of using a fat dlinked list index the commands by name into a hash then retrieve assocated lists this will save time in the future.

Definition at line 290 of file eventhandler.c.

References UserCmds::active, dlink_add_tail(), dlink_create(), HASH, UserCmds::routine, and UserCmdTable.

Referenced by psr_init().

void catchCoreErr ( int  errcode,
char *  errstr 
)
void DelEvent ( char *  event,
void *  fnct 
)
void DelServCmd ( )
void DelUserCmd ( char *  ,
void(*)(User *, int, char **)  fnct 
)
void destroy_event_list ( )

Definition at line 40 of file eventhandler.c.

References alog(), dlink_delete(), DLINK_FOREACH_SAFE, dlink_free(), events, and LOG_EVENT.

Referenced by AtExit().

void ev_connectuplink ( int  ,
char **   
)
void ev_housekeeping ( int  ,
char **   
)

Definition at line 381 of file eventhandler.c.

Referenced by Run().

void ev_ping ( int  ,
char **   
)
ServCmds* FindServCmd ( char *  cmd)
void HandleMsg ( char *  msgtype,
char *  source,
char *  dest,
char *  msg 
)
int HandleServCmd ( char *  ,
Link ,
int  ,
char **   
)

Definition at line 219 of file eventhandler.c.

References alog(), DEBUG3, DLINK_FOREACH, ServCmds::fnct, HASH, ServCmds::name, and ServCmdTable.

Referenced by parse().

int HandleUserCmd ( char *  ,
User *  ,
int  ,
char **   
)

Definition at line 348 of file eventhandler.c.

References DLINK_FOREACH, HASH, UserCmds::routine, and UserCmdTable.

Referenced by parse().


Variable Documentation

dlink_list err_handlers

Definition at line 86 of file eventhandler.h.

Definition at line 124 of file eventhandler.h.

dlink_list events
dlink_list ServCmdTable[1024]

Definition at line 84 of file eventhandler.h.

Referenced by AddServCmd(), DelServCmd(), and HandleServCmd().

dlink_list sockevents

Definition at line 85 of file eventhandler.h.

Referenced by init_lists().

dlink_list UserCmdTable[1024]

Definition at line 83 of file eventhandler.h.

Referenced by AddUserCmd(), DelUserCmd(), and HandleUserCmd().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines