#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <fcntl.h>
#include <string.h>
#include "serialsource.h"
#include <strings.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <oasys/compat/inttypes.h>
#include "dtn_api.h"
#include <ctype.h>
Go to the source code of this file.
Classes | |
struct | data_packet |
Defines | |
#define | dout stderr |
#define | DATAPACKET_SIZE 22 |
#define | SURGE_PKT 0x11 |
#define | DEBUG_PKT 0x03 |
Typedefs | |
typedef struct data_packet | DATAPACKET |
Functions | |
void | parse_options (int, char **) |
dtn_endpoint_id_t * | parse_eid (dtn_handle_t handle, dtn_endpoint_id_t *eid, char *str) |
void | print_usage () |
void | print_eid (char *label, dtn_endpoint_id_t *eid) |
void | init_motes () |
void | stderr_msg (serial_source_msg problem) |
void | usage (char *str1, char *str2) |
void | readCommandLineArgs (int argc, char **argv) |
void | hexdump () |
void | read_packet_file (char *filename) |
int | main (int argc, char **argv) |
int | read_packet (char *buf, int *n) |
int | reader_thread (void *p) |
void | hexdump (unsigned char *buf, int n) |
Variables | |
char * | progname |
static char * | msgs [] |
char | arg_dest [128] |
char | arg_target [128] |
char | devicename [128] = "/dev/ttyS0" |
char | baud [128] = "57600" |
char | directory [128] = "send" |
u_int32_t | debug = 0 |
serial_source | src |
int | g_argc |
char ** | g_argv |
#define DATAPACKET_SIZE 22 |
Definition at line 92 of file dtnmoteproxy.c.
#define DEBUG_PKT 0x03 |
Definition at line 94 of file dtnmoteproxy.c.
Referenced by read_packet(), and reader_thread().
#define dout stderr |
Definition at line 51 of file dtnmoteproxy.c.
Referenced by hexdump(), and reader_thread().
#define SURGE_PKT 0x11 |
Definition at line 93 of file dtnmoteproxy.c.
Referenced by read_packet().
typedef struct data_packet DATAPACKET |
void hexdump | ( | unsigned char * | buf, | |
int | n | |||
) |
Definition at line 377 of file dtnmoteproxy.c.
References dout.
void hexdump | ( | ) |
Referenced by read_packet_file(), and reader_thread().
void init_motes | ( | ) |
Definition at line 357 of file dtnmoteproxy.c.
References baud, devicename, open_serial_source(), reader_thread(), and stderr_msg().
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 122 of file dtnmoteproxy.c.
References g_argc, g_argv, init_motes(), and readCommandLineArgs().
dtn_endpoint_id_t* parse_eid | ( | dtn_handle_t | handle, | |
dtn_endpoint_id_t * | eid, | |||
char * | str | |||
) |
Definition at line 392 of file dtnmoteproxy.c.
References dtn_build_local_eid(), and dtn_parse_eid_string().
void parse_options | ( | int | , | |
char ** | ||||
) |
Definition at line 424 of file dtncat.c.
References aggregate, arg_dest, arg_receive, arg_replyto, arg_source, arg_target, bundle_count, bundle_dir, bundle_payload, bundletype, change, CHECK_SET, copies, COS_BULK, COS_EXPEDITED, COS_NORMAL, COS_RESERVED, count, csv_out, custody, custody_receipts, data_qty, data_source, data_unit, date_buf, debug, DEFAULT_BUNDLE_COUNT, delivery_options, delivery_receipts, DOPTS_CUSTODY, DOPTS_CUSTODY_RCPT, DOPTS_DELETE_RCPT, DOPTS_DELIVERY_RCPT, DOPTS_DO_NOT_FRAGMENT, DOPTS_FORWARD_RCPT, DOPTS_MULTINODE_DEST, DOPTS_RECEIVE_RCPT, DOPTS_SINGLETON_DEST, DTN_PAYLOAD_FILE, DTN_PAYLOAD_MEM, DTN_PAYLOAD_TEMP_FILE, DTN_REG_DEFER, DTN_REG_DROP, DTN_REG_EXEC, DTN_REGID_NONE, endpoint, expiration, expiration_time, ext_blocks, failure_action, failure_script, file_name_src, filename, findDataUnit(), forwarding_receipts, from_bundles_flag, kilo2byte(), mega2byte(), n_arg, n_copies, no_find_reg, ExtBlock::num_meta_blocks_, obsoletes_id, op_mode, p_arg, payload_type, print_usage(), priority, progname, quiet, receive_receipts, recv_timeout, regid, register_only, sequence_id, sleep_time, sleepVal, transmission_time, unregister, usage(), use_file, verbose, and wait_for_report.
Referenced by main().
void print_eid | ( | char * | label, | |
dtn_endpoint_id_t * | eid | |||
) |
Definition at line 414 of file dtnmoteproxy.c.
References dtn_endpoint_id_t::uri.
void print_usage | ( | ) |
int read_packet | ( | char * | buf, | |
int * | n | |||
) |
Definition at line 140 of file dtnmoteproxy.c.
References debug, DEBUG_PKT, read_serial_packet(), and SURGE_PKT.
Referenced by reader_thread().
void read_packet_file | ( | char * | filename | ) |
Definition at line 368 of file dtnmoteproxy.c.
References buf, fd, and hexdump().
Referenced by readCommandLineArgs().
void readCommandLineArgs | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 307 of file dtnmoteproxy.c.
References arg_dest, baud, debug, devicename, read_packet_file(), and usage().
Referenced by main().
int reader_thread | ( | void * | p | ) |
Definition at line 165 of file dtnmoteproxy.c.
References arg_dest, bundle_id, bundle_spec, debug, DEBUG_PKT, dtn_bundle_spec_t::dest, dtn_bundle_spec_t::dopts, DOPTS_DELIVERY_RCPT, dout, dtn_close(), dtn_copy_eid(), dtn_errno(), dtn_open(), DTN_PAYLOAD_MEM, DTN_REG_DEFER, DTN_REGID_NONE, dtn_register(), dtn_send(), dtn_set_payload(), dtn_strerror(), DTN_SUCCESS, dtn_reg_info_t::endpoint, dtn_bundle_spec_t::expiration, dtn_reg_info_t::expiration, dtn_reg_info_t::flags, handle, hexdump(), data_packet::hop_cnt, data_packet::light, data_packet::origin_mote_id, parse_eid(), print_eid(), read_packet(), dtn_reg_info_t::regid, regid, dtn_bundle_spec_t::replyto, dtn_bundle_spec_t::source, data_packet::source_mote_id, data_packet::surge_parent_addr, data_packet::surge_pkt_type, data_packet::surge_seq_no, and data_packet::temp.
Referenced by init_motes().
void stderr_msg | ( | serial_source_msg | problem | ) |
void usage | ( | char * | str1, | |
char * | str2 | |||
) |
Definition at line 341 of file dtnmoteproxy.c.
char arg_dest[128] |
Definition at line 109 of file dtnmoteproxy.c.
char arg_target[128] |
Definition at line 110 of file dtnmoteproxy.c.
char baud[128] = "57600" |
Definition at line 113 of file dtnmoteproxy.c.
Referenced by init_motes(), and readCommandLineArgs().
u_int32_t debug = 0 |
Definition at line 115 of file dtnmoteproxy.c.
Referenced by check_options(), main(), parse_options(), read_packet(), readCommandLineArgs(), reader_thread(), and show_report().
char devicename[128] = "/dev/ttyS0" |
Definition at line 112 of file dtnmoteproxy.c.
Referenced by init_motes(), and readCommandLineArgs().
char directory[128] = "send" |
Definition at line 114 of file dtnmoteproxy.c.
int g_argc |
Definition at line 118 of file dtnmoteproxy.c.
Referenced by main().
char** g_argv |
Definition at line 119 of file dtnmoteproxy.c.
Referenced by main().
char* msgs[] [static] |
{ "unknown_packet_type", "ack_timeout" , "sync" , "too_long" , "too_short" , "bad_sync" , "bad_crc" , "closed" , "no_memory" , "unix_error" }
Definition at line 57 of file dtnmoteproxy.c.
Referenced by stderr_msg().
char* progname |
Definition at line 55 of file dtnmoteproxy.c.
Definition at line 116 of file dtnmoteproxy.c.
Referenced by dtnsim::NodeCommand::exec(), TcaController::gate_reg(), TcaController::handle_coa_sent(), dtn::TcaRouter::is_local_source(), open_serial_source(), and dtn::BundlePayload::replace_with_file().