SRB2/src/d_net.h

63 lines
2.1 KiB
C
Raw Normal View History

2014-03-15 16:59:03 +00:00
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2016 by Sonic Team Junior.
2014-03-15 16:59:03 +00:00
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file d_net.h
/// \brief part of layer 4 (transport) (tp4) of the osi model
/// assure the reception of packet and proceed a checksums
///
/// There is a data struct that stores network communication related
/// stuff, and one that defines the actual packets to be transmitted
#ifndef __D_NET__
#define __D_NET__
2016-12-31 18:26:33 +00:00
// Max computers in a game
2014-03-15 16:59:03 +00:00
#define MAXNETNODES 32
#define BROADCASTADDR MAXNETNODES
2016-12-31 18:26:33 +00:00
#define MAXSPLITSCREENPLAYERS 2 // Max number of players on a single computer
2014-03-15 16:59:03 +00:00
#define STATLENGTH (TICRATE*2)
// stat of net
extern INT32 ticruned, ticmiss;
extern INT32 getbps, sendbps;
extern float lostpercent, duppercent, gamelostpercent;
extern INT32 packetheaderlength;
boolean Net_GetNetStat(void);
extern INT32 getbytes;
2016-12-31 18:26:33 +00:00
extern INT64 sendbytes; // Realtime updated
2014-03-15 16:59:03 +00:00
extern SINT8 nodetoplayer[MAXNETNODES];
2016-12-31 18:26:33 +00:00
extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen)
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
2014-03-15 16:59:03 +00:00
INT32 Net_GetFreeAcks(boolean urgent);
2014-03-15 16:59:03 +00:00
void Net_AckTicker(void);
2016-12-31 18:26:33 +00:00
// If reliable return true if packet sent, 0 else
2014-03-15 16:59:03 +00:00
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum,
size_t packetlength);
boolean HGetPacket(void);
void D_SetDoomcom(void);
#ifndef NONET
void D_SaveBan(void);
#endif
boolean D_CheckNetGame(void);
void D_CloseConnection(void);
2016-12-31 18:26:33 +00:00
void Net_UnAcknowledgePacket(INT32 node);
2014-03-15 16:59:03 +00:00
void Net_CloseConnection(INT32 node);
void Net_ConnectionTimeout(INT32 node);
2014-03-15 16:59:03 +00:00
void Net_AbortPacketType(UINT8 packettype);
void Net_SendAcks(INT32 node);
void Net_WaitAllAckReceived(UINT32 timeout);
2016-12-31 18:26:33 +00:00
2014-03-15 16:59:03 +00:00
#endif