mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Document the "public" functions of NQ's networking code.
This commit is contained in:
parent
ca817fafc2
commit
1d57477101
14 changed files with 264 additions and 215 deletions
|
@ -27,6 +27,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup nq-dgrm NetQuake Datagram network driver.
|
||||||
|
\ingroup nq-nd
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
int Datagram_Init (void);
|
int Datagram_Init (void);
|
||||||
void Datagram_Listen (qboolean state);
|
void Datagram_Listen (qboolean state);
|
||||||
|
@ -40,3 +44,5 @@ qboolean Datagram_CanSendMessage (qsocket_t *sock);
|
||||||
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock);
|
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock);
|
||||||
void Datagram_Close (qsocket_t *sock);
|
void Datagram_Close (qsocket_t *sock);
|
||||||
void Datagram_Shutdown (void);
|
void Datagram_Shutdown (void);
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
#include "netmain.h"
|
#include "netmain.h"
|
||||||
|
|
||||||
|
/** \defgroup nq-loop NetQuake loopback network driver.
|
||||||
|
\ingroup nq-nd
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
int Loop_Init (void);
|
int Loop_Init (void);
|
||||||
void Loop_Listen (qboolean state);
|
void Loop_Listen (qboolean state);
|
||||||
void Loop_SearchForHosts (qboolean xmit);
|
void Loop_SearchForHosts (qboolean xmit);
|
||||||
|
@ -45,4 +50,6 @@ qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock);
|
||||||
void Loop_Close (qsocket_t *sock);
|
void Loop_Close (qsocket_t *sock);
|
||||||
void Loop_Shutdown (void);
|
void Loop_Shutdown (void);
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
#endif//__net_loop_h
|
#endif//__net_loop_h
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
|
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
|
|
||||||
|
/** \defgroup nq-udp NetQuake UDP lan driver.
|
||||||
|
\ingroup nq-ld
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
int UDP_Init (void);
|
int UDP_Init (void);
|
||||||
void UDP_Shutdown (void);
|
void UDP_Shutdown (void);
|
||||||
void UDP_Listen (qboolean state);
|
void UDP_Listen (qboolean state);
|
||||||
|
@ -50,4 +55,6 @@ int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||||
int UDP_GetSocketPort (struct qsockaddr *addr);
|
int UDP_GetSocketPort (struct qsockaddr *addr);
|
||||||
int UDP_SetSocketPort (struct qsockaddr *addr, int port);
|
int UDP_SetSocketPort (struct qsockaddr *addr, int port);
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
#endif // __net_udp_h
|
#endif // __net_udp_h
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup nq-vcr NetQuake VCR network driver.
|
||||||
|
\ingroup nq-nd
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
#define VCR_OP_CONNECT 1
|
#define VCR_OP_CONNECT 1
|
||||||
#define VCR_OP_GETMESSAGE 2
|
#define VCR_OP_GETMESSAGE 2
|
||||||
#define VCR_OP_SENDMESSAGE 3
|
#define VCR_OP_SENDMESSAGE 3
|
||||||
|
@ -43,3 +48,5 @@ int VCR_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||||
qboolean VCR_CanSendMessage (qsocket_t *sock);
|
qboolean VCR_CanSendMessage (qsocket_t *sock);
|
||||||
void VCR_Close (qsocket_t *sock);
|
void VCR_Close (qsocket_t *sock);
|
||||||
void VCR_Shutdown (void);
|
void VCR_Shutdown (void);
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
|
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
|
|
||||||
|
/** \defgroup nq-wins NetQuake Winsock lan driver.
|
||||||
|
\ingroup nq-ld
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
extern int winsock_initialized;
|
extern int winsock_initialized;
|
||||||
extern WSADATA winsockdata;
|
extern WSADATA winsockdata;
|
||||||
|
|
||||||
|
@ -57,4 +62,6 @@ int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||||
int WINS_GetSocketPort (struct qsockaddr *addr);
|
int WINS_GetSocketPort (struct qsockaddr *addr);
|
||||||
int WINS_SetSocketPort (struct qsockaddr *addr, int port);
|
int WINS_SetSocketPort (struct qsockaddr *addr, int port);
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
#endif//__net_wins_h
|
#endif//__net_wins_h
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
#include "QF/quakeio.h"
|
#include "QF/quakeio.h"
|
||||||
#include "QF/sizebuf.h"
|
#include "QF/sizebuf.h"
|
||||||
|
|
||||||
|
/** \defgroup nq-net NetQuake network support.
|
||||||
|
\ingroup network
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
struct qsockaddr
|
struct qsockaddr
|
||||||
{
|
{
|
||||||
short qsa_family;
|
short qsa_family;
|
||||||
|
@ -165,8 +170,204 @@ extern qsocket_t *net_activeSockets;
|
||||||
extern qsocket_t *net_freeSockets;
|
extern qsocket_t *net_freeSockets;
|
||||||
extern int net_numsockets;
|
extern int net_numsockets;
|
||||||
|
|
||||||
typedef struct
|
#define MAX_NET_DRIVERS 8
|
||||||
{
|
|
||||||
|
extern int DEFAULTnet_hostport;
|
||||||
|
extern int net_hostport;
|
||||||
|
|
||||||
|
extern int net_driverlevel;
|
||||||
|
extern char playername[];
|
||||||
|
extern int playercolor;
|
||||||
|
|
||||||
|
extern int messagesSent;
|
||||||
|
extern int messagesReceived;
|
||||||
|
extern int unreliableMessagesSent;
|
||||||
|
extern int unreliableMessagesReceived;
|
||||||
|
|
||||||
|
/** Create and initialize a new qsocket.
|
||||||
|
|
||||||
|
Called by drivers when a new communications endpoint is required.
|
||||||
|
The sequence and buffer fields will be filled in properly.
|
||||||
|
|
||||||
|
\return The qsocket representing the connection.
|
||||||
|
*/
|
||||||
|
qsocket_t *NET_NewQSocket (void);
|
||||||
|
|
||||||
|
/** Destroy a qsocket.
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
*/
|
||||||
|
void NET_FreeQSocket(qsocket_t *sock);
|
||||||
|
|
||||||
|
/** Cache the system time for the network sub-system.
|
||||||
|
*/
|
||||||
|
double SetNetTime(void);
|
||||||
|
|
||||||
|
|
||||||
|
#define HOSTCACHESIZE 8
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char name[16];
|
||||||
|
char map[16];
|
||||||
|
char cname[32];
|
||||||
|
int users;
|
||||||
|
int maxusers;
|
||||||
|
int driver;
|
||||||
|
int ldriver;
|
||||||
|
struct qsockaddr addr;
|
||||||
|
} hostcache_t;
|
||||||
|
|
||||||
|
extern int hostCacheCount;
|
||||||
|
extern hostcache_t hostcache[HOSTCACHESIZE];
|
||||||
|
|
||||||
|
extern double net_time;
|
||||||
|
extern struct msg_s *net_message;
|
||||||
|
extern int net_activeconnections;
|
||||||
|
|
||||||
|
/** Initialize the networking sub-system.
|
||||||
|
*/
|
||||||
|
void NET_Init (void);
|
||||||
|
|
||||||
|
/** Shutdown the networking sub-system.
|
||||||
|
*/
|
||||||
|
void NET_Shutdown (void);
|
||||||
|
|
||||||
|
/** Check for new connections.
|
||||||
|
|
||||||
|
\return Pointer to the qsocket for the new connection if there
|
||||||
|
is one, otherwise null.
|
||||||
|
*/
|
||||||
|
struct qsocket_s *NET_CheckNewConnections (void);
|
||||||
|
|
||||||
|
/** Connect to a host.
|
||||||
|
|
||||||
|
\param host The name of the host to which will be connected.
|
||||||
|
\return Pointer to the qsocket representing the connection, or
|
||||||
|
null if unable to connect.
|
||||||
|
*/
|
||||||
|
struct qsocket_s *NET_Connect (const char *host);
|
||||||
|
|
||||||
|
/** Check if a message can be sent to the connection.
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
\return True if the message can be sent.
|
||||||
|
*/
|
||||||
|
qboolean NET_CanSendMessage (qsocket_t *sock);
|
||||||
|
|
||||||
|
/** Read a single message from the connection into net_message.
|
||||||
|
|
||||||
|
If there is a complete message, return it in net_message.
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
\return 0 if no data is waiting.
|
||||||
|
\return 1 if a message was received.
|
||||||
|
\return -1 if the connection died.
|
||||||
|
*/
|
||||||
|
int NET_GetMessage (struct qsocket_s *sock);
|
||||||
|
|
||||||
|
/** Send a single reliable message to the connection.
|
||||||
|
|
||||||
|
Try to send a complete length+message unit over the reliable stream.
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
\param data The message to send.
|
||||||
|
\return 0 if the message connot be delivered reliably, but the
|
||||||
|
connection is still considered valid
|
||||||
|
\return 1 if the message was sent properly
|
||||||
|
\return -1 if the connection died
|
||||||
|
*/
|
||||||
|
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||||
|
|
||||||
|
/** Send a single unreliable message to the connection.
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
\param data The message to send.
|
||||||
|
\return 1 if the message was sent properly
|
||||||
|
\return -1 if the connection died
|
||||||
|
*/
|
||||||
|
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||||
|
|
||||||
|
/** Send a reliable message to all attached clients.
|
||||||
|
|
||||||
|
\param data The message to send.
|
||||||
|
\param blocktime The blocking timeout in seconds.
|
||||||
|
\return The number of clients to which the message could not be
|
||||||
|
sent before the timeout.
|
||||||
|
*/
|
||||||
|
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
||||||
|
|
||||||
|
/** Close a connection.
|
||||||
|
|
||||||
|
If a dead connection is returned by a get or send function, this function
|
||||||
|
should be called when it is convenient.
|
||||||
|
|
||||||
|
Server calls when a client is kicked off for a game related misbehavior
|
||||||
|
like an illegal protocal conversation. Client calls when disconnecting
|
||||||
|
from a server.
|
||||||
|
|
||||||
|
A netcon_t number will not be reused until this function is called for it
|
||||||
|
|
||||||
|
\param sock The qsocket representing the connection.
|
||||||
|
*/
|
||||||
|
void NET_Close (struct qsocket_s *sock);
|
||||||
|
|
||||||
|
/** Run any current poll procedures.
|
||||||
|
*/
|
||||||
|
void NET_Poll(void);
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _PollProcedure {
|
||||||
|
struct _PollProcedure *next;
|
||||||
|
double nextTime;
|
||||||
|
void (*procedure)(void *);
|
||||||
|
void *arg;
|
||||||
|
} PollProcedure;
|
||||||
|
|
||||||
|
/** Schedule a poll procedure to run.
|
||||||
|
|
||||||
|
The poll procedure will be called by NET_Poll() no earlier than
|
||||||
|
"now"+timeOffset.
|
||||||
|
|
||||||
|
\param pp The poll procedure to shedule.
|
||||||
|
\param timeOffset The time offset from "now" at which the procedure
|
||||||
|
will be run.
|
||||||
|
*/
|
||||||
|
void SchedulePollProcedure(PollProcedure *pp, double timeOffset);
|
||||||
|
|
||||||
|
extern qboolean serialAvailable;
|
||||||
|
extern qboolean ipxAvailable;
|
||||||
|
extern qboolean tcpipAvailable;
|
||||||
|
extern char my_ipx_address[NET_NAMELEN];
|
||||||
|
extern char my_tcpip_address[NET_NAMELEN];
|
||||||
|
extern void (*GetComPortConfig) (int portNumber, int *port, int *irq, int *baud, qboolean *useModem);
|
||||||
|
extern void (*SetComPortConfig) (int portNumber, int port, int irq, int baud, qboolean useModem);
|
||||||
|
extern void (*GetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
|
||||||
|
extern void (*SetModemConfig) (int portNumber, const char *dialType, const char *clear, const char *init, const char *hangup);
|
||||||
|
|
||||||
|
extern qboolean slistInProgress;
|
||||||
|
extern qboolean slistSilent;
|
||||||
|
extern qboolean slistLocal;
|
||||||
|
|
||||||
|
extern struct cvar_s *config_com_port;
|
||||||
|
extern struct cvar_s *config_com_irq;
|
||||||
|
extern struct cvar_s *config_com_baud;
|
||||||
|
extern struct cvar_s *config_com_modem;
|
||||||
|
extern struct cvar_s *config_modem_dialtype;
|
||||||
|
extern struct cvar_s *config_modem_clear;
|
||||||
|
extern struct cvar_s *config_modem_init;
|
||||||
|
extern struct cvar_s *config_modem_hangup;
|
||||||
|
extern struct cvar_s *hostname;
|
||||||
|
|
||||||
|
extern QFile *vcrFile;
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/** \defgroup nq-ld NetQuake lan drivers.
|
||||||
|
\ingroup nq-net
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
int controlSock;
|
int controlSock;
|
||||||
|
@ -190,12 +391,17 @@ typedef struct
|
||||||
int (*SetSocketPort) (struct qsockaddr *addr, int port);
|
int (*SetSocketPort) (struct qsockaddr *addr, int port);
|
||||||
} net_landriver_t;
|
} net_landriver_t;
|
||||||
|
|
||||||
#define MAX_NET_DRIVERS 8
|
|
||||||
extern int net_numlandrivers;
|
extern int net_numlandrivers;
|
||||||
extern net_landriver_t net_landrivers[MAX_NET_DRIVERS];
|
extern net_landriver_t net_landrivers[MAX_NET_DRIVERS];
|
||||||
|
|
||||||
typedef struct
|
//@}
|
||||||
{
|
|
||||||
|
/** \defgroup nq-nd NetQuake network drivers.
|
||||||
|
\ingroup nq-net
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
int (*Init) (void);
|
int (*Init) (void);
|
||||||
|
@ -216,129 +422,6 @@ typedef struct
|
||||||
extern int net_numdrivers;
|
extern int net_numdrivers;
|
||||||
extern net_driver_t net_drivers[MAX_NET_DRIVERS];
|
extern net_driver_t net_drivers[MAX_NET_DRIVERS];
|
||||||
|
|
||||||
extern int DEFAULTnet_hostport;
|
//@}
|
||||||
extern int net_hostport;
|
|
||||||
|
|
||||||
extern int net_driverlevel;
|
|
||||||
extern char playername[];
|
|
||||||
extern int playercolor;
|
|
||||||
|
|
||||||
extern int messagesSent;
|
|
||||||
extern int messagesReceived;
|
|
||||||
extern int unreliableMessagesSent;
|
|
||||||
extern int unreliableMessagesReceived;
|
|
||||||
|
|
||||||
qsocket_t *NET_NewQSocket (void);
|
|
||||||
void NET_FreeQSocket(qsocket_t *);
|
|
||||||
double SetNetTime(void);
|
|
||||||
|
|
||||||
|
|
||||||
#define HOSTCACHESIZE 8
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char name[16];
|
|
||||||
char map[16];
|
|
||||||
char cname[32];
|
|
||||||
int users;
|
|
||||||
int maxusers;
|
|
||||||
int driver;
|
|
||||||
int ldriver;
|
|
||||||
struct qsockaddr addr;
|
|
||||||
} hostcache_t;
|
|
||||||
|
|
||||||
extern int hostCacheCount;
|
|
||||||
extern hostcache_t hostcache[HOSTCACHESIZE];
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
//
|
|
||||||
// public network functions
|
|
||||||
//
|
|
||||||
//============================================================================
|
|
||||||
|
|
||||||
extern double net_time;
|
|
||||||
extern struct msg_s *net_message;
|
|
||||||
extern int net_activeconnections;
|
|
||||||
|
|
||||||
void NET_Init (void);
|
|
||||||
void NET_Shutdown (void);
|
|
||||||
|
|
||||||
struct qsocket_s *NET_CheckNewConnections (void);
|
|
||||||
// returns a new connection number if there is one pending, else -1
|
|
||||||
|
|
||||||
struct qsocket_s *NET_Connect (const char *host);
|
|
||||||
// called by client to connect to a host. Returns -1 if not able to
|
|
||||||
|
|
||||||
qboolean NET_CanSendMessage (qsocket_t *sock);
|
|
||||||
// Returns true or false if the given qsocket can currently accept a
|
|
||||||
// message to be transmitted.
|
|
||||||
|
|
||||||
int NET_GetMessage (struct qsocket_s *sock);
|
|
||||||
// returns data in net_message sizebuf
|
|
||||||
// returns 0 if no data is waiting
|
|
||||||
// returns 1 if a message was received
|
|
||||||
// returns 2 if an unreliable message was received
|
|
||||||
// returns -1 if the connection died
|
|
||||||
|
|
||||||
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
|
||||||
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
|
||||||
// returns 0 if the message connot be delivered reliably, but the connection
|
|
||||||
// is still considered valid
|
|
||||||
// returns 1 if the message was sent properly
|
|
||||||
// returns -1 if the connection died
|
|
||||||
|
|
||||||
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
|
||||||
// This is a reliable *blocking* send to all attached clients.
|
|
||||||
|
|
||||||
|
|
||||||
void NET_Close (struct qsocket_s *sock);
|
|
||||||
// if a dead connection is returned by a get or send function, this function
|
|
||||||
// should be called when it is convenient
|
|
||||||
|
|
||||||
// Server calls when a client is kicked off for a game related misbehavior
|
|
||||||
// like an illegal protocal conversation. Client calls when disconnecting
|
|
||||||
// from a server.
|
|
||||||
// A netcon_t number will not be reused until this function is called for it
|
|
||||||
|
|
||||||
void NET_Poll(void);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _PollProcedure
|
|
||||||
{
|
|
||||||
struct _PollProcedure *next;
|
|
||||||
double nextTime;
|
|
||||||
void (*procedure)(void *);
|
|
||||||
void *arg;
|
|
||||||
} PollProcedure;
|
|
||||||
|
|
||||||
void SchedulePollProcedure(PollProcedure *pp, double timeOffset);
|
|
||||||
|
|
||||||
extern qboolean serialAvailable;
|
|
||||||
extern qboolean ipxAvailable;
|
|
||||||
extern qboolean tcpipAvailable;
|
|
||||||
extern char my_ipx_address[NET_NAMELEN];
|
|
||||||
extern char my_tcpip_address[NET_NAMELEN];
|
|
||||||
extern void (*GetComPortConfig) (int portNumber, int *port, int *irq, int *baud, qboolean *useModem);
|
|
||||||
extern void (*SetComPortConfig) (int portNumber, int port, int irq, int baud, qboolean useModem);
|
|
||||||
extern void (*GetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
|
|
||||||
extern void (*SetModemConfig) (int portNumber, const char *dialType, const char *clear, const char *init, const char *hangup);
|
|
||||||
|
|
||||||
extern qboolean slistInProgress;
|
|
||||||
extern qboolean slistSilent;
|
|
||||||
extern qboolean slistLocal;
|
|
||||||
|
|
||||||
void NET_Slist_f (void);
|
|
||||||
|
|
||||||
extern struct cvar_s *config_com_port;
|
|
||||||
extern struct cvar_s *config_com_irq;
|
|
||||||
extern struct cvar_s *config_com_baud;
|
|
||||||
extern struct cvar_s *config_com_modem;
|
|
||||||
extern struct cvar_s *config_modem_dialtype;
|
|
||||||
extern struct cvar_s *config_modem_clear;
|
|
||||||
extern struct cvar_s *config_modem_init;
|
|
||||||
extern struct cvar_s *config_modem_hangup;
|
|
||||||
extern struct cvar_s *hostname;
|
|
||||||
|
|
||||||
extern QFile *vcrFile;
|
|
||||||
|
|
||||||
#endif // __net_h
|
#endif // __net_h
|
||||||
|
|
|
@ -133,15 +133,7 @@ SetNetTime (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
qsocket_t *
|
||||||
===================
|
|
||||||
NET_NewQSocket
|
|
||||||
|
|
||||||
Called by drivers when a new communications endpoint is required
|
|
||||||
The sequence and buffer fields will be filled in properly
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
qsocket_t *
|
|
||||||
NET_NewQSocket (void)
|
NET_NewQSocket (void)
|
||||||
{
|
{
|
||||||
qsocket_t *sock;
|
qsocket_t *sock;
|
||||||
|
@ -182,7 +174,7 @@ NET_NewQSocket (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NET_FreeQSocket (qsocket_t * sock)
|
NET_FreeQSocket (qsocket_t *sock)
|
||||||
{
|
{
|
||||||
qsocket_t *s;
|
qsocket_t *s;
|
||||||
|
|
||||||
|
@ -327,7 +319,7 @@ PrintSlistTrailer (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
NET_Slist_f (void)
|
NET_Slist_f (void)
|
||||||
{
|
{
|
||||||
if (slistInProgress)
|
if (slistInProgress)
|
||||||
|
@ -393,16 +385,10 @@ Slist_Poll (void *unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
===================
|
|
||||||
NET_Connect
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
|
|
||||||
int hostCacheCount = 0;
|
int hostCacheCount = 0;
|
||||||
hostcache_t hostcache[HOSTCACHESIZE];
|
hostcache_t hostcache[HOSTCACHESIZE];
|
||||||
|
|
||||||
qsocket_t *
|
qsocket_t *
|
||||||
NET_Connect (const char *host)
|
NET_Connect (const char *host)
|
||||||
{
|
{
|
||||||
qsocket_t *ret;
|
qsocket_t *ret;
|
||||||
|
@ -471,19 +457,13 @@ NET_Connect (const char *host)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
===================
|
|
||||||
NET_CheckNewConnections
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
double time;
|
double time;
|
||||||
int op;
|
int op;
|
||||||
intptr_t session;
|
intptr_t session;
|
||||||
} vcrConnect;
|
} vcrConnect;
|
||||||
|
|
||||||
qsocket_t *
|
qsocket_t *
|
||||||
NET_CheckNewConnections (void)
|
NET_CheckNewConnections (void)
|
||||||
{
|
{
|
||||||
qsocket_t *ret;
|
qsocket_t *ret;
|
||||||
|
@ -519,13 +499,8 @@ NET_CheckNewConnections (void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===================
|
|
||||||
NET_Close
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
NET_Close (qsocket_t * sock)
|
NET_Close (qsocket_t *sock)
|
||||||
{
|
{
|
||||||
if (!sock)
|
if (!sock)
|
||||||
return;
|
return;
|
||||||
|
@ -542,18 +517,6 @@ NET_Close (qsocket_t * sock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
NET_GetMessage
|
|
||||||
|
|
||||||
If there is a complete message, return it in net_message
|
|
||||||
|
|
||||||
returns 0 if no data is waiting
|
|
||||||
returns 1 if a message was received
|
|
||||||
returns -1 if connection is invalid
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
double time;
|
double time;
|
||||||
int op;
|
int op;
|
||||||
|
@ -564,7 +527,7 @@ struct {
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
NET_GetMessage (qsocket_t * sock)
|
NET_GetMessage (qsocket_t *sock)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -622,17 +585,6 @@ NET_GetMessage (qsocket_t * sock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
NET_SendMessage
|
|
||||||
|
|
||||||
Try to send a complete length+message unit over the reliable stream.
|
|
||||||
returns 0 if the message cannot be delivered reliably, but the connection
|
|
||||||
is still considered valid
|
|
||||||
returns 1 if the message was sent properly
|
|
||||||
returns -1 if the connection died
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
struct {
|
struct {
|
||||||
double time;
|
double time;
|
||||||
int op;
|
int op;
|
||||||
|
@ -641,7 +593,7 @@ struct {
|
||||||
} vcrSendMessage;
|
} vcrSendMessage;
|
||||||
|
|
||||||
int
|
int
|
||||||
NET_SendMessage (qsocket_t * sock, sizebuf_t *data)
|
NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -671,7 +623,7 @@ NET_SendMessage (qsocket_t * sock, sizebuf_t *data)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
NET_SendUnreliableMessage (qsocket_t * sock, sizebuf_t *data)
|
NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -700,16 +652,8 @@ NET_SendUnreliableMessage (qsocket_t * sock, sizebuf_t *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
NET_CanSendMessage
|
|
||||||
|
|
||||||
Returns true or false if the given qsocket can currently accept a
|
|
||||||
message to be transmitted.
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
qboolean
|
qboolean
|
||||||
NET_CanSendMessage (qsocket_t * sock)
|
NET_CanSendMessage (qsocket_t *sock)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -797,12 +741,6 @@ NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
NET_Init
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NET_Init (void)
|
NET_Init (void)
|
||||||
{
|
{
|
||||||
|
@ -893,12 +831,6 @@ NET_Init (void)
|
||||||
Sys_MaskPrintf (SYS_DEV, "TCP/IP address %s\n", my_tcpip_address);
|
Sys_MaskPrintf (SYS_DEV, "TCP/IP address %s\n", my_tcpip_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
NET_Shutdown
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NET_Shutdown (void)
|
NET_Shutdown (void)
|
||||||
{
|
{
|
||||||
|
@ -964,7 +896,7 @@ NET_Poll (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SchedulePollProcedure (PollProcedure * proc, double timeOffset)
|
SchedulePollProcedure (PollProcedure *proc, double timeOffset)
|
||||||
{
|
{
|
||||||
PollProcedure *pp, *prev;
|
PollProcedure *pp, *prev;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_bsd.c
|
net_bsd.c
|
||||||
|
|
||||||
@description@
|
BSD socket based network and lan driver structs.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_dgrm.c
|
net_dgrm.c
|
||||||
|
|
||||||
@description@
|
Datagram network driver.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_loop.c
|
net_loop.c
|
||||||
|
|
||||||
@description@
|
Loopback network driver.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_udp.c
|
net_udp.c
|
||||||
|
|
||||||
@description@
|
UDP lan driver.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_vcr.c
|
net_vcr.c
|
||||||
|
|
||||||
@description@
|
VCR network driver.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
net_win.c
|
net_win.c
|
||||||
|
|
||||||
@description@
|
Winsock based network and lan driver structs.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
net_wins.c
|
net_wins.c
|
||||||
|
|
||||||
@description@
|
Winsock lan driver.
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue