source: source/ariba/utility/transport/rfcomm/rfcomm.hpp@ 6938

Last change on this file since 6938 was 5993, checked in by Christoph Mayer, 15 years ago

sigcomm release

File size: 1.9 KB
Line 
1#ifndef RFCOMM_HPP_
2#define RFCOMM_HPP_
3
4#include "ariba/utility/transport/transport.hpp"
5#include "ariba/utility/transport/asio/asio_io_service.h"
6#include "ariba/utility/transport/asio/bluetooth_endpoint.hpp"
7#include "ariba/utility/transport/asio/rfcomm.hpp"
8
9#include <boost/thread.hpp>
10#include <boost/system/system_error.hpp>
11#include <boost/asio/io_service.hpp>
12
13#include "ariba/utility/logging/Logging.h"
14
15namespace ariba {
16namespace transport {
17
18using boost::system::error_code;
19using namespace boost::asio;
20
21class link_info;
22class link_data;
23
24/**
25 * TODO: Doc
26 *
27 * @author Sebastian Mies <mies@tm.uka.de>
28 */
29class rfcomm : public transport_protocol {
30 use_logging_h(rfcomm)
31public:
32 rfcomm( uint16_t channel );
33 virtual ~rfcomm();
34 virtual void start();
35 virtual void stop();
36 virtual void send( const address_v* remote, const uint8_t* data, size_t size );
37 virtual void send( const endpoint_set& endpoints, const uint8_t* data, size_t size );
38 virtual void terminate( const address_v* remote );
39 virtual void register_listener( transport_listener* listener );
40
41private:
42 uint16_t channel;
43 boost::mutex links_mutex;
44 vector<link_info*> links;
45 io_service& io;
46 transport_listener* listener;
47 bluetooth::rfcomm::acceptor* acceptor;
48 int accept_retries;
49 link_data* send_data;
50
51 void start_accept();
52
53 void handle_accept( const error_code& error, link_info* info );
54
55 void start_read( link_info* info );
56
57 void handle_read_header( const error_code& error, size_t bytes, link_info* info );
58
59 void handle_read_data( const error_code& error, size_t bytes, link_info* info );
60
61 void handle_connect( const error_code& error, link_info* info );
62
63 void start_write( link_info* info );
64
65 void handle_write_data(const error_code& error, size_t bytes,
66 link_info* info, size_t size, uint8_t* buffer );
67
68 void shutdown(link_info* info);
69};
70
71}} // namespace ariba::transport
72
73#endif /* RFCOMM_HPP_ */
Note: See TracBrowser for help on using the repository browser.