CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
NSROOT::UdpSocket Class Reference
Inheritance diagram for NSROOT::UdpSocket:
Collaboration diagram for NSROOT::UdpSocket:

Public Member Functions

 UdpSocket (size_t bufferSize)
int GetErrNo () const
bool SendData (const char *buf, size_t size)
size_t ReceiveData (void *buf, size_t n)
bool IsValid () const
bool Open (SOCKET_AF_t af, const char *target, unsigned port)
bool Open (SOCKET_AF_t af, bool broadcast=false)
bool SetAddress (const char *target, unsigned port)
bool SetMulticastTTL (int multicastTTL)
std::string GetRemoteAddrInfo () const
net_socket_t GetHandle () const
Public Member Functions inherited from NSROOT::NetSocket
void SetTimeout (timeval timeout)

Private Member Functions

 UdpSocket (const UdpSocket &)
UdpSocket & operator= (const UdpSocket &)

Private Attributes

SocketAddressm_addr
SocketAddressm_from
net_socket_t m_socket
int m_errno
char * m_buffer
char * m_bufptr
size_t m_buflen
size_t m_rcvlen

Additional Inherited Members

Protected Attributes inherited from NSROOT::NetSocket
struct timeval m_timeout

Detailed Description

Definition at line 250 of file socket.h.

Constructor & Destructor Documentation

◆ UdpSocket() [1/2]

UdpSocket::UdpSocket ( )

Definition at line 806 of file socket.cpp.

◆ UdpSocket() [2/2]

UdpSocket::UdpSocket ( size_t bufferSize)

Definition at line 818 of file socket.cpp.

◆ ~UdpSocket()

UdpSocket::~UdpSocket ( )
virtual

Definition at line 830 of file socket.cpp.

Member Function Documentation

◆ GetErrNo()

int NSROOT::UdpSocket::GetErrNo ( ) const
inline
Returns
the last error occuring on call

Definition at line 260 of file socket.h.

◆ GetHandle()

net_socket_t NSROOT::UdpSocket::GetHandle ( ) const
inline
Returns
the socket handle

Definition at line 324 of file socket.h.

◆ GetRemoteAddrInfo()

std::string UdpSocket::GetRemoteAddrInfo ( ) const
Returns
the address string of the remote host

Definition at line 1062 of file socket.cpp.

◆ IsValid()

bool UdpSocket::IsValid ( ) const
Returns
true when socket is opened, else false

Definition at line 1057 of file socket.cpp.

Referenced by Open(), ReceiveData(), SendData(), SetAddress(), and SetMulticastTTL().

Here is the caller graph for this function:

◆ Open() [1/2]

bool UdpSocket::Open ( SOCKET_AF_t af,
bool broadcast = false )

Open the socket.

Parameters
afthe protocol
broadcastenable broadcast permission
Returns
true on success, else false

Definition at line 859 of file socket.cpp.

References IsValid().

◆ Open() [2/2]

bool UdpSocket::Open ( SOCKET_AF_t af,
const char * target,
unsigned port )

Open the socket and configure the given destination.

Parameters
afthe protocol
targetthe address name of destination
port
Returns
true on success, else false

Definition at line 854 of file socket.cpp.

References Open(), and SetAddress().

Referenced by Open().

Here is the caller graph for this function:

◆ ReceiveData()

size_t UdpSocket::ReceiveData ( void * buf,
size_t n )
virtual

Read data from the socket.

Parameters
bufthe pointer to write received data
nthe number of byte to read
Returns
the number of received byte

Implements NSROOT::NetSocket.

Definition at line 990 of file socket.cpp.

References IsValid().

◆ SendData()

bool UdpSocket::SendData ( const char * buf,
size_t size )
virtual

Send data into the socket.

Parameters
bufthe pointer to data
sizethe number of byte to send
Returns
true when succeeded, else false

Implements NSROOT::NetSocket.

Definition at line 973 of file socket.cpp.

References IsValid().

◆ SetAddress()

bool UdpSocket::SetAddress ( const char * target,
unsigned port )

Configure the destination.

Parameters
targetthe address name of destination
port
Returns
true on success, else false

Definition at line 892 of file socket.cpp.

References IsValid().

Referenced by Open().

Here is the caller graph for this function:

◆ SetMulticastTTL()

bool UdpSocket::SetMulticastTTL ( int multicastTTL)

Configure hop limit value to be used for multicast packets on the opened socket.

Parameters
multicastTTL
Returns
true on success, else false

Definition at line 934 of file socket.cpp.

References IsValid().

Field Documentation

◆ m_addr

SocketAddress* NSROOT::UdpSocket::m_addr
private

Definition at line 327 of file socket.h.

◆ m_buffer

char* NSROOT::UdpSocket::m_buffer
private

Definition at line 331 of file socket.h.

◆ m_buflen

size_t NSROOT::UdpSocket::m_buflen
private

Definition at line 333 of file socket.h.

◆ m_bufptr

char* NSROOT::UdpSocket::m_bufptr
private

Definition at line 332 of file socket.h.

◆ m_errno

int NSROOT::UdpSocket::m_errno
private

Definition at line 330 of file socket.h.

◆ m_from

SocketAddress* NSROOT::UdpSocket::m_from
private

Definition at line 328 of file socket.h.

◆ m_rcvlen

size_t NSROOT::UdpSocket::m_rcvlen
private

Definition at line 334 of file socket.h.

◆ m_socket

net_socket_t NSROOT::UdpSocket::m_socket
private

Definition at line 329 of file socket.h.


The documentation for this class was generated from the following files:
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/socket.h
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/socket.cpp