zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDLnetUDP.c File Reference
#include "SDLnetsys.h"
#include "SDL_net.h"

Go to the source code of this file.

Functions

UDPpacketSDLNet_AllocPacket (int size)
 
UDPpacket ** SDLNet_AllocPacketV (int howmany, int size)
 
void SDLNet_FreePacket (UDPpacket *packet)
 
void SDLNet_FreePacketV (UDPpacket **packetV)
 
int SDLNet_ResizePacket (UDPpacket *packet, int newsize)
 
int SDLNet_UDP_Bind (UDPsocket sock, int channel, const IPaddress *address)
 
void SDLNet_UDP_Close (UDPsocket sock)
 
IPaddressSDLNet_UDP_GetPeerAddress (UDPsocket sock, int channel)
 
UDPsocket SDLNet_UDP_Open (Uint16 port)
 
int SDLNet_UDP_Recv (UDPsocket sock, UDPpacket *packet)
 
int SDLNet_UDP_RecvV (UDPsocket sock, UDPpacket **packets)
 
int SDLNet_UDP_Send (UDPsocket sock, int channel, UDPpacket *packet)
 
int SDLNet_UDP_SendV (UDPsocket sock, UDPpacket **packets, int npackets)
 
void SDLNet_UDP_SetPacketLoss (UDPsocket sock, int percent)
 
void SDLNet_UDP_Unbind (UDPsocket sock, int channel)
 
static int SocketReady (SOCKET sock)
 
static int ValidChannel (int channel)
 

Function Documentation

UDPpacket* SDLNet_AllocPacket ( int  size)
UDPpacket** SDLNet_AllocPacketV ( int  howmany,
int  size 
)

Definition at line 98 of file SDLnetUDP.c.

References i, malloc, NULL, SDLNet_AllocPacket(), SDLNet_FreePacketV(), and SDLNet_SetError().

Referenced by main().

void SDLNet_FreePacket ( UDPpacket packet)

Definition at line 85 of file SDLnetUDP.c.

References UDPpacket::data, and free.

Referenced by SDLNet_AllocPacket(), and SDLNet_FreePacketV().

void SDLNet_FreePacketV ( UDPpacket **  packetV)

Definition at line 121 of file SDLnetUDP.c.

References free, i, and SDLNet_FreePacket().

Referenced by cleanup(), and SDLNet_AllocPacketV().

int SDLNet_ResizePacket ( UDPpacket packet,
int  newsize 
)

Definition at line 73 of file SDLnetUDP.c.

References UDPpacket::data, free, malloc, UDPpacket::maxlen, and NULL.

int SDLNet_UDP_Bind ( UDPsocket  sock,
int  channel,
const IPaddress address 
)
void SDLNet_UDP_Close ( UDPsocket  sock)

Definition at line 515 of file SDLnetUDP.c.

References closesocket, free, INVALID_SOCKET, and NULL.

Referenced by cleanup(), SDLNet_UDP_Open(), and Zeni::UDP_Socket::~UDP_Socket().

IPaddress* SDLNet_UDP_GetPeerAddress ( UDPsocket  sock,
int  channel 
)

Definition at line 298 of file SDLnetUDP.c.

References NULL, and ValidChannel().

Referenced by Zeni::UDP_Socket::peer_address(), and SendHello().

UDPsocket SDLNet_UDP_Open ( Uint16  port)
int SDLNet_UDP_Recv ( UDPsocket  sock,
UDPpacket packet 
)

Definition at line 504 of file SDLnetUDP.c.

References NULL, packets, and SDLNet_UDP_RecvV().

Referenced by Zeni::UDP_Socket::receive().

int SDLNet_UDP_Send ( UDPsocket  sock,
int  channel,
UDPpacket packet 
)

Definition at line 399 of file SDLnetUDP.c.

References UDPpacket::channel, and SDLNet_UDP_SendV().

Referenced by Zeni::UDP_Socket::send(), and SendBuf().

int SDLNet_UDP_SendV ( UDPsocket  sock,
UDPpacket **  packets,
int  npackets 
)
void SDLNet_UDP_SetPacketLoss ( UDPsocket  sock,
int  percent 
)

Definition at line 220 of file SDLnetUDP.c.

References NULL.

void SDLNet_UDP_Unbind ( UDPsocket  sock,
int  channel 
)

Definition at line 287 of file SDLnetUDP.c.

References SDLNET_MAX_UDPCHANNELS.

Referenced by HandleServerData().

static int SocketReady ( SOCKET  sock)
static

Definition at line 407 of file SDLnetUDP.c.

References NULL, SDLNet_GetLastError(), and SDLNet_SetLastError().

Referenced by SDLNet_UDP_RecvV().

static int ValidChannel ( int  channel)
static

Definition at line 237 of file SDLnetUDP.c.

References SDLNET_MAX_UDPCHANNELS, and SDLNet_SetError().

Referenced by SDLNet_UDP_Bind(), and SDLNet_UDP_GetPeerAddress().