delet michealsoft psure this was broken since quite a long time, now since we use quite a bunch of GNU extensions (and actually rely on the cleanup attribute), supporting this in any way is just too much, so remove everything to declutter the codebase
184 lines
4.1 KiB
C
184 lines
4.1 KiB
C
// SONIC ROBO BLAST 2
|
|
//-----------------------------------------------------------------------------
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
|
//
|
|
// 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 i_net.h
|
|
/// \brief System specific network interface stuff.
|
|
|
|
#ifndef __I_NET__
|
|
#define __I_NET__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef __GNUG__
|
|
#pragma interface
|
|
#endif
|
|
|
|
#include "doomdef.h"
|
|
#include "command.h"
|
|
|
|
/// \brief program net id
|
|
#define DOOMCOM_ID (INT32)0x12345678l
|
|
|
|
/// \def MAXPACKETLENGTH
|
|
/// For use in a LAN
|
|
#define MAXPACKETLENGTH 1450
|
|
/// \def INETPACKETLENGTH
|
|
/// For use on the internet
|
|
#define INETPACKETLENGTH 1024
|
|
|
|
#define NO_BAN_TIME (time_t)(-1)
|
|
|
|
extern INT16 hardware_MAXPACKETLENGTH;
|
|
|
|
typedef struct
|
|
{
|
|
/// Supposed to be DOOMCOM_ID
|
|
INT32 id;
|
|
|
|
/// SRB2 executes an INT32 to execute commands.
|
|
INT16 intnum;
|
|
/// Communication between SRB2 and the driver.
|
|
/// Is CMD_SEND or CMD_GET.
|
|
INT16 command;
|
|
/// Is dest for send, set by get (-1 = no packet).
|
|
INT16 remotenode;
|
|
|
|
/// Number of bytes in doomdata to be sent
|
|
INT16 datalength;
|
|
|
|
/// Info common to all nodes.
|
|
/// Console is always node 0.
|
|
INT16 numnodes;
|
|
/// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
|
INT16 ticdup;
|
|
/// Flag: 1 = send a backup tic in every packet.
|
|
INT16 extratics;
|
|
/// kind of game
|
|
INT16 gametype;
|
|
/// Flag: -1 = new game, 0-5 = load savegame
|
|
INT16 savegame;
|
|
/// currect map
|
|
INT16 map;
|
|
|
|
/// Info specific to this node.
|
|
INT16 consoleplayer;
|
|
/// Number of "slots": the highest player number in use plus one.
|
|
INT16 numslots;
|
|
|
|
/// The packet data to be sent.
|
|
char data[MAXPACKETLENGTH];
|
|
} ATTRPACK doomcom_t;
|
|
|
|
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
|
|
|
|
#ifdef HOLEPUNCH
|
|
typedef struct
|
|
{
|
|
INT32 magic;
|
|
INT32 addr;
|
|
INT16 port;
|
|
} ATTRPACK holepunch_t;
|
|
|
|
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
|
|
#endif
|
|
|
|
extern doomcom_t *doomcom;
|
|
|
|
/** \brief return packet in doomcom struct
|
|
*/
|
|
extern boolean (*I_NetGet)(void);
|
|
|
|
/** \brief send packet within doomcom struct
|
|
*/
|
|
extern void (*I_NetSend)(void);
|
|
|
|
/** \brief close a connection
|
|
|
|
\param nodenum node to be closed
|
|
|
|
\return void
|
|
|
|
|
|
*/
|
|
extern void (*I_NetFreeNodenum)(INT32 nodenum);
|
|
|
|
/** \brief open a connection with specified address
|
|
|
|
\param address address to connect to
|
|
|
|
\return number of node
|
|
|
|
|
|
*/
|
|
extern SINT8 I_NetMakeNode(const char *address);
|
|
|
|
/** \brief open a connection with specified address and port
|
|
|
|
\param address address to connect to
|
|
|
|
\param port port to connect to
|
|
|
|
\return number of node
|
|
|
|
|
|
*/
|
|
extern SINT8 (*I_NetMakeNodewPort)(const char *address, const char *port);
|
|
|
|
/** \brief open connection
|
|
*/
|
|
extern boolean (*I_NetOpenSocket)(void);
|
|
|
|
/** \brief close all connections no more allow geting any packet
|
|
*/
|
|
extern void (*I_NetCloseSocket)(void);
|
|
|
|
|
|
/** \brief send a hole punching request
|
|
*/
|
|
#ifdef HOLEPUNCH
|
|
extern void (*I_NetRequestHolePunch)(INT32 node);
|
|
#endif
|
|
/** \brief register this machine on the hole punching server
|
|
*/
|
|
#ifdef HOLEPUNCH
|
|
extern void (*I_NetRegisterHolePunch)(void);
|
|
#endif
|
|
|
|
extern boolean (*I_Ban) (INT32 node);
|
|
extern void (*I_ClearBans)(void);
|
|
extern const char *(*I_GetNodeAddress) (INT32 node);
|
|
extern const char *(*I_GetBanAddress) (size_t ban);
|
|
extern const char *(*I_GetBanMask) (size_t ban);
|
|
extern const char *(*I_GetBanUsername) (size_t ban);
|
|
extern const char *(*I_GetBanReason) (size_t ban);
|
|
extern time_t (*I_GetUnbanTime) (size_t ban);
|
|
extern boolean (*I_SetBanAddress) (const char *address,const char *mask);
|
|
extern boolean (*I_SetBanUsername) (const char *username);
|
|
extern boolean (*I_SetBanReason) (const char *reason);
|
|
extern boolean (*I_SetUnbanTime) (time_t timestamp);
|
|
|
|
typedef struct
|
|
{
|
|
size_t banid;
|
|
time_t timeleft;
|
|
} bannednode_t;
|
|
extern bannednode_t *bannednode;
|
|
|
|
/// \brief Called by D_SRB2Main to be defined by extern network driver
|
|
boolean I_InitNetwork(void);
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif
|
|
|
|
#endif
|