DABC (Data Acquisition Backbone Core)  2.9.9
SocketTransport.h
Go to the documentation of this file.
1 // $Id: SocketTransport.h 4469 2020-04-15 12:53:59Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef DABC_SocketTransport
17 #define DABC_SocketTransport
18 
19 #ifndef DABC_SocketThread
20 #include "dabc/SocketThread.h"
21 #endif
22 
23 #ifndef DABC_NetworkTransport
24 #include "dabc/NetworkTransport.h"
25 #endif
26 
27 namespace dabc {
28 
35  public NetworkInetrface {
36  protected:
37 
39 
40  char* fHeaders;
44  uint32_t fRecvRecid;
46  uint32_t fSendRecid;
47 
48  std::string fMcastAddr;
49 
50  virtual long Notify(const std::string&, int);
51 
52  virtual void OnSendCompleted();
53  virtual void OnRecvCompleted();
54 
55  virtual void OnSocketError(int msg, const std::string &info);
56 
57  public:
58  SocketNetworkInetrface(int fd, bool datagram = false);
59  virtual ~SocketNetworkInetrface();
60 
62  void SetMCastAddr(const std::string addr) { fMcastAddr = addr; }
63 
64  virtual void AllocateNet(unsigned fulloutputqueue, unsigned fullinputqueue);
65  virtual void SubmitSend(uint32_t recid);
66  virtual void SubmitRecv(uint32_t recid);
67  };
68 }
69 
70 #endif
Network interface.
Socket addon for handling I/O events.
Definition: SocketThread.h:144
Specific implementation of network transport for socket.
virtual void OnSendCompleted()
Method called when send operation is completed.
virtual void AllocateNet(unsigned fulloutputqueue, unsigned fullinputqueue)
virtual void SubmitRecv(uint32_t recid)
int fSendStatus
0 - idle, 1 - sending
SocketNetworkInetrface(int fd, bool datagram=false)
int fRecvStatus
0 - idle, 1 - header, 2 - front buffer from recv queue
std::string fMcastAddr
mcast address
uint32_t fRecvRecid
if of the record, used for data receiving (status != 0)
Queue< uint32_t > RecIdsQueue
void SetMCastAddr(const std::string addr)
Set mcast address, required to correctly close socket.
virtual long Notify(const std::string &, int)
Light-weight command interface, which can be used from worker.
virtual void OnSocketError(int msg, const std::string &info)
Generic error handler.
virtual void SubmitSend(uint32_t recid)
uint32_t fSendRecid
id of the active send record
virtual void OnRecvCompleted()
Method called when receive operation is completed.
Event manipulation API.
Definition: api.h:23