#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 *) |
| Socket * | add_new_socket (void(*read)(Socket *, int), void(*write)(void *)) |
| Socket * | new_socket () |
| Socket * | find_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 |
| Thread * | SocketThread |
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] |
| 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 | ( | ) |
Definition at line 62 of file socketengine.c.
References Socket::connected, dlink_add_tail(), dlink_create(), Socket::error_callback, Socket::flags, Socket::fullLines, Socket::mbuffer, Socket::name, Socket::read_buffer, Socket::read_callback, Socket::sd, Socket::sendq, sockets, Socket::timeout, Socket::user, and Socket::write_callback.
Referenced by add_new_socket().
| int receive | ( | Socket * | s | ) |
Definition at line 449 of file socketengine.c.
References alog(), Socket::connected, connected_sockets, Socket::dead, dlink_find_delete(), DLINK_FOREACH, DLINK_FOREACH_SAFE, dlink_free(), errfdset, Socket::error_callback, EVENT_READ, Socket::flags, ident, LOG_DEBUG2, LOG_DEBUG3, maxfds, Socket::name, Socket::read_callback, rfdset, Socket::sd, servsock, SOCK_CONNECTING, SOCK_DCCIN, SOCK_DCCOUT, SOCK_DEAD, SOCK_LISTEN, SOCK_READ, sock_readline(), SOCK_UPLINK, SOCK_WRITE, socket_flags_to_string(), sockets, Socket::timeout, wfdset, and Socket::write_callback.
Referenced by OneTimeAround().
| void send_cmd | ( | char * | source, | |
| char * | cmd, | |||
| char * | arg, | |||
| ... | ||||
| ) |
send_cmd() Sends a command from source to the server.
| 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 |
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, | |
| ... | ||||
| ) |
Definition at line 735 of file socketengine.c.
References AddTimedEvent(), alog(), ev_connectuplink(), Socket::flags, LOG_DEBUG2, LOG_ERROR, Socket::name, Socket::sd, sendq_add(), sendq_flush(), sentbytes, servsock, SOCK_DEAD, and uplink_cleanup().
Referenced by exit_one_user(), exit_user(), send_cmd(), sendto_channel(), sendto_logchan(), sendto_one(), sendto_one_notice(), sendto_one_numeric(), sendto_one_privmsg(), sendto_server(), and uplink_cleanup().
| 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] |
Definition at line 1115 of file socketengine.c.
References sendq::buf, dlink_delete(), DLINK_FOREACH_SAFE, dlink_free(), sendq::len, sendq::pos, sendq::s, and Socket::sendq.
Referenced by send_line(), sendto_socket(), and socket_cleanup().
| 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, | |||
| ... | ||||
| ) |
Definition at line 1261 of file socketengine.c.
References CfgSettings, HasId, IRCd, Conf::privmsg, send_line(), and IRCDProto::ts6.
Referenced by cmd_foo(), do_cmd(), HandleClientCmds(), help_foo_ext(), and help_m_foo().
| 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, | |||
| ... | ||||
| ) |
Definition at line 1378 of file socketengine.c.
References CfgSettings, HasId, IRCd, Core::me, Link::name, Omega, Conf::protocol, send_line(), Link::sid, and IRCDProto::ts6.
| 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, | |||
| ... | ||||
| ) |
Definition at line 1412 of file socketengine.c.
References alog(), find_channel(), find_user(), Socket::flags, LOG_DEBUG2, LOG_ERROR, Socket::name, Socket::sd, sendq_add(), sendq_flush(), sendto_channel(), sentbytes, SOCK_DEAD, and strlcat().
| 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
| 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] |
Definition at line 878 of file socketengine.c.
References AddTimedEvent(), alog(), Socket::error_callback, ev_connectuplink(), Socket::flags, LOG_ERROR, MAXLEN, Socket::name, Socket::sd, SOCK_DEAD, SOCK_UPLINK, and uplink_cleanup().
Referenced by sock_readline().
| static int sock_readline | ( | Socket * | s | ) | [static] |
Definition at line 951 of file socketengine.c.
References alog(), dlink_add_tail(), dlink_create(), Socket::flags, Socket::fullLines, LOG_DEBUG2, MAXLEN, Socket::mbuffer, MessageBuffer::message, Socket::name, Socket::read_buffer, recvbytes, SOCK_DEAD, sock_getbyte(), strlcpy(), and TRUE.
Referenced by receive().
| 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] |
Definition at line 683 of file socketengine.c.
References Socket::flags, SOCK_CONNECTING, SOCK_DEAD, SOCK_LISTEN, SOCK_READ, SOCK_UPLINK, SOCK_WRITE, strlcat(), and strlcpy().
Referenced by receive().
| void uplink_cleanup | ( | void * | message, | |
| int | exitlocal | |||
| ) |
Definition at line 1504 of file socketengine.c.
References CfgSettings, CONNECTING, exit_all_servs(), exit_local_users(), exit_remote_users(), Socket::flags, IRCd, Core::me, Link::name, Omega, Socket::sd, send_line(), servsock, Conf::sid, SOCK_DEAD, sync_state, IRCDProto::ts6, Link::uplink, Uplink, and uselogchan.
Referenced by AtExit(), do_restart(), ev_ping(), send_line(), and sock_getbyte().
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.
1.6.3