dtncat.c File Reference

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include "dtn_api.h"

Go to the source code of this file.

Defines

#define DEFAULT_BUNDLE_COUNT   1
#define FAILURE_SCRIPT   ""
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define REG_EXPIRE   (60 * 60)
#define CHECK_SET(_arg, _what)

Functions

void parse_options (int, char **)
dtn_endpoint_id_tparse_eid (dtn_handle_t handle, dtn_endpoint_id_t *eid, char *str)
void print_usage ()
void print_eid (FILE *, char *label, dtn_endpoint_id_t *eid)
int fill_payload (dtn_bundle_payload_t *payload)
void to_bundles ()
void from_bundles ()
void make_registration (dtn_reg_info_t *)
int main (int argc, char **argv)

Variables

char * progname
int copies = 1
int verbose = 0
int expiration = 3600
int delivery_receipts = 0
int forwarding_receipts = 0
int custody = 0
int custody_receipts = 0
int receive_receipts = 0
int wait_for_report = 0
int bundle_count = -1
char * arg_replyto = NULL
char * arg_source = NULL
char * arg_dest = NULL
char * arg_receive = NULL
dtn_reg_id_t regid = DTN_REGID_NONE
FILE * info
char payload_buf [DTN_MAX_BUNDLE_MEM]
int from_bundles_flag
dtn_handle_t handle
dtn_bundle_spec_t bundle_spec
dtn_bundle_spec_t reply_spec
dtn_bundle_payload_t primary_payload
dtn_bundle_payload_t reply_payload
dtn_bundle_id_t bundle_id
struct timeval start end


Define Documentation

#define CHECK_SET ( _arg,
_what   ) 

Value:

if (_arg == 0) {                                                    \
        fprintf(stderr, "%s: %s must be specified\n", progname, _what); \
        print_usage();                                                  \
        exit(EXIT_FAILURE);                                             \
    }

Referenced by parse_options().

#define DEFAULT_BUNDLE_COUNT   1

Definition at line 54 of file dtncat.c.

Referenced by parse_options().

#define FAILURE_SCRIPT   ""

Definition at line 55 of file dtncat.c.

Referenced by make_registration().

#define MIN ( a,
 )     ((a) < (b) ? (a) : (b))

Definition at line 60 of file dtncat.c.

#define REG_EXPIRE   (60 * 60)

Definition at line 79 of file dtncat.c.

Referenced by make_registration().


Function Documentation

void fill_payload ( dtn_bundle_payload_t payload  ) 

Definition at line 521 of file dtncat.c.

References DTN_ESIZE, DTN_PAYLOAD_MEM, dtn_set_payload(), MIN, and payload_buf.

Referenced by main(), and to_bundles().

void from_bundles (  ) 

Definition at line 141 of file dtncat.c.

References arg_receive, dtn_bundle_payload_t::buf, dtn_bundle_payload_t::buf_len, dtn_bundle_payload_t::buf_val, bundle_count, dtn_copy_eid(), dtn_errno(), DTN_PAYLOAD_MEM, dtn_recv(), dtn_strerror(), dtn_reg_info_t::endpoint, handle, info, make_registration(), parse_eid(), progname, dtn_bundle_spec_t::source, dtn_endpoint_id_t::uri, and verbose.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 98 of file dtncat.c.

References dtn_close(), dtn_open(), dtn_strerror(), DTN_SUCCESS, errno, from_bundles(), from_bundles_flag, dtnsim::gettimeofday(), handle, info, parse_options(), progname, to_bundles(), and verbose.

void make_registration ( dtn_reg_info_t reginfo  ) 

Definition at line 547 of file dtncat.c.

References dtn_bind(), DTN_ENOTFOUND, dtn_errno(), dtn_find_registration(), DTN_REG_DEFER, dtn_register(), dtn_strerror(), DTN_SUCCESS, dtn_reg_info_t::endpoint, dtn_reg_info_t::expiration, dtn_reg_info_t::failure_action, FAILURE_SCRIPT, handle, info, progname, REG_EXPIRE, dtn_reg_info_t::regid, regid, dtn_reg_info_t::script, dtn_reg_info_t::script_len, dtn_reg_info_t::script_val, and verbose.

Referenced by from_bundles(), and to_bundles().

dtn_endpoint_id_t * parse_eid ( dtn_handle_t  handle,
dtn_endpoint_id_t eid,
char *  str 
)

Definition at line 492 of file dtncat.c.

References dtn_build_local_eid(), dtn_parse_eid_string(), info, and verbose.

Referenced by from_bundles(), main(), reader_thread(), and to_bundles().

void parse_options ( int  argc,
char **  argv 
)

Definition at line 375 of file dtncat.c.

References arg_dest, arg_receive, arg_replyto, arg_source, bundle_count, CHECK_SET, custody, custody_receipts, DEFAULT_BUNDLE_COUNT, delivery_receipts, expiration, forwarding_receipts, from_bundles_flag, print_usage(), progname, receive_receipts, regid, verbose, and wait_for_report.

Referenced by main().

void print_eid ( FILE *  dest,
char *  label,
dtn_endpoint_id_t eid 
)

Definition at line 511 of file dtncat.c.

References dtn_endpoint_id_t::uri.

Referenced by main(), reader_thread(), and to_bundles().

void print_usage (  ) 

Definition at line 343 of file dtncat.c.

References progname.

Referenced by parse_options().

void to_bundles (  ) 

Definition at line 239 of file dtncat.c.

References arg_dest, arg_replyto, arg_source, dtn_bundle_payload_t::buf, dtn_bundle_payload_t::buf_len, custody, custody_receipts, delivery_receipts, dtn_bundle_spec_t::dest, dtn_bundle_spec_t::dopts, DOPTS_CUSTODY, DOPTS_CUSTODY_RCPT, DOPTS_DELIVERY_RCPT, DOPTS_FORWARD_RCPT, DOPTS_RECEIVE_RCPT, dtn_copy_eid(), dtn_errno(), DTN_PAYLOAD_MEM, dtn_recv(), dtn_send(), dtn_strerror(), end, dtn_reg_info_t::endpoint, errno, expiration, dtn_bundle_spec_t::expiration, fill_payload(), forwarding_receipts, dtnsim::gettimeofday(), handle, info, make_registration(), parse_eid(), print_eid(), progname, receive_receipts, dtn_bundle_spec_t::replyto, dtn_bundle_spec_t::source, dtn_endpoint_id_t::uri, verbose, and wait_for_report.

Referenced by main().


Variable Documentation

char* arg_dest = NULL

Definition at line 65 of file dtncat.c.

Referenced by main(), parse_options(), readCommandLineArgs(), reader_thread(), and to_bundles().

char* arg_receive = NULL

Definition at line 66 of file dtncat.c.

Referenced by from_bundles(), and parse_options().

char* arg_replyto = NULL

Definition at line 63 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

char* arg_source = NULL

Definition at line 64 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

int bundle_count = -1

Definition at line 52 of file dtncat.c.

Referenced by from_bundles(), and parse_options().

dtn_bundle_id_t bundle_id

Definition at line 93 of file dtncat.c.

Referenced by main(), reader_thread(), TcaController::send_bundle(), and dtntunnel::DTNTunnel::send_bundle().

dtn_bundle_spec_t bundle_spec

Definition at line 89 of file dtncat.c.

Referenced by main(), and reader_thread().

int copies = 1

Definition at line 41 of file dtncat.c.

Referenced by main().

int custody = 0

Definition at line 48 of file dtncat.c.

Referenced by dtn::BundleTLV::deserialize(), dtn::RIBTLV::deserialize(), dtn::ProphetEncounter::handle_bundle_tlv(), main(), parse_options(), and to_bundles().

int custody_receipts = 0

Definition at line 49 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

int delivery_receipts = 0

Definition at line 46 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

struct timeval start end

Definition at line 94 of file dtncat.c.

Referenced by dtn::APIServer::APIServer(), oasys::SMTP::client_session(), dtn::PrimaryBlockProcessor::debug_dump_dictionary(), dtnipc_open(), oasys::StringHashSet::dump(), oasys::StringSet::dump(), oasys::BoundedPriorityQueue< dtn::Bundle *, dtn::BundleSz, dtn::QueueComp >::enforce_bound(), dtnsim::SimCommand::exec(), dtnsim::NodeCommand::exec(), dtnsim::ConnCommand::exec(), dtn::BlockInfoVec::find_block(), dtn::PointerList< T >::free(), oasys::UnitTester::init(), oasys::Log::log_multiline(), dtnsim::ConnState::parse_bw(), oasys::URL::parse_internal(), dtnsim::ConnState::parse_time(), oasys::SMTP::process_response(), dtn::RouteEntryVec::sort_by_priority(), to_bundles(), and oasys::tokenize().

int expiration = 3600

Definition at line 45 of file dtncat.c.

Referenced by doOptions(), main(), parse_options(), and to_bundles().

int forwarding_receipts = 0

Definition at line 47 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

int from_bundles_flag

Definition at line 82 of file dtncat.c.

Referenced by main(), and parse_options().

dtn_handle_t handle

Definition at line 88 of file dtncat.c.

Referenced by dtn_begin_poll(), dtn_bind(), dtn_build_local_eid(), dtn_cancel_poll(), dtn_change_registration(), dtn_find_registration(), dtn_open(), dtn_recv(), dtn_register(), dtn_send(), dtn_unbind(), dtn_unregister(), DTNOpenCommand::exec(), from_bundles(), main(), make_registration(), open_serial_source(), reader_thread(), and to_bundles().

FILE* info

Definition at line 78 of file dtncat.c.

Referenced by dtn::BundleProtocol::consume(), dtn::ForwardingLog::dump(), from_bundles(), dtn::ForwardingLog::get_latest_entry(), dtn::APIClient::handle_send(), dtnsim::SimConvergenceLayer::init_link(), main(), make_registration(), parse_eid(), oasys::StackTrace::print_trace(), dtnsim::SimConvergenceLayer::send_bundle(), dtn::TableBasedRouter::should_fwd(), dtn::ProphetDecider::should_fwd(), dtn::ProphetEncounter::should_fwd(), and to_bundles().

char payload_buf[DTN_MAX_BUNDLE_MEM]

Definition at line 80 of file dtncat.c.

Referenced by dtn::LoggingRegistration::deliver_bundle(), dtn::LinkStateRouter::LSRegistration::deliver_bundle(), dtn::AdminRegistration::deliver_bundle(), fill_payload(), dtn::AnnounceBundle::parse_announce_bundle(), and dtn::TclRegistration::parse_bundle_data().

dtn_bundle_payload_t primary_payload

Definition at line 91 of file dtncat.c.

char* progname

Definition at line 38 of file dtncat.c.

Referenced by doOptions(), from_bundles(), main(), make_registration(), parse_options(), print_usage(), to_bundles(), and usage().

int receive_receipts = 0

Definition at line 50 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().

dtn_reg_id_t regid = DTN_REGID_NONE

Definition at line 68 of file dtncat.c.

Referenced by dtn::RegistrationCommand::exec(), DTNUnbindCommand::exec(), DTNBindCommand::exec(), DTNUnregisterCommand::exec(), DTNRegisterCommand::exec(), dtn::APIClient::handle_bind(), dtn::APIClient::handle_find_registration(), dtn::APIClient::handle_register(), dtn::APIClient::handle_unbind(), dtn::APIClient::handle_unregister(), dtntunnel::DTNTunnel::init_registration(), main(), make_registration(), parse_options(), and reader_thread().

dtn_bundle_payload_t reply_payload

Definition at line 92 of file dtncat.c.

Referenced by main().

dtn_bundle_spec_t reply_spec

Definition at line 90 of file dtncat.c.

Referenced by main().

int verbose = 0

Definition at line 42 of file dtncat.c.

Referenced by check_options(), from_bundles(), main(), make_registration(), parse_eid(), parse_options(), and to_bundles().

int wait_for_report = 0

Definition at line 51 of file dtncat.c.

Referenced by main(), parse_options(), and to_bundles().


Generated on Sat Sep 8 08:43:38 2007 for DTN Reference Implementation by  doxygen 1.5.3