Instrument Neutral Distributed Interface INDI 2.2.5
TcpSocketPrivate Class Reference

#include <tcpsocket_p.h>

Public Types

enum  ErrorType { ErrorTypeSystem , ErrorTypeInternal }

Public Member Functions

 TcpSocketPrivate (TcpSocket *parent)
virtual ~TcpSocketPrivate ()
bool createSocket (int domain)
void closeSocket ()
ssize_t recvSocket (void *dst, size_t size)
ssize_t sendSocket (const void *src, size_t size)
bool setNonblockSocket ()
bool connectSocket (const std::string &hostName, unsigned short port)
bool waitForConnectedSockets ()
bool processSocket ()
ssize_t write (const void *data, size_t size)
void connectToHost (const std::string &hostName, unsigned short port)
void aboutToClose ()
void joinThread (std::thread &thread)
void setSocketError (TcpSocket::SocketError error, ErrorType errorType=ErrorTypeSystem, const std::string &errorString="")
void setSocketState (TcpSocket::SocketState state)

Public Attributes

TcpSocket * parent
SocketFileDescriptor socketFd = SocketInvalid
Select select
int timeout {30000}
std::thread thread
std::atomic< bool > isAboutToClose {false}
std::mutex socketStateMutex
std::condition_variable socketStateChanged
std::atomic< TcpSocket::SocketState > socketState {TcpSocket::UnconnectedState}
TcpSocket::SocketError socketError
std::string errorString
std::function< void()> onConnected
std::function< void()> onDisconnected
std::function< void(const char *, size_t)> onData
std::function< void(TcpSocket::SocketError)> onErrorOccurred

Detailed Description

Definition at line 77 of file tcpsocket_p.h.

Member Enumeration Documentation

◆ ErrorType

Enumerator
ErrorTypeSystem 
ErrorTypeInternal 

Definition at line 104 of file tcpsocket_p.h.

Constructor & Destructor Documentation

◆ TcpSocketPrivate()

TcpSocketPrivate::TcpSocketPrivate ( TcpSocket * parent)

Definition at line 69 of file tcpsocket.cpp.

◆ ~TcpSocketPrivate()

TcpSocketPrivate::~TcpSocketPrivate ( )
virtual

Definition at line 73 of file tcpsocket.cpp.

Member Function Documentation

◆ aboutToClose()

void TcpSocketPrivate::aboutToClose ( )

Definition at line 266 of file tcpsocket.cpp.

◆ closeSocket()

void TcpSocketPrivate::closeSocket ( )

Definition at line 276 of file tcpsocket.cpp.

◆ connectSocket()

bool TcpSocketPrivate::connectSocket ( const std::string & hostName,
unsigned short port )

Definition at line 109 of file tcpsocket.cpp.

◆ connectToHost()

void TcpSocketPrivate::connectToHost ( const std::string & hostName,
unsigned short port )

Definition at line 224 of file tcpsocket.cpp.

◆ createSocket()

bool TcpSocketPrivate::createSocket ( int domain)

Definition at line 23 of file tcpsocket_unix.cpp.

◆ joinThread()

void TcpSocketPrivate::joinThread ( std::thread & thread)

Definition at line 201 of file tcpsocket.cpp.

◆ processSocket()

bool TcpSocketPrivate::processSocket ( )

Definition at line 165 of file tcpsocket.cpp.

◆ recvSocket()

ssize_t TcpSocketPrivate::recvSocket ( void * dst,
size_t size )

Definition at line 45 of file tcpsocket_unix.cpp.

◆ sendSocket()

ssize_t TcpSocketPrivate::sendSocket ( const void * src,
size_t size )

Definition at line 50 of file tcpsocket_unix.cpp.

◆ setNonblockSocket()

bool TcpSocketPrivate::setNonblockSocket ( )

Definition at line 29 of file tcpsocket_unix.cpp.

◆ setSocketError()

void TcpSocketPrivate::setSocketError ( TcpSocket::SocketError error,
ErrorType errorType = ErrorTypeSystem,
const std::string & errorString = "" )

Definition at line 289 of file tcpsocket.cpp.

◆ setSocketState()

void TcpSocketPrivate::setSocketState ( TcpSocket::SocketState state)

Definition at line 327 of file tcpsocket.cpp.

◆ waitForConnectedSockets()

bool TcpSocketPrivate::waitForConnectedSockets ( )

Definition at line 144 of file tcpsocket.cpp.

◆ write()

ssize_t TcpSocketPrivate::write ( const void * data,
size_t size )

Definition at line 86 of file tcpsocket.cpp.

Member Data Documentation

◆ errorString

std::string TcpSocketPrivate::errorString

Definition at line 127 of file tcpsocket_p.h.

◆ isAboutToClose

std::atomic<bool> TcpSocketPrivate::isAboutToClose {false}

Definition at line 120 of file tcpsocket_p.h.

◆ onConnected

std::function<void()> TcpSocketPrivate::onConnected

Definition at line 130 of file tcpsocket_p.h.

◆ onData

std::function<void(const char *, size_t)> TcpSocketPrivate::onData

Definition at line 132 of file tcpsocket_p.h.

◆ onDisconnected

std::function<void()> TcpSocketPrivate::onDisconnected

Definition at line 131 of file tcpsocket_p.h.

◆ onErrorOccurred

std::function<void(TcpSocket::SocketError)> TcpSocketPrivate::onErrorOccurred

Definition at line 133 of file tcpsocket_p.h.

◆ parent

TcpSocket* TcpSocketPrivate::parent

Definition at line 114 of file tcpsocket_p.h.

◆ select

Select TcpSocketPrivate::select

Definition at line 116 of file tcpsocket_p.h.

◆ socketError

TcpSocket::SocketError TcpSocketPrivate::socketError

Definition at line 126 of file tcpsocket_p.h.

◆ socketFd

SocketFileDescriptor TcpSocketPrivate::socketFd = SocketInvalid

Definition at line 115 of file tcpsocket_p.h.

◆ socketState

std::atomic<TcpSocket::SocketState> TcpSocketPrivate::socketState {TcpSocket::UnconnectedState}

Definition at line 125 of file tcpsocket_p.h.

◆ socketStateChanged

std::condition_variable TcpSocketPrivate::socketStateChanged
mutable

Definition at line 123 of file tcpsocket_p.h.

◆ socketStateMutex

std::mutex TcpSocketPrivate::socketStateMutex
mutable

Definition at line 122 of file tcpsocket_p.h.

◆ thread

std::thread TcpSocketPrivate::thread

Definition at line 119 of file tcpsocket_p.h.

◆ timeout

int TcpSocketPrivate::timeout {30000}

Definition at line 117 of file tcpsocket_p.h.


The documentation for this class was generated from the following files: