Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::lib::net Namespace Reference

Functions

bool is_little_endian ()
 
uint64_t _htonll (uint64_t src)
 Convert 64 bit value to network byte order.
 
uint64_t _ntohll (uint64_t src)
 Convert 64 bit value to host byte order.
 

Function Documentation

◆ _htonll()

uint64_t websocketpp::lib::net::_htonll ( uint64_t src)
inline

This method is prefixed to avoid conflicts with operating system level macros for this functionality.

TODO: figure out if it would be beneficial to use operating system level macros for this.

Parameters
srcThe integer in host byte order
Returns
src converted to network byte order

Definition at line 66 of file network.hpp.

66 {
67 static int typ = TYP_INIT;
68 unsigned char c;
69 union {
70 uint64_t ull;
71 unsigned char c[8];
72 } x;
73 if (typ == TYP_INIT) {
74 x.ull = 0x01;
75 typ = (x.c[7] == 0x01ULL) ? TYP_BIGE : TYP_SMLE;
76 }
77 if (typ == TYP_BIGE)
78 return src;
79 x.ull = src;
80 c = x.c[0]; x.c[0] = x.c[7]; x.c[7] = c;
81 c = x.c[1]; x.c[1] = x.c[6]; x.c[6] = c;
82 c = x.c[2]; x.c[2] = x.c[5]; x.c[5] = c;
83 c = x.c[3]; x.c[3] = x.c[4]; x.c[4] = c;
84 return x.ull;
85}
#define TYP_BIGE
Definition network.hpp:53
#define TYP_SMLE
Definition network.hpp:52
#define TYP_INIT
Definition network.hpp:51
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the caller graph for this function:

◆ _ntohll()

uint64_t websocketpp::lib::net::_ntohll ( uint64_t src)
inline

This method is prefixed to avoid conflicts with operating system level macros for this functionality.

TODO: figure out if it would be beneficial to use operating system level macros for this.

Parameters
srcThe integer in network byte order
Returns
src converted to host byte order

Definition at line 98 of file network.hpp.

98 {
99 return _htonll(src);
100}
uint64_t _htonll(uint64_t src)
Convert 64 bit value to network byte order.
Definition network.hpp:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_little_endian()

bool websocketpp::lib::net::is_little_endian ( )
inline

Definition at line 45 of file network.hpp.

45 {
46 short int val = 0x1;
47 char *ptr = reinterpret_cast<char *>(&val);
48 return (ptr[0] == 1);
49}
Here is the caller graph for this function: