This chapter describes the classes of the Pluggable Transport Interface provided by VisiBroker for C++. For information on how to implement support for a transport protocol via the VisiBroker Pluggable Transport Interface, see the chapter “VisiBroker Pluggable Transport Interface” in the VisiBroker for C++ Developer's Guide.This class is the abstract base class for a connection class that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. Each instance of the derived class will represent a single connection between a server and a client. VisiBroker will request instances of this class be created (via the corresponding factory class, see “virtual CORBA::Boolean waitNextMessage(CORBA::ULong _timeout) = 0;”) on both the client and server side of the ORB, whenever a new connection is required.The vptrans.h file should be included to use this class.virtual void close() = 0;To be implemented by the derived connection class. This method will be called by the client-side ORB, and must communicate with the remote peer’s ‘Listener’ instance to setup a new connection on the server-side. The function does not return any error code, but should throw exceptions if any transport layer errors occur. Any exception may be thrown, including a CORBA User Exception, as the exception will be thrown back to the client CORBA application. CORBA::TRANSIENT is one possible exception that could be thrown.The timeout value is in specified in milliseconds. A value of 0 means no timeout (block forever), and this is the default value, which is used unless the timeout is set through the VisiBroker QoS policy system. If the transport does not support timeouts on connect, it still can be used successfully. In this case the connect call must always block until the connection is established or has failed.
virtual void flush() = 0;virtual IOP::ProfileValue_ptr getPeerProfile() = 0;virtual CORBA::Long id() = 0;virtual CORBA::Boolean isBridgeSignalling() = 0;To be implemented by the derived connection class. This method is used to indicate to the ORB which worker thread ‘cooling’ strategy is to be used. If the method returns 0 (FALSE), it means that the protocol plug-in itself is going to handle the re-reading of the connection after a request has been read. This is only possible if the plug-in is capable of doing a blocking read with timeout on the protocol endpoint. If it cannot or chooses not to, this method should return 1 (TRUE), and the transport bridge will notify the thread if another request becomes available or the when the timeout is reached. Note that thread cooling only occurs if a cooling time is configured for that protocol instance.virtual CORBA::Boolean isConnected() = 0;To be implemented by the derived connection class. This method should return 1 (TRUE), if the remote peer is still connected. If the connection was closed by the peer or any error condition exists that prevents the use of this connection, it must return 0 (FALSE).virtual CORBA::Boolean isDataAvailable() = 0;To be implemented by the derived connection class. This method should return 1 (TRUE), if data is ready to be read from the connection. Otherwise, it should return 0 (FALSE).virtual CORBA::Boolean no_callback() = 0;To be implemented by the derived connection class. This method indicates whether a connection of this transport can be used to reverse the client/server setup and call back to a servant in the client code. It should return 0 (FALSE) if it can not, which will cause the ORB to create a new connection for this kind of call, or 1 (TRUE) if it can.virtual void read(CORBA::Boolean _isFirst, CORBA::Boolean _isLast, char* _data, CORBA::ULong _offset, CORBA::ULong _length, CORBA::ULongLong _timeout)= 0;The timeout parameter’s value defaults to 0 unless the user sets it through the VisiBroker QoS policies. A value of 0 indicates no timeout, and hence that the read should block forever waiting for data. Therefore, if this transport does not support timeouts on read/write, it still can be used successfully. In this case the read call must always block until all data has arrived.
TRUE if this is the first time data is being read from the connection. TRUE if this is the last time data is being read from the connection. To be implemented by the derived connection class. This method is used to tell a newly created client-side connection object what peer it should try to connect to in later steps (when connect() is called.) The given VISPTransProfileBase_ptr base class should be cast to the Profile class type of the particular transport and all member data in the connection should be initialized from that instance. A prefix string is also passed, for property lookup, in case additional property parameters need to be read.
String prefix of the form “vbroker.se.<SE_name>.scm.<SCM_name>” that the method can use to read any protocol-specific VisiBroker properties that may have been set to configure this instance. To be implemented by the derived connection class. This method should block the calling thread until either data has arrived on this connection or the given timeout (in milliseconds) has expired. It should return 1 (TRUE) if data is available, or 0 (FALSE) if not. Note that a value of 0 for the _timeout parameter should never occur (as in this case the ORB should not call this method). Therefore receiving this value should be handled as an error, perhaps by logging an error message.
virtual void write(CORBA::Boolean _isFirst, CORBA::Boolean _isLast, char* _data, CORBA::ULong _offset, CORBA::ULong _length, CORBA::ULongLong _timeout) = 0;
TRUE if this is the first time data is being sent through the connection. TRUE if this is the last time data is being sent through the connection. Timeout value to use, in milliseconds. 0 indicates no timeout (block forever)This class is the abstract base class for a connection factory class that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. A singleton instance of the derived class is registered with VisiBroker, via the “VISPTransRegistrar” class. The ORB calls the connection factory object to create instances of the connection class of the associated transport. The connection class is the corresponding class derived from class “VSPTransConnection”.The vptrans.h file should be included to use this class.
String prefix of the form “vbroker.se.<SE_name>.scm.<SCM_name>” that the method can use to read any protocol-specific VisiBroker properties that may have been set to configure the connection factory.This class is the abstract base class for a listener factory that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. Instances of the derived class are created each time a Server Engine is created that includes Server Connection Managers (‘SCMs’) that specify the particular transport protocol. One instance is created per SCM instance that specifies the protocol. The listener instances are used by the server-side ORB to wait for incoming connections and requests from clients. New connections and requests on existing connections are signaled by the listener to the ORB via the Pluggable Transport Interface’s Bridge class (see “VISPTransBridge”). When a request is received on an existing connection, the connection goes through a ‘Dispatch Cycle’. The Dispatch Cycle starts when the connection delivers data to the transport layer. In this initial state, the arrival of this data must be signaled to the ORB via the Bridge and then the Listener ignores the connection until the Dispatch process is completed (in the mean time, the connection is said to be in the ‘dispatch state’). The connection is returned to the initial state when the ORB makes a call to the Listener’s completedData() method. During the dispatch state the ORB will read directly from the connection until all requests are exhausted, avoiding any overhead incurred by the Bridge-Listener communication. In most cases, the transport layer uses blocking calls that wait for new connections. In order to handle this situation, the Listener should be made a subclass of the class VISThread and start a separate thread of execution that can be blocked without holding up the whole ORB.The vptrans.h file should be included to use this class.
virtual void destroy() = 0;virtual IOP::ProfileValue_ptr getListenerProfile() = 0;virtual CORBA::Boolean isDataAvailable(CORBA::Long id) = 0;To be implemented by the derived connection factory class. This method should return 1 (TRUE), if the connection with the given Id has data ready to be read. Returns 0 (FALSE) otherwise. Normally the call should just be forwarded to the transport layer to find out.
This class is the abstract base class for a listener factory class that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. A singleton instance of the derived class is registered with VisiBroker, via the VISPTransRegistrar class. The ORB calls this object to create instances of the listener class of the associated transport. The listener class is the corresponding class derived from class VISPTransListener, as described in “VISPTransListener”.The vptrans.h file should be included to use this class.
String prefix of the form “vbroker.se.<SE_name>.scm.<SCM_name>” that the method can use to read any protocol-specific VisiBroker properties that may have been set to configure the listener instance or the particular listener instance that is being created. Note that the factory can pass the prefix into the constructor of the listener instance it is creating, to allow it to read properties itself. This would require the derived listener class to have a constructor that takes the prefix as a parameter.class VISPTransProfileBase : public GIOP::ProfileBodyValue, public CORBA_DefaultValueRefCountBaseThis class is the abstract base class for a Profile class that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. This class provides the functionality to convert between a transport specific endpoint description and an CORBA IOP based IOR that can be exchanged with other CORBA implementations. It is also used during the process of binding a client to a server, by passing a ProfileValue to a ‘parsing’ function that has to return TRUE or FALSE, to determine whether a particular IOR is usable for this transport or not. An instance of the derived Profile class is frequently passed to functions via a pointer to its base class type. In order to support safe runtime downcasting with any C++ compiler, a ‘_downcast’ function must be provided that can test if the cast is legal or not.The vptrans.h file should be included to use this class.
GIOP::ObjectKey_var object_key() const;
const GIOP::Version& version() const;static const VISValueInfo& _info();static const VISValueInfo& _stat_info;IOP::ProfileValue_ptr copy()To be implemented by the derived Profile class. This method should return 1 (TRUE) if there is an IOR in the given data, that can be used to connect through this transport. Otherwise return 0 (FALSE).
IOP::ProfileId tag()IOP::TaggedProfile* toTaggedProfile();
This class is the abstract base class for a Profile factory class that must be implemented for each transport protocol that is to be plugged in to VisiBroker, to allow VisiBroker to work with that particular transport protocol. A singleton instance of the derived class is registered with VisiBroker, via the VISPTransRegistrar class. The ORB calls this object to create instances of the Profile class of the associated transport. The Profile class is the corresponding class derived from class VISPTransProfileBase, as described in “VISPTransProfileBase”.The vptrans.h file should be included to use this class.
Support the optimized storage of profiles in a hashed lookup table by calculating a hash number for the given instance. Return 0 if you do not provide hash values.
IOP::ProfileId getTag();The vptrans.h file should be included to use this class.Send a connection request to the ORB through the bridge, by passing a pointer to the Connection instance representing the Listener endpoint. The returned flag signals whether the ORB has accepted the new connection (returns 1 (TRUE)) or refused it (returns 0 (FALSE)). The latter might happen due to resource constraints or due to a restriction on connections (set up through the property system).
The vptrans.h file should be included to use this class.static void addTransport(const char* protocolName, VISPTransConnectionFactory* connFac, VISPTransListenerFactory* listFac, VISPTransProfileFactory* profFac);