[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/include net_lowlevel.h netconnect.h
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/include net_lowlevel.h netconnect.h |
Date: |
22 Dec 2003 16:07:20 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/22 16:07:20
Modified files:
src/include : net_lowlevel.h netconnect.h
Log message:
Tabs Cleanup
Patches:
Index: stratagus/src/include/net_lowlevel.h
diff -u stratagus/src/include/net_lowlevel.h:1.32
stratagus/src/include/net_lowlevel.h:1.33
--- stratagus/src/include/net_lowlevel.h:1.32 Sat Dec 20 16:33:27 2003
+++ stratagus/src/include/net_lowlevel.h Mon Dec 22 16:07:20 2003
@@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
-// T H E W A R B E G I N S
-// Stratagus - A free fantasy real time strategy game engine
+// T H E W A R B E G I N S
+// Stratagus - A free fantasy real time strategy game engine
//
-/address@hidden net_lowlevel.h - The network low level header file. */
+/address@hidden net_lowlevel.h - The network low level header file. */
//
-// (c) Copyright 1998-2001 by Lutz Sammer
+// (c) Copyright 1998-2001 by Lutz Sammer
//
// 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
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: net_lowlevel.h,v 1.32 2003/12/20 05:33:27 jsalmon3 Exp $
+// $Id: net_lowlevel.h,v 1.33 2003/12/22 05:07:20 wizzard Exp $
#ifndef __NET_LOWLEVEL_H
#define __NET_LOWLEVEL_H
@@ -34,7 +34,7 @@
//@{
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#ifndef _MSC_VER
@@ -70,30 +70,30 @@
// MS Knowledge base fix for SIO_GET_INTERFACE_LIST with NT4.0 ++
#define SIO_GET_INTERFACE_LIST 0x4004747F
-#define IFF_UP 1
+#define IFF_UP 1
#define IFF_LOOPBACK 4
typedef struct _OLD_INTERFACE_INFO
{
- unsigned long iiFlags; /* Interface flags */
- SOCKADDR iiAddress; /* Interface address */
- SOCKADDR iiBroadcastAddress; /* Broadcast address */
- SOCKADDR iiNetmask; /* Network mask */
+ unsigned long iiFlags; /* Interface flags */
+ SOCKADDR iiAddress; /* Interface address */
+ SOCKADDR iiBroadcastAddress; /* Broadcast address */
+ SOCKADDR iiNetmask; /* Network mask */
} OLD_INTERFACE_INFO;
#define INTERFACE_INFO OLD_INTERFACE_INFO
-#else // UNIX
-# include <sys/time.h>
-# include <unistd.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# include <sys/socket.h>
-# include <sys/ioctl.h>
-# ifndef __BEOS__
-# include <net/if.h>
-# include <arpa/inet.h>
-# endif
-# define INVALID_SOCKET -1
-#endif // !WIN32
+#else // UNIX
+#include <sys/time.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#ifndef __BEOS__
+#include <net/if.h>
+#include <arpa/inet.h>
+#endif
+#define INVALID_SOCKET -1
+#endif // !WIN32
#endif // !USE_SDL_NET
#ifndef INADDR_NONE
@@ -101,12 +101,12 @@
#endif
/*----------------------------------------------------------------------------
--- Defines
+-- Defines
----------------------------------------------------------------------------*/
#define NIPQUAD(ad) \
- (int)(((ad) >> 24) & 0xff), (int)(((ad) >> 16) & 0xff), \
- (int)(((ad) >> 8) & 0xff), (int)((ad) & 0xff)
+ (int)(((ad) >> 24) & 0xff), (int)(((ad) >> 16) & 0xff), \
+ (int)(((ad) >> 8) & 0xff), (int)((ad) & 0xff)
#ifdef USE_WIN32
typedef SOCKET Socket;
@@ -115,20 +115,20 @@
#endif
/*----------------------------------------------------------------------------
--- Declarations
+-- Declarations
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
--- Variables
+-- Variables
----------------------------------------------------------------------------*/
-extern int NetLastSocket; /// Last socket
-extern unsigned long NetLastHost; /// Last host number (net
format)
-extern int NetLastPort; ///
Last port number (net format)
-extern unsigned long NetLocalAddrs[]; /// Local IP-Addrs of this host
(net format)
+extern int NetLastSocket; /// Last socket
+extern unsigned long NetLastHost; /// Last host number (net format)
+extern int NetLastPort; /// Last port number (net format)
+extern unsigned long NetLocalAddrs[]; /// Local IP-Addrs of this host (net
format)
/*----------------------------------------------------------------------------
--- Functions
+-- Functions
----------------------------------------------------------------------------*/
/// Hardware dependend network init.
@@ -137,7 +137,7 @@
extern void NetExit(void);
/// Resolve host in name or or colon dot notation.
extern unsigned long NetResolveHost(const char* host);
- /// Get local IP from network file descriptor
+ /// Get local IP from network file descriptor
extern int NetSocketAddr(const Socket sock);
/// Open a UDP Socket port.
extern Socket NetOpenUDP(int port);
@@ -150,18 +150,18 @@
/// Set socket to non-blocking
extern int NetSetNonBlocking(Socket sockfd);
/// Open a TCP connection.
-extern int NetConnectTCP(Socket sockfd,unsigned long addr,int port);
+extern int NetConnectTCP(Socket sockfd, unsigned long addr, int port);
/// Send through a UPD socket to a host:port.
-extern int NetSendUDP(Socket sockfd,unsigned long host,int port
- ,const void* buf,int len);
+extern int NetSendUDP(Socket sockfd, unsigned long host, int port
+ , const void* buf, int len);
/// Send through a TCP socket
-extern int NetSendTCP(Socket sockfd,const void* buf,int len);
+extern int NetSendTCP(Socket sockfd, const void* buf, int len);
/// Wait for socket ready.
-extern int NetSocketReady(Socket sockfd,int timeout);
+extern int NetSocketReady(Socket sockfd, int timeout);
/// Receive from a UDP socket.
-extern int NetRecvUDP(Socket sockfd,void* buf,int len);
+extern int NetRecvUDP(Socket sockfd, void* buf, int len);
/// Receive from a TCP socket.
-extern int NetRecvTCP(Socket sockfd,void* buf,int len);
+extern int NetRecvTCP(Socket sockfd, void* buf, int len);
/// Listen for connections on a TCP socket
extern int NetListenTCP(Socket sockfd);
/// Accept a connection on a TCP socket
@@ -169,4 +169,4 @@
//@}
-#endif // !__NET_LOWLEVEL_H
+#endif // !__NET_LOWLEVEL_H
Index: stratagus/src/include/netconnect.h
diff -u stratagus/src/include/netconnect.h:1.53
stratagus/src/include/netconnect.h:1.54
--- stratagus/src/include/netconnect.h:1.53 Sat Dec 20 16:33:27 2003
+++ stratagus/src/include/netconnect.h Mon Dec 22 16:07:20 2003
@@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
-// T H E W A R B E G I N S
-// Stratagus - A free fantasy real time strategy game engine
+// T H E W A R B E G I N S
+// Stratagus - A free fantasy real time strategy game engine
//
-/address@hidden netconnect.h - The network connection setup header
file. */
+/address@hidden netconnect.h - The network connection setup header file. */
//
-// (c) Copyright 1998-2003 by Lutz Sammer, Andreas Arens
+// (c) Copyright 1998-2003 by Lutz Sammer, Andreas Arens
//
// 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
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: netconnect.h,v 1.53 2003/12/20 05:33:27 jsalmon3 Exp $
+// $Id: netconnect.h,v 1.54 2003/12/22 05:07:20 wizzard Exp $
#ifndef __NETCONNECT_H__
#define __NETCONNECT_H__
@@ -34,192 +34,192 @@
//@{
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#include "map.h"
/*----------------------------------------------------------------------------
--- Defines
+-- Defines
----------------------------------------------------------------------------*/
/// Network protocol major version
-#define NetworkProtocolMajorVersion 0
+#define NetworkProtocolMajorVersion 0
/// Network protocol minor version (maximal 99)
-#define NetworkProtocolMinorVersion 9
+#define NetworkProtocolMinorVersion 9
/// Network protocol patch level (maximal 99)
-#define NetworkProtocolPatchLevel 0
+#define NetworkProtocolPatchLevel 0
/// Network protocol version (1,2,3) -> 10203
#define NetworkProtocolVersion \
-
(NetworkProtocolMajorVersion*10000+NetworkProtocolMinorVersion*100 \
- +NetworkProtocolPatchLevel)
+ (NetworkProtocolMajorVersion * 10000 + NetworkProtocolMinorVersion *
100 \
+ + NetworkProtocolPatchLevel)
/// Network protocol printf format string
-#define NetworkProtocolFormatString "%d.%d.%d"
+#define NetworkProtocolFormatString "%d.%d.%d"
/// Network protocol printf format arguments
-#define NetworkProtocolFormatArgs(v) (v)/10000,((v)/100)%100,(v)%100
+#define NetworkProtocolFormatArgs(v) (v) / 10000,((v) / 100) % 100,(v) % 100
-#define NetworkDefaultPort 6660 /// Default
communication port
+#define NetworkDefaultPort 6660 /// Default communication port
/*----------------------------------------------------------------------------
--- Declarations
+-- Declarations
----------------------------------------------------------------------------*/
/**
-** Network systems active in current game.
+** Network systems active in current game.
*/
typedef struct _network_host_ {
- unsigned long Host; /// Host address
- unsigned short Port; /// Port on host
- unsigned short PlyNr; /// Player
nummer
- char PlyName[16]; /// Name of
player
+ unsigned long Host; /// Host address
+ unsigned short Port; /// Port on host
+ unsigned short PlyNr; /// Player nummer
+ char PlyName[16]; /// Name of player
} NetworkHost;
/**
-** Connect state information of network systems active in current
game.
+** Connect state information of network systems active in current game.
*/
typedef struct _network_state_ {
- unsigned char State; /// Menu:
ConnectState
- unsigned short MsgCnt; /// Menu:
Counter for state msg of same type (detect unreachable)
+ unsigned char State; /// Menu: ConnectState
+ unsigned short MsgCnt; /// Menu: Counter for state msg of same type
(detect unreachable)
// Fill in here...
} NetworkState;
/**
-** Multiplayer game setup menu state
+** Multiplayer game setup menu state
*/
typedef struct _setup_state_ {
- unsigned char ResOpt;
/// Resources option
- unsigned char UnsOpt;
/// Unit # option
- unsigned char FwsOpt;
/// Fog of war option
- unsigned char TssOpt;
/// Tileset select option
- unsigned char GaTOpt;
/// Game type option
- unsigned char CompOpt[PlayerMax]; /// Free slot
option selection
- unsigned char Ready[PlayerMax]; /// Client
ready state
- unsigned char Race[PlayerMax]; /// Client race
selection
- unsigned long LastFrame[PlayerMax]; /// Last
message received
+ unsigned char ResOpt; /// Resources option
+ unsigned char UnsOpt; /// Unit # option
+ unsigned char FwsOpt; /// Fog of war option
+ unsigned char TssOpt; /// Tileset select option
+ unsigned char GaTOpt; /// Game type option
+ unsigned char CompOpt[PlayerMax]; /// Free slot option selection
+ unsigned char Ready[PlayerMax]; /// Client ready state
+ unsigned char Race[PlayerMax]; /// Client race selection
+ unsigned long LastFrame[PlayerMax]; /// Last message received
// Fill in here...
} ServerSetup;
/**
-** Network init message.
+** Network init message.
**
-** @todo Transfering the same data in each message is waste of
bandwidth.
-** I mean the versions and the UID ...
+** @todo Transfering the same data in each message is waste of bandwidth.
+** I mean the versions and the UID ...
*/
typedef struct _init_message_ {
- unsigned char Type; /// Init message type
- unsigned char SubType; /// Init message subtype
- int Stratagus;
/// Stratagus engine version
- int Version;
/// Network protocol version
- unsigned int ConfUID; /// Engine
configuration UID (Checksum) // FIXME: not available yet
- unsigned int MapUID; /// UID of map to play.
// FIXME: add MAP name, path, etc
- int Lag;
/// Lag time
- int Updates;
/// Update frequency
- char HostsCount; /// Number of
hosts
+ unsigned char Type; /// Init message type
+ unsigned char SubType; /// Init message subtype
+ int Stratagus; /// Stratagus engine version
+ int Version; /// Network protocol version
+ unsigned int ConfUID; /// Engine configuration UID (Checksum)
FIXME: not available yet
+ unsigned int MapUID; /// UID of map to play. FIXME: add MAP
name, path, etc
+ int Lag; /// Lag time
+ int Updates; /// Update frequency
+ char HostsCount; /// Number of hosts
union {
- NetworkHost Hosts[PlayerMax]; ///
Participant information
- char MapPath[256];
- ServerSetup State;
/// Server Setup State information
+ NetworkHost Hosts[PlayerMax]; /// Participant information
+ char MapPath[256];
+ ServerSetup State; /// Server Setup State
information
} u;
} InitMessage;
/**
-** Network init config message subtypes (menu state machine).
+** Network init config message subtypes (menu state machine).
*/
enum _ic_message_subtype_ {
- ICMHello, /// Client
Request
- ICMConfig, /// Setup
message configure clients
+ ICMHello, /// Client Request
+ ICMConfig, /// Setup message configure clients
- ICMEngineMismatch, /// Stratagus engine
version doesn't match
- ICMProtocolMismatch, /// Network protocol version doesn't
match
- ICMEngineConfMismatch, /// Engine configuration isn't identical
- ICMMapUidMismatch, /// MAP UID doesn't
match
-
- ICMGameFull, /// No player slots available
- ICMWelcome, /// Acknowledge
for new client connections
-
- ICMWaiting, /// Client has
received Welcome and is waiting for Map/State
- ICMMap, /// MapInfo (and
Mapinfo Ack)
- ICMState, /// StateInfo
- ICMResync, /// Ack
StateInfo change
-
- ICMServerQuit, /// Server has quit game
- ICMGoodBye, /// Client
wants to leave game
- ICMSeeYou, /// Client has
left game
+ ICMEngineMismatch, /// Stratagus engine version doesn't match
+ ICMProtocolMismatch, /// Network protocol version doesn't match
+ ICMEngineConfMismatch, /// Engine configuration isn't identical
+ ICMMapUidMismatch, /// MAP UID doesn't match
+
+ ICMGameFull, /// No player slots available
+ ICMWelcome, /// Acknowledge for new client connections
+
+ ICMWaiting, /// Client has received Welcome and is waiting
for Map/State
+ ICMMap, /// MapInfo (and Mapinfo Ack)
+ ICMState, /// StateInfo
+ ICMResync, /// Ack StateInfo change
+
+ ICMServerQuit, /// Server has quit game
+ ICMGoodBye, /// Client wants to leave game
+ ICMSeeYou, /// Client has left game
- ICMGo, /// Client is ready to
run
+ ICMGo, /// Client is ready to run
- ICMAYT, /// Server asks are you
there
- ICMIAH, /// Client answers I am
here
+ ICMAYT, /// Server asks are you there
+ ICMIAH, /// Client answers I am here
};
/**
-** Network Client connect states
+** Network Client connect states
*/
enum _net_client_con_state_ {
ccs_unused = 0,
- ccs_connecting, /// New client
- ccs_connected, /// Has received slot info
- ccs_mapinfo, /// Has received matching
map-info
- ccs_badmap, /// Has
received non-matching map-info
- ccs_synced, /// Client is
in sync with server
- ccs_async, /// Server user
has changed selection
- ccs_changed, /// Client user has made menu
selection
- ccs_detaching, /// Client user wants to detach
- ccs_disconnected, /// Client has detached
- ccs_unreachable, /// Server is
unreachable
- ccs_usercanceled, /// Connection canceled
by user
- ccs_nofreeslots, /// Server has no more
free slots
- ccs_serverquits, /// Server quits
- ccs_goahead, /// Server wants to start game
- ccs_started, /// Server has started game
- ccs_incompatibleengine, /// Incompatible engine version
- ccs_incompatiblenetwork, /// Incompatible netowrk version
+ ccs_connecting, /// New client
+ ccs_connected, /// Has received slot info
+ ccs_mapinfo, /// Has received matching map-info
+ ccs_badmap, /// Has received non-matching map-info
+ ccs_synced, /// Client is in sync with server
+ ccs_async, /// Server user has changed selection
+ ccs_changed, /// Client user has made menu selection
+ ccs_detaching, /// Client user wants to detach
+ ccs_disconnected, /// Client has detached
+ ccs_unreachable, /// Server is unreachable
+ ccs_usercanceled, /// Connection canceled by user
+ ccs_nofreeslots, /// Server has no more free slots
+ ccs_serverquits, /// Server quits
+ ccs_goahead, /// Server wants to start game
+ ccs_started, /// Server has started game
+ ccs_incompatibleengine, /// Incompatible engine version
+ ccs_incompatiblenetwork, /// Incompatible netowrk version
};
/*----------------------------------------------------------------------------
--- Variables
+-- Variables
----------------------------------------------------------------------------*/
-extern char* NetworkArg; /// Network command
line argument
-extern int NetPlayers; /// Network
players
-extern int NetworkPort; ///
Local network port to use
-
-extern char LocalPlayerName[16]; /// Name of local player
-
-extern int HostsCount; /// Number of
hosts.
-extern NetworkHost Hosts[PlayerMax]; /// Host, port, and number of
all players.
-
-extern int NetConnectRunning; /// Network menu: Setup
mode active
-extern NetworkState NetStates[PlayerMax];/// Network menu: Server: Client Host
states
-extern unsigned char NetLocalState; /// Network menu: Local
Server/Client connect state
-extern int NetLocalHostsSlot; /// Network menu: Slot
# in Hosts array of local client
-extern char NetTriesText[32]; /// Network menu:
Client tries count text
-extern char NetServerText[64]; /// Network menu: Text
describing the Network Server IP
-extern int NetLocalPlayerNumber; /// Player number of local
client
+extern char* NetworkArg; /// Network command line argument
+extern int NetPlayers; /// Network players
+extern int NetworkPort; /// Local network port to use
+
+extern char LocalPlayerName[16]; /// Name of local player
+
+extern int HostsCount; /// Number of hosts.
+extern NetworkHost Hosts[PlayerMax]; /// Host, port, and number of all
players.
+
+extern int NetConnectRunning; /// Network menu: Setup mode active
+extern NetworkState NetStates[PlayerMax]; /// Network menu: Server: Client
Host states
+extern unsigned char NetLocalState; /// Network menu: Local
Server/Client connect state
+extern int NetLocalHostsSlot; /// Network menu: Slot # in Hosts
array of local client
+extern char NetTriesText[32]; /// Network menu: Client tries
count text
+extern char NetServerText[64]; /// Network menu: Text describing
the Network Server IP
+extern int NetLocalPlayerNumber; /// Player number of local client
-extern ServerSetup ServerSetupState; /// Network menu: Multiplayer
Server Menu selections state
-extern ServerSetup LocalSetupState; /// Network menu: Multiplayer
Client Menu selections local state
+extern ServerSetup ServerSetupState; /// Network menu: Multiplayer
Server Menu selections state
+extern ServerSetup LocalSetupState; /// Network menu: Multiplayer
Client Menu selections local state
/*----------------------------------------------------------------------------
--- Functions
+-- Functions
----------------------------------------------------------------------------*/
-extern void NetworkServerStartGame(void); /// Server user has
finally hit the start game button
-extern void NetworkConnectSetupGame(void); /// Assign Player slot,
evaluate Setup state..
+extern void NetworkServerStartGame(void); /// Server user has finally hit
the start game button
+extern void NetworkConnectSetupGame(void); /// Assign Player slot, evaluate
Setup state..
-extern void NetworkInitClientConnect(void); /// Setup network connect state
machine for clients
-extern void NetworkExitClientConnect(void); /// Terminate network connect
state machine for clients
-extern void NetworkInitServerConnect(void); /// Setup network connect state
machine for the server
-extern void NetworkExitServerConnect(void); /// Terminate network connect
state machine for the server
-extern int NetworkParseSetupEvent(const char *buf, int size); /// Parse a
network connect event
-extern int NetworkSetupServerAddress(const char *serveraddr); /// Menu: Setup
the server IP
-extern void NetworkProcessClientRequest(void); /// Menu Loop: Send out client
request messages
-extern void NetworkProcessServerRequest(void); /// Menu Loop: Send out server
request messages
-extern void NetworkServerResyncClients(void); /// Menu Loop: Server: Mark
clients state to send stateinfo message
-extern void NetworkDetachFromServer(void); /// Menu Loop: Client: Send GoodBye
to the server and detach
+extern void NetworkInitClientConnect(void); /// Setup network connect state
machine for clients
+extern void NetworkExitClientConnect(void); /// Terminate network connect
state machine for clients
+extern void NetworkInitServerConnect(void); /// Setup network connect state
machine for the server
+extern void NetworkExitServerConnect(void); /// Terminate network connect
state machine for the server
+extern int NetworkParseSetupEvent(const char *buf, int size); /// Parse a
network connect event
+extern int NetworkSetupServerAddress(const char *serveraddr); /// Menu: Setup
the server IP
+extern void NetworkProcessClientRequest(void); /// Menu Loop: Send out client
request messages
+extern void NetworkProcessServerRequest(void); /// Menu Loop: Send out server
request messages
+extern void NetworkServerResyncClients(void); /// Menu Loop: Server: Mark
clients state to send stateinfo message
+extern void NetworkDetachFromServer(void); /// Menu Loop: Client: Send
GoodBye to the server and detach
//@}
-#endif // !__NETCONNECT_H__
+#endif // !__NETCONNECT_H__
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/include net_lowlevel.h netconnect.h,
address@hidden <=