FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
CTCLServer.h
1 #ifndef CTCLSERVER_H
2 #define CTCLSERVER_H
3 /*
4  This software is Copyright by the Board of Trustees of Michigan
5  State University (c) Copyright 2005.
6 
7  You may use this software under the terms of the GNU public license
8  (GPL). The terms of this license are described at:
9 
10  http://www.gnu.org/licenses/gpl.txt
11 
12  Author:
13  Ron Fox
14  NSCL
15  Michigan State University
16  East Lansing, MI 48824-1321
17 */
18 
19 #include <tcl.h>
20 #include <string>
21 #include <list>
22 
23 // forward class definitions:
24 
25 class CTCLInterpreter;
27 
49 {
50  // Member data:
51 private:
52  CTCLInterpreter* m_pInterpreter;
53  int m_nPort;
54  Tcl_Channel m_listenChannel;
55  std::list<CTCLTcpServerInstance*> m_serverInstances;
56 
57  // canonicals:
58 
59 public:
60  CTCLServer(CTCLInterpreter* pInterp, int port);
61  virtual ~CTCLServer();
62 
63 private:
64  CTCLServer(const CTCLServer&);
65  CTCLServer& operator=(const CTCLServer&);
66  int operator==(const CTCLServer&) const;
67  int operator!=(const CTCLServer&) const;
68 
69  // Static members:
70 
71 private:
72  static void connectionRelay(ClientData pData,
73  Tcl_Channel connection,
74  char* pHostname,
75  int port);
76 
77  // Public interface:
78 public:
79  void instanceExit(CTCLTcpServerInstance* pInstance);
80  void shutdown();
81 
82 protected:
83  void onConnection(Tcl_Channel connection,
84  std::string host);
85 
86  // Overridables.
87 
88  virtual bool allowConnection(Tcl_Channel connection,
89  std::string hostname);
90  virtual CTCLTcpServerInstance* createInstance(Tcl_Channel connection,
91  std::string hostname);
92 
93 
94 };
95 
96 #endif
virtual ~CTCLServer()
Definition: CTCLServer.cpp:57
Definition: TCLInterpreter.h:59
virtual bool allowConnection(Tcl_Channel connection, std::string hostname)
Definition: CTCLServer.cpp:178
CTCLServer(CTCLInterpreter *pInterp, int port)
Definition: CTCLServer.cpp:39
Definition: CTCLServer.h:48
void onConnection(Tcl_Channel connection, std::string host)
Definition: CTCLServer.cpp:150
Definition: CTCLTcpServerInstance.h:39
void instanceExit(CTCLTcpServerInstance *pInstance)
Definition: CTCLServer.cpp:103
virtual CTCLTcpServerInstance * createInstance(Tcl_Channel connection, std::string hostname)
Definition: CTCLServer.cpp:201
void shutdown()
Definition: CTCLServer.cpp:122