00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DTLSR_H_
00018 #define _DTLSR_H_
00019
00020 #include <oasys/compat/inttypes.h>
00021 #include <oasys/serialize/SerializableVector.h>
00022 #include "naming/EndpointID.h"
00023
00024 namespace dtn {
00025
00026 class Bundle;
00027
00032 class DTLSR {
00033 public:
00034
00036 typedef enum {
00037 MSG_LSA = 1,
00038 MSG_EIDA = 2,
00039 } msg_type_t;
00040
00041
00043 class LinkParams : public oasys::SerializableObject {
00044 public:
00045 LinkParams() :
00046 state_(LINK_UP), cost_(0), delay_(0), bw_(0), qcount_(0), qsize_(0) {}
00047
00048 LinkParams(const oasys::Builder&) {}
00049 virtual ~LinkParams() {}
00050
00051 virtual void serialize(oasys::SerializeAction* a);
00052
00054 enum {
00055 LINK_UP = 0x1,
00056 LINK_DOWN = 0x2
00057 };
00058
00059 u_int8_t state_;
00060 u_int32_t cost_;
00061 u_int32_t delay_;
00062 u_int32_t bw_;
00063 u_int32_t qcount_;
00064 u_int32_t qsize_;
00065 };
00066
00067
00069 class LinkState : public oasys::SerializableObject {
00070 public:
00071 LinkState(){}
00072 LinkState(const oasys::Builder&) {}
00073 virtual ~LinkState() {}
00074
00075 virtual void serialize(oasys::SerializeAction* a);
00076
00077 EndpointID dest_;
00078 std::string id_;
00079 u_int32_t elapsed_;
00080
00081 LinkParams params_;
00082 };
00083
00084 typedef oasys::SerializableVector<LinkState> LinkStateVec;
00085
00086
00088 class LSA : public oasys::SerializableObject {
00089 public:
00090 LSA() {}
00091 LSA(const oasys::Builder&) {}
00092 virtual ~LSA() {}
00093
00094 virtual void serialize(oasys::SerializeAction* a);
00095
00096 u_int32_t seqno_;
00097
00098 LinkStateVec links_;
00099 };
00100
00104 static void format_lsa_bundle(Bundle* bundle, const LSA* lsa);
00105
00109 static bool parse_lsa_bundle(const Bundle* bundle, LSA* lsa);
00110 };
00111
00112 }
00113
00114 #endif