#include <IPDiscovery.h>

Definition at line 35 of file IPDiscovery.h.
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. | |
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 | |
Friends | |
| class | Discovery |
Classes | |
| struct | DiscoveryHeader |
| On-the-wire (radio, whatever) representation of IP address family's advertisement beacon. More... | |
| virtual dtn::IPDiscovery::~IPDiscovery | ( | ) | [inline, virtual] |
Definition at line 95 of file IPDiscovery.h.
| dtn::IPDiscovery::IPDiscovery | ( | const std::string & | name | ) | [protected] |
Definition at line 27 of file IPDiscovery.cc.
References local_addr_, mcast_ttl_, port_, remote_addr_, and shutdown_.
| static const char* dtn::IPDiscovery::type_to_str | ( | cl_type_t | t | ) | [inline, static] |
Definition at line 67 of file IPDiscovery.h.
References NOTREACHED, TCPCL, UDPCL, and UNDEFINED.
Referenced by run().
| static cl_type_t dtn::IPDiscovery::str_to_type | ( | const char * | cltype | ) | [inline, static] |
Definition at line 78 of file IPDiscovery.h.
References NOTREACHED, TCPCL, and UDPCL.
Referenced by dtn::IPAnnounce::format_advertisement().
| void dtn::IPDiscovery::shutdown | ( | ) | [inline, virtual] |
Close main socket, causing thread to exit.
Implements dtn::Discovery.
Definition at line 93 of file IPDiscovery.h.
References oasys::IOHandlerBase::get_notifier(), shutdown_, and socket_.
| 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 39 of file IPDiscovery.cc.
References oasys::OptParser::addopt(), oasys::IPSocket::bind(), oasys::IPSocket::ip_socket_params::broadcast_, oasys::StringBuffer::c_str(), intoa, dtn::Discovery::local_, local_addr_, log_debug, log_err, log_warn, oasys::Logger::logpath(), oasys::IPSocket::ip_socket_params::mcast_ttl_, mcast_ttl_, oasys::IPSocket::ip_socket_params::multicast_, oasys::IPSocket::params_, oasys::OptParser::parse(), port_, remote_addr_, oasys::IOHandlerBase::set_notifier(), oasys::IPSocket::set_remote_addr(), socket_, oasys::Thread::start(), oasys::Thread::started(), and dtn::Discovery::to_addr_.
| void dtn::IPDiscovery::run | ( | ) | [protected, virtual] |
virtual from oasys::Thread
Implements oasys::Thread.
Definition at line 112 of file IPDiscovery.cc.
References dtn::Discovery::announce(), oasys::ScratchBuffer< _memory_t, _static_size >::buf(), dtn::EndpointID::equals(), errno, dtn::IPAnnounce::format_advertisement(), dtn::Discovery::handle_neighbor_discovered(), dtn::Announce::interval(), dtn::Announce::interval_remaining(), intoa, oasys::IOINTR, oasys::IOTIMEOUT, dtn::Discovery::list_, log_debug, log_err, log_warn, parse_advertisement(), oasys::IPSocket::poll_sockfd(), port_, oasys::IPSocket::recvfrom(), remote_addr_, oasys::IPSocket::sendto(), shutdown_, socket_, and type_to_str().
| 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] |
Convenience method to pull the relevant items out of the inbound packet.
Definition at line 219 of file IPDiscovery.cc.
References dtn::EndpointID::assign(), oasys::StringBuffer::c_str(), dtn::IPDiscovery::DiscoveryHeader::cl_type, dtn::IPDiscovery::DiscoveryHeader::inet_addr, dtn::IPDiscovery::DiscoveryHeader::inet_port, intoa, dtn::IPDiscovery::DiscoveryHeader::length, dtn::IPDiscovery::DiscoveryHeader::name_len, and dtn::IPDiscovery::DiscoveryHeader::sender_name.
Referenced by run().
| void dtn::IPDiscovery::handle_announce | ( | ) | [inline, protected, virtual] |
Virtual from Discovery.
Reimplemented from dtn::Discovery.
Definition at line 126 of file IPDiscovery.h.
References oasys::IOHandlerBase::get_notifier(), and socket_.
friend class Discovery [friend] |
Definition at line 98 of file IPDiscovery.h.
On-the-wire (radio, whatever) representation of IP address family's advertisement beacon.
volatile bool dtn::IPDiscovery::shutdown_ [protected] |
signal to close down thread
Definition at line 131 of file IPDiscovery.h.
Referenced by IPDiscovery(), run(), and shutdown().
in_addr_t dtn::IPDiscovery::local_addr_ [protected] |
address for bind() to receive beacons
Definition at line 132 of file IPDiscovery.h.
Referenced by configure(), and IPDiscovery().
u_int16_t dtn::IPDiscovery::port_ [protected] |
local and remote
Definition at line 133 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 134 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 135 of file IPDiscovery.h.
Referenced by configure(), and IPDiscovery().
oasys::UDPClient dtn::IPDiscovery::socket_ [protected] |
the socket for beacons in- and out-bound
Definition at line 136 of file IPDiscovery.h.
Referenced by configure(), handle_announce(), run(), and shutdown().
1.5.3