| 1 | #ifndef TRANSPORT_CONNECTION_HPP
 | 
|---|
| 2 | #define TRANSPORT_CONNECTION_HPP
 | 
|---|
| 3 | 
 | 
|---|
| 4 | // ariba
 | 
|---|
| 5 | #include "ariba/utility/transport/messages/message.hpp"
 | 
|---|
| 6 | #include "ariba/utility/addressing2/endpoint.hpp"
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include <vector>
 | 
|---|
| 9 | #include <boost/shared_ptr.hpp>
 | 
|---|
| 10 | 
 | 
|---|
| 11 | namespace ariba {
 | 
|---|
| 12 | 
 | 
|---|
| 13 | // forward declaration
 | 
|---|
| 14 | namespace utility {
 | 
|---|
| 15 |     class LinkID;
 | 
|---|
| 16 | }
 | 
|---|
| 17 | 
 | 
|---|
| 18 | 
 | 
|---|
| 19 | namespace transport {
 | 
|---|
| 20 | 
 | 
|---|
| 21 | class transport_connection
 | 
|---|
| 22 | {
 | 
|---|
| 23 | public:
 | 
|---|
| 24 |     typedef boost::shared_ptr<transport_connection> sptr;
 | 
|---|
| 25 |     
 | 
|---|
| 26 |     /// Allow deleting implementing classes by pointer
 | 
|---|
| 27 |     virtual ~transport_connection() {}
 | 
|---|
| 28 |     
 | 
|---|
| 29 |     virtual bool send(reboost::message_t message, uint8_t priority = 1) = 0;
 | 
|---|
| 30 |     
 | 
|---|
| 31 |     virtual ariba::addressing2::EndpointPtr getLocalEndpoint() = 0;
 | 
|---|
| 32 |     virtual ariba::addressing2::EndpointPtr getRemoteEndpoint() = 0;
 | 
|---|
| 33 | 
 | 
|---|
| 34 |     
 | 
|---|
| 35 |     /**
 | 
|---|
| 36 |      * Tells this transport_connection, that it's used by the given
 | 
|---|
| 37 |      * communication link.
 | 
|---|
| 38 |      */
 | 
|---|
| 39 |     virtual void register_communication_link(ariba::utility::LinkID* link) = 0;
 | 
|---|
| 40 | 
 | 
|---|
| 41 |     /**
 | 
|---|
| 42 |      * Tells this transport_connection, that it's no longer used by the given
 | 
|---|
| 43 |      * communication link.
 | 
|---|
| 44 |      * 
 | 
|---|
| 45 |      * A transport_connection may terminate itself, when it's no longer used by
 | 
|---|
| 46 |      * any communication link.
 | 
|---|
| 47 |      */
 | 
|---|
| 48 |     virtual void unregister_communication_link(ariba::utility::LinkID* link) = 0;
 | 
|---|
| 49 |     
 | 
|---|
| 50 |     /**
 | 
|---|
| 51 |      * @return A vector of all registered communication links.
 | 
|---|
| 52 |      */
 | 
|---|
| 53 |     virtual std::vector<ariba::utility::LinkID*> get_communication_links() = 0;
 | 
|---|
| 54 |     
 | 
|---|
| 55 |     virtual void terminate() = 0;
 | 
|---|
| 56 | };
 | 
|---|
| 57 | 
 | 
|---|
| 58 | } /* namespace transport */
 | 
|---|
| 59 | } /* namespace ariba */
 | 
|---|
| 60 | #endif /* TRANSPORT_CONNECTION_HPP */
 | 
|---|