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

Last change on this file since 5284 was 5284, checked in by mies, 15 years ago

+ added new transport modules and adapted ariba to them
+ exchange endpoint descriptors an link establishment
+ clean up of base communication
+ link establishment with in the presence of multiple endpoints
+ local discovery for ipv6, ipv4 and bluetooth mac addresses

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