version 1.12 | | version 1.13 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_sockets_c = | | * static char *rcsid_sockets_c = |
* "$Id: lowlevel.c,v 1.12 2005/12/05 23:34:04 akirschbaum Exp $"; | | * "$Id: lowlevel.c,v 1.13 2006/03/18 15:05:37 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
sl->buf[sl->len++] =( char )( data & 0xff ); | | sl->buf[sl->len++] =( char )( data & 0xff ); |
} | | } |
| | |
/* Basically does the reverse of SockList_AddInt, but on | | /** |
| | * Basically does the reverse of SockList_AddInt, but on |
* strings instead. Same for the GetShort, but for 16 bits. | | * strings instead. Same for the GetShort, but for 16 bits. |
*/ | | */ |
int GetInt_String(unsigned char *data) | | int GetInt_String(unsigned char *data) |
| | |
* data, and len is the number of bytes to add. | | * data, and len is the number of bytes to add. |
*/ | | */ |
| | |
static void add_to_buffer(NewSocket *ns, unsigned char *buf, int len) | | static void add_to_buffer(socket_struct *ns, unsigned char *buf, int len) |
{ | | { |
int avail, end; | | int avail, end; |
| | |
| | |
* When the socket is clear to write, and we have backlogged data, this | | * When the socket is clear to write, and we have backlogged data, this |
* is called to write it out. | | * is called to write it out. |
*/ | | */ |
void write_socket_buffer(NewSocket *ns) | | void write_socket_buffer(socket_struct *ns) |
{ | | { |
int amt, max; | | int amt, max; |
| | |
| | |
* of bytes to write. IT doesn't return anything - rather, it | | * of bytes to write. IT doesn't return anything - rather, it |
* updates the ns structure if we get an error. | | * updates the ns structure if we get an error. |
*/ | | */ |
void Write_To_Socket(NewSocket *ns, unsigned char *buf, int len) | | void Write_To_Socket(socket_struct *ns, unsigned char *buf, int len) |
{ | | { |
int amt=0; | | int amt=0; |
unsigned char *pos=buf; | | unsigned char *pos=buf; |
| | |
* Takes a string of data, and writes it out to the socket. A very handy | | * Takes a string of data, and writes it out to the socket. A very handy |
* shortcut function. | | * shortcut function. |
*/ | | */ |
void cs_write_string(NewSocket *ns, const char *buf, int len) | | void cs_write_string(socket_struct *ns, const char *buf, int len) |
{ | | { |
SockList sl; | | SockList sl; |
| | |
| | |
* The only difference in this function is that we take a SockList | | * The only difference in this function is that we take a SockList |
*, and we prepend the length information. | | *, and we prepend the length information. |
*/ | | */ |
void Send_With_Handling(NewSocket *ns,SockList *msg) | | void Send_With_Handling(socket_struct *ns,SockList *msg) |
{ | | { |
unsigned char sbuf[4]; | | unsigned char sbuf[4]; |
| | |
| | |
* Takes a string of data, and writes it out to the socket. A very handy | | * Takes a string of data, and writes it out to the socket. A very handy |
* shortcut function. | | * shortcut function. |
*/ | | */ |
void Write_String_To_Socket(NewSocket *ns, char *buf, int len) | | void Write_String_To_Socket(socket_struct *ns, char *buf, int len) |
{ | | { |
SockList sl; | | SockList sl; |
| | |