00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <oasys/util/StringBuffer.h>
00019
00020 #include "Simulator.h"
00021 #include "SimRegistration.h"
00022 #include "Topology.h"
00023 #include "bundling/Bundle.h"
00024 #include "bundling/BundleDaemon.h"
00025 #include "bundling/BundleEvent.h"
00026 #include "storage/GlobalStore.h"
00027
00028 using namespace dtn;
00029
00030 namespace dtnsim {
00031
00032 SimRegistration::SimRegistration(Node* node, const EndpointID& endpoint)
00033 : Registration(GlobalStore::instance()->next_regid(),
00034 endpoint, DEFER, 0), node_(node)
00035 {
00036 logpathf("/reg/%s/%d", node->name(), regid_);
00037
00038 log_debug("new sim registration");
00039 }
00040
00041 void
00042 SimRegistration::deliver_bundle(Bundle* bundle)
00043 {
00044 size_t payload_len = bundle->payload_.length();
00045
00046 log_info("N[%s]: RCV id:%d %s -> %s size:%zu",
00047 node_->name(), bundle->bundleid_,
00048 bundle->source_.c_str(), bundle->dest_.c_str(),
00049 payload_len);
00050
00051 BundleDaemon::post(new BundleDeliveredEvent(bundle, this));
00052
00053
00054 double now = Simulator::time();
00055 arrivals_[now] = bundle;
00056 }
00057
00058 }