35 const unsigned int BundleID::RAW_LENGTH_MAX = 33 + 1024 + 1 + 1024;
38 : source(), timestamp(0), sequencenumber(0), fragmentoffset(0), _fragment(false), _payloadlength(0)
43 : source(id.source), timestamp(id.timestamp), sequencenumber(id.sequencenumber),
44 fragmentoffset(id.fragmentoffset), _fragment(id.isFragment()), _payloadlength(id.getPayloadLength())
88 return !(((*this) < other) || ((*
this) == other));
93 return !((*this) == other);
114 return _payloadlength;
119 _payloadlength = value;
134 unsigned char data[RAW_LENGTH_MAX];
135 const size_t data_len =
raw((
unsigned char*)&data, RAW_LENGTH_MAX);
136 bf.insert((
unsigned char*)&data, data_len);
141 unsigned char data[RAW_LENGTH_MAX];
142 const size_t data_len =
raw((
unsigned char*)&data, RAW_LENGTH_MAX);
143 return bf.contains((
unsigned char*)&data, data_len);
151 if (len < 33)
return 0;
155 ::memcpy(data, reinterpret_cast<unsigned char*>(&tmp),
sizeof(tmp));
160 ::memcpy(data, reinterpret_cast<unsigned char*>(&tmp),
sizeof(tmp));
165 data +=
sizeof(uint8_t);
169 ::memcpy(data, reinterpret_cast<unsigned char*>(&tmp),
sizeof(tmp));
174 ::memcpy(data, reinterpret_cast<unsigned char*>(&tmp),
sizeof(tmp));
181 ::strncpy((
char*)data, s.c_str(), len - 33);
183 if ((len - 33) < s.length()) {
186 return 33 + s.length();
232 stream.
get((
char&)frag);
std::string toString() const
bool isIn(const ibrcommon::BloomFilter &bf) const
std::ostream & operator<<(std::ostream &stream, const BundleID &obj)
bool operator>(const BundleID &other) const
BundleID & operator=(const BundleID &id)
dtn::data::Timestamp timestamp
size_t raw(unsigned char *data, size_t len) const
virtual dtn::data::Length getPayloadLength() const
virtual void setFragment(bool val)
bool operator!=(const BundleID &other) const
bool operator<(const BundleID &other) const
void addTo(ibrcommon::BloomFilter &bf) const
dtn::data::Number sequencenumber
std::string toString() const
std::istream & operator>>(std::istream &stream, BundleID &obj)
std::string getString() const
dtn::data::SDNV< Size > Number
dtn::data::Number fragmentoffset
virtual void setPayloadLength(const dtn::data::Length &value)
virtual bool isFragment() const
bool operator==(const BundleID &other) const