libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moNetManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moNetManager.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_NETMANAGER_H__
33 #define __MO_NETMANAGER_H__
34 
35 #include "moTypes.h"
36 #include "moText.h"
37 #include "moConfig.h"
38 #include "moLock.h"
39 #include "moResourceManager.h"
40 
41 
43 
47 typedef void* moBoostIOService;
48 typedef void* moBoostAddress;
49 
50 typedef void* moBoostResolver;
51 typedef void* moBoostQuery;
52 typedef void* moBoostSocket;
53 typedef void* moBoostAcceptor;
54 
55 typedef void* moBoostSystemErrorCode;
56 
58 
59 typedef moText moAddress;
60 typedef moText moPort;
61 
62 
64 
68 
69 };
70 
72 
73  public:
74  moNetObject();
75  virtual ~moNetObject();
76 
77 };
78 
79 
80 
82 
86 
87  public:
89  virtual ~moNetConnection();
90 
91  bool Start();
92  bool Stop();
93 
94  moBoostSocket Socket();
95 
96 
97 
98  void HandleRead( long bytesbuf );
99 
101  void HandleWrite();
102 
103  private:
104  moBoostSocket m_Socket;
105 
106  moBoostResolver m_Resolver;
107 
108 };
109 
110 moDeclareExportedDynamicArray( moNetConnection*, moNetConnections );
111 
113 
114  public:
116  virtual ~moNetConnectionManager();
117 
118  void Start( moNetConnection* p_new_connection );
119  void Stop( moNetConnection* p_connection );
120  void StopAll();
121 
122  private:
123 
124  moNetConnections m_Connections;
125 
126  moBoostHandleFunctionsPtr m_pHandleFunctions;
127 
128 };
129 
131 
132  public:
133  moNetServer( moAddress p_address, moPort p_port, moText p_directory );
134  virtual ~moNetServer();
135 
136  void Run();
137  void Stop();
138 
139 
140  void HandleAccept();
141 
142  private:
143 
144 
145 
146  void HandleStop();
147 
148  moBoostAcceptor m_pAcceptor;
149  moBoostIOService m_pIOService;
150 
151  moNetConnectionManager m_ConnectionManager;
152 
153  moNetConnection* m_pNewConnection;
154 
155  moBoostHandleFunctionsPtr m_pHandleFunctions;
156 
157 
158 };
159 
160 
161 
163 
165 {
166  public:
167 
168  moNetManager();
169  virtual ~moNetManager();
170 
171  virtual MOboolean Init();
172  virtual MOboolean Finish();
173 
174  protected:
175  moNetObjects m_NetObjects;
176 
177 };
178 
179 #endif
180 
moText moAddress
Definition: moNetManager.h:59
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
#define MOboolean
Definition: moTypes.h:385
moNetObjectType
Definition: moNetManager.h:63
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
#define LIBMOLDEO_API
Definition: moTypes.h:180
virtual MOboolean Init()
clase de para manejar textos
Definition: moText.h:75
void * moBoostAddress
Definition: moNetManager.h:48
void * moBoostHandleFunctionsPtr
Definition: moNetManager.h:57
void * moBoostQuery
Definition: moNetManager.h:51
moText moPort
Definition: moNetManager.h:60
void * moBoostSocket
Definition: moNetManager.h:52
void * moBoostSystemErrorCode
Definition: moNetManager.h:55
moNetObjects m_NetObjects
Definition: moNetManager.h:175
virtual MOboolean Finish()
void * moBoostIOService
Boost.Asio specific classes type definitions.
Definition: moNetManager.h:47
clase para crear y mantener una conección basada en el protocolo tcp
Definition: moNetManager.h:85
void * moBoostAcceptor
Definition: moNetManager.h:53
void * moBoostResolver
Definition: moNetManager.h:50
moDeclareExportedDynamicArray(moNetConnection *, moNetConnections)