Commit 3a509922c1061ce6b540c2d91ec326d4b824d0a2
1 parent
c9b6daf9
Exists in
master
and in
3 other branches
Starting new IPC client for windows.
Showing
3 changed files
with
103 additions
and
1 deletions
Show diff stats
src/lib3270++/lib3270++.cbp
| @@ -57,6 +57,7 @@ | @@ -57,6 +57,7 @@ | ||
| 57 | <Unit filename="private.h" /> | 57 | <Unit filename="private.h" /> |
| 58 | <Unit filename="session.cc" /> | 58 | <Unit filename="session.cc" /> |
| 59 | <Unit filename="testprogram/testprogram.cc" /> | 59 | <Unit filename="testprogram/testprogram.cc" /> |
| 60 | + <Unit filename="windows/request.cc" /> | ||
| 60 | <Extensions> | 61 | <Extensions> |
| 61 | <code_completion /> | 62 | <code_completion /> |
| 62 | <envvars /> | 63 | <envvars /> |
src/lib3270++/private.h
| @@ -226,7 +226,6 @@ | @@ -226,7 +226,6 @@ | ||
| 226 | #pragma pack(1) | 226 | #pragma pack(1) |
| 227 | struct DataBlock { | 227 | struct DataBlock { |
| 228 | uint8_t type; | 228 | uint8_t type; |
| 229 | - size_t sz; | ||
| 230 | }; | 229 | }; |
| 231 | #pragma pack() | 230 | #pragma pack() |
| 232 | 231 | ||
| @@ -234,6 +233,9 @@ | @@ -234,6 +233,9 @@ | ||
| 234 | 233 | ||
| 235 | std::vector<DataBlock *> output; | 234 | std::vector<DataBlock *> output; |
| 236 | 235 | ||
| 236 | + /// @brief Create DataBlock | ||
| 237 | + static DataBlock * createDataBlock(const void *ptr, size_t len); | ||
| 238 | + | ||
| 237 | /// @brief Descompacta argumentos recebidos. | 239 | /// @brief Descompacta argumentos recebidos. |
| 238 | static void unpack(std::vector<DataBlock *> &args, const uint8_t * buffer, size_t szBuffer); | 240 | static void unpack(std::vector<DataBlock *> &args, const uint8_t * buffer, size_t szBuffer); |
| 239 | 241 |
| @@ -0,0 +1,99 @@ | @@ -0,0 +1,99 @@ | ||
| 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/lib3270++/windows/request.cc | ||
| 32 | + * | ||
| 33 | + * @brief Implements WIN32 Pipe Based IPC. | ||
| 34 | + * | ||
| 35 | + * @author perry.werneck@gmail.com | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | + #include "../private.h" | ||
| 40 | + | ||
| 41 | + using std::string; | ||
| 42 | + | ||
| 43 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
| 44 | + | ||
| 45 | + namespace TN3270 { | ||
| 46 | + | ||
| 47 | + IPC::Request::Request(const Session &session) { | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + IPC::Request::Request(const Session &session, const char *method) : Request(session) { | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + IPC::Request::Request(const Session &session, bool isSet, const char *property) : Request(session) { | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + IPC::Request::~Request() { | ||
| 57 | + | ||
| 58 | + for(auto block : input) { | ||
| 59 | + delete[] ((uint8_t *) block); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + for(auto block : output) { | ||
| 63 | + delete[] ((uint8_t *) block); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /// @brief Create DataBlock | ||
| 69 | + IPC::Request::DataBlock * IPC::Request::createDataBlock(const void *ptr, size_t length) { | ||
| 70 | + | ||
| 71 | + IPC::Request::DataBlock * rc = (IPC::Request::DataBlock *) (new uint8_t[sizeof(IPC::Request::DataBlock)+length]); | ||
| 72 | + memset((void *) rc, 0, sizeof(IPC::Request::DataBlock)); | ||
| 73 | + memcpy(((uint8_t *) (rc+1)), ((uint8_t *) ptr), length); | ||
| 74 | + | ||
| 75 | + return rc; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + IPC::Request & IPC::Request::call() { | ||
| 79 | + return *this; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + IPC::Request & IPC::Request::push(const char *arg) { | ||
| 83 | + IPC::Request::DataBlock * block = createDataBlock(arg, strlen(arg)+1); | ||
| 84 | + output.push_back(block); | ||
| 85 | + return *this; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + IPC::Request & IPC::Request::pop(std::string &value) { | ||
| 89 | + | ||
| 90 | + return *this; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + IPC::Request & IPC::Request::Request::pop(int &value) { | ||
| 94 | + return *this; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + |