cmds.h File Reference

Go to the source code of this file.

Data Structures

struct  CmdHash
struct  HelpEntry

Defines

#define CMD_ERR_OK   0
#define CMD_ERR_INV   1
#define CMD_ERR_ACC   2
#define CMD_ERR_PARAMS   3
#define CMD_ERR_INDEX   4
#define CMD_ERR_HASH   5

Functions

int HELP_FOREACH (User *, User *)
int do_cmd (char *cmd, User *us, User *u, int ac, char *av)
void ACCESS_DENIED (User *, User *)
CmdHash * CmdHashCreate (User *u)
int AddCmd (User *, char *, char *, void(*fnct)(User *, char **))
void DelCmd (User *, char *, void(*fnct)(User *, char **))
int AddHelpExt (int index, User *u, void(*helpcmd)(User *))
int AddHelp (User *u, void(*helpcmd)(User *))
int DelHelp (User *u, void(*helpcmd)(User *))
char * CmdErr (int)
static void ClientCmdNull (User *u, char *av)

Define Documentation

#define CMD_ERR_ACC   2

Definition at line 7 of file cmds.h.

#define CMD_ERR_HASH   5

Definition at line 10 of file cmds.h.

#define CMD_ERR_INDEX   4

Definition at line 9 of file cmds.h.

#define CMD_ERR_INV   1

Definition at line 6 of file cmds.h.

#define CMD_ERR_OK   0

Definition at line 5 of file cmds.h.

#define CMD_ERR_PARAMS   3

Definition at line 8 of file cmds.h.


Function Documentation

void ACCESS_DENIED ( User *  ,
User *   
)
int AddCmd ( User *  u,
char *  name,
char *  access,
void(*)(User *, char **)  fnct 
)

Add a command to our clients command hash.

Note:
There is a bit of presumptions we make when issueing this function, for one we assume that u is always our client, since client structuresare the same as user structures except they have been flagged as our clients.
Parameters:
u Pointer to our clients structure
name The name of the command we are using, this is imporntant becuase the command will be issued and looked up via its name.
access Access level required to issue the command.
fnct A pointer to the command's function.
Returns:
True/False - Returns true if everything goes as planned and false if not.

Definition at line 67 of file cmds.c.

References alog(), DEBUG3, dlink_add_tail(), dlink_create(), HASH, and strlcpy().

Referenced by Module_Init().

int AddHelp ( User *  u,
void(*)(User *)  helpcmd 
)

Definition at line 96 of file cmds.c.

References alog(), DEBUG3, dlink_add_tail(), dlink_create(), and HelpEntry::routine.

Referenced by Module_Init().

int AddHelpExt ( int  index,
User *  u,
void(*)(User *)  helpcmd 
)

Definition at line 121 of file cmds.c.

References alog(), DEBUG3, dlink_add_tail(), dlink_create(), and HelpEntry::routine.

Referenced by Module_Init().

static void ClientCmdNull ( User *  u,
char *  av 
) [static]
char* CmdErr ( int   ) 

Definition at line 319 of file cmds.c.

Referenced by HandleClientCmds().

CmdHash* CmdHashCreate ( User *  u  ) 
void DelCmd ( User *  ,
char *  ,
void(*)(User *, char **)  fnct 
)

Definition at line 171 of file cmds.c.

References dlink_find_delete(), DLINK_FOREACH_SAFE, dlink_free(), HASH, and MyFree.

int DelHelp ( User *  u,
void(*)(User *)  helpcmd 
)

Definition at line 144 of file cmds.c.

References dlink_find_delete(), DLINK_FOREACH, dlink_free(), and HelpEntry::routine.

Referenced by Module_Close().

int do_cmd ( char *  cmd,
User *  us,
User *  u,
int  ac,
char *  av 
)

int do_cmd() - Handles a command to a client - do all the santatity checks here.

Parameters:
cmd = The command we are actioning on.
us = A pointer to OUR client struct
u = A pointer to the SRC of the command
ac = The argument count being passed into the command handler - used to see if av is null :)
av = The PARAMATERS to the command - the original command.
Returns:
int 0 = Success 1 = No cmd for it was found. 2 = Access Denied. 3 = Fail something was passed wrong
  • Write this so that it can make more sense in the future
    • Also find a better way to handle user commands, i fear that this isnt the best method of doing this... meh.

Definition at line 224 of file cmds.c.

References CfgSettings, check_access(), DLINK_FOREACH, generictoken(), HASH, HELP_FOREACH(), Conf::operonly, HelpEntry::routine, and sendto_one().

Referenced by HandleClientCmds().

int HELP_FOREACH ( User *  ,
User *   
)

Definition at line 302 of file cmds.c.

References DLINK_FOREACH, and HelpEntry::routine.

Referenced by do_cmd().

Generated on Mon Jul 19 21:53:04 2010 for Omega Security Services by  doxygen 1.6.3