Library: RemotingNG
Package: Transport
Header: Poco/RemotingNG/Transport.h
Transport objects are responsible for setting up and maintaining a network (or other kind of) connection between Proxy objects on the client side and Listener objects on the server side, and for exchanging messages over that connection.
A Transport object also maintains Serializer and Deserializer objects.
Transport objects must support two message exchange patterns (MEP):
Provided a Transport object is already connected, sending a one-way message is a three-step process:
Doing a request-reply message exchange is a five-step process.
Transport objects must be able to deal with incomplete message exchange sequences. For example, if an exception occurs between a call to beginRequest() and the corresponding call to sendRequest(), sendRequest() and endRequest() will not be called for this exchange. When beginRequest() or beginMessage() is called the next time, it must do the necessary cleanup to reset the Transport object to a well-defined state.
Direct Base Classes: AttributedObject
All Base Classes: Poco::RefCountedObject, AttributedObject
Known Derived Classes: Poco::UPnP::GENA::Transport, Poco::UPnP::SOAP::Transport
Member Functions: beginMessage, beginRequest, connect, connected, disconnect, endPoint, endRequest, sendMessage, sendRequest
Inherited Functions: duplicate, getAttribute, hasAttribute, referenceCount, release, setAttribute
typedef std::map < std::string, std::string > NameValueMap;
typedef Poco::AutoPtr < Transport > Ptr;
Transport();
Creates a Transport.
virtual ~Transport();
Destroys the Transport.
virtual Serializer & beginMessage(
const Identifiable::ObjectId & oid,
const Identifiable::TypeId & tid,
const std::string & messageName,
SerializerBase::MessageType messageType
) = 0;
Prepare a one-way message and set up a Serializer for writing the request.
The messageType should be MESSAGE_REQUEST or MESSAGE_EVENT. Whether this is checked is up to the actual implementation.
Returns a Serializer for composing the message.
No response message will be sent back for a one-way request.
virtual Serializer & beginRequest(
const Identifiable::ObjectId & oid,
const Identifiable::TypeId & tid,
const std::string & messageName,
SerializerBase::MessageType messageType
) = 0;
Prepare a two-way (request - reply) message exchange and set up a Serializer for writing the request.
The messageType should be MESSAGE_REQUEST or MESSAGE_EVENT. Whether this is checked is up to the actual implementation.
Returns a Serializer for composing the request message.
virtual void connect(
const std::string & endPoint
) = 0;
Connects the transport to the given endpoint.
The format of the endpoint is specific to the Transport. Some Transport implementations may accept a complete URI as endpoint.
virtual bool connected() const = 0;
virtual void disconnect() = 0;
Disconnects the transport.
virtual const std::string & endPoint() const = 0;
Returns the endpoint to which this Transport is connected. If not connected, an empty string will be returned.
virtual void endRequest() = 0;
Ends a request - reply message exchange.
virtual void sendMessage(
const Identifiable::ObjectId & oid,
const Identifiable::TypeId & tid,
const std::string & messageName,
SerializerBase::MessageType messageType
) = 0;
Deliver the one-way message to the server and complete the message exchange.
All parameters must have the same value as the parameters passed to beginMessage(). If not, the behavior is undefined.
virtual Deserializer & sendRequest(
const Identifiable::ObjectId & oid,
const Identifiable::TypeId & tid,
const std::string & messageName,
SerializerBase::MessageType messageType
) = 0;
Deliver the request message to the server, wait for a response and prepare a Deserializer for reading the reply.
All parameters must have the same value as the parameters passed to beginRequest(). If not, the behavior is undefined.
Returns a Deserializer for reading the reply message.