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