#include <BluetoothConvergenceLayer.h>
Inheritance diagram for dtn::BluetoothConvergenceLayer:

Definition at line 24 of file BluetoothConvergenceLayer.h.
Public Types | |
| enum | contact_header_flags_t { BUNDLE_ACK_ENABLED = 0x1 } |
| Values for ContactHeader flags. More... | |
| enum | btcl_header_type_t { BUNDLE_DATA = 0x1, BUNDLE_ACK = 0x2, KEEPALIVE = 0x3, SHUTDOWN = 0x4 } |
| Valid type codes for the protocol headers. More... | |
Public Member Functions | |
| BluetoothConvergenceLayer () | |
| bool | init_link (Link *link, int argc, const char *argv[]) |
| Create any CL-specific components of the Link. | |
| void | dump_link (Link *link, oasys::StringBuffer *buf) |
| Dump out CL specific link information. | |
| bool | interface_up (Interface *iface, int argc, const char *argv[]) |
| Register a new interface. | |
| bool | interface_down (Interface *iface) |
| Bring down the interface. | |
| void | dump_interface (Interface *iface, oasys::StringBuffer *buf) |
| Dump out CL specific interface information. | |
| bool | open_contact (const ContactRef &contact) |
| Open the connection to the given contact and prepare for bundles to be transmitted. | |
| bool | close_contact (const ContactRef &contact) |
| Close the connection to the contact. | |
| void | send_bundle (const ContactRef &, Bundle *) |
| Send a bundle to the Contact, mark the link as busy, and queue the bundle on the Connection's bundle queue. | |
Public Attributes | |
| dtn::BluetoothConvergenceLayer::BTCLHeader | packed |
| Contact parameter header. | |
| dtn::BluetoothConvergenceLayer::BundleDataHeader | packed |
| Header for the start of a block of bundle data. | |
| dtn::BluetoothConvergenceLayer::BundleAckHeader | packed |
| Header for a bundle acknowledgment. | |
Static Public Attributes | |
| static const u_int8_t | BTCL_VERSION = 0x01 |
| Current version of the protocol. | |
| static Params | defaults_ |
| static ConnectionManager | connections_ |
Protected Member Functions | |
| bool | parse_params (Params *params, int argc, const char **argv, const char **invalidp) |
| Parse variable args into a parameter structure. | |
| bool | parse_nexthop (const char *, bdaddr_t *) |
Classes | |
| struct | BTCLHeader |
| Contact parameter header. More... | |
| struct | BundleAckHeader |
| Header for a bundle acknowledgment. More... | |
| struct | BundleDataHeader |
| Header for the start of a block of bundle data. More... | |
| class | Connection |
| Helper class that wraps the sender-side per-contact state. More... | |
| class | ConnectionManager |
| ConnectionManager associates Listeners to their Bluetooth adapter address and provides a factory method for instantiating Connection objects. More... | |
| class | Listener |
| Helper class (and thread) that listens on a registered interface for incoming data. More... | |
| class | NeighborDiscovery |
| class | Params |
| Tunable parameter structure. More... | |
Valid type codes for the protocol headers.
For BT/RFCOMM, the one byte code is always sent first, followed by the per-type header
| BUNDLE_DATA | bundle data |
| BUNDLE_ACK | bundle acknowledgment |
| KEEPALIVE | keepalive packet |
| SHUTDOWN | indicates sending side will close connection |
Definition at line 58 of file BluetoothConvergenceLayer.h.
| dtn::BluetoothConvergenceLayer::BluetoothConvergenceLayer | ( | ) |
Definition at line 49 of file BluetoothConvergenceLayer.cc.
References BDADDR_ANY, dtn::BluetoothConvergenceLayer::Params::bundle_ack_enabled_, defaults_, dtn::BluetoothConvergenceLayer::Params::hcidev_, dtn::BluetoothConvergenceLayer::Params::keepalive_interval_, dtn::BluetoothConvergenceLayer::Params::local_addr_, dtn::BluetoothConvergenceLayer::Params::max_retry_interval_, dtn::BluetoothConvergenceLayer::Params::min_retry_interval_, dtn::BluetoothConvergenceLayer::Params::neighbor_poll_interval_, dtn::BluetoothConvergenceLayer::Params::partial_ack_len_, dtn::BluetoothConvergenceLayer::Params::readbuf_len_, dtn::BluetoothConvergenceLayer::Params::remote_addr_, dtn::BluetoothConvergenceLayer::Params::retry_interval_, dtn::BluetoothConvergenceLayer::Params::rtt_timeout_, and dtn::BluetoothConvergenceLayer::Params::writebuf_len_.
| bool dtn::BluetoothConvergenceLayer::init_link | ( | Link * | link, | |
| int | argc, | |||
| const char * | argv[] | |||
| ) | [virtual] |
Create any CL-specific components of the Link.
This parses and validates the parameters and stores them in the CLInfo slot in the Link class.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 228 of file BluetoothConvergenceLayer.cc.
References oasys::Bluetooth::batostr(), BDADDR_ANY, defaults_, oasys::Bluetooth::hci_get_bdaddr(), dtn::BluetoothConvergenceLayer::Params::hcidev_, dtn::BluetoothConvergenceLayer::Params::local_addr_, log_debug, log_err, dtn::BluetoothConvergenceLayer::Params::max_retry_interval_, dtn::BluetoothConvergenceLayer::Params::min_retry_interval_, dtn::Link::nexthop(), dtn::Link::OPPORTUNISTIC, dtn::Link::params(), parse_nexthop(), parse_params(), dtn::Link::retry_interval_, dtn::BluetoothConvergenceLayer::Params::retry_interval_, dtn::Link::set_cl_info(), dtn::Link::set_local(), dtn::Link::type(), and dtn::Link::type_str().
| void dtn::BluetoothConvergenceLayer::dump_link | ( | Link * | link, | |
| oasys::StringBuffer * | buf | |||
| ) | [virtual] |
Dump out CL specific link information.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 290 of file BluetoothConvergenceLayer.cc.
References oasys::StringBuffer::appendf(), oasys::Bluetooth::batostr(), dtn::Link::cl_info(), dtn::BluetoothConvergenceLayer::Params::local_addr_, and dtn::BluetoothConvergenceLayer::Params::remote_addr_.
| bool dtn::BluetoothConvergenceLayer::interface_up | ( | Interface * | iface, | |
| int | argc, | |||
| const char * | argv[] | |||
| ) | [virtual] |
Register a new interface.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 107 of file BluetoothConvergenceLayer.cc.
References BDADDR_ANY, connections_, defaults_, oasys::Bluetooth::hci_get_bdaddr(), oasys::BluetoothServer::listen(), dtn::BluetoothConvergenceLayer::ConnectionManager::listener(), log_debug, log_err, oasys::Logger::logpath_, oasys::Logger::logpathf(), dtn::Interface::name(), dtn::BluetoothConvergenceLayer::Listener::nd_, parse_params(), oasys::RFCOMMServerThread::rc_bind(), dtn::Interface::set_cl_info(), and oasys::Thread::start().
Bring down the interface.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 168 of file BluetoothConvergenceLayer.cc.
References dtn::Interface::cl_info(), oasys::BluetoothSocket::close(), connections_, dtn::BluetoothConvergenceLayer::ConnectionManager::del_listener(), oasys::Thread::interrupt(), oasys::IOHandlerBase::interrupt_from_io(), oasys::Thread::is_stopped(), dtn::BluetoothConvergenceLayer::Listener::nd_, oasys::Thread::set_should_stop(), and oasys::Thread::yield().
| void dtn::BluetoothConvergenceLayer::dump_interface | ( | Interface * | iface, | |
| oasys::StringBuffer * | buf | |||
| ) | [virtual] |
Dump out CL specific interface information.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 202 of file BluetoothConvergenceLayer.cc.
References oasys::StringBuffer::appendf(), oasys::Bluetooth::batostr(), BDADDR_ANY, dtn::Interface::cl_info(), dtn::BluetoothConvergenceLayer::Params::hcidev_, dtn::BluetoothConvergenceLayer::Params::local_addr_, dtn::BluetoothConvergenceLayer::Params::neighbor_poll_interval_, and dtn::BluetoothConvergenceLayer::Params::remote_addr_.
| bool dtn::BluetoothConvergenceLayer::open_contact | ( | const ContactRef & | contact | ) | [virtual] |
Open the connection to the given contact and prepare for bundles to be transmitted.
Implements dtn::ConvergenceLayer.
Definition at line 306 of file BluetoothConvergenceLayer.cc.
References ASSERT, BDADDR_ANY, dtn::Link::cl_info(), dtn::BluetoothConvergenceLayer::ConnectionManager::connection(), connections_, log_debug, dtn::Link::nexthop(), parse_nexthop(), dtn::BluetoothConvergenceLayer::Connection::set_contact(), and oasys::Thread::start().
| bool dtn::BluetoothConvergenceLayer::close_contact | ( | const ContactRef & | contact | ) | [virtual] |
Close the connection to the contact.
Reimplemented from dtn::ConvergenceLayer.
Definition at line 339 of file BluetoothConvergenceLayer.cc.
References dtn::BluetoothConvergenceLayer::Connection::interrupt_from_io(), oasys::Thread::is_stopped(), log_debug, log_info, oasys::Ref< _Type >::object(), oasys::Thread::set_should_stop(), oasys::Thread::should_stop(), and oasys::Thread::yield().
| void dtn::BluetoothConvergenceLayer::send_bundle | ( | const ContactRef & | , | |
| Bundle * | ||||
| ) | [virtual] |
Send a bundle to the Contact, mark the link as busy, and queue the bundle on the Connection's bundle queue.
Implements dtn::ConvergenceLayer.
Definition at line 375 of file BluetoothConvergenceLayer.cc.
References ASSERT, dtn::Link::BUSY, log_info, and oasys::Ref< _Type >::object().
| bool dtn::BluetoothConvergenceLayer::parse_params | ( | Params * | params, | |
| int | argc, | |||
| const char ** | argv, | |||
| const char ** | invalidp | |||
| ) | [protected] |
Parse variable args into a parameter structure.
Definition at line 73 of file BluetoothConvergenceLayer.cc.
References oasys::OptParser::addopt(), dtn::BluetoothConvergenceLayer::Params::bundle_ack_enabled_, dtn::BluetoothConvergenceLayer::Params::hcidev_, dtn::BluetoothConvergenceLayer::Params::keepalive_interval_, dtn::BluetoothConvergenceLayer::Params::local_addr_, dtn::BluetoothConvergenceLayer::Params::max_retry_interval_, dtn::BluetoothConvergenceLayer::Params::min_retry_interval_, dtn::BluetoothConvergenceLayer::Params::neighbor_poll_interval_, oasys::OptParser::parse(), dtn::BluetoothConvergenceLayer::Params::partial_ack_len_, dtn::BluetoothConvergenceLayer::Params::readbuf_len_, dtn::BluetoothConvergenceLayer::Params::remote_addr_, dtn::BluetoothConvergenceLayer::Params::rtt_timeout_, and dtn::BluetoothConvergenceLayer::Params::writebuf_len_.
Referenced by init_link(), and interface_up().
| bool dtn::BluetoothConvergenceLayer::parse_nexthop | ( | const char * | , | |
| bdaddr_t * | ||||
| ) | [protected] |
Definition at line 390 of file BluetoothConvergenceLayer.cc.
References log_warn, and oasys::Bluetooth::strtoba().
Referenced by init_link(), and open_contact().
const u_int8_t dtn::BluetoothConvergenceLayer::BTCL_VERSION = 0x01 [static] |
Current version of the protocol.
Definition at line 30 of file BluetoothConvergenceLayer.h.
Referenced by dtn::BluetoothConvergenceLayer::Connection::recv_contact_header(), and dtn::BluetoothConvergenceLayer::Connection::send_contact_header().
Contact parameter header.
Sent once in each direction for BT/RFCOMM.
Header for the start of a block of bundle data.
Header for a bundle acknowledgment.
Definition at line 176 of file BluetoothConvergenceLayer.h.
Referenced by BluetoothConvergenceLayer(), init_link(), and interface_up().
Definition at line 177 of file BluetoothConvergenceLayer.h.
Referenced by interface_down(), interface_up(), open_contact(), and dtn::BluetoothConvergenceLayer::NeighborDiscovery::send_announce().
1.5.1