nidas v1.2.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nidas::core::XMLConfigInput Class Reference

#include <XMLConfigInput.h>

Inheritance diagram for nidas::core::XMLConfigInput:
Inheritance graph
[legend]

Public Member Functions

 XMLConfigInput ()
 
void setInterface (Inet4NetworkInterface iaddr)
 Set a specific interface for the multicasts.
 
Inet4NetworkInterface getInterface () const
 
std::list< Inet4NetworkInterface > getInterfaces () const
 Return all network interfaces on this system.
 
const Inet4SocketAddress & getInet4McastSocketAddress () const
 Get the multicast address for listening to requests.
 
void setInet4McastSocketAddress (const Inet4SocketAddress &val)
 Set the multicast address for listening to requests.
 
void setRequestType (int val)
 Set the request type value.
 
int getRequestType () const
 Get the request type number.
 
void listen ()
 Register with a McSocketListener to listen on the multicast address.
 
nidas::util::Socketaccept (Inet4PacketInfoX &)
 Like ServerSocket::accept(), this method will return a connected socket.
 
virtual void connected (nidas::util::Socket *, const Inet4PacketInfoX &)
 Virtual method that is called when a socket connection is established.
 
void request ()
 Start issuing requests for a connection by multicasting McSocketDatagrams.
 
nidas::util::Socketconnect (Inet4PacketInfoX &)
 Do a request(), and then wait until a TCP connection is established, or a UDP datagram is received back.
 
virtual void close ()
 Unregister this McSocket from the multicasting and listening threads.
 

Private Member Functions

void offer (nidas::util::Socket *sock, const Inet4PacketInfoX &pktinfo)
 How a McSocketListener passes back a connected TCP socket or DatagramSocket.
 
void offer (int err)
 
void joinMulticaster ()
 

Private Attributes

Inet4SocketAddress _mcastAddr
 
Inet4NetworkInterface _iface
 
int _requestType
 
Cond _connectCond
 
nidas::util::Socket_newsocket
 
Inet4PacketInfoX _newpktinfo
 
bool _socketOffered
 
int _offerErrno
 
Thread * _multicaster
 The thread we start which multicasts for connections.
 
Mutex _multicaster_mutex
 

Constructor & Destructor Documentation

◆ XMLConfigInput()

nidas::core::XMLConfigInput::XMLConfigInput ( )
inline

Member Function Documentation

◆ accept()

Like ServerSocket::accept(), this method will return a connected socket.

As with listen(), it registers with a McSocketListener to listen on the multicast address, then waits until a request is received with a matching request type and socket type. accept() will return with a pointer to a connected TCP Socket for a McSocket<Socket>, or to a DatagramSocket for a McSocket<DatagramSocket>, with a default destination address of the requesting host and port. The caller owns the pointer to the socket and is responsible for closing and deleting it when done.

Exceptions
IOException

◆ close()

void nidas::util::McSocket< nidas::util::Socket >::close ( )
virtualinherited

Unregister this McSocket from the multicasting and listening threads.

Exceptions
IOException

◆ connect()

Do a request(), and then wait until a TCP connection is established, or a UDP datagram is received back.

Returns the pointer to the connected TCP Socket or the DatagramSocket. McSocket then owns the pointer to the socket and is responsible for closing and deleting it when done.

Exceptions
IOException

◆ connected()

virtual void nidas::util::McSocket< nidas::util::Socket >::connected ( nidas::util::Socket * ,
const Inet4PacketInfoX &  )
inlinevirtualinherited

Virtual method that is called when a socket connection is established.

This must be implemented in derived classes if the user wants to implement an asynchronous, two-step connection using listen() instead of accept() for incoming requests or request() instead of connect() for outgoing requests.

Parameters
sockThe socket which is ready for I/O. McSocket then owns the pointer to the socket and is responsible for closing and deleting it when done.

Reimplemented in nidas::core::McSocket::MyMcSocket.

◆ getInet4McastSocketAddress()

const Inet4SocketAddress & nidas::util::McSocket< nidas::util::Socket >::getInet4McastSocketAddress ( ) const
inlineinherited

Get the multicast address for listening to requests.

◆ getInterface()

Inet4NetworkInterface nidas::util::McSocket< nidas::util::Socket >::getInterface ( ) const
inlineinherited

◆ getInterfaces()

