OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4NetIO.cpp File Reference
#include "C4Include.h"
#include "network/C4NetIO.h"
#include "lib/C4Random.h"
#include "config/C4Constants.h"
#include "config/C4Config.h"
#include <utility>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <ifaddrs.h>
#include <net/if.h>
Include dependency graph for C4NetIO.cpp:

Go to the source code of this file.

Classes

struct  C4NetIOUDP::BinAddr
 
struct  C4NetIOUDP::PacketHdr
 
struct  C4NetIOUDP::ConnPacket
 
struct  C4NetIOUDP::ConnOKPacket
 
struct  C4NetIOUDP::AddAddrPacket
 
struct  C4NetIOUDP::DataPacketHdr
 
struct  C4NetIOUDP::CheckPacketHdr
 
struct  C4NetIOUDP::ClosePacket
 
struct  C4NetIOUDP::TestPacket
 
union  C4NetIOUDP::BinAddr.__unnamed__
 

Macros

#define ioctlsocket   ioctl
 
#define closesocket   close
 
#define SOCKET_ERROR   (-1)
 
#define C4NETIOUDP_OPT_RECV_CHECK_IMMEDIATE
 

Functions

const char * GetSocketErrorMsg (int iError)
 
const char * GetSocketErrorMsg ()
 
bool HaveSocketError ()
 
bool HaveWouldBlockError ()
 
bool HaveConnResetError ()
 
void ResetSocketError ()
 

Class Documentation

union C4NetIOUDP::BinAddr.__unnamed__

Definition at line 2353 of file C4NetIO.cpp.

Class Members
uint8_t v4[4]
uint8_t v6[16]

Macro Definition Documentation

#define C4NETIOUDP_OPT_RECV_CHECK_IMMEDIATE

Definition at line 2272 of file C4NetIO.cpp.

#define ioctlsocket   ioctl

Function Documentation

const char* GetSocketErrorMsg ( int  iError)

Definition at line 196 of file C4NetIO.cpp.

Referenced by C4NetIOTCP::Execute(), C4NetIOSimpleUDP::Execute(), GetSocketErrorMsg(), and C4NetIO::SetError().

197 {
198  return strerror(iError);
199 }

Here is the caller graph for this function:

const char* GetSocketErrorMsg ( )

Definition at line 200 of file C4NetIO.cpp.

References GetSocketErrorMsg().

201 {
202  return GetSocketErrorMsg(errno);
203 }
const char * GetSocketErrorMsg(int iError)
Definition: C4NetIO.cpp:196

Here is the call graph for this function:

bool HaveConnResetError ( )

Definition at line 213 of file C4NetIO.cpp.

Referenced by C4NetIOSimpleUDP::Execute().

214 {
215  return errno == ECONNRESET;
216 }

Here is the caller graph for this function:

bool HaveSocketError ( )

Definition at line 205 of file C4NetIO.cpp.

Referenced by C4NetIO::SetError().

206 {
207  return !! errno;
208 }

Here is the caller graph for this function:

bool HaveWouldBlockError ( )

Definition at line 209 of file C4NetIO.cpp.

Referenced by C4NetIOTCP::Connect(), C4NetIOTCP::Execute(), C4NetIOTCP::Peer::Send(), and C4NetIOSimpleUDP::Send().

210 {
211  return errno == EINPROGRESS || errno == EWOULDBLOCK;
212 }

Here is the caller graph for this function:

void ResetSocketError ( )

Definition at line 217 of file C4NetIO.cpp.

Referenced by C4NetIOTCP::Execute().

218 {
219  errno = 0;
220 }

Here is the caller graph for this function: