dtnmoteproxy.c File Reference

#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 data_packet DATAPACKET

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 (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 Documentation

#define DATAPACKET_SIZE   22

Definition at line 89 of file dtnmoteproxy.c.

#define DEBUG_PKT   0x03

Definition at line 91 of file dtnmoteproxy.c.

Referenced by read_packet(), and reader_thread().

#define dout   stderr

Definition at line 48 of file dtnmoteproxy.c.

Referenced by hexdump(), and reader_thread().

#define SURGE_PKT   0x11

Definition at line 90 of file dtnmoteproxy.c.

Referenced by read_packet().


Typedef Documentation

typedef struct data_packet DATAPACKET


Function Documentation

void hexdump ( unsigned char *  buf,
int  n 
)

Definition at line 372 of file dtnmoteproxy.c.

References dout.

void hexdump (  ) 

Referenced by read_packet_file(), and reader_thread().

void init_motes (  ) 

Definition at line 352 of file dtnmoteproxy.c.

References baud, devicename, open_serial_source(), reader_thread(), src, and stderr_msg().

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 119 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 
)

void parse_options ( int  ,
char **   
)

Definition at line 68 of file dtnrecv.c.

void print_eid ( char *  label,
dtn_endpoint_id_t eid 
)

void print_usage (  ) 

Definition at line 50 of file tca_admin.cc.

int read_packet ( char *  buf,
int *  n 
)

Definition at line 137 of file dtnmoteproxy.c.

References debug, DEBUG_PKT, read_serial_packet(), src, and SURGE_PKT.

Referenced by reader_thread().

void read_packet_file ( char *  filename  ) 

Definition at line 363 of file dtnmoteproxy.c.

References fd, and hexdump().

Referenced by readCommandLineArgs().

void readCommandLineArgs ( int  argc,
char **  argv 
)

Definition at line 302 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 162 of file dtnmoteproxy.c.

References arg_dest, bundle_id, bundle_spec, debug, DEBUG_PKT, 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, handle, hexdump(), data_packet::hop_cnt, data_packet::light, data_packet::origin_mote_id, parse_eid(), print_eid(), read_packet(), regid, 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  ) 

Definition at line 132 of file dtnmoteproxy.c.

References msgs.

Referenced by init_motes().

void usage ( char *  str1,
char *  str2 
)

Definition at line 336 of file dtnmoteproxy.c.


Variable Documentation

char arg_dest[128]

Definition at line 106 of file dtnmoteproxy.c.

char arg_target[128]

Definition at line 107 of file dtnmoteproxy.c.

char baud[128] = "57600"

Definition at line 110 of file dtnmoteproxy.c.

Referenced by init_motes(), and readCommandLineArgs().

u_int32_t debug = 0

Definition at line 112 of file dtnmoteproxy.c.

Referenced by check_options(), main(), read_packet(), readCommandLineArgs(), reader_thread(), and show_report().

char devicename[128] = "/dev/ttyS0"

Definition at line 109 of file dtnmoteproxy.c.

Referenced by init_motes(), and readCommandLineArgs().

char directory[128] = "send"

Definition at line 111 of file dtnmoteproxy.c.

int g_argc

Definition at line 115 of file dtnmoteproxy.c.

Referenced by main().

char** g_argv

Definition at line 116 of file dtnmoteproxy.c.

Referenced by main().

char* msgs[] [static]

Initial value:

 {
  "unknown_packet_type",
  "ack_timeout" ,
  "sync"        ,
  "too_long"    ,
  "too_short"   ,
  "bad_sync"    ,
  "bad_crc"     ,
  "closed"      ,
  "no_memory"   ,
  "unix_error"
}

Definition at line 54 of file dtnmoteproxy.c.

Referenced by stderr_msg().

char* progname

Definition at line 52 of file dtnmoteproxy.c.

serial_source src

Definition at line 113 of file dtnmoteproxy.c.

Referenced by buggyread(), close_serial_source(), oasys::MarshalCopy::copy(), dtn::ProphetTLV::create_bundle(), dtn_copy_eid(), escape_add(), escape_byte(), dtnsim::Simdtn2Command::exec(), dtnsim::NodeCommand::exec(), free_escaper(), TcaController::gate_reg(), TcaController::handle_coa_sent(), dtnsim::TrAgent::init(), init_escaper(), init_motes(), dtn::TcaRouter::is_local_source(), message(), open_serial_source(), packet_available(), pop_protocol_packet(), dtn::TcaRouter::post_bundle(), process_packet(), push_protocol_packet(), dtn::TcaRouter::push_wrapped_bundle(), read_and_process(), read_byte(), read_packet(), read_serial_packet(), dtn::BundlePayload::replace_with_file(), serial_source_empty(), serial_source_fd(), source_wait(), source_write(), terminate_escaper(), dtn::BundlePayload::write_data(), write_framed_packet(), and write_serial_packet().


Generated on Thu Jun 7 16:56:53 2007 for DTN Reference Implementation by  doxygen 1.5.1