$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <vector>
#include <errno.h>
#include <time.h>
#include <winsock2.h>
#include <windows.h>
#include <winsock.h>
Go to the source code of this file.
Classes | |
struct | _OLD_INTERFACE_INFO |
struct | SocketSet |
net_lowlevel.h - The network low level header file. | |
#define | USE_WINSOCK |
#define | SIO_GET_INTERFACE_LIST 0x4004747F |
#define | IFF_UP 1 |
#define | IFF_LOOPBACK 4 |
#define | INTERFACE_INFO OLD_INTERFACE_INFO |
#define | INADDR_NONE -1 |
#define | NIPQUAD(ad) |
typedef struct _OLD_INTERFACE_INFO | OLD_INTERFACE_INFO |
typedef SOCKET | Socket |
int | NetLastSocket |
unsigned long | NetLastHost |
Last socket. | |
int | NetLastPort |
Last host number (net format). | |
unsigned long | NetLocalAddrs [] |
Last port number (net format). | |
int | NetInit () |
Local IP-Addrs of this host (net format). | |
void | NetExit () |
Hardware dependend network exit. | |
unsigned long | NetResolveHost (const std::string &host) |
Resolve host in name or or colon dot notation. | |
int | NetSocketAddr (const Socket sock) |
Get local IP from network file descriptor. | |
Socket | NetOpenUDP (const char *addr, int port) |
Open a UDP Socket port. | |
Socket | NetOpenTCP (const char *addr, int port) |
Open a TCP Socket port. | |
void | NetCloseUDP (Socket sockfd) |
Close a UDP socket port. | |
void | NetCloseTCP (Socket sockfd) |
Close a TCP socket port. | |
int | NetSetNonBlocking (Socket sockfd) |
Set socket to non-blocking. | |
int | NetConnectTCP (Socket sockfd, unsigned long addr, int port) |
Open a TCP connection. | |
int | NetSendUDP (Socket sockfd, unsigned long host, int port, const void *buf, int len) |
Send through a UPD socket to a host:port. | |
int | NetSendTCP (Socket sockfd, const void *buf, int len) |
Send through a TCP socket. | |
int | NetSocketReady (Socket sockfd, int timeout) |
Wait for socket ready. | |
int | NetSocketSetReady (SocketSet *sockfd, int timeout) |
Wait for socket set ready. | |
int | NetSocketSetSocketReady (SocketSet *set, Socket socket) |
Check if a socket in a socket set is ready. | |
int | NetRecvUDP (Socket sockfd, void *buf, int len) |
Receive from a UDP socket. | |
int | NetRecvTCP (Socket sockfd, void *buf, int len) |
Receive from a TCP socket. | |
int | NetListenTCP (Socket sockfd) |
Listen for connections on a TCP socket. | |
Socket | NetAcceptTCP (Socket sockfd) |
Accept a connection on a TCP socket. | |
void | NetAddSocket (SocketSet *set, Socket socket) |
Add a socket to a socket set. | |
void | NetDelSocket (SocketSet *set, Socket socket) |
Delete a socket from a socket set. |
#define IFF_LOOPBACK 4 |
#define IFF_UP 1 |
#define INADDR_NONE -1 |
#define INTERFACE_INFO OLD_INTERFACE_INFO |
#define NIPQUAD | ( | ad | ) |
Value:
(int)(((ad) >> 24) & 0xff), (int)(((ad) >> 16) & 0xff), \ (int)(((ad) >> 8) & 0xff), (int)((ad) & 0xff)
#define SIO_GET_INTERFACE_LIST 0x4004747F |
#define USE_WINSOCK |
typedef struct _OLD_INTERFACE_INFO OLD_INTERFACE_INFO |
typedef SOCKET Socket |
Accept a connection on a TCP socket.
Accept a connection on a TCP socket.
sockfd | Socket |
void NetCloseTCP | ( | Socket | sockfd | ) |
Close a TCP socket port.
Close a TCP socket port.
sockfd | Socket fildes |
void NetCloseUDP | ( | Socket | sockfd | ) |
Close a UDP socket port.
Close an UDP socket port.
sockfd | Socket fildes |
int NetConnectTCP | ( | Socket | sockfd, | |
unsigned long | addr, | |||
int | port | |||
) |
void NetExit | ( | ) |
Hardware dependend network exit.
Hardware dependend network exit.
int NetInit | ( | ) |
Local IP-Addrs of this host (net format).
Hardware dependend network init.
Hardware dependend network init.
int NetListenTCP | ( | Socket | sockfd | ) |
Listen for connections on a TCP socket.
Listen for connections on a TCP socket.
sockfd | Socket |
Socket NetOpenTCP | ( | const char * | addr, | |
int | port | |||
) |
Socket NetOpenUDP | ( | const char * | addr, | |
int | port | |||
) |
int NetRecvTCP | ( | Socket | sockfd, | |
void * | buf, | |||
int | len | |||
) |
Receive from a TCP socket.
Receive from a TCP socket.
sockfd | Socket | |
buf | Receive message buffer. | |
len | Receive message buffer length. |
int NetRecvUDP | ( | Socket | sockfd, | |
void * | buf, | |||
int | len | |||
) |
Receive from a UDP socket.
Receive from a UDP socket.
sockfd | Socket | |
buf | Receive message buffer. | |
len | Receive message buffer length. |
unsigned long NetResolveHost | ( | const std::string & | host | ) |
Resolve host in name or or colon dot notation.
Resolve host in name or dotted quad notation.
host | Host name (f.e. 192.168.0.0 or stratagus.net) |
int NetSendTCP | ( | Socket | sockfd, | |
const void * | buf, | |||
int | len | |||
) |
Send through a TCP socket.
Send through a TCP socket.
sockfd | Socket | |
buf | Send message buffer. | |
len | Send message buffer length. |
int NetSendUDP | ( | Socket | sockfd, | |
unsigned long | host, | |||
int | port, | |||
const void * | buf, | |||
int | len | |||
) |
Send through a UPD socket to a host:port.
Send through a UPD socket to a host:port.
sockfd | Socket | |
host | Host to send to (network byte order). | |
port | Port of host to send to (network byte order). | |
buf | Send message buffer. | |
len | Send message buffer length. |
int NetSetNonBlocking | ( | Socket | sockfd | ) |
Set socket to non-blocking.
Set socket to non-blocking.
sockfd | Socket |
int NetSocketAddr | ( | const Socket | sock | ) |
Get local IP from network file descriptor.
Get IP-addrs of local interfaces from Network file descriptor and store them in the NetLocalAddrs array.
sock | local socket. |
int NetSocketReady | ( | Socket | sockfd, | |
int | timeout | |||
) |
Wait for socket ready.
Wait for socket ready.
sockfd | Socket fildes to probe. | |
timeout | Timeout in 1/1000 seconds. |
int NetSocketSetReady | ( | SocketSet * | set, | |
int | timeout | |||
) |
Wait for socket set ready.
Wait for socket set ready.
set | Socket set to probe. | |
timeout | Timeout in 1/1000 seconds. |
Check if a socket in a socket set is ready.
Check if a socket in a socket set is ready.
set | Socket set | |
socket | Socket to check |
unsigned long NetLastHost |
Last socket.
int NetLastPort |
Last host number (net format).
int NetLastSocket |
unsigned long NetLocalAddrs[] |
Last port number (net format).