BmnRoot
Loading...
Searching...
No Matches
BmnDataReceiver.h
Go to the documentation of this file.
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: BmnDataReceiver.h
9 * Author: ilnur
10 *
11 * Created on October 18, 2016, 5:22 PM
12 */
13
14#ifndef BMNDATARECEIVER_H
15#define BMNDATARECEIVER_H 1
16#include <stdlib.h>
17#include <deque>
18#include <TNamed.h>
19
20#include <BmnMath.h>
21
22#define PNP_DISCOVER_PORT 33304
23#define PNP_DISCOVER_IP_ADDR "239.192.1.2"
24#define INPUT_IFACE "eno1"
25#define MAX_BUF_LEN 128 * 1024 * 1024
26#define MAX_ADDR_LEN 255
27#define MAX_PORT_LEN 7
28#define MSG_TIMEOUT 400000
29#define CONN_TIMEOUT 3000000
30
31using namespace std;
32
33class BmnDataReceiver: public TNamed {
34public:
36 virtual ~BmnDataReceiver();
37
38 Int_t ConnectRaw();
39 Int_t Connect();
40 Int_t SendHello();
41 Int_t InitRecvStream();
42 void FreeRecvStream();
43 Int_t IterRecvStream();
44 Int_t RecvData();
45
46 void SetDataQueue(deque<UInt_t> v) {
47 this->data_queue = v;
48 }
49
50 deque<UInt_t>* GetDataQueue() {
51 return &data_queue;
52 }
53
54// void *GetQueMutex(){ return _deque_mutex;}
55// void SetQueMutex(void *v){_deque_mutex = v;}
56
57private:
58 //zmq::context_t _ctx;
59 //zmq::socket_t _socket_mcast;
60 struct serverIface
61 {
62 Bool_t enabled;
63 Bool_t isFree;
64 Int_t id;
65 UShort_t port;
66 Char_t type[MAX_ADDR_LEN];
67 };
68 struct serverInfo
69 {
70 Char_t hostName[MAX_ADDR_LEN];
71 Char_t index[MAX_ADDR_LEN];
72 Char_t name[MAX_ADDR_LEN];
73 Char_t type[MAX_ADDR_LEN];
74 vector<serverIface> interfaces;
75 };
76
77 deque<UInt_t> data_queue;
78 void * _ctx;
79 void * _socket_mcast;
80 void * _socket_data;
81 Int_t _sfd;
82 struct serverInfo _dataServer;
83 struct addrinfo *dataAddrInfo;
84 Bool_t isListening;
85 Bool_t isAddr = kFALSE;
86// void *_deque_mutex; // actually std::mutex
87 //static void HandleSignal(int signal);
88 void InitSocks();
89 void DeinitSocks();
90 static Int_t ParsePNPMsg(char *msgStr, serverInfo *sInfo);
91
92
93
94 ClassDef(BmnDataReceiver, 1)
95
96};
97
98#endif /* BMNDATARECEIVER_H */
99
__m128 v
Definition P4_F32vec4.h:1
virtual ~BmnDataReceiver()
void SetDataQueue(deque< UInt_t > v)
deque< UInt_t > * GetDataQueue()
#define MAX_ADDR_LEN
name
Definition setup.py:7
STL namespace.