-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvoid.hpp
More file actions
60 lines (35 loc) · 1.17 KB
/
void.hpp
File metadata and controls
60 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef VOID_HPP
#define VOID_HPP
#include <vector>
#include <thread>
#include <mutex>
#include "hamcast/hamcast_module.h"
class void_module;
void void_module_generator_loop(void_module*);
class void_module
{
friend void void_module_generator_loop(void_module*);
public:
typedef hamcast::uri uri;
void_module(hc_event_callback_t ecb, hc_recv_callback_t rcb);
~void_module();
void set_handle(hc_module_instance_handle_t hdl);
void join(const uri& what);
void leave(const uri& what);
uri map(const uri& what);
void send(const uri& whom, const void* data, int len, unsigned char ttl);
void neighbor_set(std::vector<uri>& storage);
void group_set(std::vector<std::pair<uri, int> >& storage);
void children_set(std::vector<uri>& storage, const uri& group);
void parent_set(std::vector<uri>& storage, const uri& group);
bool designated_host(const uri& group);
private:
void generator_loop();
hc_recv_callback_t m_recv;
hc_event_callback_t m_event_cb;
hc_module_instance_handle_t m_handle;
std::thread generator_thread;
std::mutex generator_mtx;
bool generator_running;
};
#endif // VOID_HPP