nidas v1.2.3
|
#include <MultipleUDPSockets.h>
Public Member Functions | |
MultipleUDPSockets () | |
MultipleUDPSockets (const MultipleUDPSockets &x) | |
MultipleUDPSockets * | clone () const |
Derived classes must provide clone. | |
IOChannel * | connect () |
void | connected (nidas::util::DatagramSocket *sock, const nidas::util::Inet4PacketInfoX &pktinfo) throw () |
size_t | getBufferSize () const throw () |
Return suggested buffer length. | |
size_t | read (void *, size_t) |
size_t | write (const void *buf, size_t len) |
size_t | write (const struct iovec *iov, int iovcnt) |
void | close () |
int | getFd () const |
void | fromDOMElement (const xercesc::DOMElement *) |
void | addClient (const ConnectionInfo &info) |
From the Inet4PacketInfoX associated with the received request, determine if we need to create a new socket to send data to the requester. | |
void | removeClient (const nidas::util::Inet4SocketAddress &remoteSAddr) |
void | removeClient (nidas::util::DatagramSocket *) |
void | setDataPort (unsigned short val) |
unsigned short | getDataPort () const |
void | setRequestType (enum McSocketRequest val) |
enum McSocketRequest | getRequestType () const |
bool | isRequester () const |
Does this McSocket request connections, or does it listen for incoming connections. | |
void | setRequester (bool val) |
void | setName (const std::string &val) |
const std::string & | getName () const |
void | requestConnection (IOChannelRequester *service) |
virtual bool | isNewInput () const |
Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file. | |
void | setNonBlocking (bool val) |
Do setNonBlocking(val) on underlying socket. | |
bool | isNonBlocking () const |
Return isNonBlocking() of underlying socket. | |
void | setInet4McastSocketAddress (const nidas::util::Inet4SocketAddress &val) |
const nidas::util::Inet4SocketAddress & | getInet4McastSocketAddress () const |
virtual int | getReconnectDelaySecs () const |
virtual const ConnectionInfo & | getConnectionInfo () const |
What is the IP address of the host at the other end of the connection. | |
virtual void | setConnectionInfo (const ConnectionInfo &val) |
virtual void | flush () |
Default flush implementation does nothing. | |
virtual dsm_time_t | createFile (dsm_time_t t, bool exact) |
Request that an IOChannel open a new file, with a name based on a time. | |
virtual bool | writeNidasHeader () const |
Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there. | |
virtual void | setDSMConfig (const DSMConfig *val) |
What DSM is this IOChannel connected to? | |
virtual const DSMConfig * | getDSMConfig () const |
What DSM is this IOChannel connected to? May be NULL. | |
virtual void | addSampleTag (const nidas::core::SampleTag *) |
The special NetcdfRPCChannel subclass needs a way to add a SampleTag to the IOChannel through a virtual base class. | |
virtual xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const |
Create a DOMElement and append it to the parent. | |
virtual xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const |
Add my content into a DOMElement. | |
Static Public Member Functions | |
static IOChannel * | createIOChannel (const xercesc::DOMElement *node) |
static const XMLCh * | getNamespaceURI () |
Protected Attributes | |
IOChannelRequester * | _iochanRequester |
MyMcSocket | _mcsocket |
Private Member Functions | |
void | handleChangedSockets () |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
MultipleUDPSockets::MultipleUDPSockets | ( | ) |
References nidas::core::McSocketUDP::setName().
Referenced by clone().
MultipleUDPSockets::MultipleUDPSockets | ( | const MultipleUDPSockets & | x | ) |
References nidas::core::McSocketUDP::setName().
void MultipleUDPSockets::addClient | ( | const ConnectionInfo & | info | ) |
From the Inet4PacketInfoX associated with the received request, determine if we need to create a new socket to send data to the requester.
If this is a new destination address for unicast packets add a new nidas::util::DatagramSocket. Or, if the requester sent a multicast request, and it was received on an interface which has not received requests before, then add a new nidas::util::MulticastSocket on that interface.
References _multicastClients, _multicastInterfaces, _multicastSockets, _pendingSockets, _socketMutex, _socketsChanged, _unicastSockets, getDataPort(), nidas::core::ConnectionInfo::getDestinationAddress(), nidas::core::McSocketUDP::getInet4McastSocketAddress(), nidas::core::ConnectionInfo::getInterface(), nidas::core::ConnectionInfo::getRemoteSocketAddress(), nidas::core::getSample(), ILOG, nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
Referenced by connect().
|
virtualinherited |
|
virtual |
Derived classes must provide clone.
Reimplemented from nidas::core::McSocketUDP.
References MultipleUDPSockets().
|
virtual |
nidas::util::IOException |
Reimplemented from nidas::core::McSocketUDP.
References _pendingSockets, _socketMutex, _sockets, _socketsChanged, nidas::util::DatagramSocket::close(), nidas::core::getSample(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
|
virtual |
nidas::util::IOException |
Reimplemented from nidas::core::McSocketUDP.
References nidas::core::McSocketUDP::_mcsocket, nidas::util::McSocket< SocketT >::accept(), addClient(), nidas::core::getSample(), and nidas::core::McSocketUDP::isNonBlocking().
|
virtual |
Reimplemented from nidas::core::McSocketUDP.
References nidas::core::getSample(), and ILOG.
|
inlinevirtualinherited |
Request that an IOChannel open a new file, with a name based on a time.
This should be implemented by derived classes which write to disk files. Other derived classes (e.g. sockets) can just use this default implementation - basically ignoring the request.
t | Time to use when creating file name. |
exact | Use exact time when creating file name, else the time is adjusted to an even time interval. |
nidas::util::IOException |
Reimplemented in nidas::core::FileSet.
References nidas::core::getSample().
Referenced by nidas::core::IOStream::createFile(), and nidas::core::SampleOutputBase::createNextFile().
nidas::util::InvalidParameterException |
References nidas::core::DOMObjectFactory::createObject(), nidas::core::Socket::createSocket(), and nidas::core::getSample().
Referenced by nidas::core::DSMService::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), and nidas::dynld::SampleInputStream::fromDOMElement().
Default flush implementation does nothing.
nidas::util::IOException |
Referenced by nidas::core::IOStream::flush().
nidas::util::InvalidParameterException |
Reimplemented from nidas::core::McSocketUDP.
References nidas::core::McSocketUDP::getName(), nidas::core::getSample(), LOG_WARNING, NIDAS_MULTICAST_ADDR, NIDAS_SVC_REQUEST_PORT_UDP, port, nidas::core::McSocketUDP::setInet4McastSocketAddress(), nidas::core::McSocketUDP::setNonBlocking(), nidas::core::McSocketUDP::setRequester(), nidas::core::McSocketUDP::setRequestType(), and nidas::core::UDP_PROCESSED_SAMPLE_FEED.
|
virtual |
Return suggested buffer length.
Reimplemented from nidas::core::IOChannel.
References _socketMutex, _sockets, nidas::util::DatagramSocket::getReceiveBufferSize(), and nidas::core::getSample().
|
inlinevirtualinherited |
What is the IP address of the host at the other end of the connection.
If this IOChannel is not a socket then return INADDR_ANY, using the default constructor of an Inet4Address. Socket subclasses should override this.
References nidas::core::IOChannel::_conInfo.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
References _dataPortNumber, and nidas::core::getSample().
Referenced by addClient().
What DSM is this IOChannel connected to? May be NULL.
References nidas::core::IOChannel::_dsm.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
|
virtual |
Reimplemented from nidas::core::McSocketUDP.
References _socketMutex, _sockets, nidas::util::DatagramSocket::getFd(), and nidas::core::getSample().
|
inlineinherited |
References nidas::core::McSocketUDP::_mcsocket, and nidas::util::McSocket< SocketT >::getInet4McastSocketAddress().
Referenced by addClient().
|
inlinevirtualinherited |
Implements nidas::core::IOChannel.
References nidas::core::McSocketUDP::_name.
Referenced by nidas::core::McSocketUDP::fromDOMElement(), and fromDOMElement().
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
Reimplemented in nidas::core::FileSet.
Referenced by nidas::core::SampleOutputBase::getReconnectDelaySecs().
|
inlinevirtualinherited |
Reimplemented from nidas::core::IOChannel.
References nidas::core::McSocketUDP::_mcsocket, and nidas::util::McSocket< SocketT >::getRequestType().
|
private |
Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file.
This method is used by code which may need to do special things at the beginning of a file, like read a SampleInputHeader.
Reimplemented from nidas::core::IOChannel.
References nidas::core::McSocketUDP::_newInput.
|
inlinevirtualinherited |
Return isNonBlocking() of underlying socket.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::McSocketUDP::_nonBlocking.
Referenced by nidas::core::McSocketUDP::connect(), connect(), and nidas::core::McSocketUDP::connected().
|
inlineinherited |
Does this McSocket request connections, or does it listen for incoming connections.
References nidas::core::McSocketUDP::_amRequester.
Referenced by nidas::core::McSocketUDP::connect(), nidas::core::McSocketUDP::fromDOMElement(), and nidas::core::McSocketUDP::requestConnection().
nidas::util::IOException |
Reimplemented from nidas::core::McSocketUDP.
References nidas::core::getSample().
void MultipleUDPSockets::removeClient | ( | const nidas::util::Inet4SocketAddress & | remoteSAddr | ) |
void MultipleUDPSockets::removeClient | ( | nidas::util::DatagramSocket * | dsock | ) |
|
virtualinherited |
nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::McSocketUDP::_iochanRequester, nidas::core::McSocketUDP::_mcsocket, nidas::core::getSample(), nidas::core::McSocketUDP::isRequester(), nidas::util::McSocket< SocketT >::listen(), and nidas::util::McSocket< SocketT >::request().
|
inlinevirtualinherited |
References nidas::core::IOChannel::_conInfo, and nidas::core::getSample().
Referenced by nidas::core::Socket::connect().
References _dataPortNumber, and nidas::core::getSample().
Referenced by nidas::dynld::UDPSampleOutput::fromDOMElement().
What DSM is this IOChannel connected to?
References nidas::core::IOChannel::_dsm, and nidas::core::getSample().
Referenced by nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
|
inlineinherited |
References nidas::core::McSocketUDP::_mcsocket, and nidas::util::McSocket< SocketT >::setInet4McastSocketAddress().
Referenced by nidas::core::McSocketUDP::fromDOMElement(), and fromDOMElement().
Implements nidas::core::IOChannel.
References nidas::core::McSocketUDP::_name, and nidas::core::getSample().
Referenced by nidas::core::McSocketUDP::McSocketUDP(), MultipleUDPSockets(), and MultipleUDPSockets().
Do setNonBlocking(val) on underlying socket.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::McSocketUDP::_nonBlocking, and nidas::core::getSample().
Referenced by nidas::core::McSocketUDP::fromDOMElement(), and fromDOMElement().
References nidas::core::McSocketUDP::_amRequester, and nidas::core::getSample().
Referenced by nidas::core::McSocketUDP::fromDOMElement(), and fromDOMElement().
|
inlinevirtualinherited |
Reimplemented from nidas::core::IOChannel.
References nidas::core::McSocketUDP::_mcsocket, and nidas::util::McSocket< SocketT >::setRequestType().
Referenced by nidas::core::McSocketUDP::fromDOMElement(), and fromDOMElement().
|
virtualinherited |
Add my content into a DOMElement.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
nidas::util::IOException |
Reimplemented from nidas::core::McSocketUDP.
References _sockets, _socketsChanged, nidas::core::getSample(), handleChangedSockets(), ILOG, removeClient(), and nidas::util::DatagramSocket::sendto().
nidas::util::IOException |
Reimplemented from nidas::core::McSocketUDP.
References _sockets, _socketsChanged, nidas::core::getSample(), handleChangedSockets(), ILOG, len, removeClient(), and nidas::util::DatagramSocket::sendto().
Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there.
Reimplemented in nidas::core::DatagramSocket.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
|
privateinherited |
Referenced by nidas::core::McSocketUDP::isRequester(), and nidas::core::McSocketUDP::setRequester().
|
privateinherited |
Referenced by getDataPort(), and setDataPort().
|
privateinherited |
|
protectedinherited |
Referenced by nidas::core::McSocketUDP::connected(), and nidas::core::McSocketUDP::requestConnection().
|
protectedinherited |
Referenced by nidas::core::McSocketUDP::close(), nidas::core::McSocketUDP::connect(), connect(), nidas::core::McSocketUDP::getInet4McastSocketAddress(), nidas::core::McSocketUDP::getRequestType(), nidas::core::McSocketUDP::requestConnection(), nidas::core::McSocketUDP::setInet4McastSocketAddress(), and nidas::core::McSocketUDP::setRequestType().
|
private |
Remote clients of each multicast interface.
Referenced by addClient(), removeClient(), and removeClient().
|
private |
The local multicast interface of each remote client.
Referenced by addClient(), removeClient(), and removeClient().
|
private |
Socket of each multicast interface.
Referenced by addClient(), removeClient(), and removeClient().
|
privateinherited |
Referenced by nidas::core::McSocketUDP::getName(), and nidas::core::McSocketUDP::setName().
|
privateinherited |
Referenced by nidas::core::McSocketUDP::isNewInput().
|
privateinherited |
Referenced by nidas::core::McSocketUDP::isNonBlocking(), and nidas::core::McSocketUDP::setNonBlocking().
|
private |
Referenced by handleChangedSockets(), removeClient(), and removeClient().
|
private |
Referenced by addClient(), close(), and handleChangedSockets().
|
mutableprivate |
Referenced by addClient(), close(), getBufferSize(), getFd(), handleChangedSockets(), removeClient(), and removeClient().
|
private |
Referenced by close(), getBufferSize(), getFd(), handleChangedSockets(), write(), and write().
|
private |
Referenced by addClient(), close(), handleChangedSockets(), removeClient(), removeClient(), write(), and write().
|
private |
Unicast Sockets for each destination.
Referenced by addClient(), removeClient(), and removeClient().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().