Commit ae5138b907310e41ad13a732ab430e0857e36e52
1 parent
bbf9264c
Exists in
master
and in
1 other branch
Reorganizing paths for documentation.
Showing
35 changed files
with
969 additions
and
897 deletions
Show diff stats
client/Makefile.in
| ... | ... | @@ -91,7 +91,8 @@ DEPENDS= \ |
| 91 | 91 | Makefile \ |
| 92 | 92 | src/include/*.h \ |
| 93 | 93 | $(BASEDIR)/common/src/include/*.h \ |
| 94 | - $(BASEDIR)/common/src/include/lib3270/*.h | |
| 94 | + $(BASEDIR)/client/src/include/lib3270/*.h \ | |
| 95 | + $(BASEDIR)/client/src/include/lib3270/ipc/*.h \ | |
| 95 | 96 | |
| 96 | 97 | CFLAGS= \ |
| 97 | 98 | @CFLAGS@ \ | ... | ... |
client/ipcclient.cbp
| ... | ... | @@ -61,6 +61,8 @@ |
| 61 | 61 | <Unit filename="src/host/stream.cc" /> |
| 62 | 62 | <Unit filename="src/host/string.cc" /> |
| 63 | 63 | <Unit filename="src/include/ipc-client-internals.h" /> |
| 64 | + <Unit filename="src/include/lib3270/ipc.h" /> | |
| 65 | + <Unit filename="src/include/lib3270/ipc/request.h" /> | |
| 64 | 66 | <Unit filename="src/session/get.cc" /> |
| 65 | 67 | <Unit filename="src/session/local/actions.cc" /> |
| 66 | 68 | <Unit filename="src/session/local/events.cc" /> | ... | ... |
client/src/core/linux/request.cc
| ... | ... | @@ -44,6 +44,12 @@ |
| 44 | 44 | |
| 45 | 45 | namespace TN3270 { |
| 46 | 46 | |
| 47 | + IPC::Request::Request(DBusConnection * conn) { | |
| 48 | + this->conn = conn; | |
| 49 | + this->msg.in = nullptr; | |
| 50 | + this->msg.out = nullptr; | |
| 51 | + } | |
| 52 | + | |
| 47 | 53 | IPC::Request::~Request() { |
| 48 | 54 | if(msg.out) { |
| 49 | 55 | dbus_message_unref(msg.out); | ... | ... |
client/src/include/ipc-client-internals.h
| ... | ... | @@ -53,6 +53,7 @@ |
| 53 | 53 | #include <iostream> |
| 54 | 54 | #include <mutex> |
| 55 | 55 | #include <lib3270/ipc.h> |
| 56 | + #include <lib3270/ipc/request.h> | |
| 56 | 57 | #include <lib3270/popup.h> |
| 57 | 58 | #include <system_error> |
| 58 | 59 | #include <stdexcept> |
| ... | ... | @@ -174,105 +175,8 @@ |
| 174 | 175 | namespace IPC { |
| 175 | 176 | |
| 176 | 177 | TN3270_PRIVATE TN3270::Session * getSessionInstance(const char *id); |
| 177 | - | |
| 178 | 178 | class Session; |
| 179 | 179 | |
| 180 | - /// @brief PW3270 IPC Request/Response. | |
| 181 | - class Request { | |
| 182 | - private: | |
| 183 | - | |
| 184 | -#ifdef _WIN32 | |
| 185 | - /// @brief Pipe Handle. | |
| 186 | - HANDLE hPipe; | |
| 187 | - | |
| 188 | - /// @brief IPC Data type. | |
| 189 | - enum Type : uint8_t { | |
| 190 | - String = 's', | |
| 191 | - Boolean = 'b', | |
| 192 | - Uchar = 'y', | |
| 193 | - Int16 = 'n', | |
| 194 | - Uint16 = 'q', | |
| 195 | - Int32 = 'i', | |
| 196 | - Int32x = 'h', | |
| 197 | - Uint32 = 'u', | |
| 198 | - Int64 = 'x', | |
| 199 | - Uint64 = 't' | |
| 200 | - }; | |
| 201 | - | |
| 202 | - struct { | |
| 203 | - DWORD length; ///< @brief Length of input buffer. | |
| 204 | - DWORD used; ///< @brief Length of used block. | |
| 205 | - DWORD current; ///< @brief Offset of the current argument. | |
| 206 | - uint8_t * block; | |
| 207 | - } in; | |
| 208 | - | |
| 209 | - struct { | |
| 210 | - DWORD length; | |
| 211 | - DWORD used; | |
| 212 | - uint8_t * block; | |
| 213 | - } out; | |
| 214 | - | |
| 215 | - struct DataBlock { | |
| 216 | - Type type; | |
| 217 | - }; | |
| 218 | - | |
| 219 | - /// @brief Store value on data block. | |
| 220 | - DataBlock * pushBlock(const void *ptr, size_t len); | |
| 221 | - | |
| 222 | - /// @brief Get next argument. | |
| 223 | - DataBlock * getNextBlock() const; | |
| 224 | - | |
| 225 | - /// @brief Pointer to number of variants in the output buffer. | |
| 226 | - uint16_t * outvalues; | |
| 227 | - | |
| 228 | -#else | |
| 229 | - struct { | |
| 230 | - DBusMessage * in; | |
| 231 | - DBusMessage * out; | |
| 232 | - DBusMessageIter iter; | |
| 233 | - | |
| 234 | - } msg; | |
| 235 | - DBusConnection * conn; | |
| 236 | - | |
| 237 | -#endif // _WIN32 | |
| 238 | - | |
| 239 | - protected: | |
| 240 | - | |
| 241 | -#ifdef _WIN32 | |
| 242 | - Request(HANDLE hPipe, const char *name, uint16_t type); | |
| 243 | -#endif // _WIN32 | |
| 244 | - | |
| 245 | - public: | |
| 246 | - | |
| 247 | - /// @brief Create a method call. | |
| 248 | - Request(const IPC::Session &session, const char *method); | |
| 249 | - | |
| 250 | - /// @brief Create a get/set property call. | |
| 251 | - /// | |
| 252 | - /// @param session Session object. | |
| 253 | - /// @param isSet true if this is a setProperty call. | |
| 254 | - /// @param property Property name. | |
| 255 | - // | |
| 256 | - Request(const IPC::Session &session, bool isSet, const char *property); | |
| 257 | - | |
| 258 | - ~Request(); | |
| 259 | - | |
| 260 | - Request & call(); | |
| 261 | - | |
| 262 | - // Push values | |
| 263 | - Request & push(const char *arg); | |
| 264 | - Request & push(const bool arg); | |
| 265 | - Request & push(const int32_t arg); | |
| 266 | - Request & push(const uint32_t arg); | |
| 267 | - Request & push(const uint8_t arg); | |
| 268 | - | |
| 269 | - // Pop values | |
| 270 | - Request & pop(std::string &value); | |
| 271 | - Request & pop(int &value); | |
| 272 | - Request & pop(unsigned int &value); | |
| 273 | - | |
| 274 | - }; | |
| 275 | - | |
| 276 | 180 | } |
| 277 | 181 | |
| 278 | 182 | } | ... | ... |
| ... | ... | @@ -0,0 +1,624 @@ |
| 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 ipc.h 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 | +#ifndef LIB3270_IPC_H_INCLUDED | |
| 31 | + | |
| 32 | + #define LIB3270_IPC_H_INCLUDED 1 | |
| 33 | + | |
| 34 | + #include <iostream> | |
| 35 | + #include <cstdarg> | |
| 36 | + #include <vector> | |
| 37 | + #include <functional> | |
| 38 | + #include <lib3270.h> | |
| 39 | + #include <lib3270/keyboard.h> | |
| 40 | + | |
| 41 | + #if defined(_WIN32) | |
| 42 | + | |
| 43 | + #define TN3270_PUBLIC __declspec (dllexport) | |
| 44 | + #define TN3270_PRIVATE | |
| 45 | + | |
| 46 | + #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) | |
| 47 | + | |
| 48 | + #define TN3270_PUBLIC | |
| 49 | + #define TN3270_PRIVATE | |
| 50 | + | |
| 51 | + #elif defined(__GNUC__) | |
| 52 | + | |
| 53 | + #define TN3270_PUBLIC __attribute__((visibility("default"))) | |
| 54 | + #define TN3270_PRIVATE __attribute__((visibility("hidden"))) | |
| 55 | + | |
| 56 | + #else | |
| 57 | + | |
| 58 | + #error Unable to set visibility attribute | |
| 59 | + | |
| 60 | + #endif | |
| 61 | + | |
| 62 | +#ifdef __cplusplus | |
| 63 | + | |
| 64 | + #include <string> | |
| 65 | + | |
| 66 | + namespace TN3270 { | |
| 67 | + | |
| 68 | + class Host; | |
| 69 | + class Controller; | |
| 70 | + | |
| 71 | + #define DEFAULT_TIMEOUT 5 | |
| 72 | + | |
| 73 | + TN3270_PUBLIC const char * getVersion(); | |
| 74 | + TN3270_PUBLIC const char * getRevision(); | |
| 75 | + | |
| 76 | + class TN3270_PUBLIC Event { | |
| 77 | + public: | |
| 78 | + enum Type : uint8_t { | |
| 79 | + All, ///< @brief All events (undefined). | |
| 80 | + Popup, ///< @brief Popup message. | |
| 81 | + Trace, ///< @brief Trace message. | |
| 82 | + Message, ///< @brief Generic message. | |
| 83 | + Connection ///< @brief Connect/Disconnect event. | |
| 84 | + }; | |
| 85 | + | |
| 86 | + private: | |
| 87 | + Type type; | |
| 88 | + | |
| 89 | + protected: | |
| 90 | + Event(enum Type type); | |
| 91 | + | |
| 92 | + public: | |
| 93 | + virtual ~Event(); | |
| 94 | + | |
| 95 | + /// @brief Check event type | |
| 96 | + inline bool is(Event::Type type) const noexcept { | |
| 97 | + return this->type == type; | |
| 98 | + } | |
| 99 | + | |
| 100 | + /// @brief Check event type | |
| 101 | + inline bool operator==(Event::Type type) const noexcept { | |
| 102 | + return this->type == type; | |
| 103 | + } | |
| 104 | + | |
| 105 | + inline operator Event::Type() const noexcept { | |
| 106 | + return this->type; | |
| 107 | + } | |
| 108 | + | |
| 109 | + /// @brief Get event description. | |
| 110 | + virtual std::string toString() const = 0; | |
| 111 | + | |
| 112 | + }; | |
| 113 | + | |
| 114 | + enum ProgramMessage : uint8_t { | |
| 115 | + MESSAGE_NONE = LIB3270_MESSAGE_NONE, ///< @brief No message | |
| 116 | + MESSAGE_SYSWAIT = LIB3270_MESSAGE_SYSWAIT, ///< @brief -- | |
| 117 | + MESSAGE_TWAIT = LIB3270_MESSAGE_TWAIT, ///< @brief -- | |
| 118 | + MESSAGE_CONNECTED = LIB3270_MESSAGE_CONNECTED, ///< @brief Connected | |
| 119 | + MESSAGE_DISCONNECTED = LIB3270_MESSAGE_DISCONNECTED, ///< @brief Disconnected from host | |
| 120 | + MESSAGE_AWAITING_FIRST = LIB3270_MESSAGE_AWAITING_FIRST, ///< @brief -- | |
| 121 | + MESSAGE_MINUS = LIB3270_MESSAGE_MINUS, ///< @brief -- | |
| 122 | + MESSAGE_PROTECTED = LIB3270_MESSAGE_PROTECTED, ///< @brief -- | |
| 123 | + MESSAGE_NUMERIC = LIB3270_MESSAGE_NUMERIC, ///< @brief -- | |
| 124 | + MESSAGE_OVERFLOW = LIB3270_MESSAGE_OVERFLOW, ///< @brief -- | |
| 125 | + MESSAGE_INHIBIT = LIB3270_MESSAGE_INHIBIT, ///< @brief -- | |
| 126 | + MESSAGE_KYBDLOCK = LIB3270_MESSAGE_KYBDLOCK, ///< @brief Keyboard is locked | |
| 127 | + | |
| 128 | + MESSAGE_X = LIB3270_MESSAGE_X, ///< @brief -- | |
| 129 | + MESSAGE_RESOLVING = LIB3270_MESSAGE_RESOLVING, ///< @brief Resolving hostname (running DNS query) | |
| 130 | + MESSAGE_CONNECTING = LIB3270_MESSAGE_CONNECTING ///< @brief Connecting to host | |
| 131 | + | |
| 132 | + }; | |
| 133 | + | |
| 134 | + /// @brief connection state. | |
| 135 | + enum ConnectionState : uint8_t { | |
| 136 | + DISCONNECTED = LIB3270_NOT_CONNECTED, ///< @brief disconnected | |
| 137 | + RESOLVING = LIB3270_RESOLVING, ///< @brief resolving hostname | |
| 138 | + PENDING = LIB3270_PENDING, ///< @brief connection pending | |
| 139 | + CONNECTED_INITIAL = LIB3270_CONNECTED_INITIAL, ///< @brief connected, no mode yet | |
| 140 | + CONNECTED_ANSI = LIB3270_CONNECTED_ANSI, ///< @brief connected in NVT ANSI mode | |
| 141 | + CONNECTED_3270 = LIB3270_CONNECTED_3270, ///< @brief connected in old-style 3270 mode | |
| 142 | + CONNECTED_INITIAL_E = LIB3270_CONNECTED_INITIAL_E, ///< @brief connected in TN3270E mode, unnegotiated | |
| 143 | + CONNECTED_NVT = LIB3270_CONNECTED_NVT, ///< @brief connected in TN3270E mode, NVT mode | |
| 144 | + CONNECTED_SSCP = LIB3270_CONNECTED_SSCP, ///< @brief connected in TN3270E mode, SSCP-LU mode | |
| 145 | + CONNECTED_TN3270E = LIB3270_CONNECTED_TN3270E, ///< @brief connected in TN3270E mode, 3270 mode | |
| 146 | + }; | |
| 147 | + | |
| 148 | + enum SSLState : uint8_t { | |
| 149 | + SSL_UNSECURE = LIB3270_SSL_UNSECURE, ///< @brief No secure connection | |
| 150 | + SSL_SECURE = LIB3270_SSL_SECURE, ///< @brief Connection secure with CA check | |
| 151 | + SSL_NEGOTIATED = LIB3270_SSL_NEGOTIATED, ///< @brief Connection secure, no CA, self-signed or expired CRL | |
| 152 | + SSL_NEGOTIATING = LIB3270_SSL_NEGOTIATING, ///< @brief Negotiating SSL | |
| 153 | + SSL_UNDEFINED = LIB3270_SSL_UNDEFINED ///< @brief Undefined | |
| 154 | + }; | |
| 155 | + | |
| 156 | + /// @brief PF Keys | |
| 157 | + enum PFKey : uint8_t { | |
| 158 | + PF_1, | |
| 159 | + PF_2, | |
| 160 | + PF_3, | |
| 161 | + PF_4, | |
| 162 | + PF_5, | |
| 163 | + PF_6, | |
| 164 | + PF_7, | |
| 165 | + PF_8, | |
| 166 | + PF_9, | |
| 167 | + PF_10, | |
| 168 | + PF_11, | |
| 169 | + PF_12, | |
| 170 | + PF_13, | |
| 171 | + PF_14, | |
| 172 | + PF_15, | |
| 173 | + PF_16, | |
| 174 | + PF_17, | |
| 175 | + PF_18, | |
| 176 | + PF_19, | |
| 177 | + PF_20, | |
| 178 | + PF_21, | |
| 179 | + PF_22, | |
| 180 | + PF_23, | |
| 181 | + PF_24 | |
| 182 | + }; | |
| 183 | + | |
| 184 | + /// @brief PF Keys | |
| 185 | + enum PAKey : uint8_t { | |
| 186 | + PA_1, | |
| 187 | + PA_2, | |
| 188 | + PA_3 | |
| 189 | + }; | |
| 190 | + | |
| 191 | + /// @brief Actions keys | |
| 192 | + enum Action : uint8_t { | |
| 193 | + ENTER, ///< @brief Enter key | |
| 194 | + ERASE, | |
| 195 | + ERASE_EOF, | |
| 196 | + ERASE_EOL, | |
| 197 | + ERASE_INPUT, | |
| 198 | + KYBD_RESET, | |
| 199 | + NEWLINE, | |
| 200 | + CLEAR, | |
| 201 | + SELECT_FIELD, | |
| 202 | + SELECT_ALL, | |
| 203 | + UNSELECT, | |
| 204 | + RESELECT, | |
| 205 | + CHAR_DELETE, | |
| 206 | + DUP, | |
| 207 | + FIELDMARK, | |
| 208 | + BACKSPACE, | |
| 209 | + WORD_PREVIOUS, | |
| 210 | + WORD_NEXT, | |
| 211 | + FIELD_END, ///< @brief Move the cursor to the first blank after the last nonblank in the field. | |
| 212 | + FIELD_FIRST, ///< @brief Move to first unprotected field on screen. | |
| 213 | + FIELD_NEXT, ///< @brief Jump to the next field. | |
| 214 | + FIELD_PREVIOUS, ///< @brief Tab backward to previous field. | |
| 215 | + ATTN, ///< @brief ATTN key, per RFC 2355. Sends IP, regardless. | |
| 216 | + BREAK, | |
| 217 | + WORD_DELETE, ///< @brief Backspaces the cursor until it hits the front of a word (does a ^W). | |
| 218 | + FIELD_DELETE, ///< @brief Delete field key (does a ^U). | |
| 219 | + SYSREQ, | |
| 220 | + KYBD_UNLOCK, ///< @brief Unlock the keyboard if it was locked by operator error. | |
| 221 | + }; | |
| 222 | + | |
| 223 | + /// @brief TN3270 Session. | |
| 224 | + class TN3270_PUBLIC Session { | |
| 225 | + protected: | |
| 226 | + Session(); | |
| 227 | + | |
| 228 | + /// @brief Write information to log file. | |
| 229 | + void info(const char *fmt, ...) const; | |
| 230 | + | |
| 231 | + /// @brief Write warning to log file. | |
| 232 | + void warning(const char *fmt, ...) const; | |
| 233 | + | |
| 234 | + /// @brief Write error to log file. | |
| 235 | + void error(const char *fmt, ...) const; | |
| 236 | + | |
| 237 | + /// @brief Fire event. | |
| 238 | + void fire(const Event &event); | |
| 239 | + | |
| 240 | + public: | |
| 241 | + | |
| 242 | + /// @brief Get an instance of the TN3270 session based on the supplied ID. | |
| 243 | + static Session * getInstance(const char *id = nullptr); | |
| 244 | + virtual ~Session(); | |
| 245 | + | |
| 246 | + // States | |
| 247 | + virtual ProgramMessage getProgramMessage() const = 0; | |
| 248 | + virtual ConnectionState getConnectionState() const = 0; | |
| 249 | + virtual SSLState getSSLState() const = 0; | |
| 250 | + | |
| 251 | + // Contents | |
| 252 | + virtual std::string toString(int baddr = 0, int len = -1, char lf = '\n') const = 0; | |
| 253 | + virtual std::string toString(unsigned int row, unsigned int col, int len, char lf = '\n') const = 0; | |
| 254 | + | |
| 255 | + /// @brief Input string. | |
| 256 | + virtual void push(const char *text, size_t length) = 0; | |
| 257 | + virtual void push(int baddr, const char *text, int length) = 0; | |
| 258 | + virtual void push(int row, int col, const char *text, int length) = 0; | |
| 259 | + | |
| 260 | + inline void push(const std::string &text) { | |
| 261 | + push(-1,text.c_str(),text.size()); | |
| 262 | + } | |
| 263 | + | |
| 264 | + inline void push(int baddr, const std::string &text) { | |
| 265 | + push(baddr,text.c_str(),text.size()); | |
| 266 | + } | |
| 267 | + | |
| 268 | + inline void push(int row, int col, const std::string &text) { | |
| 269 | + push(row,col,text.c_str(),text.size()); | |
| 270 | + } | |
| 271 | + | |
| 272 | + void push(const PFKey key); | |
| 273 | + void push(const PAKey key); | |
| 274 | + virtual void push(const Action action) = 0; | |
| 275 | + | |
| 276 | + /// @brief Get contents of field ad address. | |
| 277 | + virtual void pop(int baddr, std::string &text) = 0; | |
| 278 | + | |
| 279 | + /// @brief Get contents of field at position. | |
| 280 | + virtual void pop(int row, int col, std::string &text) = 0; | |
| 281 | + | |
| 282 | + /// @brief Get contents of field at cursor position. | |
| 283 | + virtual void pop(std::string &text) = 0; | |
| 284 | + | |
| 285 | + /** | |
| 286 | + * @brief Input string parsing control char. | |
| 287 | + */ | |
| 288 | + LIB3270_KEYBOARD_LOCK_STATE input(const std::string &str, const char control_char = '@'); | |
| 289 | + | |
| 290 | + // Properties. | |
| 291 | + virtual void getProperty(const char *name, int &value) const = 0; | |
| 292 | + virtual void getProperty(const char *name, unsigned int &value) const = 0; | |
| 293 | + virtual void getProperty(const char *name, std::string &value) const = 0; | |
| 294 | + virtual void getProperty(const char *name, bool &value) const = 0; | |
| 295 | + virtual void setProperty(const char *name, const int value) = 0; | |
| 296 | + virtual void setProperty(const char *name, const char *value) = 0; | |
| 297 | + | |
| 298 | + virtual std::string getVersion() const = 0; | |
| 299 | + virtual std::string getRevision() const = 0; | |
| 300 | + virtual std::string getLUName() const = 0; | |
| 301 | + virtual LIB3270_KEYBOARD_LOCK_STATE getKeyboardLockState() const = 0; | |
| 302 | + | |
| 303 | + virtual std::string getHostURL() const = 0; | |
| 304 | + virtual void setHostURL(const char *url) = 0; | |
| 305 | + | |
| 306 | + virtual void setUnlockDelay(unsigned short delay = 350) = 0; | |
| 307 | + virtual void setLockOnOperatorError(bool lock = true) = 0; | |
| 308 | + | |
| 309 | + virtual unsigned short getScreenWidth() const = 0; | |
| 310 | + virtual unsigned short getScreenHeight() const = 0; | |
| 311 | + virtual unsigned short getScreenLength() const = 0; | |
| 312 | + | |
| 313 | + /// @brief Set cursor address. | |
| 314 | + virtual unsigned short setCursor(int addr = -1) = 0; | |
| 315 | + | |
| 316 | + /// @brief Set cursor position. | |
| 317 | + virtual unsigned short setCursor(unsigned short row, unsigned short col) = 0; | |
| 318 | + | |
| 319 | + /// @brief Get cursor address | |
| 320 | + virtual unsigned short getCursorAddress() = 0; | |
| 321 | + | |
| 322 | + /// @brief Set local charset. | |
| 323 | + virtual void setCharSet(const char *charset = NULL) = 0; | |
| 324 | + | |
| 325 | + // Actions | |
| 326 | + | |
| 327 | + /// @brief Execute action by name. | |
| 328 | + virtual void action(const char *action_name) = 0; | |
| 329 | + | |
| 330 | + // Connect/disconnect | |
| 331 | + virtual void connect(const char *url = nullptr, int seconds = DEFAULT_TIMEOUT) = 0; | |
| 332 | + virtual void disconnect() = 0; | |
| 333 | + | |
| 334 | + /// @brief Wait. | |
| 335 | + virtual void wait(time_t seconds) const = 0; | |
| 336 | + | |
| 337 | + /// @brief Wait until session state changes to "ready". | |
| 338 | + virtual void waitForReady(time_t timeout = DEFAULT_TIMEOUT) const = 0; | |
| 339 | + | |
| 340 | + /// @brief Wait for screen changes. | |
| 341 | + virtual void waitForChange(time_t seconds = DEFAULT_TIMEOUT) const = 0; | |
| 342 | + | |
| 343 | + /// @brief Wait for screen changes. | |
| 344 | + virtual LIB3270_KEYBOARD_LOCK_STATE waitForKeyboardUnlock(time_t seconds = DEFAULT_TIMEOUT) const = 0; | |
| 345 | + | |
| 346 | + /// @brief Send PF. | |
| 347 | + virtual void pfkey(unsigned short value) = 0; | |
| 348 | + | |
| 349 | + /// @brief Send PA. | |
| 350 | + virtual void pakey(unsigned short value) = 0; | |
| 351 | + | |
| 352 | + /// @brief Request print | |
| 353 | + virtual void print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) = 0; | |
| 354 | + | |
| 355 | + /// @brief Insert event listener. | |
| 356 | + // void insert(Event::Type type, std::function <void(const Event &event)> listener); | |
| 357 | + | |
| 358 | + // Misc | |
| 359 | + | |
| 360 | + /// @brief Search | |
| 361 | + size_t find(const char * str, size_t pos = 0) const; | |
| 362 | + | |
| 363 | + /// @brief Compare contents. | |
| 364 | + int compare(int baddr, const char* s, int len = -1) const; | |
| 365 | + int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; | |
| 366 | + | |
| 367 | + }; | |
| 368 | + | |
| 369 | + /// @brief TN3270 Host | |
| 370 | + class TN3270_PUBLIC Host : public std::basic_streambuf<char, std::char_traits<char> > { | |
| 371 | + private: | |
| 372 | + | |
| 373 | + /// @brief Connection with the host | |
| 374 | + Session *session; | |
| 375 | + | |
| 376 | + /// @brief How much seconds we wait for the terminal to be ready? | |
| 377 | + time_t timeout; | |
| 378 | + | |
| 379 | + protected: | |
| 380 | + | |
| 381 | + /// @brief Writes characters to the associated file from the put area | |
| 382 | + int sync() override; | |
| 383 | + | |
| 384 | + /// @brief Writes characters to the associated output sequence from the put area. | |
| 385 | + int overflow(int c) override; | |
| 386 | + | |
| 387 | + /* | |
| 388 | + /// @brief Write information to log file. | |
| 389 | + void info(const char *fmt, ...) const; | |
| 390 | + | |
| 391 | + /// @brief Write warning to log file. | |
| 392 | + void warning(const char *fmt, ...) const; | |
| 393 | + | |
| 394 | + /// @brief Write error to log file. | |
| 395 | + void error(const char *fmt, ...) const; | |
| 396 | + */ | |
| 397 | + | |
| 398 | + public: | |
| 399 | + Host(const char *id = nullptr, const char *url = nullptr, time_t timeout = DEFAULT_TIMEOUT); | |
| 400 | + ~Host(); | |
| 401 | + | |
| 402 | + inline bool operator==(ConnectionState state) const noexcept { | |
| 403 | + return session->getConnectionState() == state; | |
| 404 | + } | |
| 405 | + | |
| 406 | + // Contents | |
| 407 | + | |
| 408 | + /** | |
| 409 | + * @brief Input string parsing control char. | |
| 410 | + */ | |
| 411 | + LIB3270_KEYBOARD_LOCK_STATE input(const char *text, int length = -1, const char control_char = '@'); | |
| 412 | + | |
| 413 | + Host & push(int baddr, const std::string &text); | |
| 414 | + Host & push(int row, int col, const std::string &text); | |
| 415 | + Host & push(const std::string &text); | |
| 416 | + | |
| 417 | + Host & push(int baddr, const char *str, int len = -1); | |
| 418 | + Host & push(int row, int col, const char *str, int len = -1); | |
| 419 | + Host & push(const char *str, int len = -1); | |
| 420 | + | |
| 421 | + Host & pop(int baddr, std::string &text); | |
| 422 | + Host & pop(int row, int col, std::string &text); | |
| 423 | + Host & pop(std::string &text); | |
| 424 | + | |
| 425 | + std::string toString() const; | |
| 426 | + std::string toString(int baddr, int len = -1, char lf = '\n') const; | |
| 427 | + std::string toString(unsigned int row, unsigned int col, int len = -1, char lf = '\n') const; | |
| 428 | + | |
| 429 | + template<typename T> | |
| 430 | + Host & push(T value) { | |
| 431 | + session->push(value); | |
| 432 | + sync(); | |
| 433 | + return *this; | |
| 434 | + } | |
| 435 | + | |
| 436 | + template<typename T> | |
| 437 | + Host & pop(T value) { | |
| 438 | + sync(); | |
| 439 | + session->pop(value); | |
| 440 | + return *this; | |
| 441 | + } | |
| 442 | + | |
| 443 | + // Actions | |
| 444 | + Host & connect(const char *url = nullptr); | |
| 445 | + Host & disconnect(); | |
| 446 | + Host & waitForReady(time_t seconds); | |
| 447 | + | |
| 448 | + inline Host & waitForReady() { | |
| 449 | + return waitForReady(this->timeout); | |
| 450 | + } | |
| 451 | + | |
| 452 | + inline LIB3270_KEYBOARD_LOCK_STATE waitForKeyboardUnlock() noexcept { | |
| 453 | + return this->session->waitForKeyboardUnlock(timeout); | |
| 454 | + } | |
| 455 | + | |
| 456 | + /// @brief Execute action by name. | |
| 457 | + inline Host & action(const char *action_name) { | |
| 458 | + session->action(action_name); | |
| 459 | + return *this; | |
| 460 | + } | |
| 461 | + | |
| 462 | + inline ProgramMessage getProgramMessage() const { | |
| 463 | + return session->getProgramMessage(); | |
| 464 | + } | |
| 465 | + | |
| 466 | + operator bool() const; | |
| 467 | + | |
| 468 | + inline operator ProgramMessage() const { | |
| 469 | + return getProgramMessage(); | |
| 470 | + } | |
| 471 | + | |
| 472 | + inline ConnectionState getConnectionState() const { | |
| 473 | + return session->getConnectionState(); | |
| 474 | + } | |
| 475 | + | |
| 476 | + bool isReady() const; | |
| 477 | + bool isConnected() const; | |
| 478 | + | |
| 479 | + inline operator ConnectionState() const { | |
| 480 | + return getConnectionState(); | |
| 481 | + } | |
| 482 | + | |
| 483 | + /// @brief Set cursor address. | |
| 484 | + inline Host & setCursor(unsigned short addr) { | |
| 485 | + session->setCursor(addr); | |
| 486 | + return *this; | |
| 487 | + } | |
| 488 | + | |
| 489 | + /// @brief Set cursor position. | |
| 490 | + inline Host & setCursor(unsigned short row, unsigned short col) { | |
| 491 | + session->setCursor(row,col); | |
| 492 | + return *this; | |
| 493 | + } | |
| 494 | + | |
| 495 | + /// @brief Get cursor address | |
| 496 | + inline unsigned short getCursorAddress() { | |
| 497 | + return session->getCursorAddress(); | |
| 498 | + } | |
| 499 | + | |
| 500 | + inline void setUnlockDelay(unsigned short delay) { | |
| 501 | + return session->setUnlockDelay(delay); | |
| 502 | + } | |
| 503 | + | |
| 504 | + inline void setLockOnOperatorError(bool lock = true) { | |
| 505 | + return session->setLockOnOperatorError(lock); | |
| 506 | + } | |
| 507 | + | |
| 508 | + inline void setCharSet(const char *charset) { | |
| 509 | + return session->setCharSet(charset); | |
| 510 | + } | |
| 511 | + | |
| 512 | + // Get properties | |
| 513 | + | |
| 514 | + /// @brief Get lib3270 version. | |
| 515 | + inline std::string getVersion() const { | |
| 516 | + return session->getVersion(); | |
| 517 | + } | |
| 518 | + | |
| 519 | + /// @brief Get lib3270 revision. | |
| 520 | + std::string getRevision() const { | |
| 521 | + return session->getRevision(); | |
| 522 | + } | |
| 523 | + | |
| 524 | + /// @brief Get LU Name. | |
| 525 | + std::string getLUName() const { | |
| 526 | + return session->getLUName(); | |
| 527 | + } | |
| 528 | + | |
| 529 | + inline LIB3270_KEYBOARD_LOCK_STATE getKeyboardLockState() const { | |
| 530 | + return session->getKeyboardLockState(); | |
| 531 | + } | |
| 532 | + | |
| 533 | + // Actions | |
| 534 | + | |
| 535 | + /// @brief Send PF. | |
| 536 | + inline Host & pfkey(unsigned short value) { | |
| 537 | + session->pfkey(value); | |
| 538 | + return *this; | |
| 539 | + } | |
| 540 | + | |
| 541 | + /// @brief Send PA. | |
| 542 | + inline Host & pakey(unsigned short value) { | |
| 543 | + session->pakey(value); | |
| 544 | + return *this; | |
| 545 | + } | |
| 546 | + | |
| 547 | + /// @brief Request print | |
| 548 | + inline Host & print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) { | |
| 549 | + session->print(option); | |
| 550 | + return *this; | |
| 551 | + } | |
| 552 | + | |
| 553 | + /// @brief Wait. | |
| 554 | + inline Host & wait(unsigned short seconds) { | |
| 555 | + session->wait(seconds); | |
| 556 | + return *this; | |
| 557 | + } | |
| 558 | + | |
| 559 | + /// @brief Wait for update. | |
| 560 | + inline Host & waitForChange(unsigned short seconds) { | |
| 561 | + session->waitForChange(seconds); | |
| 562 | + return *this; | |
| 563 | + } | |
| 564 | + | |
| 565 | + // Set contents. | |
| 566 | + | |
| 567 | + /// @brief Input string. | |
| 568 | + /// | |
| 569 | + /// Input the supplied string processing commands delimited by the control char in | |
| 570 | + /// the same way of the old HLLAPI. | |
| 571 | + /// | |
| 572 | + /// @param text String with the text to input. | |
| 573 | + /// @param control_char Control character used to identify commands. | |
| 574 | + // Host & input(const char *text, const char control_char = '@'); | |
| 575 | + | |
| 576 | + // Host & input(const char *text, size_t sz); | |
| 577 | + | |
| 578 | + /// @brief Set field at current position, jumps to next writable field. | |
| 579 | + inline Host & push(const char *text) { | |
| 580 | + session->push(text,-1); | |
| 581 | + return *this; | |
| 582 | + }; | |
| 583 | + | |
| 584 | + /* | |
| 585 | + // Event listeners | |
| 586 | + inline Host & insert(Event::Type type, std::function <void(const Event &event)> listener) noexcept { | |
| 587 | + session->insert(type, listener); | |
| 588 | + return *this; | |
| 589 | + } | |
| 590 | + */ | |
| 591 | + | |
| 592 | + | |
| 593 | + }; | |
| 594 | + | |
| 595 | + } | |
| 596 | + | |
| 597 | + TN3270_PUBLIC const char * toCharString(const TN3270::ProgramMessage programMessage); | |
| 598 | + TN3270_PUBLIC const char * toCharString(const TN3270::ConnectionState connectionState); | |
| 599 | + TN3270_PUBLIC const char * toCharString(const TN3270::Action action); | |
| 600 | + | |
| 601 | + template <typename T> | |
| 602 | + inline TN3270_PUBLIC TN3270::Session & operator<<(TN3270::Session& session, const T value) { | |
| 603 | + return session.push(value); | |
| 604 | + } | |
| 605 | + | |
| 606 | + template <typename T> | |
| 607 | + inline TN3270_PUBLIC TN3270::Session & operator>>(TN3270::Session& session, const T value) { | |
| 608 | + return session.pop(value); | |
| 609 | + } | |
| 610 | + | |
| 611 | + template <typename T> | |
| 612 | + inline TN3270_PUBLIC TN3270::Host & operator<<(TN3270::Host& host, const T value) { | |
| 613 | + return host.push(value); | |
| 614 | + } | |
| 615 | + | |
| 616 | + inline std::ostream & operator<<(std::ostream &stream, const TN3270::Host& host) { | |
| 617 | + stream << host.toString(); | |
| 618 | + return stream; | |
| 619 | + } | |
| 620 | + | |
| 621 | + | |
| 622 | +#endif | |
| 623 | + | |
| 624 | +#endif // LIB3270_IPC_H_INCLUDED | ... | ... |
| ... | ... | @@ -0,0 +1,165 @@ |
| 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 lib3270/ipc/request.h | |
| 32 | + * | |
| 33 | + * @brief Declares the TN3270 IPC Request object. | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | +#ifndef IPC3270_REQUEST_H_INCLUDED | |
| 40 | + | |
| 41 | + #define IPC3270_REQUEST_H_INCLUDED | |
| 42 | + | |
| 43 | + #include <config.h> | |
| 44 | + | |
| 45 | + #ifdef _WIN32 | |
| 46 | + #include <winsock2.h> | |
| 47 | + #include <windows.h> | |
| 48 | + #include <ws2tcpip.h> | |
| 49 | + #else | |
| 50 | + #include <dbus/dbus.h> | |
| 51 | + #endif // WIN32 | |
| 52 | + | |
| 53 | + namespace TN3270 { | |
| 54 | + | |
| 55 | + namespace IPC { | |
| 56 | + | |
| 57 | + class Session; | |
| 58 | + | |
| 59 | + /// @brief PW3270 IPC Request/Response. | |
| 60 | + class TN3270_PUBLIC Request { | |
| 61 | + private: | |
| 62 | + | |
| 63 | +#ifdef _WIN32 | |
| 64 | + /// @brief Pipe Handle. | |
| 65 | + HANDLE hPipe; | |
| 66 | + | |
| 67 | + /// @brief IPC Data type. | |
| 68 | + enum Type : uint8_t { | |
| 69 | + String = 's', | |
| 70 | + Boolean = 'b', | |
| 71 | + Uchar = 'y', | |
| 72 | + Int16 = 'n', | |
| 73 | + Uint16 = 'q', | |
| 74 | + Int32 = 'i', | |
| 75 | + Int32x = 'h', | |
| 76 | + Uint32 = 'u', | |
| 77 | + Int64 = 'x', | |
| 78 | + Uint64 = 't' | |
| 79 | + }; | |
| 80 | + | |
| 81 | + struct { | |
| 82 | + DWORD length; ///< @brief Length of input buffer. | |
| 83 | + DWORD used; ///< @brief Length of used block. | |
| 84 | + DWORD current; ///< @brief Offset of the current argument. | |
| 85 | + uint8_t * block; | |
| 86 | + } in; | |
| 87 | + | |
| 88 | + struct { | |
| 89 | + DWORD length; | |
| 90 | + DWORD used; | |
| 91 | + uint8_t * block; | |
| 92 | + } out; | |
| 93 | + | |
| 94 | + struct DataBlock { | |
| 95 | + Type type; | |
| 96 | + }; | |
| 97 | + | |
| 98 | + /// @brief Store value on data block. | |
| 99 | + DataBlock * pushBlock(const void *ptr, size_t len); | |
| 100 | + | |
| 101 | + /// @brief Get next argument. | |
| 102 | + DataBlock * getNextBlock() const; | |
| 103 | + | |
| 104 | + /// @brief Pointer to number of variants in the output buffer. | |
| 105 | + uint16_t * outvalues; | |
| 106 | + | |
| 107 | +#else | |
| 108 | + struct { | |
| 109 | + DBusMessage * in; | |
| 110 | + DBusMessage * out; | |
| 111 | + DBusMessageIter iter; | |
| 112 | + | |
| 113 | + } msg; | |
| 114 | + DBusConnection * conn; | |
| 115 | + | |
| 116 | + Request(DBusConnection * conn); | |
| 117 | + | |
| 118 | +#endif // _WIN32 | |
| 119 | + | |
| 120 | + protected: | |
| 121 | + | |
| 122 | +#ifdef _WIN32 | |
| 123 | + Request(HANDLE hPipe, const char *name, uint16_t type); | |
| 124 | +#endif // _WIN32 | |
| 125 | + | |
| 126 | + public: | |
| 127 | + | |
| 128 | + /// @brief Create a method call. | |
| 129 | + /// | |
| 130 | + /// @param session Session object. | |
| 131 | + /// @param method Method name. | |
| 132 | + /// | |
| 133 | + Request(const IPC::Session &session, const char *method); | |
| 134 | + | |
| 135 | + /// @brief Create a get/set property call. | |
| 136 | + /// | |
| 137 | + /// @param session Session object. | |
| 138 | + /// @param isSet true if this is a setProperty call. | |
| 139 | + /// @param property Property name. | |
| 140 | + /// | |
| 141 | + Request(const IPC::Session &session, bool isSet, const char *property); | |
| 142 | + | |
| 143 | + ~Request(); | |
| 144 | + | |
| 145 | + Request & call(); | |
| 146 | + | |
| 147 | + // Push values | |
| 148 | + Request & push(const char *arg); | |
| 149 | + Request & push(const bool arg); | |
| 150 | + Request & push(const int32_t arg); | |
| 151 | + Request & push(const uint32_t arg); | |
| 152 | + Request & push(const uint8_t arg); | |
| 153 | + | |
| 154 | + // Pop values | |
| 155 | + Request & pop(std::string &value); | |
| 156 | + Request & pop(int &value); | |
| 157 | + Request & pop(unsigned int &value); | |
| 158 | + | |
| 159 | + }; | |
| 160 | + | |
| 161 | + } | |
| 162 | + | |
| 163 | + } | |
| 164 | + | |
| 165 | +#endif // IPC3270_REQUEST_H_INCLUDED | ... | ... |
client/src/session/remote/linux/request.cc
| ... | ... | @@ -47,13 +47,7 @@ |
| 47 | 47 | |
| 48 | 48 | namespace TN3270 { |
| 49 | 49 | |
| 50 | - IPC::Request::Request(const IPC::Session &session) { | |
| 51 | - this->conn = session.conn; | |
| 52 | - this->msg.in = nullptr; | |
| 53 | - this->msg.out = nullptr; | |
| 54 | - } | |
| 55 | - | |
| 56 | - IPC::Request::Request(const IPC::Session &session, const char *method) : Request(session) { | |
| 50 | + IPC::Request::Request(const IPC::Session &session, const char *method) : Request(session.conn) { | |
| 57 | 51 | |
| 58 | 52 | #ifdef DEBUG |
| 59 | 53 | clog << "Creating request \"" << method << "\"" << endl; |
| ... | ... | @@ -72,7 +66,7 @@ |
| 72 | 66 | |
| 73 | 67 | } |
| 74 | 68 | |
| 75 | - IPC::Request::Request(const IPC::Session &session, bool isSet, const char *property) : Request(session) { | |
| 69 | + IPC::Request::Request(const IPC::Session &session, bool isSet, const char *property) : Request(session.conn) { | |
| 76 | 70 | |
| 77 | 71 | this->msg.out = dbus_message_new_method_call( |
| 78 | 72 | session.name.c_str(), // Destination | ... | ... |
common/src/include/lib3270/ipc-glib.h
| ... | ... | @@ -1,138 +0,0 @@ |
| 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. Registro no INPI sob | |
| 5 | - * o nome G3270. | |
| 6 | - * | |
| 7 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 8 | - * | |
| 9 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 10 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 11 | - * Free Software Foundation. | |
| 12 | - * | |
| 13 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 14 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 15 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 16 | - * obter mais detalhes. | |
| 17 | - * | |
| 18 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 19 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 20 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 21 | - * | |
| 22 | - * Este programa está nomeado como - e possui - linhas de código. | |
| 23 | - * | |
| 24 | - * Contatos: | |
| 25 | - * | |
| 26 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 27 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 28 | - * | |
| 29 | - */ | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * @brief Common definitions for pw3270 IPC plugin. | |
| 33 | - * | |
| 34 | - * @author Perry Werneck <perry.werneck@gmail.com> | |
| 35 | - * | |
| 36 | - */ | |
| 37 | - | |
| 38 | -#ifndef PW3270_IPC_H_INCLUDED | |
| 39 | - | |
| 40 | - #define PW3270_IPC_H_INCLUDED | |
| 41 | - | |
| 42 | - #ifdef _WIN32 | |
| 43 | - | |
| 44 | - #define PW3270_IPC_SESSION_BUS_NAME "\\\\.\\pipe\\%s\\%c" | |
| 45 | - | |
| 46 | - #else | |
| 47 | - | |
| 48 | - #define PW3270_IPC_SESSION_BUS_NAME "br.com.bb.%s.%c" | |
| 49 | - #define PW3270_IPC_SESSION_INTERFACE_NAME "br.com.bb.tn3270.session" | |
| 50 | - #define PW3270_IPC_SESSION_OBJECT_PATH "/br/com/bb/tn3270/session" | |
| 51 | - | |
| 52 | - #define PW3270_IPC_SERVICE_BUS_NAME "br.com.bb.tn3270.service" | |
| 53 | - #define PW3270_IPC_SERVICE_INTERFACE_NAME "br.com.bb.tn3270.service" | |
| 54 | - #define PW3270_IPC_SERVICE_OBJECT_PATH "/br/com/bb/tn3270/service" | |
| 55 | - | |
| 56 | - #endif // _WIN32 | |
| 57 | - | |
| 58 | - #include <glib.h> | |
| 59 | - #include <gtk/gtk.h> | |
| 60 | - #include <lib3270.h> | |
| 61 | - | |
| 62 | - G_BEGIN_DECLS | |
| 63 | - | |
| 64 | - #define GLIB_TYPE_IPC3270_RESPONSE (ipc3270Response_get_type ()) | |
| 65 | - #define IPC3270_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLIB_TYPE_IPC3270_RESPONSE, ipc3270Response)) | |
| 66 | - #define IPC3270_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIB_TYPE_IPC3270_RESPONSE, ipc3270ResponseClass)) | |
| 67 | - #define IS_IPC3270_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLIB_TYPE_IPC3270_RESPONSE)) | |
| 68 | - #define IS_IPC3270_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIB_TYPE_IPC3270_RESPONSE)) | |
| 69 | - #define IPC3270_RESPONSE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS ((obj), GLIB_TYPE_IPC3270_RESPONSE, ipc3270ResponseClass)) | |
| 70 | - | |
| 71 | - typedef struct _ipc3270Response ipc3270Response; | |
| 72 | - typedef struct _ipc3270ResponseClass ipc3270ResponseClass; | |
| 73 | - | |
| 74 | - GObject * ipc3270_response_new(); | |
| 75 | - | |
| 76 | - void ipc3270_response_append_int32(GObject *object, gint32 value); | |
| 77 | - void ipc3270_response_append_uint32(GObject *object, guint32 value); | |
| 78 | - void ipc3270_response_append_string(GObject *object, const gchar *text); | |
| 79 | - gboolean ipc3270_response_has_values(GObject *object); | |
| 80 | - GVariant * ipc3270_response_steal_value(GObject *object); | |
| 81 | - | |
| 82 | - | |
| 83 | - #define GLIB_TYPE_IPC3270 (ipc3270_get_type ()) | |
| 84 | - #define IPC3270(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLIB_TYPE_IPC3270, ipc3270)) | |
| 85 | - #define IPC3270_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIB_TYPE_IPC3270, ipc3270Class)) | |
| 86 | - #define IS_IPC3270(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLIB_TYPE_IPC3270)) | |
| 87 | - #define IS_IPC3270_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIB_TYPE_IPC3270)) | |
| 88 | - #define IPC3270_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLIB_TYPE_IPC3270, ipc3270Class)) | |
| 89 | - | |
| 90 | - typedef struct _ipc3270 ipc3270; | |
| 91 | - typedef struct _ipc3270Class ipc3270Class; | |
| 92 | - | |
| 93 | - GObject * ipc3270_new(); | |
| 94 | - GType ipc3270_get_type(void); | |
| 95 | - void ipc3270_set_terminal_widget(GObject *object, GtkWidget *widget); | |
| 96 | - void ipc3270_export_object(GObject *object, const char *name, GError **error); | |
| 97 | - | |
| 98 | - void ipc3270_add_terminal_introspection(GString *string); | |
| 99 | - | |
| 100 | - const gchar * ipc3270_get_display_charset(GObject *object); | |
| 101 | - H3270 * ipc3270_get_session(GObject *object); | |
| 102 | - | |
| 103 | - GQuark ipc3270_get_error_domain(GObject *object); | |
| 104 | - | |
| 105 | - void ipc3270_set_error(GObject *object, int errcode, GError **error); | |
| 106 | - | |
| 107 | - int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *request, GObject *response, GError **error); | |
| 108 | - gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error); | |
| 109 | - GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error); | |
| 110 | - | |
| 111 | - #ifdef _WIN32 | |
| 112 | - unsigned char * ipc3270_pack(const gchar *name, int id, GVariant *values, size_t * szPacket); | |
| 113 | - unsigned char * ipc3270_pack_value(const gchar *name, int id, GVariant *value, size_t * szPacket); | |
| 114 | - unsigned char * ipc3270_pack_error(const GError *error, size_t * szPacket); | |
| 115 | - GVariant * ipc3270_unpack(const unsigned char *packet, int *id); | |
| 116 | - #endif // _WIN32 | |
| 117 | - | |
| 118 | - G_END_DECLS | |
| 119 | - | |
| 120 | - #if ! GLIB_CHECK_VERSION(2,44,0) | |
| 121 | - G_GNUC_INTERNAL void ipc3270_autoptr_cleanup_generic_gfree(void *p); | |
| 122 | - #define g_autofree __attribute__((cleanup(ipc3270_autoptr_cleanup_generic_gfree))) | |
| 123 | - #endif // ! GLIB(2,44,0) | |
| 124 | - | |
| 125 | - #ifdef DEBUG | |
| 126 | - #define debug( fmt, ... ) fprintf(stderr,"%s(%d) " fmt "\n", __FILE__, (int) __LINE__, __VA_ARGS__ ); fflush(stderr); | |
| 127 | - #else | |
| 128 | - #define debug(...) /* __VA_ARGS */ | |
| 129 | - #endif | |
| 130 | - | |
| 131 | - typedef struct _ipc_method_int_arg { | |
| 132 | - const gchar *name; | |
| 133 | - int (*call)(H3270 *hSession, int keycode); | |
| 134 | - } IPC_METHOD_INT_ARG; | |
| 135 | - | |
| 136 | - const IPC_METHOD_INT_ARG * ipc3270_get_int_arg_methods(); | |
| 137 | - | |
| 138 | -#endif // PW3270_IPC_H_INCLUDED |
common/src/include/lib3270/ipc.h
| ... | ... | @@ -1,624 +0,0 @@ |
| 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 ipc.h 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 | -#ifndef LIB3270_IPC_H_INCLUDED | |
| 31 | - | |
| 32 | - #define LIB3270_IPC_H_INCLUDED 1 | |
| 33 | - | |
| 34 | - #include <iostream> | |
| 35 | - #include <cstdarg> | |
| 36 | - #include <vector> | |
| 37 | - #include <functional> | |
| 38 | - #include <lib3270.h> | |
| 39 | - #include <lib3270/keyboard.h> | |
| 40 | - | |
| 41 | - #if defined(_WIN32) | |
| 42 | - | |
| 43 | - #define TN3270_PUBLIC __declspec (dllexport) | |
| 44 | - #define TN3270_PRIVATE | |
| 45 | - | |
| 46 | - #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) | |
| 47 | - | |
| 48 | - #define TN3270_PUBLIC | |
| 49 | - #define TN3270_PRIVATE | |
| 50 | - | |
| 51 | - #elif defined(__GNUC__) | |
| 52 | - | |
| 53 | - #define TN3270_PUBLIC __attribute__((visibility("default"))) | |
| 54 | - #define TN3270_PRIVATE __attribute__((visibility("hidden"))) | |
| 55 | - | |
| 56 | - #else | |
| 57 | - | |
| 58 | - #error Unable to set visibility attribute | |
| 59 | - | |
| 60 | - #endif | |
| 61 | - | |
| 62 | -#ifdef __cplusplus | |
| 63 | - | |
| 64 | - #include <string> | |
| 65 | - | |
| 66 | - namespace TN3270 { | |
| 67 | - | |
| 68 | - class Host; | |
| 69 | - class Controller; | |
| 70 | - | |
| 71 | - #define DEFAULT_TIMEOUT 5 | |
| 72 | - | |
| 73 | - TN3270_PUBLIC const char * getVersion(); | |
| 74 | - TN3270_PUBLIC const char * getRevision(); | |
| 75 | - | |
| 76 | - class TN3270_PUBLIC Event { | |
| 77 | - public: | |
| 78 | - enum Type : uint8_t { | |
| 79 | - All, ///< @brief All events (undefined). | |
| 80 | - Popup, ///< @brief Popup message. | |
| 81 | - Trace, ///< @brief Trace message. | |
| 82 | - Message, ///< @brief Generic message. | |
| 83 | - Connection ///< @brief Connect/Disconnect event. | |
| 84 | - }; | |
| 85 | - | |
| 86 | - private: | |
| 87 | - Type type; | |
| 88 | - | |
| 89 | - protected: | |
| 90 | - Event(enum Type type); | |
| 91 | - | |
| 92 | - public: | |
| 93 | - virtual ~Event(); | |
| 94 | - | |
| 95 | - /// @brief Check event type | |
| 96 | - inline bool is(Event::Type type) const noexcept { | |
| 97 | - return this->type == type; | |
| 98 | - } | |
| 99 | - | |
| 100 | - /// @brief Check event type | |
| 101 | - inline bool operator==(Event::Type type) const noexcept { | |
| 102 | - return this->type == type; | |
| 103 | - } | |
| 104 | - | |
| 105 | - inline operator Event::Type() const noexcept { | |
| 106 | - return this->type; | |
| 107 | - } | |
| 108 | - | |
| 109 | - /// @brief Get event description. | |
| 110 | - virtual std::string toString() const = 0; | |
| 111 | - | |
| 112 | - }; | |
| 113 | - | |
| 114 | - enum ProgramMessage : uint8_t { | |
| 115 | - MESSAGE_NONE = LIB3270_MESSAGE_NONE, ///< @brief No message | |
| 116 | - MESSAGE_SYSWAIT = LIB3270_MESSAGE_SYSWAIT, ///< @brief -- | |
| 117 | - MESSAGE_TWAIT = LIB3270_MESSAGE_TWAIT, ///< @brief -- | |
| 118 | - MESSAGE_CONNECTED = LIB3270_MESSAGE_CONNECTED, ///< @brief Connected | |
| 119 | - MESSAGE_DISCONNECTED = LIB3270_MESSAGE_DISCONNECTED, ///< @brief Disconnected from host | |
| 120 | - MESSAGE_AWAITING_FIRST = LIB3270_MESSAGE_AWAITING_FIRST, ///< @brief -- | |
| 121 | - MESSAGE_MINUS = LIB3270_MESSAGE_MINUS, ///< @brief -- | |
| 122 | - MESSAGE_PROTECTED = LIB3270_MESSAGE_PROTECTED, ///< @brief -- | |
| 123 | - MESSAGE_NUMERIC = LIB3270_MESSAGE_NUMERIC, ///< @brief -- | |
| 124 | - MESSAGE_OVERFLOW = LIB3270_MESSAGE_OVERFLOW, ///< @brief -- | |
| 125 | - MESSAGE_INHIBIT = LIB3270_MESSAGE_INHIBIT, ///< @brief -- | |
| 126 | - MESSAGE_KYBDLOCK = LIB3270_MESSAGE_KYBDLOCK, ///< @brief Keyboard is locked | |
| 127 | - | |
| 128 | - MESSAGE_X = LIB3270_MESSAGE_X, ///< @brief -- | |
| 129 | - MESSAGE_RESOLVING = LIB3270_MESSAGE_RESOLVING, ///< @brief Resolving hostname (running DNS query) | |
| 130 | - MESSAGE_CONNECTING = LIB3270_MESSAGE_CONNECTING ///< @brief Connecting to host | |
| 131 | - | |
| 132 | - }; | |
| 133 | - | |
| 134 | - /// @brief connection state. | |
| 135 | - enum ConnectionState : uint8_t { | |
| 136 | - DISCONNECTED = LIB3270_NOT_CONNECTED, ///< @brief disconnected | |
| 137 | - RESOLVING = LIB3270_RESOLVING, ///< @brief resolving hostname | |
| 138 | - PENDING = LIB3270_PENDING, ///< @brief connection pending | |
| 139 | - CONNECTED_INITIAL = LIB3270_CONNECTED_INITIAL, ///< @brief connected, no mode yet | |
| 140 | - CONNECTED_ANSI = LIB3270_CONNECTED_ANSI, ///< @brief connected in NVT ANSI mode | |
| 141 | - CONNECTED_3270 = LIB3270_CONNECTED_3270, ///< @brief connected in old-style 3270 mode | |
| 142 | - CONNECTED_INITIAL_E = LIB3270_CONNECTED_INITIAL_E, ///< @brief connected in TN3270E mode, unnegotiated | |
| 143 | - CONNECTED_NVT = LIB3270_CONNECTED_NVT, ///< @brief connected in TN3270E mode, NVT mode | |
| 144 | - CONNECTED_SSCP = LIB3270_CONNECTED_SSCP, ///< @brief connected in TN3270E mode, SSCP-LU mode | |
| 145 | - CONNECTED_TN3270E = LIB3270_CONNECTED_TN3270E, ///< @brief connected in TN3270E mode, 3270 mode | |
| 146 | - }; | |
| 147 | - | |
| 148 | - enum SSLState : uint8_t { | |
| 149 | - SSL_UNSECURE = LIB3270_SSL_UNSECURE, ///< @brief No secure connection | |
| 150 | - SSL_SECURE = LIB3270_SSL_SECURE, ///< @brief Connection secure with CA check | |
| 151 | - SSL_NEGOTIATED = LIB3270_SSL_NEGOTIATED, ///< @brief Connection secure, no CA, self-signed or expired CRL | |
| 152 | - SSL_NEGOTIATING = LIB3270_SSL_NEGOTIATING, ///< @brief Negotiating SSL | |
| 153 | - SSL_UNDEFINED = LIB3270_SSL_UNDEFINED ///< @brief Undefined | |
| 154 | - }; | |
| 155 | - | |
| 156 | - /// @brief PF Keys | |
| 157 | - enum PFKey : uint8_t { | |
| 158 | - PF_1, | |
| 159 | - PF_2, | |
| 160 | - PF_3, | |
| 161 | - PF_4, | |
| 162 | - PF_5, | |
| 163 | - PF_6, | |
| 164 | - PF_7, | |
| 165 | - PF_8, | |
| 166 | - PF_9, | |
| 167 | - PF_10, | |
| 168 | - PF_11, | |
| 169 | - PF_12, | |
| 170 | - PF_13, | |
| 171 | - PF_14, | |
| 172 | - PF_15, | |
| 173 | - PF_16, | |
| 174 | - PF_17, | |
| 175 | - PF_18, | |
| 176 | - PF_19, | |
| 177 | - PF_20, | |
| 178 | - PF_21, | |
| 179 | - PF_22, | |
| 180 | - PF_23, | |
| 181 | - PF_24 | |
| 182 | - }; | |
| 183 | - | |
| 184 | - /// @brief PF Keys | |
| 185 | - enum PAKey : uint8_t { | |
| 186 | - PA_1, | |
| 187 | - PA_2, | |
| 188 | - PA_3 | |
| 189 | - }; | |
| 190 | - | |
| 191 | - /// @brief Actions keys | |
| 192 | - enum Action : uint8_t { | |
| 193 | - ENTER, ///< @brief Enter key | |
| 194 | - ERASE, | |
| 195 | - ERASE_EOF, | |
| 196 | - ERASE_EOL, | |
| 197 | - ERASE_INPUT, | |
| 198 | - KYBD_RESET, | |
| 199 | - NEWLINE, | |
| 200 | - CLEAR, | |
| 201 | - SELECT_FIELD, | |
| 202 | - SELECT_ALL, | |
| 203 | - UNSELECT, | |
| 204 | - RESELECT, | |
| 205 | - CHAR_DELETE, | |
| 206 | - DUP, | |
| 207 | - FIELDMARK, | |
| 208 | - BACKSPACE, | |
| 209 | - WORD_PREVIOUS, | |
| 210 | - WORD_NEXT, | |
| 211 | - FIELD_END, ///< @brief Move the cursor to the first blank after the last nonblank in the field. | |
| 212 | - FIELD_FIRST, ///< @brief Move to first unprotected field on screen. | |
| 213 | - FIELD_NEXT, ///< @brief Jump to the next field. | |
| 214 | - FIELD_PREVIOUS, ///< @brief Tab backward to previous field. | |
| 215 | - ATTN, ///< @brief ATTN key, per RFC 2355. Sends IP, regardless. | |
| 216 | - BREAK, | |
| 217 | - WORD_DELETE, ///< @brief Backspaces the cursor until it hits the front of a word (does a ^W). | |
| 218 | - FIELD_DELETE, ///< @brief Delete field key (does a ^U). | |
| 219 | - SYSREQ, | |
| 220 | - KYBD_UNLOCK, ///< @brief Unlock the keyboard if it was locked by operator error. | |
| 221 | - }; | |
| 222 | - | |
| 223 | - /// @brief TN3270 Session. | |
| 224 | - class TN3270_PUBLIC Session { | |
| 225 | - protected: | |
| 226 | - Session(); | |
| 227 | - | |
| 228 | - /// @brief Write information to log file. | |
| 229 | - void info(const char *fmt, ...) const; | |
| 230 | - | |
| 231 | - /// @brief Write warning to log file. | |
| 232 | - void warning(const char *fmt, ...) const; | |
| 233 | - | |
| 234 | - /// @brief Write error to log file. | |
| 235 | - void error(const char *fmt, ...) const; | |
| 236 | - | |
| 237 | - /// @brief Fire event. | |
| 238 | - void fire(const Event &event); | |
| 239 | - | |
| 240 | - public: | |
| 241 | - | |
| 242 | - /// @brief Get an instance of the TN3270 session based on the supplied ID. | |
| 243 | - static Session * getInstance(const char *id = nullptr); | |
| 244 | - virtual ~Session(); | |
| 245 | - | |
| 246 | - // States | |
| 247 | - virtual ProgramMessage getProgramMessage() const = 0; | |
| 248 | - virtual ConnectionState getConnectionState() const = 0; | |
| 249 | - virtual SSLState getSSLState() const = 0; | |
| 250 | - | |
| 251 | - // Contents | |
| 252 | - virtual std::string toString(int baddr = 0, int len = -1, char lf = '\n') const = 0; | |
| 253 | - virtual std::string toString(unsigned int row, unsigned int col, int len, char lf = '\n') const = 0; | |
| 254 | - | |
| 255 | - /// @brief Input string. | |
| 256 | - virtual void push(const char *text, size_t length) = 0; | |
| 257 | - virtual void push(int baddr, const char *text, int length) = 0; | |
| 258 | - virtual void push(int row, int col, const char *text, int length) = 0; | |
| 259 | - | |
| 260 | - inline void push(const std::string &text) { | |
| 261 | - push(-1,text.c_str(),text.size()); | |
| 262 | - } | |
| 263 | - | |
| 264 | - inline void push(int baddr, const std::string &text) { | |
| 265 | - push(baddr,text.c_str(),text.size()); | |
| 266 | - } | |
| 267 | - | |
| 268 | - inline void push(int row, int col, const std::string &text) { | |
| 269 | - push(row,col,text.c_str(),text.size()); | |
| 270 | - } | |
| 271 | - | |
| 272 | - void push(const PFKey key); | |
| 273 | - void push(const PAKey key); | |
| 274 | - virtual void push(const Action action) = 0; | |
| 275 | - | |
| 276 | - /// @brief Get contents of field ad address. | |
| 277 | - virtual void pop(int baddr, std::string &text) = 0; | |
| 278 | - | |
| 279 | - /// @brief Get contents of field at position. | |
| 280 | - virtual void pop(int row, int col, std::string &text) = 0; | |
| 281 | - | |
| 282 | - /// @brief Get contents of field at cursor position. | |
| 283 | - virtual void pop(std::string &text) = 0; | |
| 284 | - | |
| 285 | - /** | |
| 286 | - * @brief Input string parsing control char. | |
| 287 | - */ | |
| 288 | - LIB3270_KEYBOARD_LOCK_STATE input(const std::string &str, const char control_char = '@'); | |
| 289 | - | |
| 290 | - // Properties. | |
| 291 | - virtual void getProperty(const char *name, int &value) const = 0; | |
| 292 | - virtual void getProperty(const char *name, unsigned int &value) const = 0; | |
| 293 | - virtual void getProperty(const char *name, std::string &value) const = 0; | |
| 294 | - virtual void getProperty(const char *name, bool &value) const = 0; | |
| 295 | - virtual void setProperty(const char *name, const int value) = 0; | |
| 296 | - virtual void setProperty(const char *name, const char *value) = 0; | |
| 297 | - | |
| 298 | - virtual std::string getVersion() const = 0; | |
| 299 | - virtual std::string getRevision() const = 0; | |
| 300 | - virtual std::string getLUName() const = 0; | |
| 301 | - virtual LIB3270_KEYBOARD_LOCK_STATE getKeyboardLockState() const = 0; | |
| 302 | - | |
| 303 | - virtual std::string getHostURL() const = 0; | |
| 304 | - virtual void setHostURL(const char *url) = 0; | |
| 305 | - | |
| 306 | - virtual void setUnlockDelay(unsigned short delay = 350) = 0; | |
| 307 | - virtual void setLockOnOperatorError(bool lock = true) = 0; | |
| 308 | - | |
| 309 | - virtual unsigned short getScreenWidth() const = 0; | |
| 310 | - virtual unsigned short getScreenHeight() const = 0; | |
| 311 | - virtual unsigned short getScreenLength() const = 0; | |
| 312 | - | |
| 313 | - /// @brief Set cursor address. | |
| 314 | - virtual unsigned short setCursor(int addr = -1) = 0; | |
| 315 | - | |
| 316 | - /// @brief Set cursor position. | |
| 317 | - virtual unsigned short setCursor(unsigned short row, unsigned short col) = 0; | |
| 318 | - | |
| 319 | - /// @brief Get cursor address | |
| 320 | - virtual unsigned short getCursorAddress() = 0; | |
| 321 | - | |
| 322 | - /// @brief Set local charset. | |
| 323 | - virtual void setCharSet(const char *charset = NULL) = 0; | |
| 324 | - | |
| 325 | - // Actions | |
| 326 | - | |
| 327 | - /// @brief Execute action by name. | |
| 328 | - virtual void action(const char *action_name) = 0; | |
| 329 | - | |
| 330 | - // Connect/disconnect | |
| 331 | - virtual void connect(const char *url = nullptr, int seconds = DEFAULT_TIMEOUT) = 0; | |
| 332 | - virtual void disconnect() = 0; | |
| 333 | - | |
| 334 | - /// @brief Wait. | |
| 335 | - virtual void wait(time_t seconds) const = 0; | |
| 336 | - | |
| 337 | - /// @brief Wait until session state changes to "ready". | |
| 338 | - virtual void waitForReady(time_t timeout = DEFAULT_TIMEOUT) const = 0; | |
| 339 | - | |
| 340 | - /// @brief Wait for screen changes. | |
| 341 | - virtual void waitForChange(time_t seconds = DEFAULT_TIMEOUT) const = 0; | |
| 342 | - | |
| 343 | - /// @brief Wait for screen changes. | |
| 344 | - virtual LIB3270_KEYBOARD_LOCK_STATE waitForKeyboardUnlock(time_t seconds = DEFAULT_TIMEOUT) const = 0; | |
| 345 | - | |
| 346 | - /// @brief Send PF. | |
| 347 | - virtual void pfkey(unsigned short value) = 0; | |
| 348 | - | |
| 349 | - /// @brief Send PA. | |
| 350 | - virtual void pakey(unsigned short value) = 0; | |
| 351 | - | |
| 352 | - /// @brief Request print | |
| 353 | - virtual void print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) = 0; | |
| 354 | - | |
| 355 | - /// @brief Insert event listener. | |
| 356 | - // void insert(Event::Type type, std::function <void(const Event &event)> listener); | |
| 357 | - | |
| 358 | - // Misc | |
| 359 | - | |
| 360 | - /// @brief Search | |
| 361 | - size_t find(const char * str, size_t pos = 0) const; | |
| 362 | - | |
| 363 | - /// @brief Compare contents. | |
| 364 | - int compare(int baddr, const char* s, int len = -1) const; | |
| 365 | - int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; | |
| 366 | - | |
| 367 | - }; | |
| 368 | - | |
| 369 | - /// @brief TN3270 Host | |
| 370 | - class TN3270_PUBLIC Host : public std::basic_streambuf<char, std::char_traits<char> > { | |
| 371 | - private: | |
| 372 | - | |
| 373 | - /// @brief Connection with the host | |
| 374 | - Session *session; | |
| 375 | - | |
| 376 | - /// @brief How much seconds we wait for the terminal to be ready? | |
| 377 | - time_t timeout; | |
| 378 | - | |
| 379 | - protected: | |
| 380 | - | |
| 381 | - /// @brief Writes characters to the associated file from the put area | |
| 382 | - int sync() override; | |
| 383 | - | |
| 384 | - /// @brief Writes characters to the associated output sequence from the put area. | |
| 385 | - int overflow(int c) override; | |
| 386 | - | |
| 387 | - /* | |
| 388 | - /// @brief Write information to log file. | |
| 389 | - void info(const char *fmt, ...) const; | |
| 390 | - | |
| 391 | - /// @brief Write warning to log file. | |
| 392 | - void warning(const char *fmt, ...) const; | |
| 393 | - | |
| 394 | - /// @brief Write error to log file. | |
| 395 | - void error(const char *fmt, ...) const; | |
| 396 | - */ | |
| 397 | - | |
| 398 | - public: | |
| 399 | - Host(const char *id = nullptr, const char *url = nullptr, time_t timeout = DEFAULT_TIMEOUT); | |
| 400 | - ~Host(); | |
| 401 | - | |
| 402 | - inline bool operator==(ConnectionState state) const noexcept { | |
| 403 | - return session->getConnectionState() == state; | |
| 404 | - } | |
| 405 | - | |
| 406 | - // Contents | |
| 407 | - | |
| 408 | - /** | |
| 409 | - * @brief Input string parsing control char. | |
| 410 | - */ | |
| 411 | - LIB3270_KEYBOARD_LOCK_STATE input(const char *text, int length = -1, const char control_char = '@'); | |
| 412 | - | |
| 413 | - Host & push(int baddr, const std::string &text); | |
| 414 | - Host & push(int row, int col, const std::string &text); | |
| 415 | - Host & push(const std::string &text); | |
| 416 | - | |
| 417 | - Host & push(int baddr, const char *str, int len = -1); | |
| 418 | - Host & push(int row, int col, const char *str, int len = -1); | |
| 419 | - Host & push(const char *str, int len = -1); | |
| 420 | - | |
| 421 | - Host & pop(int baddr, std::string &text); | |
| 422 | - Host & pop(int row, int col, std::string &text); | |
| 423 | - Host & pop(std::string &text); | |
| 424 | - | |
| 425 | - std::string toString() const; | |
| 426 | - std::string toString(int baddr, int len = -1, char lf = '\n') const; | |
| 427 | - std::string toString(unsigned int row, unsigned int col, int len = -1, char lf = '\n') const; | |
| 428 | - | |
| 429 | - template<typename T> | |
| 430 | - Host & push(T value) { | |
| 431 | - session->push(value); | |
| 432 | - sync(); | |
| 433 | - return *this; | |
| 434 | - } | |
| 435 | - | |
| 436 | - template<typename T> | |
| 437 | - Host & pop(T value) { | |
| 438 | - sync(); | |
| 439 | - session->pop(value); | |
| 440 | - return *this; | |
| 441 | - } | |
| 442 | - | |
| 443 | - // Actions | |
| 444 | - Host & connect(const char *url = nullptr); | |
| 445 | - Host & disconnect(); | |
| 446 | - Host & waitForReady(time_t seconds); | |
| 447 | - | |
| 448 | - inline Host & waitForReady() { | |
| 449 | - return waitForReady(this->timeout); | |
| 450 | - } | |
| 451 | - | |
| 452 | - inline LIB3270_KEYBOARD_LOCK_STATE waitForKeyboardUnlock() noexcept { | |
| 453 | - return this->session->waitForKeyboardUnlock(timeout); | |
| 454 | - } | |
| 455 | - | |
| 456 | - /// @brief Execute action by name. | |
| 457 | - inline Host & action(const char *action_name) { | |
| 458 | - session->action(action_name); | |
| 459 | - return *this; | |
| 460 | - } | |
| 461 | - | |
| 462 | - inline ProgramMessage getProgramMessage() const { | |
| 463 | - return session->getProgramMessage(); | |
| 464 | - } | |
| 465 | - | |
| 466 | - operator bool() const; | |
| 467 | - | |
| 468 | - inline operator ProgramMessage() const { | |
| 469 | - return getProgramMessage(); | |
| 470 | - } | |
| 471 | - | |
| 472 | - inline ConnectionState getConnectionState() const { | |
| 473 | - return session->getConnectionState(); | |
| 474 | - } | |
| 475 | - | |
| 476 | - bool isReady() const; | |
| 477 | - bool isConnected() const; | |
| 478 | - | |
| 479 | - inline operator ConnectionState() const { | |
| 480 | - return getConnectionState(); | |
| 481 | - } | |
| 482 | - | |
| 483 | - /// @brief Set cursor address. | |
| 484 | - inline Host & setCursor(unsigned short addr) { | |
| 485 | - session->setCursor(addr); | |
| 486 | - return *this; | |
| 487 | - } | |
| 488 | - | |
| 489 | - /// @brief Set cursor position. | |
| 490 | - inline Host & setCursor(unsigned short row, unsigned short col) { | |
| 491 | - session->setCursor(row,col); | |
| 492 | - return *this; | |
| 493 | - } | |
| 494 | - | |
| 495 | - /// @brief Get cursor address | |
| 496 | - inline unsigned short getCursorAddress() { | |
| 497 | - return session->getCursorAddress(); | |
| 498 | - } | |
| 499 | - | |
| 500 | - inline void setUnlockDelay(unsigned short delay) { | |
| 501 | - return session->setUnlockDelay(delay); | |
| 502 | - } | |
| 503 | - | |
| 504 | - inline void setLockOnOperatorError(bool lock = true) { | |
| 505 | - return session->setLockOnOperatorError(lock); | |
| 506 | - } | |
| 507 | - | |
| 508 | - inline void setCharSet(const char *charset) { | |
| 509 | - return session->setCharSet(charset); | |
| 510 | - } | |
| 511 | - | |
| 512 | - // Get properties | |
| 513 | - | |
| 514 | - /// @brief Get lib3270 version. | |
| 515 | - inline std::string getVersion() const { | |
| 516 | - return session->getVersion(); | |
| 517 | - } | |
| 518 | - | |
| 519 | - /// @brief Get lib3270 revision. | |
| 520 | - std::string getRevision() const { | |
| 521 | - return session->getRevision(); | |
| 522 | - } | |
| 523 | - | |
| 524 | - /// @brief Get LU Name. | |
| 525 | - std::string getLUName() const { | |
| 526 | - return session->getLUName(); | |
| 527 | - } | |
| 528 | - | |
| 529 | - inline LIB3270_KEYBOARD_LOCK_STATE getKeyboardLockState() const { | |
| 530 | - return session->getKeyboardLockState(); | |
| 531 | - } | |
| 532 | - | |
| 533 | - // Actions | |
| 534 | - | |
| 535 | - /// @brief Send PF. | |
| 536 | - inline Host & pfkey(unsigned short value) { | |
| 537 | - session->pfkey(value); | |
| 538 | - return *this; | |
| 539 | - } | |
| 540 | - | |
| 541 | - /// @brief Send PA. | |
| 542 | - inline Host & pakey(unsigned short value) { | |
| 543 | - session->pakey(value); | |
| 544 | - return *this; | |
| 545 | - } | |
| 546 | - | |
| 547 | - /// @brief Request print | |
| 548 | - inline Host & print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) { | |
| 549 | - session->print(option); | |
| 550 | - return *this; | |
| 551 | - } | |
| 552 | - | |
| 553 | - /// @brief Wait. | |
| 554 | - inline Host & wait(unsigned short seconds) { | |
| 555 | - session->wait(seconds); | |
| 556 | - return *this; | |
| 557 | - } | |
| 558 | - | |
| 559 | - /// @brief Wait for update. | |
| 560 | - inline Host & waitForChange(unsigned short seconds) { | |
| 561 | - session->waitForChange(seconds); | |
| 562 | - return *this; | |
| 563 | - } | |
| 564 | - | |
| 565 | - // Set contents. | |
| 566 | - | |
| 567 | - /// @brief Input string. | |
| 568 | - /// | |
| 569 | - /// Input the supplied string processing commands delimited by the control char in | |
| 570 | - /// the same way of the old HLLAPI. | |
| 571 | - /// | |
| 572 | - /// @param text String with the text to input. | |
| 573 | - /// @param control_char Control character used to identify commands. | |
| 574 | - // Host & input(const char *text, const char control_char = '@'); | |
| 575 | - | |
| 576 | - // Host & input(const char *text, size_t sz); | |
| 577 | - | |
| 578 | - /// @brief Set field at current position, jumps to next writable field. | |
| 579 | - inline Host & push(const char *text) { | |
| 580 | - session->push(text,-1); | |
| 581 | - return *this; | |
| 582 | - }; | |
| 583 | - | |
| 584 | - /* | |
| 585 | - // Event listeners | |
| 586 | - inline Host & insert(Event::Type type, std::function <void(const Event &event)> listener) noexcept { | |
| 587 | - session->insert(type, listener); | |
| 588 | - return *this; | |
| 589 | - } | |
| 590 | - */ | |
| 591 | - | |
| 592 | - | |
| 593 | - }; | |
| 594 | - | |
| 595 | - } | |
| 596 | - | |
| 597 | - TN3270_PUBLIC const char * toCharString(const TN3270::ProgramMessage programMessage); | |
| 598 | - TN3270_PUBLIC const char * toCharString(const TN3270::ConnectionState connectionState); | |
| 599 | - TN3270_PUBLIC const char * toCharString(const TN3270::Action action); | |
| 600 | - | |
| 601 | - template <typename T> | |
| 602 | - inline TN3270_PUBLIC TN3270::Session & operator<<(TN3270::Session& session, const T value) { | |
| 603 | - return session.push(value); | |
| 604 | - } | |
| 605 | - | |
| 606 | - template <typename T> | |
| 607 | - inline TN3270_PUBLIC TN3270::Session & operator>>(TN3270::Session& session, const T value) { | |
| 608 | - return session.pop(value); | |
| 609 | - } | |
| 610 | - | |
| 611 | - template <typename T> | |
| 612 | - inline TN3270_PUBLIC TN3270::Host & operator<<(TN3270::Host& host, const T value) { | |
| 613 | - return host.push(value); | |
| 614 | - } | |
| 615 | - | |
| 616 | - inline std::ostream & operator<<(std::ostream &stream, const TN3270::Host& host) { | |
| 617 | - stream << host.toString(); | |
| 618 | - return stream; | |
| 619 | - } | |
| 620 | - | |
| 621 | - | |
| 622 | -#endif | |
| 623 | - | |
| 624 | -#endif // LIB3270_IPC_H_INCLUDED |
doxygen/doxyfile.in
| ... | ... | @@ -140,7 +140,7 @@ FULL_PATH_NAMES = YES |
| 140 | 140 | # relative paths, which will be relative from the directory where doxygen is |
| 141 | 141 | # started. |
| 142 | 142 | |
| 143 | -STRIP_FROM_PATH = @BASEDIR@ | |
| 143 | +STRIP_FROM_PATH = @BASEDIR@/client/src | |
| 144 | 144 | |
| 145 | 145 | # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of |
| 146 | 146 | # the path mentioned in the documentation of a class, which tells |
| ... | ... | @@ -149,7 +149,7 @@ STRIP_FROM_PATH = @BASEDIR@ |
| 149 | 149 | # definition is used. Otherwise one should specify the include paths that |
| 150 | 150 | # are normally passed to the compiler using the -I flag. |
| 151 | 151 | |
| 152 | -STRIP_FROM_INC_PATH = | |
| 152 | +STRIP_FROM_INC_PATH = @BASEDIR@/client/src | |
| 153 | 153 | |
| 154 | 154 | # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter |
| 155 | 155 | # (but less readable) file names. This can be useful if your file system |
| ... | ... | @@ -659,7 +659,7 @@ WARN_LOGFILE = @BASEDIR@/doxygen/doxygen.log |
| 659 | 659 | # directories like "/usr/src/myproject". Separate the files or directories |
| 660 | 660 | # with spaces. |
| 661 | 661 | |
| 662 | -INPUT = @BASEDIR@ | |
| 662 | +INPUT = @BASEDIR@/client/src | |
| 663 | 663 | |
| 664 | 664 | # This tag can be used to specify the character encoding of the source files |
| 665 | 665 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is |
| ... | ... | @@ -1539,7 +1539,7 @@ INCLUDE_FILE_PATTERNS = |
| 1539 | 1539 | # undefined via #undef or recursively expanded use the := operator |
| 1540 | 1540 | # instead of the = operator. |
| 1541 | 1541 | |
| 1542 | -PREDEFINED = | |
| 1542 | +PREDEFINED = __cplusplus | |
| 1543 | 1543 | |
| 1544 | 1544 | # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then |
| 1545 | 1545 | # this tag can be used to specify a list of macro names that should be expanded. | ... | ... |
server/Makefile.in
| ... | ... | @@ -91,11 +91,11 @@ BINRLS=$(BINDIR)/Release |
| 91 | 91 | |
| 92 | 92 | DEPENDS= \ |
| 93 | 93 | Makefile \ |
| 94 | - $(BASEDIR)/common/src/include/*.h \ | |
| 95 | - $(BASEDIR)/common/src/include/lib3270/*.h | |
| 94 | + $(BASEDIR)/common/src/include/*.h | |
| 96 | 95 | |
| 97 | 96 | CFLAGS= \ |
| 98 | 97 | @CFLAGS@ \ |
| 98 | + -I$(BASEDIR)/server/src/include \ | |
| 99 | 99 | -I$(BASEDIR)/common/src/include \ |
| 100 | 100 | -DBUILD_DATE=`date +%Y%m%d` \ |
| 101 | 101 | @LIB3270_CFLAGS@ \ | ... | ... |
server/src/core/constants.c
server/src/core/getproperties.c
server/src/core/linux/gobject.h
server/src/core/linux/start.c
server/src/core/linux/stop.c
server/src/core/methods/private.h
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | |
| 39 | 39 | #include <config.h> |
| 40 | 40 | #include <lib3270.h> |
| 41 | - #include <lib3270/ipc-glib.h> | |
| 41 | + #include <ipc-glib.h> | |
| 42 | 42 | |
| 43 | 43 | G_GNUC_INTERNAL int ipc3270_method_connect(GObject *session, GVariant *request, GObject *response, GError **error); |
| 44 | 44 | G_GNUC_INTERNAL int ipc3270_method_disconnect(GObject *session, GVariant *request, GObject *response, GError **error); | ... | ... |
server/src/core/setproperties.c
server/src/core/tools.c
server/src/core/windows/gobject.c
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | #include <lib3270.h> |
| 32 | 32 | #include <lib3270/actions.h> |
| 33 | 33 | #include <lib3270/properties.h> |
| 34 | -#include <lib3270/ipc-glib.h> | |
| 34 | +#include <ipc-glib.h> | |
| 35 | 35 | #include <v3270.h> |
| 36 | 36 | |
| 37 | 37 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | ... | ... |
server/src/core/windows/gobject.h
server/src/core/windows/inout.c
server/src/core/windows/pipesource.c
server/src/core/windows/start.c
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | #include <lib3270.h> |
| 32 | 32 | #include <lib3270/actions.h> |
| 33 | 33 | #include <lib3270/properties.h> |
| 34 | -#include <lib3270/ipc-glib.h> | |
| 34 | +#include <ipc-glib.h> | |
| 35 | 35 | |
| 36 | 36 | void ipc3270_export_object(GObject *object, const char *name, GError G_GNUC_UNUSED(**error)) { |
| 37 | 37 | ... | ... |
server/src/core/windows/stop.c
| ... | ... | @@ -0,0 +1,138 @@ |
| 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. Registro no INPI sob | |
| 5 | + * o nome G3270. | |
| 6 | + * | |
| 7 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 8 | + * | |
| 9 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 10 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 11 | + * Free Software Foundation. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 14 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 15 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 16 | + * obter mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 19 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 20 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 21 | + * | |
| 22 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 23 | + * | |
| 24 | + * Contatos: | |
| 25 | + * | |
| 26 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 27 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 28 | + * | |
| 29 | + */ | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * @brief Common definitions for pw3270 IPC plugin. | |
| 33 | + * | |
| 34 | + * @author Perry Werneck <perry.werneck@gmail.com> | |
| 35 | + * | |
| 36 | + */ | |
| 37 | + | |
| 38 | +#ifndef PW3270_IPC_H_INCLUDED | |
| 39 | + | |
| 40 | + #define PW3270_IPC_H_INCLUDED | |
| 41 | + | |
| 42 | + #ifdef _WIN32 | |
| 43 | + | |
| 44 | + #define PW3270_IPC_SESSION_BUS_NAME "\\\\.\\pipe\\%s\\%c" | |
| 45 | + | |
| 46 | + #else | |
| 47 | + | |
| 48 | + #define PW3270_IPC_SESSION_BUS_NAME "br.com.bb.%s.%c" | |
| 49 | + #define PW3270_IPC_SESSION_INTERFACE_NAME "br.com.bb.tn3270.session" | |
| 50 | + #define PW3270_IPC_SESSION_OBJECT_PATH "/br/com/bb/tn3270/session" | |
| 51 | + | |
| 52 | + #define PW3270_IPC_SERVICE_BUS_NAME "br.com.bb.tn3270.service" | |
| 53 | + #define PW3270_IPC_SERVICE_INTERFACE_NAME "br.com.bb.tn3270.service" | |
| 54 | + #define PW3270_IPC_SERVICE_OBJECT_PATH "/br/com/bb/tn3270/service" | |
| 55 | + | |
| 56 | + #endif // _WIN32 | |
| 57 | + | |
| 58 | + #include <glib.h> | |
| 59 | + #include <gtk/gtk.h> | |
| 60 | + #include <lib3270.h> | |
| 61 | + | |
| 62 | + G_BEGIN_DECLS | |
| 63 | + | |
| 64 | + #define GLIB_TYPE_IPC3270_RESPONSE (ipc3270Response_get_type ()) | |
| 65 | + #define IPC3270_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLIB_TYPE_IPC3270_RESPONSE, ipc3270Response)) | |
| 66 | + #define IPC3270_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIB_TYPE_IPC3270_RESPONSE, ipc3270ResponseClass)) | |
| 67 | + #define IS_IPC3270_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLIB_TYPE_IPC3270_RESPONSE)) | |
| 68 | + #define IS_IPC3270_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIB_TYPE_IPC3270_RESPONSE)) | |
| 69 | + #define IPC3270_RESPONSE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS ((obj), GLIB_TYPE_IPC3270_RESPONSE, ipc3270ResponseClass)) | |
| 70 | + | |
| 71 | + typedef struct _ipc3270Response ipc3270Response; | |
| 72 | + typedef struct _ipc3270ResponseClass ipc3270ResponseClass; | |
| 73 | + | |
| 74 | + GObject * ipc3270_response_new(); | |
| 75 | + | |
| 76 | + void ipc3270_response_append_int32(GObject *object, gint32 value); | |
| 77 | + void ipc3270_response_append_uint32(GObject *object, guint32 value); | |
| 78 | + void ipc3270_response_append_string(GObject *object, const gchar *text); | |
| 79 | + gboolean ipc3270_response_has_values(GObject *object); | |
| 80 | + GVariant * ipc3270_response_steal_value(GObject *object); | |
| 81 | + | |
| 82 | + | |
| 83 | + #define GLIB_TYPE_IPC3270 (ipc3270_get_type ()) | |
| 84 | + #define IPC3270(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLIB_TYPE_IPC3270, ipc3270)) | |
| 85 | + #define IPC3270_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIB_TYPE_IPC3270, ipc3270Class)) | |
| 86 | + #define IS_IPC3270(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLIB_TYPE_IPC3270)) | |
| 87 | + #define IS_IPC3270_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIB_TYPE_IPC3270)) | |
| 88 | + #define IPC3270_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLIB_TYPE_IPC3270, ipc3270Class)) | |
| 89 | + | |
| 90 | + typedef struct _ipc3270 ipc3270; | |
| 91 | + typedef struct _ipc3270Class ipc3270Class; | |
| 92 | + | |
| 93 | + GObject * ipc3270_new(); | |
| 94 | + GType ipc3270_get_type(void); | |
| 95 | + void ipc3270_set_terminal_widget(GObject *object, GtkWidget *widget); | |
| 96 | + void ipc3270_export_object(GObject *object, const char *name, GError **error); | |
| 97 | + | |
| 98 | + void ipc3270_add_terminal_introspection(GString *string); | |
| 99 | + | |
| 100 | + const gchar * ipc3270_get_display_charset(GObject *object); | |
| 101 | + H3270 * ipc3270_get_session(GObject *object); | |
| 102 | + | |
| 103 | + GQuark ipc3270_get_error_domain(GObject *object); | |
| 104 | + | |
| 105 | + void ipc3270_set_error(GObject *object, int errcode, GError **error); | |
| 106 | + | |
| 107 | + int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *request, GObject *response, GError **error); | |
| 108 | + gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error); | |
| 109 | + GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error); | |
| 110 | + | |
| 111 | + #ifdef _WIN32 | |
| 112 | + unsigned char * ipc3270_pack(const gchar *name, int id, GVariant *values, size_t * szPacket); | |
| 113 | + unsigned char * ipc3270_pack_value(const gchar *name, int id, GVariant *value, size_t * szPacket); | |
| 114 | + unsigned char * ipc3270_pack_error(const GError *error, size_t * szPacket); | |
| 115 | + GVariant * ipc3270_unpack(const unsigned char *packet, int *id); | |
| 116 | + #endif // _WIN32 | |
| 117 | + | |
| 118 | + G_END_DECLS | |
| 119 | + | |
| 120 | + #if ! GLIB_CHECK_VERSION(2,44,0) | |
| 121 | + G_GNUC_INTERNAL void ipc3270_autoptr_cleanup_generic_gfree(void *p); | |
| 122 | + #define g_autofree __attribute__((cleanup(ipc3270_autoptr_cleanup_generic_gfree))) | |
| 123 | + #endif // ! GLIB(2,44,0) | |
| 124 | + | |
| 125 | + #ifdef DEBUG | |
| 126 | + #define debug( fmt, ... ) fprintf(stderr,"%s(%d) " fmt "\n", __FILE__, (int) __LINE__, __VA_ARGS__ ); fflush(stderr); | |
| 127 | + #else | |
| 128 | + #define debug(...) /* __VA_ARGS */ | |
| 129 | + #endif | |
| 130 | + | |
| 131 | + typedef struct _ipc_method_int_arg { | |
| 132 | + const gchar *name; | |
| 133 | + int (*call)(H3270 *hSession, int keycode); | |
| 134 | + } IPC_METHOD_INT_ARG; | |
| 135 | + | |
| 136 | + const IPC_METHOD_INT_ARG * ipc3270_get_int_arg_methods(); | |
| 137 | + | |
| 138 | +#endif // PW3270_IPC_H_INCLUDED | ... | ... |
server/src/plugin/plugin.c
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | |
| 44 | 44 | #include "private.h" |
| 45 | 45 | #include <v3270.h> |
| 46 | - #include <lib3270/ipc-glib.h> | |
| 46 | + #include <ipc-glib.h> | |
| 47 | 47 | |
| 48 | 48 | int pw3270_plugin_stop(GtkWidget G_GNUC_UNUSED(*window), GtkWidget *terminal) { |
| 49 | 49 | debug("%s(%p)",__FUNCTION__,g_object_get_data(G_OBJECT(terminal),"ipc-object-info")); | ... | ... |
server/src/plugin/private.h
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | #define PRIVATE_H_INCLUDED |
| 39 | 39 | |
| 40 | 40 | #include <config.h> |
| 41 | - #include <lib3270/ipc-glib.h> | |
| 41 | + #include <ipc-glib.h> | |
| 42 | 42 | |
| 43 | 43 | int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal); |
| 44 | 44 | int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal); | ... | ... |
server/src/service/getproperties.c
server/src/service/linux/start.c
server/src/service/methods.c
server/src/service/service.c
server/src/service/session.c
server/src/service/setproperties.c
server/src/testprogram/testprogram.c