libassa  3.5.1
Macros
Socket.cpp File Reference
#include <sstream>
#include "assa/Socket.h"
#include "assa/XDRHack.h"

Go to the source code of this file.

Macros

#define LONGEST   long
 
#define READ_INT(TYPE)
 
#define WRITE_INT(TYPE)
 

Macro Definition Documentation

◆ LONGEST

#define LONGEST   long

Definition at line 428 of file Socket.cpp.

◆ READ_INT

#define READ_INT (   TYPE)
Value:
{\
LONGEST val;\
int typesz = sizeof(TYPE);\
if (read ( (char* ) &val, typesz) == typesz) {\
if (sizeof(int32_t) <= typesz) {\
n_ = (TYPE) ntohl (val); \
}\
else {\
if (Socket::is_little_endian ()) {\
*((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val)) );\
*((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val))+1);\
}\
else {\
*((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val)) );\
*((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val))+1);\
}\
}\
}\
else {\
setstate (Socket::eofbit|Socket::failbit);\
}\
return *this;\
}
Socket & operator>>(Socket &s_, CharInBuffer &b_)
Regardless of the delimeter size, which can be >1, add the character received to the buffer and compa...

Definition at line 436 of file Socket.cpp.

◆ WRITE_INT

#define WRITE_INT (   TYPE)
Value:
Socket& Socket::operator<< (TYPE n_) \
{ \
LONGEST val;\
int typesz = sizeof(TYPE);\
if (sizeof(int32_t) <= typesz) {\
val = (TYPE) ntohl (n_); \
}\
else {\
if (Socket::is_little_endian ()) {\
*((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_)) );\
*((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_))+1);\
}\
else {\
*((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_)) );\
*((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_))+1);\
}\
}\
if (write ((const char*) &val, typesz) != typesz) {\
setstate (Socket::eofbit|Socket::failbit);\
}\
return *this;\
}

Definition at line 588 of file Socket.cpp.