dtn::IPDiscovery Class Reference

IPDiscovery is the main thread in IP-based neighbor discovery, configured via config file or command console to listen to a specified UDP port for unicast, broadcast, or multicast beacons from advertising neighbors. More...

#include <IPDiscovery.h>

Inheritance diagram for dtn::IPDiscovery:

dtn::Discovery

List of all members.

Classes

struct  DiscoveryHeader
 On-the-wire (radio, whatever) representation of IP address family's advertisement beacon. More...

Public Types

enum  cl_type_t { UNDEFINED = 0, TCPCL = 1, UDPCL = 2 }
 Enumerate which type of CL is advertised. More...

Public Member Functions

void shutdown ()
 Close main socket, causing thread to exit.
virtual ~IPDiscovery ()

Static Public Member Functions

static const char * type_to_str (cl_type_t t)
static cl_type_t str_to_type (const char *cltype)

Public Attributes

struct
dtn::IPDiscovery::DiscoveryHeader 
packed
 On-the-wire (radio, whatever) representation of IP address family's advertisement beacon.

Static Public Attributes

static const u_int32_t DEFAULT_DST_ADDR = 0xffffffff
 If no other options are set for destination, default to sending to the IPv4 broadcast address.
static const u_int32_t DEFAULT_SRC_ADDR = INADDR_ANY
 If no other options are set for source, use this as default local address.
static const u_int DEFAULT_MCAST_TTL = 1
 If no other options are set for multicast TTL, set to 1.

Protected Member Functions

 IPDiscovery (const std::string &name)
bool configure (int argc, const char *argv[])
 Set internal state using parameter list; return true on success, else false.
void run ()
 virtual from oasys::Thread
bool parse_advertisement (u_char *buf, size_t len, in_addr_t remote_addr, u_int8_t &cl_type, std::string &nexthop, EndpointID &remote_eid)
 Convenience method to pull the relevant items out of the inbound packet.
void handle_announce ()
 Virtual from Discovery.

Protected Attributes

volatile bool shutdown_
 signal to close down thread
in_addr_t local_addr_
 address for bind() to receive beacons
u_int16_t port_
 local and remote
in_addr_t remote_addr_
 whether unicast, multicast, or broadcast
u_int mcast_ttl_
 TTL hop count for multicast option.
oasys::UDPClient socket_
 the socket for beacons in- and out-bound
bool persist_
 whether to exit thread on send/recv failures

Friends

class Discovery


Detailed Description

IPDiscovery is the main thread in IP-based neighbor discovery, configured via config file or command console to listen to a specified UDP port for unicast, broadcast, or multicast beacons from advertising neighbors.

Definition at line 35 of file IPDiscovery.h.


Member Enumeration Documentation

Enumerate which type of CL is advertised.

Enumerator:
UNDEFINED 
TCPCL 
UDPCL 

Definition at line 76 of file IPDiscovery.h.


Constructor & Destructor Documentation

virtual dtn::IPDiscovery::~IPDiscovery (  )  [inline, virtual]

Definition at line 112 of file IPDiscovery.h.

dtn::IPDiscovery::IPDiscovery ( const std::string &  name  )  [protected]


Member Function Documentation

bool dtn::IPDiscovery::configure ( int  argc,
const char *  argv[] 
) [protected, virtual]

Set internal state using parameter list; return true on success, else false.

Implements dtn::Discovery.

Definition at line 51 of file IPDiscovery.cc.

References buf, dtn::Discovery::local_, local_addr_, mcast_ttl_, persist_, port_, remote_addr_, socket_, and dtn::Discovery::to_addr_.

void dtn::IPDiscovery::handle_announce (  )  [inline, protected, virtual]

Virtual from Discovery.

Reimplemented from dtn::Discovery.

Definition at line 143 of file IPDiscovery.h.

References socket_.

bool dtn::IPDiscovery::parse_advertisement ( u_char *  buf,
size_t  len,
in_addr_t  remote_addr,
u_int8_t &  cl_type,
std::string &  nexthop,
EndpointID remote_eid 
) [protected]

void dtn::IPDiscovery::run (  )  [protected]

void dtn::IPDiscovery::shutdown (  )  [inline, virtual]

Close main socket, causing thread to exit.

Implements dtn::Discovery.

Definition at line 110 of file IPDiscovery.h.

References shutdown_, and socket_.

static cl_type_t dtn::IPDiscovery::str_to_type ( const char *  cltype  )  [inline, static]

Definition at line 95 of file IPDiscovery.h.

References TCPCL, and UDPCL.

Referenced by dtn::IPAnnounce::format_advertisement().

static const char* dtn::IPDiscovery::type_to_str ( cl_type_t  t  )  [inline, static]

Definition at line 84 of file IPDiscovery.h.

References TCPCL, UDPCL, and UNDEFINED.

Referenced by run().


Friends And Related Function Documentation

friend class Discovery [friend]

Definition at line 115 of file IPDiscovery.h.


Member Data Documentation

const u_int32_t dtn::IPDiscovery::DEFAULT_DST_ADDR = 0xffffffff [static]

If no other options are set for destination, default to sending to the IPv4 broadcast address.

Definition at line 44 of file IPDiscovery.h.

Referenced by IPDiscovery().

const u_int dtn::IPDiscovery::DEFAULT_MCAST_TTL = 1 [static]

If no other options are set for multicast TTL, set to 1.

Definition at line 55 of file IPDiscovery.h.

Referenced by IPDiscovery().

const u_int32_t dtn::IPDiscovery::DEFAULT_SRC_ADDR = INADDR_ANY [static]

If no other options are set for source, use this as default local address.

Definition at line 50 of file IPDiscovery.h.

Referenced by IPDiscovery().

in_addr_t dtn::IPDiscovery::local_addr_ [protected]

address for bind() to receive beacons

Definition at line 149 of file IPDiscovery.h.

Referenced by configure(), IPDiscovery(), and run().

u_int dtn::IPDiscovery::mcast_ttl_ [protected]

TTL hop count for multicast option.

Definition at line 152 of file IPDiscovery.h.

Referenced by configure(), and IPDiscovery().

On-the-wire (radio, whatever) representation of IP address family's advertisement beacon.

whether to exit thread on send/recv failures

Definition at line 154 of file IPDiscovery.h.

Referenced by configure(), IPDiscovery(), and run().

u_int16_t dtn::IPDiscovery::port_ [protected]

local and remote

Definition at line 150 of file IPDiscovery.h.

Referenced by configure(), IPDiscovery(), and run().

in_addr_t dtn::IPDiscovery::remote_addr_ [protected]

whether unicast, multicast, or broadcast

Definition at line 151 of file IPDiscovery.h.

Referenced by configure(), IPDiscovery(), and run().

volatile bool dtn::IPDiscovery::shutdown_ [protected]

signal to close down thread

Definition at line 148 of file IPDiscovery.h.

Referenced by IPDiscovery(), run(), and shutdown().

oasys::UDPClient dtn::IPDiscovery::socket_ [protected]

the socket for beacons in- and out-bound

Definition at line 153 of file IPDiscovery.h.

Referenced by configure(), handle_announce(), run(), and shutdown().


The documentation for this class was generated from the following files:

Generated on Fri Jan 30 09:43:14 2009 for DTN Reference Implementation by  doxygen 1.5.8