-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSenderModule.h
More file actions
54 lines (45 loc) · 1.2 KB
/
SenderModule.h
File metadata and controls
54 lines (45 loc) · 1.2 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
#ifndef MCAST_TOOL_MCASTSENDERMODULE_H_
#define MCAST_TOOL_MCASTSENDERMODULE_H_
#include "McastModuleInterface.h"
/**
* Send multicast
*/
class SenderModule: public McastModuleInterface
{
public:
SenderModule(const vector<IfaceData>& ifaces, const vector<string>& mcastAddresses,
int mcastPort, int nLoopbackIfaces, bool useIpV6, float loopInterval);
virtual ~SenderModule() {}
bool run();
/**
* Listen for ACK messages from receiver modules
*/
void* runUcastReceiver();
protected:
/**
* Init all interfaces
* @return true on success
*/
bool init();
/**
* Main sender function
* @param port - the port to send to, set -1 if want to use mMcastPort
* @return true on success
*/
bool sendMcastMessages(int port = -1);
private:
// true if should send message in loop
bool shouldLoop() const;
private:
int mLoopbackCount;
float mLoopInterval; // loop micro seconds, -1 if send once
string mMcastSingleAddress;
int mSenderPort;
// multi thread area -----------------------------
private:
bool mIsStopped;
public:
static void* rxThreadHelper(void* context);
// -----------------------------------------------
};
#endif /* MCAST_TOOL_MCASTSENDERMODULE_H_ */