2010-02-15 23:26:55 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-2001 Id Software, Inc.
|
|
|
|
Copyright (C) 2002-2009 John Fitzgibbons and others
|
2010-06-20 17:21:10 +00:00
|
|
|
Copyright (C) 2009-2010 Ozkan Sezer
|
2014-09-22 08:55:46 +00:00
|
|
|
Copyright (C) 2010-2014 QuakeSpasm developers
|
2010-02-15 23:26:55 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
/*
|
|
|
|
net.h
|
|
|
|
quake's interface to the networking layer
|
|
|
|
network functions and data, common to the
|
|
|
|
whole engine
|
|
|
|
*/
|
|
|
|
|
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
|
|
|
#ifndef _QUAKE_NET_H
|
|
|
|
#define _QUAKE_NET_H
|
|
|
|
|
2010-02-15 23:26:55 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
#define NET_NAMELEN 64
|
|
|
|
|
2014-03-25 07:28:11 +00:00
|
|
|
#define NET_MAXMESSAGE 64000 /* ericw -- was 32000 */
|
2010-06-20 17:21:10 +00:00
|
|
|
|
|
|
|
extern int DEFAULTnet_hostport;
|
|
|
|
extern int net_hostport;
|
|
|
|
|
|
|
|
extern cvar_t hostname;
|
2010-02-15 23:26:55 +00:00
|
|
|
|
|
|
|
extern double net_time;
|
|
|
|
extern sizebuf_t net_message;
|
2010-06-20 17:21:10 +00:00
|
|
|
extern int net_activeconnections;
|
|
|
|
|
2010-02-15 23:26:55 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
void NET_Init (void);
|
|
|
|
void NET_Shutdown (void);
|
2010-02-15 23:26:55 +00:00
|
|
|
|
|
|
|
struct qsocket_s *NET_CheckNewConnections (void);
|
|
|
|
// returns a new connection number if there is one pending, else -1
|
|
|
|
|
2010-08-29 02:22:55 +00:00
|
|
|
struct qsocket_s *NET_Connect (const char *host);
|
2010-02-15 23:26:55 +00:00
|
|
|
// called by client to connect to a host. Returns -1 if not able to
|
|
|
|
|
2015-04-01 09:30:10 +00:00
|
|
|
double NET_QSocketGetTime (const struct qsocket_s *sock);
|
2017-09-17 02:12:53 +00:00
|
|
|
const char *NET_QSocketGetTrueAddressString (const struct qsocket_s *sock);
|
|
|
|
const char *NET_QSocketGetMaskedAddressString (const struct qsocket_s *sock);
|
|
|
|
qboolean NET_QSocketGetProQuakeAngleHack (const struct qsocket_s *sock);
|
|
|
|
int NET_QSocketGetSequenceIn (const struct qsocket_s *sock);
|
|
|
|
int NET_QSocketGetSequenceOut (const struct qsocket_s *sock);
|
|
|
|
void NET_QSocketSetMSS(struct qsocket_s *s, int mss);
|
2012-04-18 20:33:12 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
qboolean NET_CanSendMessage (struct qsocket_s *sock);
|
2010-02-15 23:26:55 +00:00
|
|
|
// Returns true or false if the given qsocket can currently accept a
|
|
|
|
// message to be transmitted.
|
|
|
|
|
2017-09-17 02:12:53 +00:00
|
|
|
struct qsocket_s *NET_GetServerMessage(void);
|
|
|
|
//returns data in net_message, qsocket says which client its from
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
int NET_GetMessage (struct qsocket_s *sock);
|
2010-02-15 23:26:55 +00:00
|
|
|
// returns data in net_message sizebuf
|
|
|
|
// returns 0 if no data is waiting
|
|
|
|
// returns 1 if a message was received
|
|
|
|
// returns 2 if an unreliable message was received
|
|
|
|
// returns -1 if the connection died
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
|
|
|
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
2010-02-15 23:26:55 +00:00
|
|
|
// returns 0 if the message connot be delivered reliably, but the connection
|
|
|
|
// is still considered valid
|
|
|
|
// returns 1 if the message was sent properly
|
|
|
|
// returns -1 if the connection died
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
2010-02-15 23:26:55 +00:00
|
|
|
// This is a reliable *blocking* send to all attached clients.
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
void NET_Close (struct qsocket_s *sock);
|
2010-02-15 23:26:55 +00:00
|
|
|
// 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
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
void NET_Poll (void);
|
|
|
|
|
2010-02-15 23:26:55 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
// Server list related globals:
|
|
|
|
extern qboolean slistInProgress;
|
|
|
|
extern qboolean slistSilent;
|
2017-09-17 02:12:53 +00:00
|
|
|
extern enum slistScope_e
|
|
|
|
{
|
|
|
|
SLIST_LOOP,
|
|
|
|
SLIST_LAN,
|
|
|
|
SLIST_INTERNET
|
|
|
|
} slistScope;
|
2010-02-15 23:26:55 +00:00
|
|
|
|
2017-09-17 02:12:53 +00:00
|
|
|
extern size_t hostCacheCount;
|
2012-04-18 20:33:12 +00:00
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
void NET_Slist_f (void);
|
2012-04-18 20:33:12 +00:00
|
|
|
void NET_SlistSort (void);
|
2017-09-17 02:12:53 +00:00
|
|
|
const char *NET_SlistPrintServer (size_t n);
|
|
|
|
const char *NET_SlistPrintServerName (size_t n);
|
2010-02-15 23:26:55 +00:00
|
|
|
|
|
|
|
|
2010-06-20 17:21:10 +00:00
|
|
|
/* FIXME: driver related, but public:
|
|
|
|
*/
|
2010-02-15 23:26:55 +00:00
|
|
|
extern qboolean ipxAvailable;
|
2017-09-17 02:12:53 +00:00
|
|
|
extern qboolean ipv4Available;
|
|
|
|
extern qboolean ipv6Available;
|
2010-02-15 23:26:55 +00:00
|
|
|
extern char my_ipx_address[NET_NAMELEN];
|
2017-09-17 02:12:53 +00:00
|
|
|
extern char my_ipv4_address[NET_NAMELEN];
|
|
|
|
extern char my_ipv6_address[NET_NAMELEN];
|
2010-02-15 23:26:55 +00:00
|
|
|
|
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
|
|
|
#endif /* _QUAKE_NET_H */
|
|
|
|
|