OpenClonk
C4NetIO.cpp File Reference
#include "C4Include.h"
#include "network/C4NetIO.h"
#include "config/C4Constants.h"
#include "lib/C4Random.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 <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.__unnamed66__
 

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

◆ C4NetIOUDP::BinAddr.__unnamed66__

union C4NetIOUDP::BinAddr.__unnamed66__

Definition at line 2398 of file C4NetIO.cpp.

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

Macro Definition Documentation

◆ C4NETIOUDP_OPT_RECV_CHECK_IMMEDIATE

#define C4NETIOUDP_OPT_RECV_CHECK_IMMEDIATE

Definition at line 2312 of file C4NetIO.cpp.

◆ closesocket

#define closesocket   close

Definition at line 46 of file C4NetIO.cpp.

◆ ioctlsocket

#define ioctlsocket   ioctl

Definition at line 45 of file C4NetIO.cpp.

◆ SOCKET_ERROR

#define SOCKET_ERROR   (-1)

Definition at line 47 of file C4NetIO.cpp.

Function Documentation

◆ GetSocketErrorMsg() [1/2]

const char* GetSocketErrorMsg ( )

Definition at line 194 of file C4NetIO.cpp.

195 {
196  return GetSocketErrorMsg(errno);
197 }
const char * GetSocketErrorMsg(int iError)
Definition: C4NetIO.cpp:190

References GetSocketErrorMsg().

Here is the call graph for this function:

◆ GetSocketErrorMsg() [2/2]

const char* GetSocketErrorMsg ( int  iError)

Definition at line 190 of file C4NetIO.cpp.

191 {
192  return strerror(iError);
193 }

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

Here is the caller graph for this function:

◆ HaveConnResetError()

bool HaveConnResetError ( )

Definition at line 207 of file C4NetIO.cpp.

208 {
209  return errno == ECONNRESET;
210 }

Referenced by C4NetIOSimpleUDP::Execute().

Here is the caller graph for this function:

◆ HaveSocketError()

bool HaveSocketError ( )

Definition at line 199 of file C4NetIO.cpp.

200 {
201  return !! errno;
202 }

Referenced by C4NetIO::SetError().

Here is the caller graph for this function:

◆ HaveWouldBlockError()

bool HaveWouldBlockError ( )

Definition at line 203 of file C4NetIO.cpp.

204 {
205  return errno == EINPROGRESS || errno == EWOULDBLOCK;
206 }

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

Here is the caller graph for this function:

◆ ResetSocketError()

void ResetSocketError ( )

Definition at line 211 of file C4NetIO.cpp.

212 {
213  errno = 0;
214 }

Referenced by C4NetIOTCP::Execute().

Here is the caller graph for this function: