A simple utility class used mostly for testing registrations. More...
#include <TclRegistration.h>
Public Member Functions | |
TclRegistration (const EndpointIDPattern &endpoint, Tcl_Interp *interp) | |
int | exec (int argc, const char **argv, Tcl_Interp *interp) |
int | get_list_channel (Tcl_Interp *interp) |
Return in the tcl result a Tcl_Channel to wrap the BundleList's notifier pipe. | |
int | get_bundle_data (Tcl_Interp *interp) |
Assuming the list channel has been notified, pops a bundle off the list and then returns in the tcl result a list of the relevant metadata and the payload data. | |
void | deliver_bundle (Bundle *bundle) |
virtual from Registration | |
Static Public Member Functions | |
static int | parse_bundle_data (Tcl_Interp *interp, const BundleRef &b, Tcl_Obj **result) |
Parse the given bundle's internals into a new tcl list object (or an error if parsing fails). | |
Protected Attributes | |
BlockingBundleList * | bundle_list_ |
Tcl_Channel | notifier_channel_ |
A simple utility class used mostly for testing registrations.
When created, this sets up a new registration within the daemon, and for any bundles that arrive, outputs logs of the bundle header fields as well as the payload data (if ascii). The implementation is structured as a thread that blocks (forever) waiting for bundles to arrive on the registration's bundle list, then tcl the bundles and looping again.
Definition at line 42 of file TclRegistration.h.
dtn::TclRegistration::TclRegistration | ( | const EndpointIDPattern & | endpoint, | |
Tcl_Interp * | interp | |||
) |
Definition at line 29 of file TclRegistration.cc.
References dtn::EndpointID::c_str(), dtn::Registration::DEFER, endpoint, and dtn::GlobalStore::instance().
void dtn::TclRegistration::deliver_bundle | ( | Bundle * | bundle | ) | [virtual] |
virtual from Registration
Implements dtn::Registration.
Definition at line 50 of file TclRegistration.cc.
int dtn::TclRegistration::exec | ( | int | argc, | |
const char ** | argv, | |||
Tcl_Interp * | interp | |||
) |
Definition at line 56 of file TclRegistration.cc.
int dtn::TclRegistration::get_bundle_data | ( | Tcl_Interp * | interp | ) |
Assuming the list channel has been notified, pops a bundle off the list and then returns in the tcl result a list of the relevant metadata and the payload data.
Definition at line 91 of file TclRegistration.cc.
int dtn::TclRegistration::get_list_channel | ( | Tcl_Interp * | interp | ) |
Return in the tcl result a Tcl_Channel to wrap the BundleList's notifier pipe.
Definition at line 81 of file TclRegistration.cc.
int dtn::TclRegistration::parse_bundle_data | ( | Tcl_Interp * | interp, | |
const BundleRef & | b, | |||
Tcl_Obj ** | result | |||
) | [static] |
Parse the given bundle's internals into a new tcl list object (or an error if parsing fails).
Return a Tcl list key-value pairs detailing bundle contents to a registered procedure each time a bundle arrives.
The returned TCL list is suitable for assigning to an array, e.g. array set b $bundle_info
Using the TclListSerialize class, all fields that are serialized in Bundle::serialize will be present in the returned tcl list.
ADMIN-BUNDLE-ONLY KEY-VALUE PAIRS:
admin_type : the Admin Type (the following pairs are only defined if the admin_type = "Stauts Report") reason_code : Reason Code string orig_creation_ts : creation timestamp of original bundle orig_source : EID of the original bundle's source
ADMIN-BUNDLE-ONLY OPTIONAL KEY-VALUE PAIRS:
orig_frag_offset : Offset of fragment orig_frag_length : Length of original bundle
STATUS-REPORT-ONLY OPTIONAL KEY-VALUE PAIRS
(Note that the presence of timestamp keys implies a corresponding flag has been set true. For example if forwarded_time is returned the Bundle Forwarded status flag was set; if frag_offset and frag_length are returned the ACK'ed bundle was fragmented.)
sr_reason : status report reason code sr_received_time : bundle reception timestamp sr_custody_time : bundle custody transfer timestamp sr_forwarded_time : bundle forwarding timestamp sr_delivered_time : bundle delivery timestamp sr_deletion_time : bundle deletion timestamp
CUSTODY-SIGNAL-ONLY OPTIONAL KEY-VALUE PAIRS
custody_succeeded : boolean if custody transfer succeeded custody_reason : reason information custody_signal_time : custody transfer time
Definition at line 157 of file TclRegistration.cc.
BlockingBundleList* dtn::TclRegistration::bundle_list_ [protected] |
Definition at line 73 of file TclRegistration.h.
Tcl_Channel dtn::TclRegistration::notifier_channel_ [protected] |
Definition at line 74 of file TclRegistration.h.