]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/l_net/l_net.h
Merge remote-tracking branch 'github/master'
[xonotic/netradiant.git] / libs / l_net / l_net.h
index 167a5a36c5a8eaaea6e86a868192e9942970794a..120201b3629fa620ab988b519340d621e3cbf1ac 100644 (file)
@@ -1,23 +1,23 @@
 /*
-Copyright (C) 1999-2007 id Software, Inc. and contributors.
-For a list of contributors, see the accompanying CONTRIBUTORS file.
+   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
 //====================================================================
 //
@@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //++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
+#define MAX_NETMESSAGE      1024
+#define MAX_NETADDRESS      32
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,59 +66,61 @@ typedef struct netmessage_s
 
 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
+       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;
 
+void WinPrint( const char *format, ... );
+
 //compare addresses
-int Net_AddressCompare(address_t *addr1, address_t *addr2);
+int Net_AddressCompare( address_t *addr1, address_t *addr2 );
 //gives the address of a socket
-void Net_SocketToAddress(socket_t *sock, address_t *address);
+void Net_SocketToAddress( socket_t *sock, address_t *address );
 //converts a string to an address
-void Net_StringToAddress(char *string, address_t *address);
+void Net_StringToAddress( const char *string, address_t *address );
 //set the address ip port
-void Net_SetAddressPort(address_t *address, int 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);
+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);
+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);
+socket_t *Net_Connect( address_t *address, int port );
 //disconnect from a host
-void Net_Disconnect(socket_t *sock);
+void Net_Disconnect( socket_t *sock );
 //returns the local address
-void Net_MyAddress(address_t *address);
+void Net_MyAddress( address_t *address );
 //listen at the given port
-socket_t *Net_ListenSocket(int port);
+socket_t *Net_ListenSocket( int port );
 //accept new connections at the given socket
-socket_t *Net_Accept(socket_t *sock);
+socket_t *Net_Accept( socket_t *sock );
 //setup networking
-int Net_Setup(void);
+int Net_Setup( void );
 //shutdown networking
-void Net_Shutdown(void);
+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);
+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);
+const char *WINS_ErrorMessage( int error );
 
 #ifdef __cplusplus
 }