-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphy.hpp
42 lines (26 loc) · 897 Bytes
/
phy.hpp
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
#pragma once
#include <thread>
#include <mosquitto.h>
#include "types.hpp"
#include "myqueue.hpp"
class Phy {
public:
// Continue to process packets forever, sending those that come on
// where the rx_queue goes, and sending out those packets that come
// on the tx_queue.
Phy(ThreadedQueue<fifo_job>* tx_queue, ThreadedQueue<fifo_job>* rx_queue, const char* host, int port, const char* vpc);
Phy(ThreadedQueue<fifo_job>* tx_queue, ThreadedQueue<fifo_job>* rx_queue): Phy(tx_queue, rx_queue, "localhost", 1883, "VPC") {};
bool m_done;
const char* m_vpc;
uint32_t m_nic;
ThreadedQueue<fifo_job>* m_tx_queue;
ThreadedQueue<fifo_job>* m_rx_queue;
private:
std::thread m_tx_thread;
std::thread m_rx_thread;
void handle_tx(void);
void handle_rx(void);
std::thread m_mosquitto;
struct mosquitto* m_mosq;
void handle_mosquitto(void);
};