21 #ifndef _string_socket_h 22 #define _string_socket_h 28 #include <arpa/inet.h> 29 #include <sys/types.h> 30 #include <sys/socket.h> 31 #include <netinet/in.h> 32 #include <netinet/tcp.h> 40 #undef DDC_DEBUG_FDLEAK 89 : m_Type(sockType), m_Addr(sockAddr), m_Port(sockPort)
94 : m_Type(X.m_Type), m_Addr(X.m_Addr), m_Port(X.m_Port)
118 inline operator bool()
const 162 extern bool CloseSocket(
int l_socket,
bool linger=
false,
int timeout=5);
172 extern bool SendString (
int client_fd,
const char* Str, uint32_t StrLen,
string& ErrorStr);
173 extern bool SendString (
int client_fd,
const std::string &str,
string& ErrorStr);
uint32_t lsb_to_size(uint32_t sz_lsb)
Definition: string_socket.cpp:181
void SocketPeer(int sock, string &PeerAddr, int &PeerPort)
Definition: string_socket.cpp:209
NetworkErrorsEnum receive_buffer(int client_fd, char *Buffer, int Length, int &have_read, int TimeOut)
Definition: string_socket.cpp:285
#define SOCKET
Definition: string_socket.h:66
NetworkErrorsEnum
Definition: string_socket.h:45
string GetNetworkErrorString(const NetworkErrorsEnum &t)
Definition: string_socket.cpp:540
Definition: string_socket.h:53
Definition: string_socket.h:63
Definition: string_socket.h:49
Definition: string_socket.h:46
Definition: string_socket.h:81
bool CloseSocketRef(int &rConnectedSocket, bool linger=false, int timeout=5)
Definition: string_socket.cpp:156
uint32_t size_to_lsb(uint32_t sz)
Definition: string_socket.cpp:170
void flush_socket(int sock)
Definition: string_socket.cpp:513
void ParseAddrPort()
Definition: string_socket.cpp:111
Definition: string_socket.h:52
CSocketAddr & operator=(const CSocketAddr &X)
Definition: string_socket.h:103
bool SocketDeinitialize()
Definition: string_socket.cpp:534
Definition: string_socket.h:55
Definition: string_socket.h:51
Definition: string_socket.h:50
NetworkErrorsEnum ReceiveString(int client_fd, string &Result, int TimeOut, uint32_t maxPacketLength=0)
Definition: string_socket.cpp:312
CSocketAddr(const string &Str, bool parsePort=true)
Definition: string_socket.h:98
SocketTypeEnum m_Type
socket domain
Definition: string_socket.h:83
string toString() const
Definition: string_socket.cpp:123
Definition: string_socket.h:47
CSocketAddr(SocketTypeEnum sockType=stUnknown, const string &sockAddr="", int sockPort=-1)
Definition: string_socket.h:88
bool SendString(int client_fd, const char *Str, uint32_t StrLen, string &ErrorStr)
Definition: string_socket.cpp:261
bool IsValid() const
Definition: string_socket.cpp:54
int create_unix_socket(const string &socket_path, bool bBind, mode_t bindPerms, string &strError)
Definition: string_socket.cpp:372
void Clear()
Definition: string_socket.cpp:46
bool SocketInitialize(bool bReadFromLocalFile)
Definition: string_socket.cpp:527
Definition: string_socket.h:54
Definition: string_socket.h:48
int create_socket(const CSocketAddr &Addr, bool bBind, mode_t bindPerms, string &strError)
Definition: string_socket.cpp:358
bool CloseSocket(int l_socket, bool linger=false, int timeout=5)
Definition: string_socket.cpp:139
const int ddcSocketChunkSize
Definition: string_socket.cpp:30
void ParseSocketAddr(const string &Str, bool parsePort=true)
Definition: string_socket.cpp:67
Definition: string_socket.h:62
Definition: string_socket.h:61
Definition: string_socket.h:56
int m_Port
unix:filler, tcp:port number
Definition: string_socket.h:85
CSocketAddr(const CSocketAddr &X)
Definition: string_socket.h:93
string m_Addr
unix:filesystem path, tcp:host address
Definition: string_socket.h:84
int create_inet_socket(const char *HostAddr, int Port, bool bBind, string &strError)
Definition: string_socket.cpp:431
SocketTypeEnum
enum for socket schemes
Definition: string_socket.h:60