Modules | |
| NetQuake lan drivers. | |
| NetQuake network drivers. | |
Data Structures | |
| struct | _PollProcedure |
| struct | hostcache_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 |
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_s * | NET_CheckNewConnections (void) |
| Check for new connections. More... | |
| void | NET_Close (struct qsocket_s *sock) |
| Close a connection. More... | |
| struct qsocket_s * | NET_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_t * | NET_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_s * | hostname |
| char | my_tcpip_address [NET_NAMELEN] |
| int | net_activeconnections |
| int | net_driverlevel |
| int | net_hostport |
| struct msg_s * | net_message |
| double | net_time |
| qboolean | slistInProgress |
| qboolean | slistLocal |
| qboolean | slistSilent |
| qboolean | tcpipAvailable |
| QFile * | vcrFile |
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:
| |
| #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... | |
socket management | |
| qsocket_t * | net_activeSockets |
| qsocket_t * | net_freeSockets |
| int | net_numsockets |
message statistics | |
| int | messagesSent |
| int | messagesReceived |
| int | unreliableMessagesSent |
| int | unreliableMessagesReceived |
| #define CCREP_ACCEPT 0x81 |
Connect Reply:
port The port which the client is to use for further communication. | #define CCREP_PLAYER_INFO 0x84 |
Connect Reply:
player_number name colors frags connect_time address | #define CCREP_REJECT 0x82 |
Connect Reply:
reason | #define CCREP_RULE_INFO 0x85 |
Connect Reply:
rule value | #define CCREP_SERVER_INFO 0x83 |
Connect Reply:
server_address host_name level_name current_players max_players protocol_version NET_PROTOCOL_VERSION | #define CCREQ_CONNECT 0x01 |
Connect Request:
game_name "QUAKE" net_protocol_version NET_PROTOCOL_VERSION game_name is currently always "QUAKE", but is there so this same protocol can be used for future games as well | #define CCREQ_PLAYER_INFO 0x03 |
Connect Request:
player_number | #define CCREQ_RULE_INFO 0x04 |
Connect Request:
rule | #define CCREQ_SERVER_INFO 0x02 |
Connect Request:
game_name "QUAKE" net_protocol_version NET_PROTOCOL_VERSION game_name is currently always "QUAKE", but is there so this same protocol can be used for future games as well | #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 |
| #define NETFLAG_ACK 0x00020000 |
| #define NETFLAG_CTL 0x80000000 |
| #define NETFLAG_DATA 0x00010000 |
| #define NETFLAG_EOM 0x00080000 |
| #define NETFLAG_LENGTH_MASK 0x0000ffff |
| #define NETFLAG_NAK 0x00040000 |
| #define NETFLAG_UNRELIABLE 0x00100000 |
| typedef struct _PollProcedure PollProcedure |
Check if a message can be sent to the connection.
| sock | The qsocket representing the connection. |
| struct qsocket_s* NET_CheckNewConnections | ( | void | ) |
Check for new connections.
| void NET_Close | ( | struct qsocket_s * | sock | ) |
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
| sock | The qsocket representing the connection. |
Connect to a host.
| host | The name of the host to which will be connected. |
| void NET_FreeQSocket | ( | qsocket_t * | sock | ) |
Destroy a qsocket.
| sock | The qsocket representing the connection. |
Read a single message from the connection into net_message.
If there is a complete message, return it in net_message.
| sock | The qsocket representing the connection. |
| void NET_Init | ( | void | ) |
Initialize the networking sub-system.
| qsocket_t* NET_NewQSocket | ( | void | ) |
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.
| void NET_Poll | ( | void | ) |
Run any current poll procedures.
Send a single reliable message to the connection.
Try to send a complete length+message unit over the reliable stream.
| sock | The qsocket representing the connection. |
| data | The message to send. |
Send a reliable message to all attached clients.
| data | The message to send. |
| blocktime | The blocking timeout in seconds. |
Send a single unreliable message to the connection.
| sock | The qsocket representing the connection. |
| data | The message to send. |
| void NET_Shutdown | ( | void | ) |
Shutdown the networking sub-system.
Shutdown the networking sub-system.
| void SchedulePollProcedure | ( | PollProcedure * | pp, |
| double | timeOffset | ||
| ) |
Schedule a poll procedure to run.
The poll procedure will be called by NET_Poll() no earlier than "now"+timeOffset.
| pp | The poll procedure to shedule. |
| timeOffset | The time offset from "now" at which the procedure will be run. |
| double SetNetTime | ( | void | ) |
Cache the system time for the network sub-system.
| int DEFAULTnet_hostport |
| hostcache_t hostcache[HOSTCACHESIZE] |
| int hostCacheCount |
| struct cvar_s* hostname |
| int messagesReceived |
| int messagesSent |
| char my_tcpip_address[NET_NAMELEN] |
| int net_activeconnections |
| qsocket_t* net_activeSockets |
| int net_driverlevel |
| qsocket_t* net_freeSockets |
| int net_hostport |
| struct msg_s* net_message |
| int net_numsockets |
| double net_time |
| qboolean slistInProgress |
| qboolean slistLocal |
| qboolean slistSilent |
| qboolean tcpipAvailable |
| int unreliableMessagesReceived |
| int unreliableMessagesSent |
| QFile* vcrFile |