Ignore:
Timestamp:
Jul 24, 2009, 3:23:11 PM (16 years ago)
Author:
mies
Message:

+ added new transport modules and adapted ariba to them
+ exchange endpoint descriptors an link establishment
+ clean up of base communication
+ link establishment with in the presence of multiple endpoints
+ local discovery for ipv6, ipv4 and bluetooth mac addresses

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/EndpointDescriptor.h

    r4986 r5284  
    4040#define ENDPOINTDESCRIPTOR_H_
    4141
     42// deprecated
     43//#include "ariba/communication/modules/network/ip/IPv4Locator.h"
     44
     45// deprecated
     46//using ariba::utility::Locator;
     47//using ariba::communication::IPv4Locator;
     48
     49// typical types
    4250#include "ariba/utility/types.h"
    4351#include "ariba/utility/serialization.h"
    44 #include "ariba/communication/modules/network/ip/IPv4Locator.h"
     52
     53// new addressing and transport
     54#include "ariba/utility/addressing/addressing.hpp"
     55#include "ariba/utility/transport/transport.hpp"
     56
     57// stdlibc++
    4558#include <string>
    4659#include <set>
    47 
    48 using std::string;
    49 using std::set;
    50 using ariba::utility::Locator;
    51 using ariba::communication::IPv4Locator;
    5260
    5361namespace ariba {
     
    5563
    5664using_serialization;
     65using namespace std;
     66using namespace ariba::addressing;
    5767
    58 class EndpointDescriptor : public VSerializeable {
    59         VSERIALIZEABLE;
    60 
     68class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE
    6169        friend class BaseCommunication;
    6270
    6371public:
    64         /**
    65          * The default constructor.
    66          */
    67         EndpointDescriptor();
     72        /// the unspecified endpoint descriptor
     73        static const EndpointDescriptor UNSPECIFIED;
    6874
    69         EndpointDescriptor(const EndpointDescriptor& rh);
    70         EndpointDescriptor(const Locator* _locator);
    71         EndpointDescriptor(const string str);
     75        /// creates an empty endpoint descriptor with zero endpoints
     76        EndpointDescriptor() : endpoints() {
     77        }
    7278
    73         /**
    74          * The destructor.
    75          */
     79        /// destructor.
    7680        virtual ~EndpointDescriptor();
    7781
    78         /**
    79          * An unspecified end-point
    80          */
    81         static const EndpointDescriptor UNSPECIFIED;
     82        /// copy constructor
     83        EndpointDescriptor(const EndpointDescriptor& rh) :
     84                endpoints(rh.endpoints) {
     85        }
    8286
    83         /**
    84          * Returns true, if the descriptor is unspecified.
    85          *
    86          * @return True, if the descriptor is unspecified.
    87          */
    88         bool isUnspecified() const;
     87        /// construct end-points from an endpoint set
     88        EndpointDescriptor(const endpoint_set& endpoints ) :
     89                endpoints(endpoints) {
     90        }
    8991
    90         virtual string toString() const;
    91         static EndpointDescriptor* fromString( string str );
     92        /// construct end-points from a string
     93        EndpointDescriptor(const string& str) : endpoints(str) {
     94        }
    9295
    93         bool operator==( const EndpointDescriptor& rh ) const;
    94         bool operator!=( const EndpointDescriptor& rh ) const;
     96        /// convert end-points to string
     97        string toString() const {
     98                return endpoints.to_string();
     99        }
     100
     101        /// returns true, if this object is the unspecified object
     102        bool isUnspecified() const {
     103                return this == &UNSPECIFIED;
     104        }
     105
     106        /// create endpoint
     107        static EndpointDescriptor* fromString(string str) {
     108                return new EndpointDescriptor(str);
     109        }
     110
     111        bool operator==(const EndpointDescriptor& rh) const {
     112                if (rh.isUnspecified() && isUnspecified()) return true;
     113                return false;
     114        }
     115
     116        bool operator!=(const EndpointDescriptor& rh) const {
     117                if (!rh.isUnspecified() && !isUnspecified()) return true;
     118                return false;
     119        }
     120
     121        EndpointDescriptor& operator=( const EndpointDescriptor& rhs) {
     122                endpoints = rhs.endpoints;
     123        }
     124
     125        /// returns the end-points of this descriptor
     126        endpoint_set& getEndpoints() {
     127                return endpoints;
     128        }
     129
     130        /// returns the end-points of this descriptor
     131        const endpoint_set& getEndpoints() const {
     132                return endpoints;
     133        }
    95134
    96135private:
    97         bool isUnspec;
    98         IPv4Locator* locator;
     136        endpoint_set endpoints;
    99137};
    100138
    101139}} // namespace ariba, communication
    102140
    103 sznBeginDefault( ariba::communication::EndpointDescriptor, X ) {
    104         uint8_t unspec = isUnspec;
    105 
    106         X && unspec && VO(locator);
    107 
    108         // when deserializing reset unspec flag
    109         if (X.isDeserializer()) isUnspec = unspec;
    110 } sznEnd();
     141sznBeginDefault( ariba::communication::EndpointDescriptor, X ){
     142        // serialize endpoints
     143        uint16_t len = endpoints.to_bytes_size();
     144        X && len;
     145        uint8_t* buffer = X.bytes( len );
     146        if (buffer!=NULL) {
     147                if (X.isDeserializer()) endpoints.assign(buffer,len);
     148                else endpoints.to_bytes(buffer);
     149        }
     150}sznEnd();
    111151
    112152#endif /*ENDPOINTDESCRIPTOR_H_*/
Note: See TracChangeset for help on using the changeset viewer.