tools.c File Reference

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

Go to the source code of this file.

Defines

#define TIMEBUF   100
#define T_MONTH   "month"
#define T_MONTHS   "months"
#define T_DAY   "day"
#define T_DAYS   "days"
#define T_HOUR   "hour"
#define T_HOURS   "hours"
#define T_MINUTE   "minute"
#define T_MINUTES   "minutes"
#define T_SECOND   "second"
#define T_SECONDS   "seconds"

Functions

char * strtolower (char *str)
size_t strlcat (char *dst, const char *src, size_t siz)
size_t strlcpy (char *dst, const char *src, size_t siz)
void init_uid (void)
char * generate_uid (void)
void generate_p10_uid (User *u)
void ExpandParv (char *dest, int max, int initial, int parc, char *parv[])
int generictoken (char delim, int size, char *message, char **parv)
uint32 hash (char *item)
unsigned int hash_safe (char *item, ub4 len)
time_t time_to_sec (char *time)
char * timediff (time_t u)
char * str_signed (unsigned char *str)
void ntoa (struct in_addr addr, char *ipaddr, int len)
char * str_ntoa (struct in_addr addr)

Variables

static char current_uid [10]
static char p10_uid [6]
char p10_id [3]

Define Documentation

#define T_DAY   "day"

Definition at line 38 of file tools.c.

Referenced by timediff().

#define T_DAYS   "days"

Definition at line 39 of file tools.c.

Referenced by timediff().

#define T_HOUR   "hour"

Definition at line 40 of file tools.c.

Referenced by timediff().

#define T_HOURS   "hours"

Definition at line 41 of file tools.c.

Referenced by timediff().

#define T_MINUTE   "minute"

Definition at line 42 of file tools.c.

Referenced by timediff().

#define T_MINUTES   "minutes"

Definition at line 43 of file tools.c.

Referenced by timediff().

#define T_MONTH   "month"

Definition at line 36 of file tools.c.

#define T_MONTHS   "months"

Definition at line 37 of file tools.c.

#define T_SECOND   "second"

Definition at line 44 of file tools.c.

Referenced by timediff().

#define T_SECONDS   "seconds"

Definition at line 45 of file tools.c.

Referenced by timediff().

#define TIMEBUF   100

Definition at line 30 of file tools.c.

Referenced by timediff().


Function Documentation

void ExpandParv ( char *  dest,
int  max,
int  initial,
int  parc,
char *  parv[] 
)

Definition at line 226 of file tools.c.

References strlcat(), and strlcpy().

void generate_p10_uid ( User *  u  ) 

Definition at line 177 of file tools.c.

References alog(), LOG_DEBUG2, p10_id, p10_uid, s_assert, and strlcpy().

Referenced by NewClient().

char* generate_uid ( void   ) 

Definition at line 146 of file tools.c.

References current_uid, and s_assert.

Referenced by NewClient().

int generictoken ( char  delim,
int  size,
char *  message,
char **  parv 
)

Definition at line 240 of file tools.c.

Referenced by base64dects(), do_cmd(), and HandleClientCmds().

uint32 hash ( char *  item  ) 

Definition at line 295 of file tools.c.

Referenced by hash_safe().

unsigned int hash_safe ( char *  item,
ub4  len 
)

Definition at line 318 of file tools.c.

References hash().

void init_uid ( void   ) 

Definition at line 131 of file tools.c.

References CfgSettings, current_uid, p10_uid, and Conf::sid.

Referenced by Run().

void ntoa ( struct in_addr  addr,
char *  ipaddr,
int  len 
)

Definition at line 441 of file tools.c.

char* str_ntoa ( struct in_addr  addr  ) 

return an allocated string similar to inet_ntoa however this doesnt take a lengh or char* argument however this will only malloc up to 17 which is the lengh of an IP addr + 1 padding. so we dont piss away memory :)

Definition at line 462 of file tools.c.

char* str_signed ( unsigned char *  str  ) 

Change an unsigned string to a signed string, overwriting the original string.

Parameters:
str input string
Returns:
output string, same as input string.

Definition at line 423 of file tools.c.

Referenced by encode_ip().

size_t strlcat ( char *  dst,
const char *  src,
size_t  siz 
)

Since not every one has strlcpy and strlcat we need to create them if they do not exist on the system

Definition at line 75 of file tools.c.

Referenced by create_chanmode_string(), create_mod_temp(), create_sjoin_nicklist(), create_usermode_string(), ExpandParv(), read_chanmode_string(), sendto_socket(), set_access_flag(), and socket_flags_to_string().

size_t strlcpy ( char *  dst,
const char *  src,
size_t  siz 
)
char* strtolower ( char *  str  ) 

Definition at line 54 of file tools.c.

time_t time_to_sec ( char *  time  ) 

Definition at line 331 of file tools.c.

char* timediff ( time_t  u  ) 

Definition at line 380 of file tools.c.

References T_DAY, T_DAYS, T_HOUR, T_HOURS, T_MINUTE, T_MINUTES, T_SECOND, T_SECONDS, and TIMEBUF.


Variable Documentation

char current_uid[10] [static]

Definition at line 47 of file tools.c.

Referenced by generate_uid(), and init_uid().

char p10_id[3]

Definition at line 50 of file tools.c.

Referenced by generate_p10_uid(), and VerifyConf().

char p10_uid[6] [static]

Definition at line 49 of file tools.c.

Referenced by generate_p10_uid(), and init_uid().

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