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 "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.__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 2336 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 2250 of file C4NetIO.cpp.

#define ioctlsocket   ioctl

Function Documentation

const char* GetSocketErrorMsg ( int  iError)

Definition at line 190 of file C4NetIO.cpp.

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

191 {
192  return strerror(iError);
193 }

Here is the caller graph for this function:

const char* GetSocketErrorMsg ( )

Definition at line 194 of file C4NetIO.cpp.

References GetSocketErrorMsg().

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

Here is the call graph for this function:

bool HaveConnResetError ( )

Definition at line 207 of file C4NetIO.cpp.

Referenced by C4NetIOSimpleUDP::Execute().

208 {
209  return errno == ECONNRESET;
210 }

Here is the caller graph for this function:

bool HaveSocketError ( )

Definition at line 199 of file C4NetIO.cpp.

Referenced by C4NetIO::SetError().

200 {
201  return !! errno;
202 }

Here is the caller graph for this function:

bool HaveWouldBlockError ( )

Definition at line 203 of file C4NetIO.cpp.

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

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

Here is the caller graph for this function:

void ResetSocketError ( )

Definition at line 211 of file C4NetIO.cpp.

Referenced by C4NetIOTCP::Execute().

212 {
213  errno = 0;
214 }

Here is the caller graph for this function: