socketengine.c File Reference

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

Go to the source code of this file.

Functions

static char sock_getbyte (Socket *)
static int sock_readline (Socket *)
static char * socket_flags_to_string (Socket *)
static void sendq_add (Socket *, char *, int, int)
static int sendq_flush (Socket *)
Socketadd_new_socket (void(*read)(Socket *, int), void(*write)(void *))
Socketnew_socket ()
Socketfind_socket (char *name)
void Connect (Socket *s, char *server, char *vhost, int port)
int Listen (Socket *s, char *address, int port)
struct in_addr * GetHost (char *address)
int receive (Socket *s)
int send_line (char *fmt,...)
char * GetLine (Socket *s)
char * SendToken (char *reg, char *tok)
void send_cmd (char *source, char *cmd, char *arg,...)
void sendto_one (User *source, User *target, char *fmt,...)
void sendto_one_privmsg (User *source, User *target, char *fmt,...)
void sendto_one_notice (User *source, User *target, char *fmt,...)
void sendto_ircops (User *source, char *fmt,...)
void sendto_channel (User *src, Channel *trg, char *fmt,...)
void sendto_one_numeric (char *source, User *target, int numeric, char *fmt,...)
void sendto_server (User *source, char *fmt,...)
int sendto_socket (Socket *sock, char *fmt,...)
void uplink_cleanup (void *message, int exitlocal)
struct hostent * get_hostname (char *para)
void socket_cleanup ()

Variables

int maxfds
static char readBuffer [MAXLEN+1]
static int data_in_buffer = 0
ThreadSocketThread

Function Documentation

Socket* add_new_socket ( void(*)(Socket *, int)  read,
void(*)(void *)  write 
)

Definition at line 45 of file socketengine.c.

References new_socket(), Socket::read_callback, and Socket::write_callback.

Referenced by Run().

void Connect ( Socket s,
char *  server,
char *  vhost,
int  port 
)

Definition at line 287 of file socketengine.c.

References CfgSettings, Socket::sd, and Conf::uplink.

Referenced by ev_connectuplink(), and Run().

Socket* find_socket ( char *  name  ) 

Definition at line 104 of file socketengine.c.

References DLINK_FOREACH, Socket::name, and sockets.

struct hostent* get_hostname ( char *  para  )  [read]

Definition at line 1555 of file socketengine.c.

References MAXSERV.

Referenced by VerifyConf().

struct in_addr* GetHost ( char *  address  )  [read]

Definition at line 441 of file socketengine.c.

char* GetLine ( Socket s  ) 

Return a pointer to our buffered lines

block loss prevention -.- some how were spitting out WAY to many blocks here

==21769== 49,428 bytes in 96 blocks are definately lost in loss record 40 of 41 ==21769== at 0x40053C0 malloc (vg_replace_malloc.c:149) ==21769== by 0x804D3FF GetLine (socketengine.c:433)

This occurse on the malloc below - Twitch

Definition at line 1034 of file socketengine.c.

References alog(), dlink_delete(), DLINK_FOREACH_SAFE, dlink_free(), Socket::fullLines, MAXLEN, Socket::mbuffer, and MessageBuffer::message.

Referenced by psr_HandleEvent().

int Listen ( Socket s,
char *  address,
int  port 
)

Definition at line 396 of file socketengine.c.

References alog(), Socket::flags, LOG_ERROR, Socket::sd, SOCK_LISTEN, and SOCK_READ.

Socket* new_socket (  ) 
int receive ( Socket s  ) 
void send_cmd ( char *  source,
char *  cmd,
char *  arg,
  ... 
)

send_cmd() Sends a command from source to the server.

Parameters:
u The source of of the command if this is null we will use the servername.
cmd The command to send this takes veradic arguments
arg Aguments to the command
... Varatic arguments for CMD
Returns:
void

Note this is perfered to be used because it assumes a sender and makes proper format :)

Definition at line 1235 of file socketengine.c.

References CfgSettings, send_line(), and Conf::servername.

int send_line ( char *  fmt,
  ... 
)
static void sendq_add ( Socket s,
char *  buf,
int  len,
int  pos 
) [static]

SendQ commands

Definition at line 1097 of file socketengine.c.

References sendq::buf, dlink_add_tail(), dlink_create(), sendq::len, sendq::pos, sendq::s, Socket::sd, and Socket::sendq.

Referenced by send_line(), and sendto_socket().

static int sendq_flush ( Socket s  )  [static]
void sendto_channel ( User *  src,
Channel trg,
char *  fmt,
  ... 
)

Definition at line 1356 of file socketengine.c.

References BURSTING, IRCd, Channel::name, send_line(), sync_state, and IRCDProto::ts6.

Referenced by sendto_socket().

void sendto_ircops ( User *  source,
char *  fmt,
  ... 
)

Definition at line 1328 of file socketengine.c.

References DLINK_FOREACH, sendto_one_notice(), and userlist.

void sendto_one ( User *  source,
User *  target,
char *  fmt,
  ... 
)
void sendto_one_notice ( User *  source,
User *  target,
char *  fmt,
  ... 
)

Definition at line 1305 of file socketengine.c.

References HasId, IRCd, send_line(), and IRCDProto::ts6.

Referenced by sendto_ircops().

void sendto_one_numeric ( char *  source,
User *  target,
int  numeric,
char *  fmt,
  ... 
)
void sendto_one_privmsg ( User *  source,
User *  target,
char *  fmt,
  ... 
)

Definition at line 1283 of file socketengine.c.

References HasId, IRCd, send_line(), and IRCDProto::ts6.

void sendto_server ( User *  source,
char *  fmt,
  ... 
)

Definition at line 1398 of file socketengine.c.

References CfgSettings, HasId, send_line(), and Conf::servername.

int sendto_socket ( Socket sock,
char *  fmt,
  ... 
)
char* SendToken ( char *  reg,
char *  tok 
)

SendToken() - This function checks wether or not we have specified to use tokens if we have it returns the tokens if not then it returns reg

Parameters:
reg - Non token command. IE NICK
tok - Tokenized version of the command IE & return char* the correct version we are using

Definition at line 1206 of file socketengine.c.

References UseTokens.

static char sock_getbyte ( Socket s  )  [static]
static int sock_readline ( Socket s  )  [static]
void socket_cleanup (  ) 

Definition at line 1586 of file socketengine.c.

References dlink_delete(), DLINK_FOREACH_SAFE, dlink_free(), Socket::sd, sendq_flush(), and sockets.

Referenced by AtExit().

static char * socket_flags_to_string ( Socket s  )  [static]
void uplink_cleanup ( void *  message,
int  exitlocal 
)

Variable Documentation

int data_in_buffer = 0 [static]

Definition at line 35 of file socketengine.c.

int maxfds

Definition at line 12 of file socketengine.c.

char readBuffer[MAXLEN+1] [static]

Definition at line 34 of file socketengine.c.

Definition at line 41 of file socketengine.c.

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