libassa 3.5.1
Loading...
Searching...
No Matches
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:
{\
int typesz = sizeof(TYPE);\
if (read ( (char* ) &val, typesz) == typesz) {\
if (sizeof(int32_t) <= typesz) {\
n_ = (TYPE) ntohl (val); \
}\
else {\
*((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 {\
}\
return *this;\
}
#define LONGEST
Definition Socket.cpp:428
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
Socket & operator>>(char &c)
Input of built-in char type. The value will be XDR-decoded.
Definition Socket.cpp:359
static bool is_little_endian()
Determine the endianess of the platform we are on.
Definition Socket.cpp:700
@ eofbit
indicates that an input operation reached the end of an input sequence
Definition Socket.h:82
@ failbit
indicates that an input operation failed to read the expected characters, or that an output operation...
Definition Socket.h:84

Definition at line 436 of file Socket.cpp.

438{\
439 LONGEST val;\
440 int typesz = sizeof(TYPE);\
441 if (read ( (char* ) &val, typesz) == typesz) {\
442 if (sizeof(int32_t) <= typesz) {\
443 n_ = (TYPE) ntohl (val); \
444 }\
445 else {\
447 *((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val)) );\
448 *((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val))+1);\
449 }\
450 else {\
451 *((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val)) );\
452 *((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val))+1);\
453 }\
454 }\
455 }\
456 else {\
458 }\
459 return *this;\
460}

◆ WRITE_INT

#define WRITE_INT (   TYPE)
Value:
{ \
int typesz = sizeof(TYPE);\
if (sizeof(int32_t) <= typesz) {\
val = (TYPE) ntohl (n_); \
}\
else {\
*((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) {\
}\
return *this;\
}
Socket & operator<<(char c)
Output of built-in char type. The value will be XDR-encoded.
Definition Socket.cpp:508

Definition at line 588 of file Socket.cpp.

590{ \
591 LONGEST val;\
592 int typesz = sizeof(TYPE);\
593 if (sizeof(int32_t) <= typesz) {\
594 val = (TYPE) ntohl (n_); \
595 }\
596 else {\
598 *((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_)) );\
599 *((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_))+1);\
600 }\
601 else {\
602 *((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_)) );\
603 *((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_))+1);\
604 }\
605 }\
606 if (write ((const char*) &val, typesz) != typesz) {\
608 }\
609 return *this;\
610}