-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
-*/\r
-\r
-//====================================================================\r
-//\r
-// Name: l_net.h\r
-// Function: -\r
-// Programmer: MrElusive\r
-// Last update: TTimo: cross-platform version, l_net library\r
-// Tab size: 2\r
-// Notes:\r
-//====================================================================\r
-\r
-//++timo FIXME: the l_net code understands that as the max size for the netmessage_s structure\r
-// we have defined unsigned char data[MAX_NETMESSAGE] in netmessage_s but actually it cannot be filled completely\r
-// we need to introduce a new #define and adapt to data[MAX_NETBUFFER]\r
-#define MAX_NETMESSAGE 1024\r
-#define MAX_NETADDRESS 32\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#ifndef __BYTEBOOL__\r
-#define __BYTEBOOL__\r
-typedef enum { qfalse, qtrue } qboolean;\r
-typedef unsigned char byte;\r
-#endif\r
-\r
-typedef struct address_s\r
-{\r
- char ip[MAX_NETADDRESS];\r
-} address_t;\r
-\r
-typedef struct sockaddr_s\r
-{\r
- short sa_family;\r
- unsigned char sa_data[14];\r
-} sockaddr_t;\r
-\r
-typedef struct netmessage_s\r
-{\r
- unsigned char data[MAX_NETMESSAGE];\r
- int size;\r
- int read;\r
- int readoverflow;\r
-} netmessage_t;\r
-\r
-typedef struct socket_s\r
-{\r
- int socket; //socket number\r
- sockaddr_t addr; //socket address\r
- netmessage_t msg; //current message being read\r
- int remaining; //remaining bytes to read for the current message\r
- struct socket_s *prev, *next; //prev and next socket in a list\r
-} socket_t;\r
-\r
-//compare addresses\r
-int Net_AddressCompare(address_t *addr1, address_t *addr2);\r
-//gives the address of a socket\r
-void Net_SocketToAddress(socket_t *sock, address_t *address);\r
-//converts a string to an address\r
-void Net_StringToAddress(char *string, address_t *address);\r
-//set the address ip port\r
-void Net_SetAddressPort(address_t *address, int port);\r
-//send a message to the given socket\r
-int Net_Send(socket_t *sock, netmessage_t *msg);\r
-//recieve a message from the given socket\r
-int Net_Receive(socket_t *sock, netmessage_t *msg);\r
-//connect to a host\r
-// NOTE: port is the localhost port, usually 0\r
-// ex: Net_Connect( "192.168.0.1:39000", 0 )\r
-socket_t *Net_Connect(address_t *address, int port);\r
-//disconnect from a host\r
-void Net_Disconnect(socket_t *sock);\r
-//returns the local address\r
-void Net_MyAddress(address_t *address);\r
-//listen at the given port\r
-socket_t *Net_ListenSocket(int port);\r
-//accept new connections at the given socket\r
-socket_t *Net_Accept(socket_t *sock);\r
-//setup networking\r
-int Net_Setup(void);\r
-//shutdown networking\r
-void Net_Shutdown(void);\r
-//message handling\r
-void NMSG_Clear(netmessage_t *msg);\r
-void NMSG_WriteChar(netmessage_t *msg, int c);\r
-void NMSG_WriteByte(netmessage_t *msg, int c);\r
-void NMSG_WriteShort(netmessage_t *msg, int c);\r
-void NMSG_WriteLong(netmessage_t *msg, int c);\r
-void NMSG_WriteFloat(netmessage_t *msg, float c);\r
-void NMSG_WriteString(netmessage_t *msg, char *string);\r
-void NMSG_ReadStart(netmessage_t *msg);\r
-int NMSG_ReadChar(netmessage_t *msg);\r
-int NMSG_ReadByte(netmessage_t *msg);\r
-int NMSG_ReadShort(netmessage_t *msg);\r
-int NMSG_ReadLong(netmessage_t *msg);\r
-float NMSG_ReadFloat(netmessage_t *msg);\r
-char *NMSG_ReadString(netmessage_t *msg);\r
-\r
-//++timo FIXME: the WINS_ things are not necessary, they can be made portable arther easily\r
-char *WINS_ErrorMessage(int error);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+//====================================================================
+//
+// Name: l_net.h
+// Function: -
+// Programmer: MrElusive
+// Last update: TTimo: cross-platform version, l_net library
+// Tab size: 2
+// Notes:
+//====================================================================
+
+//++timo FIXME: the l_net code understands that as the max size for the netmessage_s structure
+// we have defined unsigned char data[MAX_NETMESSAGE] in netmessage_s but actually it cannot be filled completely
+// we need to introduce a new #define and adapt to data[MAX_NETBUFFER]
+#define MAX_NETMESSAGE 1024
+#define MAX_NETADDRESS 32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __BYTEBOOL__
+#define __BYTEBOOL__
+typedef enum { qfalse, qtrue } qboolean;
+typedef unsigned char byte;
+#endif
+
+typedef struct address_s
+{
+ char ip[MAX_NETADDRESS];
+} address_t;
+
+typedef struct sockaddr_s
+{
+ short sa_family;
+ unsigned char sa_data[14];
+} sockaddr_t;
+
+typedef struct netmessage_s
+{
+ unsigned char data[MAX_NETMESSAGE];
+ int size;
+ int read;
+ int readoverflow;
+} netmessage_t;
+
+typedef struct socket_s
+{
+ int socket; //socket number
+ sockaddr_t addr; //socket address
+ netmessage_t msg; //current message being read
+ int remaining; //remaining bytes to read for the current message
+ struct socket_s *prev, *next; //prev and next socket in a list
+} socket_t;
+
+//compare addresses
+int Net_AddressCompare(address_t *addr1, address_t *addr2);
+//gives the address of a socket
+void Net_SocketToAddress(socket_t *sock, address_t *address);
+//converts a string to an address
+void Net_StringToAddress(char *string, address_t *address);
+//set the address ip port
+void Net_SetAddressPort(address_t *address, int port);
+//send a message to the given socket
+int Net_Send(socket_t *sock, netmessage_t *msg);
+//recieve a message from the given socket
+int Net_Receive(socket_t *sock, netmessage_t *msg);
+//connect to a host
+// NOTE: port is the localhost port, usually 0
+// ex: Net_Connect( "192.168.0.1:39000", 0 )
+socket_t *Net_Connect(address_t *address, int port);
+//disconnect from a host
+void Net_Disconnect(socket_t *sock);
+//returns the local address
+void Net_MyAddress(address_t *address);
+//listen at the given port
+socket_t *Net_ListenSocket(int port);
+//accept new connections at the given socket
+socket_t *Net_Accept(socket_t *sock);
+//setup networking
+int Net_Setup(void);
+//shutdown networking
+void Net_Shutdown(void);
+//message handling
+void NMSG_Clear(netmessage_t *msg);
+void NMSG_WriteChar(netmessage_t *msg, int c);
+void NMSG_WriteByte(netmessage_t *msg, int c);
+void NMSG_WriteShort(netmessage_t *msg, int c);
+void NMSG_WriteLong(netmessage_t *msg, int c);
+void NMSG_WriteFloat(netmessage_t *msg, float c);
+void NMSG_WriteString(netmessage_t *msg, char *string);
+void NMSG_ReadStart(netmessage_t *msg);
+int NMSG_ReadChar(netmessage_t *msg);
+int NMSG_ReadByte(netmessage_t *msg);
+int NMSG_ReadShort(netmessage_t *msg);
+int NMSG_ReadLong(netmessage_t *msg);
+float NMSG_ReadFloat(netmessage_t *msg);
+char *NMSG_ReadString(netmessage_t *msg);
+
+//++timo FIXME: the WINS_ things are not necessary, they can be made portable arther easily
+char *WINS_ErrorMessage(int error);
+
+#ifdef __cplusplus
+}
+#endif