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 "Contact.h"
00022 #include "bundling/Bundle.h"
00023 #include "bundling/BundleDaemon.h"
00024 #include "bundling/BundleEvent.h"
00025 #include "bundling/BundleList.h"
00026 #include "conv_layers/ConvergenceLayer.h"
00027
00028 namespace dtn {
00029
00033 Contact::Contact(const LinkRef& link)
00034 : RefCountedObject("/dtn/contact/refs"),
00035 Logger("Contact", "/dtn/contact/%s",link->name()),
00036 link_(link.object(), "Contact"), cl_info_(NULL)
00037 {
00038 start_time_.get_time();
00039 duration_ = 0;
00040 bps_ = 0;
00041 latency_ = 0;
00042
00043 log_info("new contact *%p", this);
00044 }
00045
00046 Contact::~Contact()
00047 {
00048 ASSERT(cl_info_ == NULL);
00049 }
00050
00054 int
00055 Contact::format(char* buf, size_t sz) const
00056 {
00057 return snprintf(buf, sz, "contact %s (started %u.%u)",
00058 link_->nexthop(),
00059 start_time_.sec_, start_time_.usec_);
00060 }
00061
00062 void
00063 Contact::serialize(oasys::SerializeAction *a)
00064 {
00065 a->process("start_time_sec", &start_time_.sec_);
00066 a->process("start_time_usec", &start_time_.usec_);
00067 a->process("duration", &duration_);
00068 a->process("bps", &bps_);
00069 a->process("latency", &latency_);
00070 a->process("link", link_.object());
00071 }
00072
00073 }