Version: 0.6.0
net.h
1 /******************************************************************************
2  * Project: wxGIS (Task Manager)
3  * Purpose: Network classes.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012,2014 Dmitry Baryshnikov
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 
22 #pragma once
23 
24 #include "wxgis/net/network.h"
25 #include "wxgis/net/servernet.h"
26 
34  public wxGISNetworkService
35 {
36  DECLARE_CLASS(wxGISLocalNetworkService)
37 public:
39  virtual ~wxGISLocalNetworkService(void);
40  virtual int GetConnectionCount(void){return m_nConnectionCounter;};
41  //INetworkService
42  virtual bool Start(void);
43  virtual wxString GetServerName(void) const;
44  virtual bool CanConnect(const wxString &sName, const wxString &sPass);
45 };
46 
54 {
55  DECLARE_CLASS(wxGISLocalNetworkPlugin)
56 
57  enum{
58  // id for sockets
59  TCP_SERVER_ID = 105
60  };
61 public:
63  virtual ~wxGISLocalNetworkPlugin(void);
64  bool CreateListenSocket(void);
65  //INetworkPlugin
66  virtual bool Start(INetService* pNetService, const wxXmlNode* pConfig);
67  virtual bool Stop(void);
68  //events
69  virtual void OnTCPServerEvent(wxSocketEvent& event);
70 protected:
71  int m_nPort;
72  wxString m_sAddr;
73  INetService* m_pNetService;
74  wxSocketServer* m_listeningSocket;
75 
76  DECLARE_EVENT_TABLE()
77 };
78 
86 {
87  DECLARE_CLASS(wxGISLocalServerConnection)
88 public:
90  //wxGISLocalServerConnection(wxSocketBase* sock);
91  virtual ~wxGISLocalServerConnection(void);
92  virtual void SetSocket(wxSocketBase* sock);
93 protected:
94  //events
95  virtual void OnSocketEvent(wxSocketEvent& event);
96  virtual void OnTimer( wxTimerEvent & event);
97 protected:
98  virtual bool ProcessInputNetMessage(void);
99 };
Definition: netevent.h:66
Definition: servernet.h:32
Definition: net.h:33
The network server connection interface class.
Definition: netconn.h:33
A Server side Network Service.
Definition: servernet.h:49
Definition: net.h:53
Definition: net.h:85
The network service base interface class.
Definition: netconn.h:70