Crossfire Client, Trunk
|
Go to the source code of this file.
Functions | |
int | cs_print_string (GSocketConnection *fd, const char *str,...) |
char | GetChar_String (const unsigned char *data) |
gint64 | GetInt64_String (const unsigned char *data) |
int | GetInt_String (const unsigned char *data) |
short | GetShort_String (const unsigned char *data) |
static guint16 | GetUShort_String (const unsigned char data[static 2]) |
void | SockList_AddChar (SockList *sl, char c) |
void | SockList_AddInt (SockList *sl, guint32 data) |
void | SockList_AddShort (SockList *sl, guint16 data) |
void | SockList_AddString (SockList *sl, const char *str) |
void | SockList_Init (SockList *sl, guint8 *buf) |
bool | SockList_ReadPacket (GSocketConnection c[static 1], SockList sl[static 1], size_t len, GError **error) |
int | SockList_Send (SockList *sl, GSocketConnection *c) |
Made this either client or server specific for 0.95.2 release - getting too complicated to keep them the same, and the common code is pretty much frozen now.
Definition in file newsocket.c.
int cs_print_string | ( | GSocketConnection * | fd, |
const char * | str, | ||
... | |||
) |
Send a printf-formatted packet to the socket.
fd | The socket to send to. |
str | The printf format string. |
... | An optional list of values to fulfill the format string. |
Definition at line 252 of file newsocket.c.
References SockList::buf, SockList::len, MAX_BUF, script_monitor_str(), SockList_Init(), and SockList_Send().
Referenced by client_mapsize(), client_negotiate(), client_send_apply(), client_send_examine(), client_send_move(), cmd_raw(), command_take(), config_check(), create_character_window_show(), get_image_info(), get_new_char_info(), look_at(), ReplyInfoCmd(), requestface(), script_process_cmd(), send_command(), send_reply(), SendAddMe(), SendVersion(), and SetupCmd().
char GetChar_String | ( | const unsigned char * | data | ) |
data |
Definition at line 137 of file newsocket.c.
Referenced by AddspellCmd(), ExtSmooth(), get_new_char_info(), MapExtendedCmd(), process_race_class_info(), and UpdspellCmd().
gint64 GetInt64_String | ( | const unsigned char * | data | ) |
The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 64 bits
data |
Definition at line 161 of file newsocket.c.
Referenced by get_exp_info(), script_watch(), and StatsCmd().
int GetInt_String | ( | const unsigned char * | data | ) |
The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 16 bits.
data |
Definition at line 149 of file newsocket.c.
Referenced by AddspellCmd(), CompleteCmd(), DeleteItem(), DeleteSpell(), Face2Cmd(), get_image_sums(), Image2Cmd(), Item2Cmd(), PickupCmd(), PlayerCmd(), script_watch(), StatsCmd(), TickCmd(), UpdateItemCmd(), and UpdspellCmd().
short GetShort_String | ( | const unsigned char * | data | ) |
data |
Definition at line 179 of file newsocket.c.
Referenced by AccountPlayersCmd(), AddspellCmd(), AnimCmd(), CompleteCmd(), Face2Cmd(), get_exp_info(), get_image_sums(), get_starting_map_info(), Item2Cmd(), Map2Cmd(), MapExtendedCmd(), process_race_class_info(), script_watch(), SmoothCmd(), StatsCmd(), UpdateItemCmd(), and UpdspellCmd().
|
static |
Get an unsigned short from the stream. Useful for checking size of server packets.
data | The character stream to read. |
Definition at line 197 of file newsocket.c.
Referenced by SockList_ReadPacket().
void SockList_AddChar | ( | SockList * | sl, |
char | c | ||
) |
sl | |
c |
Definition at line 43 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by add_character_to_account(), create_new_character(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), script_process_cmd(), send_create_player_to_server(), and toggle_locked().
void SockList_AddInt | ( | SockList * | sl, |
guint32 | data | ||
) |
sl | |
data |
Definition at line 80 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by inscribe_magical_scroll(), script_process_cmd(), send_command(), send_mark_obj(), and toggle_locked().
void SockList_AddShort | ( | SockList * | sl, |
guint16 | data | ||
) |
sl | |
data |
Definition at line 64 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by send_command().
void SockList_AddString | ( | SockList * | sl, |
const char * | str | ||
) |
sl | |
str |
Definition at line 98 of file newsocket.c.
References SockList::buf, SockList::len, and MAX_BUF.
Referenced by add_character_to_account(), create_new_character(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().
void SockList_Init | ( | SockList * | sl, |
guint8 * | buf | ||
) |
sl | |
buf |
Definition at line 32 of file newsocket.c.
References SockList::buf, and SockList::len.
Referenced by add_character_to_account(), create_new_character(), cs_print_string(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().
bool SockList_ReadPacket | ( | GSocketConnection | c[static 1], |
SockList | sl[static 1], | ||
size_t | len, | ||
GError ** | error | ||
) |
Reads from the socket and puts data into a socklist. The only processing done is to remove the initial size value. An assumption made is that the buffer is at least 2 bytes long.
fd | Socket to read from. |
sl | Pointer to a buffer to put the read data. |
len | Size of the buffer allocated to accept data. |
Definition at line 213 of file newsocket.c.
References SockList::buf, CLIENT_ERROR, CLIENT_ERROR_TOOBIG, csocket, cst_lst, cst_tot, ClientSocket::fd, GetUShort_String(), CS_Stats::ibytes, in, and SockList::len.
Referenced by client_run().
int SockList_Send | ( | SockList * | sl, |
GSocketConnection * | c | ||
) |
Send data from a socklist to the socket.
Definition at line 112 of file newsocket.c.
References SockList::buf, debug_protocol, SockList::len, LOG(), LOG_INFO, LOG_WARNING, and printable().
Referenced by add_character_to_account(), create_new_character(), cs_print_string(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().