Version: 0.6.0
networkplugin.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Server)
3  * Purpose: TCP network server class.
4  * Author: Bishop (aka Barishnikov Dmitriy), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2008-2010 Bishop
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgissrv/srv_net/netconn.h"
24 
25 #include "wx/xml/xml.h"
26 
30 class WXDLLIMPEXP_GIS_SRVNET INetworkPlugin : public wxEvtHandler
31 {
32  DECLARE_ABSTRACT_CLASS(INetworkPlugin)
33 public:
34  virtual ~INetworkPlugin(void);
35  virtual bool Start(INetworkService* pNetService, wxXmlNode* pConfig) = 0;
36  virtual bool Stop(void) = 0;
37 };
38 
39 /*
40 #include "wxgissrv/framework/framework.h"
41 
42 #include "wx/socket.h"
43 
44 #ifdef __WXMSW__
45 #define CURROS WIN
46 #else
47 #define CURROS LIN
48 #endif
49 
50 class wxTCPNetworkPlugin;
51 
52 // ----------------------------------------------------------------------------
53 // wxTCPConnectThread
54 // ----------------------------------------------------------------------------
55 
56 class wxTCPConnectThread : public wxThread
57 {
58 public:
59  wxTCPConnectThread(wxTCPNetworkPlugin* pParent);
60 
61  // thread execution starts here
62  virtual void *Entry();
63 
64  // called when the thread exits - whether it terminates normally or is
65  // stopped with Delete() (but not when it is Kill()ed!)
66  virtual void OnExit();
67 
68 private:
69  wxTCPNetworkPlugin* m_pParent;
70  wxSocketServer *m_pServer;
71 };
72 
73 // ----------------------------------------------------------------------------
74 // wxTCPNetworkPlugin
75 // ----------------------------------------------------------------------------
76 
77 class wxTCPNetworkPlugin :
78  public wxObject,
79  public IService
80 {
81  DECLARE_DYNAMIC_CLASS(wxTCPNetworkPlugin)
82 public:
83  wxTCPNetworkPlugin(void);
84  virtual ~wxTCPNetworkPlugin(void);
85  virtual bool Start(IServerApplication* pApp, wxXmlNode* pConfig);
86  virtual bool Stop(void);
87  virtual int GetPort(void){return m_nPort;};
88  virtual wxString GetAddres(void){return m_sAddr;};
89  virtual wxString GetServerName(void){return m_pApp->GetServerName();};
90  virtual bool CanAcceptConnection(void){return m_pApp->CanAcceptConnection();};
91  virtual bool AddConnection(wxSocketBase* pNewSocket);
92  virtual void RemoveConnection(long nID);
93 protected:
94  int m_nPort;
95  wxString m_sAddr;
96  wxXmlNode* m_pConfig;
97  IServerApplication* m_pApp;
98  wxTCPConnectThread* m_pWaitThread;
99 };
100 */
The network service base interface class.
Definition: netconn.h:68
A Server side INetworkPlugin interface.
Definition: networkplugin.h:30