Version: 0.6.0
netconn.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Server)
3  * Purpose: network server conection class.
4  * Author: Bishop (aka Barishnikov Dmitriy), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012 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 "wxgis/net/network.h"
24 #include "wxgissrv/srv_net/net.h"
25 
27 
31 class WXDLLIMPEXP_GIS_SRVNET wxGISNetServerConnection : public INetConnection
32 {
33  DECLARE_CLASS(wxGISNetServerConnection)
34  enum{
35  // id for sockets
36  SOCKET_ID = 103,
37  // id for auth timer
38  TIMER_ID = 1014
39  };
40 public:
42  wxGISNetServerConnection(wxSocketBase* sock);
43  virtual ~wxGISNetServerConnection(void);
44  virtual void SetNetworkService(INetworkService* pNetService);
45  virtual void SetSocket(wxSocketBase* sock);
46  virtual bool Destroy(void);
47 // virtual void SetAuth(AUTHRESPOND sUserInfo) = 0;//set user authenticated state true
48  //virtual AUTHRESPOND GetAuth(void) = 0; // get if user has been authenticated
49  //virtual void SetAlive(wxDateTime dtm) = 0;
50  //virtual wxDateTime GetAlive(void) = 0;
51 protected:
52  //events
53  virtual void OnSocketEvent(wxSocketEvent& event);
54  void OnTimer( wxTimerEvent & event);
55 protected:
56  virtual void ProcessInputNetMessage(unsigned char * const buff);
57 protected:
58  INetworkService* m_pNetService;
59  wxTimer m_timer;
60 private:
61  DECLARE_EVENT_TABLE()
62 };
63 
64 
69 {
70 public:
71  virtual ~INetworkService(void){};
72  virtual bool Start(void) = 0;
73  virtual bool Stop(void) = 0;
74  virtual wxString GetServerName(void) const = 0;
75  virtual bool CanConnect(const wxString &sName, const wxString &sPass) = 0;
76  virtual void AddConnection(wxGISNetServerConnection* pConn) = 0;
77  virtual bool DestroyConnection( wxGISNetServerConnection* pConn ) = 0;
78  virtual void RemoveConnection( wxGISNetServerConnection* pConn ) = 0;
79 };
80 
The network service base interface class.
Definition: netconn.h:68
The network server connection interface class.
Definition: netconn.h:33
Definition: network.h:74