|
nidas v1.2.3
|
Implementation of an IOChannel, using nidas::util::McSocket<nidas::util::Socket> to establish a TCP connection. More...
#include <McSocket.h>

Classes | |
| class | MyMcSocket |
Public Member Functions | |
| McSocket () | |
| Constructor. | |
| ~McSocket () | |
| McSocket * | clone () const |
| Derived classes must provide clone. | |
| 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) |
| IOChannel * | connect () |
| virtual void | connected (nidas::util::Socket *sock, const nidas::util::Inet4PacketInfoX &pktinfo) |
| 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 | setKeepAliveIdleSecs (int val) |
| int | getKeepAliveIdleSecs () const |
| void | setNonBlocking (bool val) |
| Do setNonBlocking(val) on underlying socket. | |
| bool | isNonBlocking () const |
| Return isNonBlocking() of underlying socket. | |
| size_t | read (void *, size_t) |
| A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection. | |
| size_t | write (const void *, size_t) |
| A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection. | |
| size_t | write (const struct iovec *, int) |
| A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection. | |
| void | close () |
| int | getFd () const |
| void | fromDOMElement (const xercesc::DOMElement *) |
| 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 size_t | getBufferSize () const |
| Return suggested buffer length. | |
| 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 Member Functions | |
| McSocket (const McSocket &) | |
| Copy constructor. | |
Protected Attributes | |
| IOChannelRequester * | _iochanRequester |
| MyMcSocket | _mcsocket |
Private Member Functions | |
| McSocket & | operator= (const McSocket &) |
| No assignment. | |
Private Attributes | |
| std::string | _name |
| bool | _amRequester |
| bool | _firstRead |
| bool | _newInput |
| int | _keepAliveIdleSecs |
| bool | _nonBlocking |
| const DSMConfig * | _dsm |
| ConnectionInfo | _conInfo |
Static Private Attributes | |
| static XMLCh * | namespaceURI = 0 |
Implementation of an IOChannel, using nidas::util::McSocket<nidas::util::Socket> to establish a TCP connection.
|
inline |
Copy constructor.
Should only be called before nidas::util::Socket is connected.
|
virtualinherited |
|
virtual |
|
virtual |
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References _mcsocket, and nidas::util::McSocket< SocketT >::close().
|
virtual |
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References _keepAliveIdleSecs, _mcsocket, nidas::util::McSocket< SocketT >::accept(), nidas::util::McSocket< SocketT >::connect(), getRequestType(), nidas::core::getSample(), isNonBlocking(), isRequester(), and nidas::util::Socket::setKeepAliveIdleSecs().
|
virtual |
|
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 |
Implements nidas::core::DOMable.
References _keepAliveIdleSecs, getName(), nidas::core::getSample(), isRequester(), LOG_WARNING, NIDAS_MULTICAST_ADDR, NIDAS_SVC_REQUEST_PORT_UDP, port, setInet4McastSocketAddress(), setNonBlocking(), setRequester(), and setRequestType().
Return suggested buffer length.
Reimplemented in nidas::core::DatagramSocket, nidas::core::MultipleUDPSockets, and nidas::core::Socket.
Referenced by nidas::dynld::SampleInputStream::SampleInputStream(), and nidas::dynld::SampleInputStream::SampleInputStream().
|
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().
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 |
Implements nidas::core::IOChannel.
|
inline |
References _mcsocket, and nidas::util::McSocket< SocketT >::getInet4McastSocketAddress().
|
inline |
| nidas::util::IOException |
References _keepAliveIdleSecs.
|
inlinevirtual |
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().
|
inlinevirtual |
Reimplemented from nidas::core::IOChannel.
References _mcsocket, and nidas::util::McSocket< SocketT >::getRequestType().
Referenced by connect(), and connected().
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 _newInput.
|
inlinevirtual |
Return isNonBlocking() of underlying socket.
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References _nonBlocking.
Referenced by connect(), and connected().
|
inline |
Does this McSocket request connections, or does it listen for incoming connections.
References _amRequester.
Referenced by connect(), fromDOMElement(), and requestConnection().
A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection.
The returned IOChannel should be used to read/write. Calling this method will fail with an assert.
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::getSample().
|
virtual |
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References _iochanRequester, _mcsocket, nidas::core::getSample(), 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().
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().
|
inline |
References _mcsocket, and nidas::util::McSocket< SocketT >::setInet4McastSocketAddress().
Referenced by fromDOMElement().
| nidas::util::IOException |
References _keepAliveIdleSecs, and nidas::core::getSample().
Implements nidas::core::IOChannel.
References _name, and nidas::core::getSample().
Referenced by McSocket().
Do setNonBlocking(val) on underlying socket.
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References _nonBlocking, and nidas::core::getSample().
Referenced by fromDOMElement().
References _amRequester, and nidas::core::getSample().
Referenced by fromDOMElement().
|
inlinevirtual |
Reimplemented from nidas::core::IOChannel.
References _mcsocket, and nidas::util::McSocket< SocketT >::setRequestType().
Referenced by 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.
A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection.
The returned IOChannel should be used to read/write. Calling this method will fail with an assert.
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::getSample().
A McSocket shouldn't be used to do any actual reads or writes, it just sets up the connection.
The returned IOChannel should be used to read/write. Calling this method will fail with an assert.
| nidas::util::IOException |
Implements nidas::core::IOChannel.
References nidas::core::getSample().
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().
|
private |
Referenced by isRequester(), and setRequester().
|
privateinherited |
|
private |
|
protected |
Referenced by connected(), and requestConnection().
|
private |
Referenced by connect(), connected(), fromDOMElement(), getKeepAliveIdleSecs(), and setKeepAliveIdleSecs().
|
protected |
Referenced by close(), connect(), getInet4McastSocketAddress(), getRequestType(), requestConnection(), setInet4McastSocketAddress(), and setRequestType().
|
private |
Referenced by isNewInput().
|
private |
Referenced by isNonBlocking(), and setNonBlocking().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().