cmds.c File Reference

#include "stdinc.h"
#include "server.h"

Go to the source code of this file.

Functions

void HelpNull (User *)
int AddCmd (User *u, char *name, char *access, void(*fnct)(User *, char **))
int AddHelp (User *u, void(*helpcmd)(User *))
int AddHelpExt (int index, User *u, void(*helpcmd)(User *))
int DelHelp (User *u, void(*helpcmd)(User *))
void DelCmd (User *u, char *cmd, void(*fnct)(User *, char **))
int do_cmd (char *cmd, User *us, User *u, int ac, char *av)
int HELP_FOREACH (User *us, User *u)
char * CmdErr (int err)

Variables

const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0])
const float max_load_factor = 0.65
ModulecurrentModule
int hc = 0

Function Documentation

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().

char* CmdErr ( int  err  ) 

Definition at line 319 of file cmds.c.

Referenced by HandleClientCmds().

void DelCmd ( User *  u,
char *  cmd,
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 *  us,
User *  u 
)

Definition at line 302 of file cmds.c.

References DLINK_FOREACH, and HelpEntry::routine.

Referenced by do_cmd().

void HelpNull ( User *  u  ) 

Definition at line 336 of file cmds.c.


Variable Documentation

int hc = 0

Definition at line 42 of file cmds.c.

const float max_load_factor = 0.65

Definition at line 37 of file cmds.c.

const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0])

Definition at line 36 of file cmds.c.

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