00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DICTIONARY_H_
00018 #define _DICTIONARY_H_
00019
00020 #include <oasys/serialize/SerializableVector.h>
00021 #include <servlib/naming/EndpointID.h>
00022
00023 namespace dtn {
00024
00030 class Dictionary : public oasys::SerializableObject {
00031 public:
00032 Dictionary();
00033 Dictionary(const oasys::Builder&);
00034 virtual ~Dictionary();
00035 virtual void serialize( oasys::SerializeAction *a );
00036
00038 u_int32_t length() const { return length_; }
00039 const u_char* dict() const { return dict_; }
00040 void set_dict(const u_char* dict, u_int32_t length);
00042
00047 void add_str(const std::string& str);
00048
00052 void add_eid(const EndpointID& eid)
00053 {
00054 add_str(eid.scheme_str());
00055 add_str(eid.ssp());
00056 }
00057
00062 bool get_offset(const std::string& str, u_int32_t* offset);
00063
00064 bool get_offset(const std::string& str, u_int64_t* offset);
00065
00070 bool get_offsets(const EndpointID& eid,
00071 u_int32_t* scheme_offset,
00072 u_int32_t* ssp_offset)
00073 {
00074 return (get_offset(eid.scheme_str(), scheme_offset) &&
00075 get_offset(eid.ssp(), ssp_offset));
00076 }
00077
00078 bool get_offsets(const EndpointID& eid,
00079 u_int64_t* scheme_offset,
00080 u_int64_t* ssp_offset)
00081 {
00082 return (get_offset(eid.scheme_str(), scheme_offset) &&
00083 get_offset(eid.ssp(), ssp_offset));
00084 }
00085
00090 bool extract_eid(EndpointID* eid,
00091 u_int32_t scheme_offset,
00092 u_int32_t ssp_offset);
00093
00094 bool extract_eid(EndpointID* eid,
00095 u_int64_t scheme_offset,
00096 u_int64_t ssp_offset);
00097
00098 protected:
00099 u_char* dict_;
00100 u_int32_t dict_length_;
00101 u_int32_t length_;
00102 };
00103
00104 }
00105
00106 #endif