QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
netmain.h File Reference
This graph shows which files directly or indirectly include this file:

Data Structures

struct  _PollProcedure
 
struct  hostcache_t
 
struct  net_driver_t
 
struct  net_landriver_t
 
struct  netadr_t
 
struct  qsocket_s
 

Macros

#define HOSTCACHESIZE   8
 
#define MAX_NET_DRIVERS   8
 
#define NET_DATAGRAMSIZE   (MAX_DATAGRAM + NET_HEADERSIZE)
 
#define NET_HEADERSIZE   (2 * sizeof(unsigned int))
 
#define NET_MAXMESSAGE   32000
 
#define NET_NAMELEN   64
 
#define NET_PROTOCOL_VERSION   3
 
NetHeader flags
#define NETFLAG_LENGTH_MASK   0x0000ffff
 
#define NETFLAG_DATA   0x00010000
 
#define NETFLAG_ACK   0x00020000
 
#define NETFLAG_NAK   0x00040000
 
#define NETFLAG_EOM   0x00080000
 
#define NETFLAG_UNRELIABLE   0x00100000
 
#define NETFLAG_CTL   0x80000000
 
Connection Protocol

This is the network info/connection protocol.

It is used to find Quake servers, get info about them, and connect to them. Once connected, the Quake game protocol (documented elsewhere) is used.

General notes:

Note
There are two address forms used. The short form is just a port number. The address that goes along with the port is defined as "whatever address you receive this reponse from". This lets us use the host OS to solve the problem of multiple host addresses (possibly with no routing between them); the host will use the right address when we reply to the inbound connection request. The long from is a full address and port in a string. It is used for returning the address of a server that is not running locally.
#define CCREQ_CONNECT   0x01
 Connect Request: More...
 
#define CCREQ_SERVER_INFO   0x02
 Connect Request: More...
 
#define CCREQ_PLAYER_INFO   0x03
 Connect Request: More...
 
#define CCREQ_RULE_INFO   0x04
 Connect Request: More...
 
#define CCREP_ACCEPT   0x81
 Connect Reply: More...
 
#define CCREP_REJECT   0x82
 Connect Reply: More...
 
#define CCREP_SERVER_INFO   0x83
 Connect Reply: More...
 
#define CCREP_PLAYER_INFO   0x84
 Connect Reply: More...
 
#define CCREP_RULE_INFO   0x85
 Connect Reply: More...
 

Typedefs

typedef struct _PollProcedure PollProcedure
 
typedef struct qsocket_s qsocket_t
 

Functions

qboolean NET_CanSendMessage (qsocket_t *sock)
 Check if a message can be sent to the connection. More...
 
struct qsocket_sNET_CheckNewConnections (void)
 Check for new connections. More...
 
void NET_Close (struct qsocket_s *sock)
 Close a connection. More...
 
struct qsocket_sNET_Connect (const char *host)
 Connect to a host. More...
 
void NET_FreeQSocket (qsocket_t *sock)
 Destroy a qsocket. More...
 
int NET_GetMessage (struct qsocket_s *sock)
 Read a single message from the connection into net_message. More...
 
void NET_Init (void)
 Initialize the networking sub-system. More...
 
qsocket_tNET_NewQSocket (void)
 Create and initialize a new qsocket. More...
 
void NET_Poll (void)
 Run any current poll procedures. More...
 
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data)
 Send a single reliable message to the connection. More...
 
int NET_SendToAll (sizebuf_t *data, double blocktime)
 Send a reliable message to all attached clients. More...
 
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data)
 Send a single unreliable message to the connection. More...
 
void NET_Shutdown (void)
 Shutdown the networking sub-system. More...
 
void SchedulePollProcedure (PollProcedure *pp, double timeOffset)
 Schedule a poll procedure to run. More...
 
double SetNetTime (void)
 Cache the system time for the network sub-system. More...
 

Variables

int DEFAULTnet_hostport
 
hostcache_t hostcache [HOSTCACHESIZE]
 
int hostCacheCount
 
struct cvar_shostname
 
char my_tcpip_address [NET_NAMELEN]
 
int net_activeconnections
 
int net_driverlevel
 
net_driver_t net_drivers [MAX_NET_DRIVERS]
 
int net_hostport
 
net_landriver_t net_landrivers [MAX_NET_DRIVERS]
 
struct msg_snet_message
 
int net_numdrivers
 
int net_numlandrivers
 
double net_time
 
qboolean slistInProgress
 
qboolean slistLocal
 
qboolean slistSilent
 
qboolean tcpipAvailable
 
QFilevcrFile
 
socket management
qsocket_tnet_activeSockets
 
qsocket_tnet_freeSockets
 
int net_numsockets
 
message statistics
int messagesSent
 
int messagesReceived
 
int unreliableMessagesSent
 
int unreliableMessagesReceived