Commit 0cc65f1c56ddbc022cae352dd383bc4837a84c9b
1 parent
1d9706d1
Exists in
master
and in
1 other branch
Refactoring IPC object.
Showing
9 changed files
with
598 additions
and
154 deletions
Show diff stats
client/lib3270++.cbp
| ... | ... | @@ -62,7 +62,13 @@ |
| 62 | 62 | <Unit filename="src/session/local/properties.cc" /> |
| 63 | 63 | <Unit filename="src/session/local/set.cc" /> |
| 64 | 64 | <Unit filename="src/session/local/tools.cc" /> |
| 65 | - <Unit filename="src/session/remote/session.cc" /> | |
| 65 | + <Unit filename="src/session/remote/actions.cc" /> | |
| 66 | + <Unit filename="src/session/remote/get.cc" /> | |
| 67 | + <Unit filename="src/session/remote/init.cc" /> | |
| 68 | + <Unit filename="src/session/remote/private.h" /> | |
| 69 | + <Unit filename="src/session/remote/properties.cc" /> | |
| 70 | + <Unit filename="src/session/remote/set.cc" /> | |
| 71 | + <Unit filename="src/session/remote/tools.cc" /> | |
| 66 | 72 | <Unit filename="src/session/set.cc" /> |
| 67 | 73 | <Unit filename="src/testprogram/testprogram.cc" /> |
| 68 | 74 | <Extensions> | ... | ... |
client/src/include/ipc-client-internals.h
| ... | ... | @@ -167,167 +167,17 @@ |
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - /* | |
| 171 | - | |
| 172 | - /// @brief lib3270 direct access objects (no IPC); | |
| 173 | - namespace Local { | |
| 174 | - | |
| 175 | - class TN3270_PRIVATE Session : public TN3270::Abstract::Session { | |
| 176 | - private: | |
| 177 | - | |
| 178 | - /// @brief Handle of the related instance of lib3270 | |
| 179 | - H3270 * hSession; | |
| 180 | - | |
| 181 | - /// @brief Mutex to serialize access to lib3270 | |
| 182 | - std::mutex sync; | |
| 183 | - | |
| 184 | - /// @brief Popup Handler. | |
| 185 | - static void popupHandler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg); | |
| 186 | - | |
| 187 | - /// @brief Connect Handler. | |
| 188 | - static void connectHandler(H3270 *session, unsigned char connected); | |
| 189 | - | |
| 190 | - /// @brief Wait for network events | |
| 191 | - void wait(time_t timeout = 5); | |
| 192 | - | |
| 193 | - /// @brief Check lib3270 return codes, launch exception when failed. | |
| 194 | - static void chkResponse(int rc); | |
| 195 | - | |
| 196 | - public: | |
| 197 | - Session(); | |
| 198 | - virtual ~Session(); | |
| 199 | - | |
| 200 | - // Connect/disconnect | |
| 201 | - void connect(const char *url) override; | |
| 202 | - void disconnect() override; | |
| 203 | - | |
| 204 | - // Wait for session state. | |
| 205 | - void waitForReady(time_t timeout = 5) throw() override; | |
| 206 | - | |
| 207 | - // Get properties. | |
| 208 | - void getProperty(const char *name, int &value) const override; | |
| 209 | - void getProperty(const char *name, std::string &value) const override; | |
| 210 | - void getProperty(const char *name, bool &value) const override; | |
| 211 | - | |
| 212 | - // Set properties. | |
| 213 | - void setUnlockDelay(unsigned short delay = 350) override; | |
| 214 | - void setHostURL(const char *url) override; | |
| 215 | - | |
| 216 | - std::string getVersion() const override; | |
| 217 | - std::string getRevision() const override; | |
| 218 | - std::string getLUName() const override; | |
| 219 | - std::string getHostURL() const override; | |
| 220 | - SSLState getSSLState() const override; | |
| 221 | - | |
| 222 | - unsigned short getScreenWidth() const override; | |
| 223 | - unsigned short getScreenHeight() const override; | |
| 224 | - unsigned short getScreenLength() const override; | |
| 225 | - | |
| 226 | - // Gets | |
| 227 | - std::string toString(int baddr, size_t len, char lf) const override; | |
| 228 | - std::string toString(int row, int col, size_t sz, char lf) const override; | |
| 229 | - | |
| 230 | - ProgramMessage getProgramMessage() const override; | |
| 231 | - | |
| 232 | - ConnectionState getConnectionState() const override; | |
| 233 | - | |
| 234 | - TN3270::Session & setCursor(unsigned short addr) override; | |
| 235 | - TN3270::Session & setCursor(unsigned short row, unsigned short col) override; | |
| 236 | - unsigned short getCursorAddress() override; | |
| 237 | - | |
| 238 | - TN3270::Session & pfkey(unsigned short value); | |
| 239 | - TN3270::Session & pakey(unsigned short value); | |
| 240 | - | |
| 241 | - TN3270::Session & input(const char *text, size_t length) override; | |
| 242 | - | |
| 243 | - /// @brief Set field at current posicion, jumps to next writable field. | |
| 244 | - TN3270::Session & push(const char *text) override; | |
| 245 | - | |
| 246 | - TN3270::Session & push(int baddr, const char *text, int length = -1) override; | |
| 247 | - TN3270::Session & push(int row, int col, const char *text, int length = -1) override; | |
| 248 | - | |
| 249 | - TN3270::Session & push(const Action action) override; | |
| 250 | - | |
| 251 | - // Get contents. | |
| 252 | - TN3270::Session & pop(int baddr, std::string &text) override; | |
| 253 | - TN3270::Session & pop(int row, int col, std::string &text) override; | |
| 254 | - TN3270::Session & pop(std::string &text) override; | |
| 255 | - | |
| 256 | - /// @brief Execute action by name. | |
| 257 | - TN3270::Session & action(const char *action_name) override; | |
| 258 | - | |
| 259 | - /// @brief Wait. | |
| 260 | - TN3270::Session & wait(unsigned short seconds) override; | |
| 261 | - | |
| 262 | - /// @brief Wait for update. | |
| 263 | - TN3270::Session & waitForChange(unsigned short seconds) override; | |
| 264 | - | |
| 265 | - }; | |
| 266 | - | |
| 267 | - } | |
| 268 | - | |
| 269 | 170 | /// @brief IPC Based acess (Access an active instance of pw3270 or pw3270d) |
| 270 | 171 | namespace IPC { |
| 271 | 172 | |
| 173 | + TN3270_PRIVATE Session * getSessionInstance(); | |
| 174 | + | |
| 272 | 175 | class Session; |
| 273 | 176 | |
| 274 | 177 | /// @brief PW3270 IPC Request/Response. |
| 275 | 178 | class Request { |
| 276 | 179 | private: |
| 277 | 180 | |
| 278 | -#ifdef _WIN32 | |
| 279 | - /// @brief Pipe Handle. | |
| 280 | - HANDLE hPipe; | |
| 281 | - | |
| 282 | - /// @brief IPC Data type. | |
| 283 | - enum Type : uint8_t { | |
| 284 | - String = 's', | |
| 285 | - Boolean = 'b', | |
| 286 | - Uchar = 'y', | |
| 287 | - Int16 = 'n', | |
| 288 | - Uint16 = 'q', | |
| 289 | - Int32 = 'i', | |
| 290 | - Int32x = 'h', | |
| 291 | - Uint32 = 'u', | |
| 292 | - Int64 = 'x', | |
| 293 | - Uint64 = 't' | |
| 294 | - }; | |
| 295 | - | |
| 296 | - struct { | |
| 297 | - DWORD length; ///< @brief Length of input buffer. | |
| 298 | - DWORD used; ///< @brief Length of used block. | |
| 299 | - DWORD current; ///< @brief Offset of the current argument. | |
| 300 | - uint8_t * block; | |
| 301 | - } in; | |
| 302 | - | |
| 303 | - struct { | |
| 304 | - DWORD length; | |
| 305 | - DWORD used; | |
| 306 | - uint8_t * block; | |
| 307 | - } out; | |
| 308 | - | |
| 309 | - struct DataBlock { | |
| 310 | - Type type; | |
| 311 | - }; | |
| 312 | - | |
| 313 | - /// @brief Store value on data block. | |
| 314 | - DataBlock * pushBlock(const void *ptr, size_t len); | |
| 315 | - | |
| 316 | - /// @brief Get next argument. | |
| 317 | - DataBlock * getNextBlock() const; | |
| 318 | - | |
| 319 | -#else | |
| 320 | - struct { | |
| 321 | - DBusMessage * in; | |
| 322 | - DBusMessage * out; | |
| 323 | - DBusMessageIter iter; | |
| 324 | - | |
| 325 | - } msg; | |
| 326 | - DBusConnection * conn; | |
| 327 | - | |
| 328 | -#endif // _WIN32 | |
| 329 | - | |
| 330 | - Request(const Session &session); | |
| 331 | 181 | |
| 332 | 182 | public: |
| 333 | 183 | |
| ... | ... | @@ -359,6 +209,9 @@ |
| 359 | 209 | |
| 360 | 210 | }; |
| 361 | 211 | |
| 212 | + /* | |
| 213 | + | |
| 214 | + | |
| 362 | 215 | class TN3270_PRIVATE Session : public TN3270::Abstract::Session { |
| 363 | 216 | private: |
| 364 | 217 | |
| ... | ... | @@ -453,8 +306,8 @@ |
| 453 | 306 | |
| 454 | 307 | }; |
| 455 | 308 | |
| 456 | - } | |
| 457 | 309 | */ |
| 310 | + } | |
| 458 | 311 | |
| 459 | 312 | } |
| 460 | 313 | ... | ... |
| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + #include <lib3270/actions.h> | |
| 41 | + | |
| 42 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 43 | + | |
| 44 | + namespace TN3270 { | |
| 45 | + | |
| 46 | + void IPC::Session::action(const char *action_name) { | |
| 47 | + } | |
| 48 | + | |
| 49 | + void IPC::Session::connect(const char *url, int seconds) { | |
| 50 | + } | |
| 51 | + | |
| 52 | + void IPC::Session::disconnect() { | |
| 53 | + } | |
| 54 | + | |
| 55 | + void IPC::Session::wait(unsigned short seconds) const { | |
| 56 | + } | |
| 57 | + | |
| 58 | + void IPC::Session::waitForReady(time_t timeout) const { | |
| 59 | + } | |
| 60 | + | |
| 61 | + void IPC::Session::waitForChange(unsigned short seconds) const { | |
| 62 | + } | |
| 63 | + | |
| 64 | + void IPC::Session::pfkey(unsigned short value) { | |
| 65 | + } | |
| 66 | + | |
| 67 | + void IPC::Session::pakey(unsigned short value) { | |
| 68 | + } | |
| 69 | + | |
| 70 | + void IPC::Session::push(const Action action) { | |
| 71 | + } | |
| 72 | + | |
| 73 | + void IPC::Session::print(LIB3270_CONTENT_OPTION option) { | |
| 74 | + } | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | + | ... | ... |
| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + | |
| 41 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 42 | + | |
| 43 | + namespace TN3270 { | |
| 44 | + | |
| 45 | + std::string IPC::Session::get() const { | |
| 46 | + } | |
| 47 | + | |
| 48 | + std::string IPC::Session::get(int baddr, size_t len, char lf) const { | |
| 49 | + } | |
| 50 | + | |
| 51 | + std::string IPC::Session::get(int row, int col, size_t sz, char lf) const { | |
| 52 | + } | |
| 53 | + | |
| 54 | + ProgramMessage IPC::Session::getProgramMessage() const { | |
| 55 | + } | |
| 56 | + | |
| 57 | + ConnectionState IPC::Session::getConnectionState() const { | |
| 58 | + } | |
| 59 | + | |
| 60 | + SSLState IPC::Session::getSSLState() const { | |
| 61 | + } | |
| 62 | + | |
| 63 | + | |
| 64 | + } | |
| 65 | + | |
| 66 | + | ... | ... |
| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file src/session/local/init.cc | |
| 32 | + * | |
| 33 | + * @brief Implement lib3270 direct access layout (NO IPC). | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + | |
| 41 | + extern "C" { | |
| 42 | + #include <lib3270/session.h> | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 46 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 47 | + | |
| 48 | + namespace TN3270 { | |
| 49 | + | |
| 50 | + Session * IPC::getSessionInstance() { | |
| 51 | + return new IPC::Session(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + IPC::Session::Session() : Abstract::Session() { | |
| 55 | + } | |
| 56 | + | |
| 57 | + IPC::Session::~Session() { | |
| 58 | + } | |
| 59 | + | |
| 60 | + } | |
| 61 | + | |
| 62 | + | ... | ... |
| ... | ... | @@ -0,0 +1,176 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file private.h | |
| 32 | + * | |
| 33 | + * @brief Private definitions for local session. | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | +#ifndef PRIVATE_H_INCLUDED | |
| 40 | + | |
| 41 | + #define PRIVATE_H_INCLUDED | |
| 42 | + | |
| 43 | + #include <config.h> | |
| 44 | + #include <ipc-client-internals.h> | |
| 45 | + #include <string> | |
| 46 | + #include <lib3270.h> | |
| 47 | + #include <stdexcept> | |
| 48 | + | |
| 49 | + using std::string; | |
| 50 | + using std::runtime_error; | |
| 51 | + | |
| 52 | + namespace TN3270 { | |
| 53 | + | |
| 54 | + namespace IPC { | |
| 55 | + | |
| 56 | + class TN3270_PRIVATE Session : public TN3270::Abstract::Session { | |
| 57 | + private: | |
| 58 | + | |
| 59 | + friend class Request; | |
| 60 | + | |
| 61 | +#ifdef _WIN32 | |
| 62 | + /// @brief Pipe Handle. | |
| 63 | + HANDLE hPipe; | |
| 64 | + | |
| 65 | + /// @brief IPC Data type. | |
| 66 | + enum Type : uint8_t { | |
| 67 | + String = 's', | |
| 68 | + Boolean = 'b', | |
| 69 | + Uchar = 'y', | |
| 70 | + Int16 = 'n', | |
| 71 | + Uint16 = 'q', | |
| 72 | + Int32 = 'i', | |
| 73 | + Int32x = 'h', | |
| 74 | + Uint32 = 'u', | |
| 75 | + Int64 = 'x', | |
| 76 | + Uint64 = 't' | |
| 77 | + }; | |
| 78 | + | |
| 79 | + struct { | |
| 80 | + DWORD length; ///< @brief Length of input buffer. | |
| 81 | + DWORD used; ///< @brief Length of used block. | |
| 82 | + DWORD current; ///< @brief Offset of the current argument. | |
| 83 | + uint8_t * block; | |
| 84 | + } in; | |
| 85 | + | |
| 86 | + struct { | |
| 87 | + DWORD length; | |
| 88 | + DWORD used; | |
| 89 | + uint8_t * block; | |
| 90 | + } out; | |
| 91 | + | |
| 92 | + struct DataBlock { | |
| 93 | + Type type; | |
| 94 | + }; | |
| 95 | + | |
| 96 | + /// @brief Store value on data block. | |
| 97 | + DataBlock * pushBlock(const void *ptr, size_t len); | |
| 98 | + | |
| 99 | + /// @brief Get next argument. | |
| 100 | + DataBlock * getNextBlock() const; | |
| 101 | + | |
| 102 | +#else | |
| 103 | + struct { | |
| 104 | + DBusMessage * in; | |
| 105 | + DBusMessage * out; | |
| 106 | + DBusMessageIter iter; | |
| 107 | + | |
| 108 | + } msg; | |
| 109 | + DBusConnection * conn; | |
| 110 | + | |
| 111 | +#endif // _WIN32 | |
| 112 | + | |
| 113 | +// Request(const Session &session); | |
| 114 | + | |
| 115 | + protected: | |
| 116 | + | |
| 117 | + // Get strings from lib3270 without charset conversion. | |
| 118 | + std::string get() const override; | |
| 119 | + std::string get(int baddr, size_t len, char lf) const override; | |
| 120 | + std::string get(int row, int col, size_t sz, char lf) const override; | |
| 121 | + | |
| 122 | + // Set strings to lib3270 without charset conversion. | |
| 123 | + void set(const std::string &str) override; | |
| 124 | + void set(int baddr, const std::string &str) override; | |
| 125 | + void set(int row, int col, const std::string &str) override; | |
| 126 | + | |
| 127 | + public: | |
| 128 | + | |
| 129 | + Session(); | |
| 130 | + virtual ~Session(); | |
| 131 | + | |
| 132 | + // Actions | |
| 133 | + void action(const char *action_name) override; | |
| 134 | + void connect(const char *url, int seconds) override; | |
| 135 | + void disconnect() override; | |
| 136 | + void pfkey(unsigned short value) override; | |
| 137 | + void pakey(unsigned short value) override; | |
| 138 | + void push(const Action action) override; | |
| 139 | + void print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) override; | |
| 140 | + | |
| 141 | + void wait(unsigned short seconds) const override; | |
| 142 | + void waitForReady(time_t timeout) const override; | |
| 143 | + void waitForChange(unsigned short seconds) const override; | |
| 144 | + | |
| 145 | + // States | |
| 146 | + ProgramMessage getProgramMessage() const override; | |
| 147 | + ConnectionState getConnectionState() const override; | |
| 148 | + SSLState getSSLState() const override; | |
| 149 | + | |
| 150 | + // Properties. | |
| 151 | + void getProperty(const char *name, int &value) const override; | |
| 152 | + void getProperty(const char *name, std::string &value) const override; | |
| 153 | + void getProperty(const char *name, bool &value) const override; | |
| 154 | + std::string getVersion() const override; | |
| 155 | + std::string getRevision() const override; | |
| 156 | + std::string getLUName() const override; | |
| 157 | + | |
| 158 | + std::string getHostURL() const override; | |
| 159 | + void setHostURL(const char *url) override; | |
| 160 | + | |
| 161 | + unsigned short getScreenWidth() const override; | |
| 162 | + unsigned short getScreenHeight() const override; | |
| 163 | + unsigned short getScreenLength() const override; | |
| 164 | + void setUnlockDelay(unsigned short delay) override; | |
| 165 | + void setCharSet(const char *charset = NULL) override; | |
| 166 | + void setCursor(unsigned short addr) override; | |
| 167 | + void setCursor(unsigned short row, unsigned short col) override; | |
| 168 | + unsigned short getCursorAddress() override; | |
| 169 | + | |
| 170 | + }; | |
| 171 | + | |
| 172 | + } | |
| 173 | + | |
| 174 | + } | |
| 175 | + | |
| 176 | +#endif // PRIVATE_H_INCLUDED | ... | ... |
| ... | ... | @@ -0,0 +1,98 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + #include <lib3270/properties.h> | |
| 41 | + #include <lib3270/toggle.h> | |
| 42 | + #include <cstring> | |
| 43 | + | |
| 44 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 45 | + | |
| 46 | + namespace TN3270 { | |
| 47 | + | |
| 48 | + void IPC::Session::getProperty(const char *name, int &value) const { | |
| 49 | + } | |
| 50 | + | |
| 51 | + void IPC::Session::getProperty(const char *name, std::string &value) const { | |
| 52 | + } | |
| 53 | + | |
| 54 | + void IPC::Session::getProperty(const char *name, bool &value) const { | |
| 55 | + } | |
| 56 | + | |
| 57 | + void IPC::Session::setCharSet(const char *charset) { | |
| 58 | + } | |
| 59 | + | |
| 60 | + unsigned short IPC::Session::getScreenWidth() const { | |
| 61 | + } | |
| 62 | + | |
| 63 | + unsigned short IPC::Session::getScreenHeight() const { | |
| 64 | + } | |
| 65 | + | |
| 66 | + unsigned short IPC::Session::getScreenLength() const { | |
| 67 | + } | |
| 68 | + | |
| 69 | + void IPC::Session::setUnlockDelay(unsigned short delay) { | |
| 70 | + } | |
| 71 | + | |
| 72 | + void IPC::Session::setCursor(unsigned short addr) { | |
| 73 | + } | |
| 74 | + | |
| 75 | + void IPC::Session::setCursor(unsigned short row, unsigned short col) { | |
| 76 | + } | |
| 77 | + | |
| 78 | + unsigned short IPC::Session::getCursorAddress() { | |
| 79 | + } | |
| 80 | + | |
| 81 | + std::string IPC::Session::getVersion() const { | |
| 82 | + } | |
| 83 | + | |
| 84 | + std::string IPC::Session::getRevision() const { | |
| 85 | + } | |
| 86 | + | |
| 87 | + std::string IPC::Session::getLUName() const { | |
| 88 | + } | |
| 89 | + | |
| 90 | + std::string IPC::Session::getHostURL() const { | |
| 91 | + } | |
| 92 | + | |
| 93 | + void IPC::Session::setHostURL(const char *url) { | |
| 94 | + } | |
| 95 | + | |
| 96 | + } | |
| 97 | + | |
| 98 | + | ... | ... |
| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + | |
| 41 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 42 | + | |
| 43 | + namespace TN3270 { | |
| 44 | + | |
| 45 | + void IPC::Session::set(const std::string &str) { | |
| 46 | + } | |
| 47 | + | |
| 48 | + void IPC::Session::set(int baddr, const std::string &str) { | |
| 49 | + } | |
| 50 | + | |
| 51 | + void IPC::Session::set(int row, int col, const std::string &str) { | |
| 52 | + } | |
| 53 | + | |
| 54 | + } | |
| 55 | + | |
| 56 | + | ... | ... |
| ... | ... | @@ -0,0 +1,49 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @file | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + | |
| 41 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 42 | + | |
| 43 | + namespace TN3270 { | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | + | ... | ... |