Hello, I'm trying to understand how the tool dtnsend (in openwrt) implements the priority option -p because I want to make some modifications into it and add some code that works in the same way.
Reading the code, I've found that .../api/Bundle.ccp has the function "void Bundle::setPriority(Bundle::BUNDLE_PRIORITY p)" that changes the 2 priority bits of the bundle with b.set(dtn::data::Bundle::PRIORITY_BIT[1-2], [false or true]).
Whats the meaning of this two similar functions? Whats the idea of adding procflags in the condition?
On another hand, what I want to know is how the DTN node processes this priority info. For example. If you first send a file with -p 1 (normal), after this, another one with -p 0 (low) and last, another one with -p 1 (normal). If everything goes well, the last one should be shipped before the one with priority -p 0. Where is this algorithm implemented in the code? I tried to find it but the only part of the code that shows something relevant about this is in daemon/src/storage/MemoryBundleStorage.h:
private:
00111 ibrcommon::Mutex _bundleslock;
00112 std::set<dtn::data::Bundle> _bundles;
00113
00114 struct CMP_BUNDLE_PRIORITY
00115 {
00116 bool operator() (const dtn::data::MetaBundle& lhs, const dtn::data::MetaBundle& rhs) const
00117 {
00118 if (lhs.getPriority() == rhs.getPriority())
00119 return rhs > lhs;
00120
00121 return (lhs.getPriority() > rhs.getPriority());
00122 }
00123 };
00124
00125 std::set<dtn::data::MetaBundle, CMP_BUNDLE_PRIORITY> _priority_index;
00126 std::map<dtn::data::BundleID, ssize_t> _bundle_lengths;
00127
00128 size_t _maxsize;
00129 size_t _currentsize;
But I dont't really understand how the change in the "storage queue"is done depending if a file has a higher or a lower priority than others that are in this queue. Where in the code is the queue of files stored in the dtn node and who send them? What means rhs and lhs?
Thank you in advance.