Crossfire Client, Trunk  R18666
Defines | Functions | Variables
/home/leaf/crossfire/client/trunk/common/newsocket.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <client.h>
#include <shared/newclient.h>
#include <script.h>
Include dependency graph for newsocket.c:

Go to the source code of this file.

Defines

#define llevDebug   LOG_DEBUG
#define llevError   LOG_ERROR

Functions

void SockList_Init (SockList *sl, uint8 *buf)
void SockList_AddChar (SockList *sl, char c)
void SockList_AddShort (SockList *sl, uint16 data)
void SockList_AddInt (SockList *sl, uint32 data)
void SockList_AddString (SockList *sl, const char *str)
int SockList_Send (SockList *sl, int fd)
char GetChar_String (const unsigned char *data)
int GetInt_String (const unsigned char *data)
sint64 GetInt64_String (const unsigned char *data)
short GetShort_String (const unsigned char *data)
int SockList_ReadPacket (int fd, SockList *sl, int len)
int cs_print_string (int fd, const char *str,...)

Variables

const char *const rcsid_common_newsocket_c = "$Id: newsocket.c 13947 2010-10-01 02:24:23Z kbulgrien $"

Detailed Description

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.


Define Documentation

#define llevDebug   LOG_DEBUG

Definition at line 53 of file newsocket.c.

#define llevError   LOG_ERROR

Definition at line 54 of file newsocket.c.


Function Documentation

int cs_print_string ( int  fd,
const char *  str,
  ... 
)

Send a printf-formatted packet to the socket.

Parameters:
fdThe socket to send to.
strThe printf format string.
...An optional list of values to fulfill the format string.

Definition at line 330 of file newsocket.c.

Here is the call graph for this function:

Here is the caller graph for this function:

char GetChar_String ( const unsigned char *  data)
Parameters:
data
Returns:

Definition at line 173 of file newsocket.c.

Here is the caller graph for this function:

sint64 GetInt64_String ( const unsigned char *  data)

The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 64 bits

Parameters:
data
Returns:

Definition at line 197 of file newsocket.c.

Here is the caller graph for this function:

int GetInt_String ( const unsigned char *  data)

The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 16 bits.

Parameters:
data
Returns:

Definition at line 185 of file newsocket.c.

Here is the caller graph for this function:

short GetShort_String ( const unsigned char *  data)
Parameters:
data
Returns:

Definition at line 215 of file newsocket.c.

Here is the caller graph for this function:

void SockList_AddChar ( SockList sl,
char  c 
)
Parameters:
sl
c

Definition at line 110 of file newsocket.c.

Here is the caller graph for this function:

void SockList_AddInt ( SockList sl,
uint32  data 
)
Parameters:
sl
data

Definition at line 131 of file newsocket.c.

Here is the caller graph for this function:

void SockList_AddShort ( SockList sl,
uint16  data 
)
Parameters:
sl
data

Definition at line 120 of file newsocket.c.

Here is the caller graph for this function:

void SockList_AddString ( SockList sl,
const char *  str 
)
Parameters:
sl
str

Definition at line 144 of file newsocket.c.

Here is the caller graph for this function:

void SockList_Init ( SockList sl,
uint8 buf 
)
Parameters:
sl
buf

Definition at line 99 of file newsocket.c.

Here is the caller graph for this function:

int SockList_ReadPacket ( int  fd,
SockList sl,
int  len 
)

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.

Parameters:
fdSocket to read from.
slPointer to a buffer to put the read data.
lenSize of the buffer allocated to accept data.
Returns:
Return true if we think we have a full packet, 0 if we have a partial packet, or -1 if an error occurred.

Definition at line 230 of file newsocket.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SockList_Send ( SockList sl,
int  fd 
)

Send data from a socklist to the socket.

Parameters:
sl
fd

Definition at line 160 of file newsocket.c.

Here is the caller graph for this function:


Variable Documentation

const char* const rcsid_common_newsocket_c = "$Id: newsocket.c 13947 2010-10-01 02:24:23Z kbulgrien $"

Definition at line 1 of file newsocket.c.