source: source/ariba/utility/addressing2/tcpip_endpoint.hpp

Last change on this file was 12060, checked in by hock@…, 11 years ago

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

File size: 2.3 KB
Line 
1/*
2 * tcpip_endpoint.h
3 *
4 * Created on: 26.03.2013
5 * Author: mario
6 */
7
8#ifndef TCPIP_ENDPOINT_HPP_
9#define TCPIP_ENDPOINT_HPP_
10
11// TODO: maybe move this class ariba/utility/transport.. ?
12
13#include "endpoint.hpp"
14
15// boost
16#include <boost/asio/ip/tcp.hpp>
17#include <boost/shared_ptr.hpp>
18
19using boost::shared_ptr;
20
21namespace ariba {
22namespace addressing2 {
23
24class tcpip_endpoint: public endpoint
25{
26public:
27 /**
28 * Implements »endpoint«
29 * @see endpoint.h
30 *
31 * NOTE: An endpoint is designed as an unmutable object!
32 */
33
34 /// factories
35 static boost::shared_ptr<tcpip_endpoint> create_TcpIP_Endpoint(
36 const boost::asio::ip::tcp::endpoint& asio_endpoint);
37
38
39 /// constructors
40
41 /**
42 * Creates a new »tcpip_endpoint« from a string representation.
43 * ---> NOT complementary to »to_string()«
44 */
45 tcpip_endpoint(const std::string& ip_addr, const int port);
46
47 /**
48 * Creates a new »tcpip_endpoint« from a byte array.
49 * ---> Complementary to »to_byte_array()«
50 *
51 * May throw »invalid_argument« exception.
52 */
53 tcpip_endpoint(const ENDPOINT_TYPE type, const uint8_t* const byte_array, const int read_max);
54
55 /**
56 * Creates a new »tcpip_endpoint« from an ASIO tcp::endpoint.
57 * ---> Complementary to »tcpip_endpoint::to_asio()«
58 */
59 tcpip_endpoint(const boost::asio::ip::tcp::endpoint& asio_endpoint);
60
61 virtual ~tcpip_endpoint();
62
63
64 /// from superclass
65 virtual ENDPOINT_CATEGORY get_category() const;
66 virtual ENDPOINT_TYPE get_type() const;
67 virtual std::string to_string() const;
68 virtual size_t to_byte_array(uint8_t* buffer) const;
69 virtual int size() const;
70
71
72 /**
73 * @return An equivalent ASIO tcp::endpoint
74 */
75 const boost::asio::ip::tcp::endpoint& to_asio() const;
76
77 /**
78 * @return »true« if rhs points to the same Address:Port pair,
79 * otherwise returns »false«.
80 */
81 bool equals(const shared_ptr<tcpip_endpoint>& rhs) const;
82
83
84private:
85 boost::asio::ip::tcp::endpoint asio_endpoint;
86};
87
88typedef boost::shared_ptr<tcpip_endpoint> TcpIP_EndpointPtr;
89//typedef boost::shared_ptr<const tcpip_endpoint> const_TcpIP_EndpointPtr;
90
91}} /* namespace ariba::addressing2 */
92#endif /* TCPIP_ENDPOINT_HPP_ */
Note: See TracBrowser for help on using the repository browser.