versadac  1
versadac - Scalable Recorder Firmware
uhh_sktserver.h
1 /*****************************************************************************
2 FILE : U H H _ S K T S E R V E R . H
3 VERSION : $Id: uhh_sktserver.h 4938 2006-10-10 14:20:18Z martinto $
4 AUTHOR : Dave Storey
5 SYSTEM : Gnu C++
6 DESCRIPTION : UHH socket server class
7 *****************************************************************************/
8 
9 #if !defined __UHH_SKTSERVER_H
10 #define __UHH_SKTSERVER_H
11 
12 #include <inetLib.h>
13 #include "OSTask.h"
14 #include "uhh_streamconn.h"
15 
16 
17 // Max number of active connections: for transient connection for trend back-fill
18 #define UHH_SKTSERVER_MAX_CONNECTS 4
19 // Max external connections of the number allowed above
20 #define UHH_SKTSERVER_MAX_EXTERNAL_CONNECTS 2
21 // Max number of queued connection requests
22 #define UHH_SKTSERVER_MAX_CONNECT_Q 10
23 
24 
25 class UhhSktServer : public UhhHeap, public OSRunnableTask
26 {
27 public:
28 
29  UhhSktServer(uint8 z_uConnxPri, uint16 z_uConnxStk);
30  void runTask();
31 
32 private:
33 
34  uint8 m_uConnxPri;
35  uint16 m_uConnxStk;
36  int m_nFdServer;
37 
38 
39  // Array of connection structures
40 
41  struct UHH_SKTCONNECTION {
42  bool bActive; // Whether this connection is active
43  // The remaining members are only valid if bActive is TRUE
44  int nFD; // The socket handle
45  UhhStreamConn *pConn; // The stream connection
46  class OSTask *pTask; // The task running the connection
47  char sinAddr[INET_ADDR_LEN]; // the IP address of this connection
48  };
49 
50  UHH_SKTCONNECTION m_Conn[UHH_SKTSERVER_MAX_CONNECTS];
51 
52  // Private methods
53  void deactivateConnection(UHH_SKTCONNECTION *z_pConn);
54  void killConnections();
55  void newConnection(int z_FD, char * z_sinAddr);
56 };
57 
58 
59 #endif
Definition: ostask.h:16
Definition: uhh_streamconn.h:16
Definition: uhh_sktserver.h:25
Definition: ostask.h:33
Definition: uhh_heap.h:31