diff options
-rw-r--r-- | src/cl_local.h | 3 | ||||
-rw-r--r-- | src/common.c | 2 | ||||
-rw-r--r-- | src/in_lirc.c | 2 | ||||
-rw-r--r-- | src/mvd_client.c | 1 | ||||
-rw-r--r-- | src/mvd_local.h | 1 | ||||
-rw-r--r-- | src/net_chan.c | 3 | ||||
-rw-r--r-- | src/net_common.c | 3 | ||||
-rw-r--r-- | src/net_common.h (renamed from src/net_sock.h) | 24 | ||||
-rw-r--r-- | src/net_stream.h | 43 | ||||
-rw-r--r-- | src/sv_ac.c | 2 | ||||
-rw-r--r-- | src/sv_local.h | 3 | ||||
-rw-r--r-- | src/sv_mvd.c | 2 | ||||
-rw-r--r-- | src/sys_unix.c | 3 |
13 files changed, 36 insertions, 56 deletions
diff --git a/src/cl_local.h b/src/cl_local.h index f0fc535..e4b9e20 100644 --- a/src/cl_local.h +++ b/src/cl_local.h @@ -28,7 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cmodel.h" #include "protocol.h" #include "q_msg.h" -#include "net_sock.h" +#include "q_fifo.h" +#include "net_common.h" #include "net_chan.h" #include "q_field.h" #include "ref_public.h" diff --git a/src/common.c b/src/common.c index a530fce..bece670 100644 --- a/src/common.c +++ b/src/common.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "protocol.h" #include "q_msg.h" #include "q_fifo.h" -#include "net_sock.h" +#include "net_common.h" #include "net_chan.h" #include "sys_public.h" #include "cl_public.h" diff --git a/src/in_lirc.c b/src/in_lirc.c index bc46c53..ba81e1e 100644 --- a/src/in_lirc.c +++ b/src/in_lirc.c @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "in_public.h" #include "cl_public.h" #include "sys_public.h" +#include "q_fifo.h" +#include "net_common.h" #include "in_lirc.h" #include <sys/types.h> diff --git a/src/mvd_client.c b/src/mvd_client.c index 3c098d9..5ac791b 100644 --- a/src/mvd_client.c +++ b/src/mvd_client.c @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mvd_local.h" #include "mvd_gtv.h" -#include "net_stream.h" #include <setjmp.h> #define FOR_EACH_GTV(gtv) \ diff --git a/src/mvd_local.h b/src/mvd_local.h index b317dd9..bf14b0a 100644 --- a/src/mvd_local.h +++ b/src/mvd_local.h @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sv_local.h" -#include "q_fifo.h" #define MVD_Malloc(size) Z_TagMalloc(size, TAG_MVD) #define MVD_Mallocz(size) Z_TagMallocz(size, TAG_MVD) diff --git a/src/net_chan.c b/src/net_chan.c index 88fa0a8..b870e30 100644 --- a/src/net_chan.c +++ b/src/net_chan.c @@ -21,7 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "common.h" #include "protocol.h" #include "q_msg.h" -#include "net_sock.h" +#include "q_fifo.h" +#include "net_common.h" #include "net_chan.h" #include "sys_public.h" diff --git a/src/net_common.c b/src/net_common.c index 5b86120..91c2ae8 100644 --- a/src/net_common.c +++ b/src/net_common.c @@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "protocol.h" #include "q_msg.h" #include "q_fifo.h" -#include "net_sock.h" -#include "net_stream.h" +#include "net_common.h" #ifdef _DEBUG #include "files.h" #endif diff --git a/src/net_sock.h b/src/net_common.h index 07cc660..9c5ad6f 100644 --- a/src/net_sock.h +++ b/src/net_common.h @@ -91,6 +91,22 @@ typedef struct netadr_s { uint16_t port; } netadr_t; +typedef enum netstate_e { + NS_DISCONNECTED,// no socket opened + NS_CONNECTING, // connect() not yet completed + NS_CONNECTED, // may transmit data + NS_CLOSED, // peer has preformed orderly shutdown + NS_BROKEN // fatal error has been signaled +} netstate_t; + +typedef struct netstream_s { + qsocket_t socket; + netadr_t address; + netstate_t state; + fifo_t recv; + fifo_t send; +} netstream_t; + static inline qboolean NET_IsEqualAdr(const netadr_t *a, const netadr_t *b) { if (a->type != b->type) { @@ -183,6 +199,14 @@ qboolean NET_StringToAdr(const char *s, netadr_t *a, int port); const char *NET_ErrorString(void); +void NET_CloseStream(netstream_t *s); +neterr_t NET_Listen(qboolean listen); +neterr_t NET_Accept(netstream_t *s); +neterr_t NET_Connect(const netadr_t *peer, netstream_t *s); +neterr_t NET_RunConnect(netstream_t *s); +neterr_t NET_RunStream(netstream_t *s); +void NET_UpdateStream(netstream_t *s); + ioentry_t *NET_AddFd(qsocket_t fd); void NET_RemoveFd(qsocket_t fd); int NET_Sleep(int msec); diff --git a/src/net_stream.h b/src/net_stream.h deleted file mode 100644 index 379e293..0000000 --- a/src/net_stream.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (C) 2003-2008 Andrey Nazarov - -This program 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. - -This program 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 this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -typedef enum netstate_e { - NS_DISCONNECTED,// no socket opened - NS_CONNECTING, // connect() not yet completed - NS_CONNECTED, // may transmit data - NS_CLOSED, // peer has preformed orderly shutdown - NS_BROKEN // fatal error has been signaled -} netstate_t; - -typedef struct netstream_s { - qsocket_t socket; - netadr_t address; - netstate_t state; - fifo_t recv; - fifo_t send; -} netstream_t; - -void NET_CloseStream(netstream_t *s); -neterr_t NET_Listen(qboolean listen); -neterr_t NET_Accept(netstream_t *s); -neterr_t NET_Connect(const netadr_t *peer, netstream_t *s); -neterr_t NET_RunConnect(netstream_t *s); -neterr_t NET_RunStream(netstream_t *s); -void NET_UpdateStream(netstream_t *s); diff --git a/src/sv_ac.c b/src/sv_ac.c index bcb795f..dd0e905 100644 --- a/src/sv_ac.c +++ b/src/sv_ac.c @@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "sv_local.h" -#include "q_fifo.h" -#include "net_stream.h" typedef enum { ACS_BAD, diff --git a/src/sv_local.h b/src/sv_local.h index c81e1e8..e30494a 100644 --- a/src/sv_local.h +++ b/src/sv_local.h @@ -31,7 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pmove.h" #include "protocol.h" #include "q_msg.h" -#include "net_sock.h" +#include "q_fifo.h" +#include "net_common.h" #include "net_chan.h" #include "g_public.h" #include "sv_public.h" diff --git a/src/sv_mvd.c b/src/sv_mvd.c index 9f425f7..faccd97 100644 --- a/src/sv_mvd.c +++ b/src/sv_mvd.c @@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "sv_local.h" -#include "q_fifo.h" -#include "net_stream.h" #include "mvd_gtv.h" #define FOR_EACH_GTV(client) \ diff --git a/src/sys_unix.c b/src/sys_unix.c index c8e371c..3e7ef62 100644 --- a/src/sys_unix.c +++ b/src/sys_unix.c @@ -46,13 +46,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "common.h" #include "q_list.h" #include "q_field.h" +#include "q_fifo.h" #include "prompt.h" #include "files.h" #if USE_REF #include "vid_public.h" #endif #include "sys_public.h" -#include "net_sock.h" +#include "net_common.h" cvar_t *sys_basedir; cvar_t *sys_libdir; |