std::list< Inet4NetworkInterface > nidas::util::McSocket< nidas::util::Socket >::getInterfaces ( ) const
inherited

Return all network interfaces on this system.

Exceptions
IOException

◆ getRequestType()

int nidas::util::McSocket< nidas::util::Socket >::getRequestType ( ) const
inlineinherited

Get the request type number.

◆ joinMulticaster()

void nidas::util::McSocket< nidas::util::Socket >::joinMulticaster ( )
privateinherited

◆ listen()

Register with a McSocketListener to listen on the multicast address.

When a request is received on the socket port, with a matching request type and socket type, McSocketListener will either do a Socket::connect() to establish a TCP connection back to the requesting host and port if the socket type is SOCK_STREAM, or if the socket type is SOCK_DGRAM, will create a DatagramSocket with a default destination address of the requesting host and port. Once this has been done, McSocketListener will call the offer() method of this McSocket. offer() then calls the virtual connected() method, passing a pointer to the connected socket. Use either listen() or accept() to wait for a connection.

Exceptions
IOException

◆ offer() [1/2]

void nidas::util::McSocket< nidas::util::Socket >::offer ( int err)
privateinherited

◆ offer() [2/2]

void nidas::util::McSocket< nidas::util::Socket >::offer ( nidas::util::Socket * sock,
const Inet4PacketInfoX & pktinfo )
privateinherited

How a McSocketListener passes back a connected TCP socket or DatagramSocket.

offer() calls the connected() virtual method. McSocket will own the pointer to the socket and is responsible for closing and deleting it when done.

Parameters
sockA pointer to a Socket. May be null, in which case err will be a non-zero errno that occured.
errIf sock is null, an errno.

◆ request()

void nidas::util::McSocket< nidas::util::Socket >::request ( )
inherited

Start issuing requests for a connection by multicasting McSocketDatagrams.

When a response is received, either in the form of a TCP socket connection in the case of a socket type of SOCK_STREAM, or a datagram is received in the case of a socket type of SOCK_DGRAM, then the connected() method is called.

Exceptions
IOException

◆ setInet4McastSocketAddress()

void nidas::util::McSocket< nidas::util::Socket >::setInet4McastSocketAddress ( const Inet4SocketAddress & val)
inlineinherited

Set the multicast address for listening to requests.

Parameters
valMulticast address to listen for McSocketDatagrams.

◆ setInterface()

void nidas::util::McSocket< nidas::util::Socket >::setInterface ( Inet4NetworkInterface iaddr)
inlineinherited

Set a specific interface for the multicasts.

If a request() or connect() is done, then requests will be sent on this interface. If an listen() or accept() is done, then an MulticastSocket::joinInterface() will be done on this interface to listen for incoming datagrams. If the interface is not set, or is left at the default of INADDR_ANY, then McSocket will send on or join all available interfaces capable of multicast, including the loopback interface.

◆ setRequestType()

void nidas::util::McSocket< nidas::util::Socket >::setRequestType ( int val)
inlineinherited

Set the request type value.

This can be any number, agreed upon by the McSocket sending requests and the McSocket listening for requests.

Parameters
valRequest number

Member Data Documentation

◆ _connectCond

Cond nidas::util::McSocket< nidas::util::Socket >::_connectCond
privateinherited

◆ _iface

Inet4NetworkInterface nidas::util::McSocket< nidas::util::Socket >::_iface
privateinherited

◆ _mcastAddr

Inet4SocketAddress nidas::util::McSocket< nidas::util::Socket >::_mcastAddr
privateinherited

◆ _multicaster

Thread* nidas::util::McSocket< nidas::util::Socket >::_multicaster
privateinherited

The thread we start which multicasts for connections.

◆ _multicaster_mutex

Mutex nidas::util::McSocket< nidas::util::Socket >::_multicaster_mutex
privateinherited

◆ _newpktinfo

Inet4PacketInfoX nidas::util::McSocket< nidas::util::Socket >::_newpktinfo
privateinherited

◆ _newsocket

◆ _offerErrno

int nidas::util::McSocket< nidas::util::Socket >::_offerErrno
privateinherited

◆ _requestType

int nidas::util::McSocket< nidas::util::Socket >::_requestType
privateinherited

◆ _socketOffered

bool nidas::util::McSocket< nidas::util::Socket >::_socketOffered
privateinherited

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