Torque2D Reference
|
#include <netInterface.h>
Public Types | |
enum | PacketTypes { MasterServerGameTypesRequest = 2, MasterServerGameTypesResponse = 4, MasterServerListRequest = 6, MasterServerListResponse = 8, GameMasterInfoRequest = 10, GameMasterInfoResponse = 12, GamePingRequest = 14, GamePingResponse = 16, GameInfoRequest = 18, GameInfoResponse = 20, GameHeartbeat = 22, ConnectChallengeRequest = 26, ConnectChallengeReject = 28, ConnectChallengeResponse = 30, ConnectRequest = 32, ConnectReject = 34, ConnectAccept = 36, Disconnect = 38 } |
Public Member Functions | |
NetInterface () | |
bool | doesAllowConnections () |
Returns whether or not this NetInterface allows connections from remote hosts. More... | |
void | setAllowsConnections (bool conn) |
Sets whether or not this NetInterface allows connections from remote hosts. More... | |
virtual void | processPacketReceiveEvent (PacketReceiveEvent *event) |
Dispatch function for processing all network packets through this NetInterface. More... | |
virtual void | handleInfoPacket (const NetAddress *address, U8 packetType, BitStream *stream) |
Handles all packets that don't fall into the category of connection handshake or game data. More... | |
void | processClient () |
Checks all connections marked as client to server for packet sends. More... | |
void | processServer () |
Checks all connections marked as server to client for packet sends. More... | |
void | startConnection (NetConnection *conn) |
Begins the connection handshaking process for a connection. More... | |
void | checkTimeouts () |
Checks for timeouts on all valid and pending connections. More... | |
void | sendDisconnectPacket (NetConnection *conn, const char *reason) |
Send a disconnect packet on a connection, along with a reason. More... | |
Protected Types | |
enum | NetInterfaceConstants { MaxPendingConnects = 20, ChallengeRetryCount = 4, ChallengeRetryTime = 2500, ConnectRetryCount = 4, ConnectRetryTime = 2500, TimeoutCheckInterval = 1500 } |
Protected Member Functions | |
void | initRandomData () |
Initialize random data. More... | |
void | computeNetMD5 (const NetAddress *address, U32 connectSequence, U32 addressDigest[4]) |
Calculate an MD5 sum representing a connection, and store it into addressDigest. More... | |
Connection management | |
Most of these are pretty self-explanatory. | |
void | addPendingConnection (NetConnection *conn) |
NetConnection * | findPendingConnection (const NetAddress *address, U32 packetSequence) |
void | removePendingConnection (NetConnection *conn) |
void | sendConnectChallengeRequest (NetConnection *conn) |
void | handleConnectChallengeRequest (const NetAddress *addr, BitStream *stream) |
void | handleConnectChallengeResponse (const NetAddress *address, BitStream *stream) |
void | sendConnectRequest (NetConnection *conn) |
void | handleConnectRequest (const NetAddress *address, BitStream *stream) |
void | sendConnectAccept (NetConnection *conn) |
void | handleConnectAccept (const NetAddress *address, BitStream *stream) |
void | sendConnectReject (NetConnection *conn, const char *reason) |
void | handleConnectReject (const NetAddress *address, BitStream *stream) |
void | handleDisconnect (const NetAddress *address, BitStream *stream) |
Protected Attributes | |
Vector< NetConnection * > | mPendingConnections |
List of connections that are in the startup phase. More... | |
U32 | mLastTimeoutCheckTime |
Last time all the active connections were checked for timeouts. More... | |
U32 | mRandomHashData [12] |
Data that gets hashed with connect challenge requests to prevent connection spoofing. More... | |
bool | mRandomDataInitialized |
Have we initialized our random number generator? More... | |
bool | mAllowConnections |
Is this NetInterface allowing connections at this time? More... | |
NetInterface class. Manages all valid and pending notify protocol connections.
|
protected |
enum PacketTypes |
PacketType is encoded as the first byte of each packet. If the LSB of the first byte is set (i.e. if the type number is odd), then the packet is a data protocol packet, otherwise it's an OOB packet, suitable for use in strange protocols, like game querying or connection initialization.
NetInterface | ( | ) |
|
protected |
void checkTimeouts | ( | ) |
Checks for timeouts on all valid and pending connections.
|
protected |
Calculate an MD5 sum representing a connection, and store it into addressDigest.
|
inline |
Returns whether or not this NetInterface allows connections from remote hosts.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
Handles all packets that don't fall into the category of connection handshake or game data.
Reimplemented in DemoNetInterface.
|
protected |
Initialize random data.
void processClient | ( | ) |
Checks all connections marked as client to server for packet sends.
|
virtual |
Dispatch function for processing all network packets through this NetInterface.
void processServer | ( | ) |
Checks all connections marked as server to client for packet sends.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void sendDisconnectPacket | ( | NetConnection * | conn, |
const char * | reason | ||
) |
Send a disconnect packet on a connection, along with a reason.
|
inline |
Sets whether or not this NetInterface allows connections from remote hosts.
void startConnection | ( | NetConnection * | conn | ) |
Begins the connection handshaking process for a connection.
|
protected |
Is this NetInterface allowing connections at this time?
|
protected |
Last time all the active connections were checked for timeouts.
|
protected |
List of connections that are in the startup phase.
|
protected |
Have we initialized our random number generator?
|
protected |
Data that gets hashed with connect challenge requests to prevent connection spoofing.