net.h File Reference

Networking stuff. More...

#include "bool.h"
#include <errno.h>

Include dependency graph for net.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CloseSocket(s)   if (s != -1) { close(s); s = -1; }
 A macro used to close sockets.
#define GetNetErrorVal()   errno
 Retrives the error value from the last network operation.
#define MSG_READ_16(ptr, val)
 A macro to read a two byte number in binary form from a character buffer.
#define MSG_READ_16C(ptr, index, val)
 A macro to read a two byte value from a character buffer at a constant position within the buffer.
#define MSG_READ_32(ptr, val)
 A macro to read a four byte number in binary form from a character buffer.
#define MSG_READ_32C(ptr, index, val)
 A macro to read a four byte value from a character buffer at a constant position within the buffer.
#define MSG_READ_8(ptr, val)   (val) = *((ptr)++)
 A macro to read a byte from a character buffer.
#define MSG_WRITE_16(ptr, val)
 A macro to write a two byte numerical value in binary form to a character buffer.
#define MSG_WRITE_16C(ptr, index, val)
 A macro to write a two byte to a value character buffer at a constant position within the buffer.
#define MSG_WRITE_32(ptr, val)
 A macro to write a four byte numerical value in binary form to a character buffer.
#define MSG_WRITE_32C(ptr, index, val)
 A macro to write a four byte value to a character buffer at a constant position within the buffer.
#define MSG_WRITE_8(ptr, val)   *((ptr)++) = (val)
 A macro to write a byte to a character buffer.
#define MSG_WRITE_8C(ptr, index, val)   (ptr)[index] = (val)
 A macro to write a byte to a character buffer at a constant position within the buffer.
#define PORT_CLI   26002
 The port used by the client to receive everything but time sync messages.
#define PORT_CTSYNC   26003
 The port used by the client to send and receive time sync messages.
#define PORT_SRV   26000
 The port used by the server to receive everything but time sync messages.
#define PORT_STSYNC   26001
 The port used by the server to send receive time sync messages.

Enumerations

enum  {
  NETSTATE_INIT, NETSTATE_SEARCHING, NETSTATE_CONNECTING, NETSTATE_RCVCFG,
  NETSTATE_CLIENT, NETSTATE_CLIDISCONN, NETSTATE_SERVER, NETSTATE_SRVDISCONN,
  NETSTATE_SRVDENY, NETSTATE_DISCONN, NETSTATE_SEARCHERR, NETSTATE_SRVERR,
  NETSTATE_CONERR
}
 Codes for the operating state of the network module used with networkState. More...

Functions

const rtsa_charGetNetErrorString (int err)
 Returns a pointer to a string that briefly explains the last network error.
Bool NetCliToSrv ()
 Changes the network state from a client state to server.
void NetDisconnect ()
 Starts the process of disconnecting this client from the server, or disconnecting all clients from this server.
Bool NetInit (char *srv)
 Initalizes the networking system.
Bool NetInitSrv ()
 Initalizes the networking system and attempts to be a server without searching for one on the network.
Bool NetSrvToCli ()
 Changes the network state from server state to client.
void NetUninit ()
 Uninitalizes the networking system.
int UnicastSocket (void *addr, Bool block)
 Creates a new unicast ready UDP socket that is bound to the given address.

Variables

int netError
 A gobal variable used to store network errors after cetrain events, such as during connection errors.
unsigned int networkState
 Contains the current operating state of the networking module.


Detailed Description

Networking stuff.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Definition in file net.h.


Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2