Commit da64c0f2eb4b83ef21f5178179d28a203dc6a3bd
1 parent
65911c55
Exists in
master
and in
3 other branches
Defining IPC cliente objects.
Showing
1 changed file
with
82 additions
and
0 deletions
Show diff stats
src/lib3270++/private.h
... | ... | @@ -177,6 +177,88 @@ |
177 | 177 | |
178 | 178 | } |
179 | 179 | |
180 | + /// @brief IPC Based acess (Access and active instance of pw3270 or pw3270d) | |
181 | + namespace IPC { | |
182 | + | |
183 | + /// @brief PW3270 IPC Request/Response. | |
184 | + class Request { | |
185 | + private: | |
186 | + | |
187 | +#ifdef _WIN32 | |
188 | + #pragma pack(1) | |
189 | + struct DataBlock { | |
190 | + uint8_t type; | |
191 | + size_t sz; | |
192 | + }; | |
193 | + #pragma pack() | |
194 | + | |
195 | + std::vector<DataBlock *> input; | |
196 | + | |
197 | + std::vector<DataBlock *> output; | |
198 | + | |
199 | + /// @brief Descompacta argumentos recebidos. | |
200 | + static void unpack(std::vector<DataBlock *> &args, const uint8_t * buffer, size_t szBuffer); | |
201 | + | |
202 | + /// @brief Compacta array de argumentos em um bloco de dados. | |
203 | + static DWORD pack(std::vector<DataBlock *> &args, uint8_t * outBuffer, size_t szBuffer); | |
204 | +#else | |
205 | + | |
206 | +#endif // _WIN32 | |
207 | + | |
208 | + public: | |
209 | + Request(const char *name); | |
210 | + | |
211 | + }; | |
212 | + | |
213 | + class TN3270_PRIVATE Session : public TN3270::Abstract::Session { | |
214 | + private: | |
215 | +#ifdef _WIN32 | |
216 | + /// @brief Pipe Handle. | |
217 | + HANDLE hPipe; | |
218 | +#else | |
219 | + | |
220 | +#endif // _WIN32 | |
221 | + | |
222 | + public: | |
223 | + | |
224 | + Session(const char *id); | |
225 | + virtual ~Session(); | |
226 | + | |
227 | + // Connect/disconnect | |
228 | + void connect(const char *url) override; | |
229 | + void disconnect() override; | |
230 | + | |
231 | + // Wait for session state. | |
232 | + void waitForReady(time_t timeout = 5) throw() override; | |
233 | + | |
234 | + // Gets | |
235 | + std::string toString(int baddr, size_t len, char lf) const override; | |
236 | + std::string toString(int row, int col, size_t sz, char lf) const override; | |
237 | + | |
238 | + ProgramMessage getProgramMessage() const override; | |
239 | + | |
240 | + ConnectionState getConnectionState() const override; | |
241 | + | |
242 | + void setCursorPosition(unsigned short addr); | |
243 | + void setCursorPosition(unsigned short row, unsigned short col); | |
244 | + | |
245 | + /// @brief Set field at current posicion, jumps to next writable field. | |
246 | + TN3270::Session & push(const char *text) override; | |
247 | + | |
248 | + TN3270::Session & push(int baddr, const std::string &text) override; | |
249 | + TN3270::Session & push(int row, int col, const std::string &text) override; | |
250 | + TN3270::Session & push(const PFKey key) override; | |
251 | + TN3270::Session & push(const PAKey key) override; | |
252 | + TN3270::Session & push(const Action action) override; | |
253 | + | |
254 | + // Get contents. | |
255 | + TN3270::Session & pop(int baddr, std::string &text) override; | |
256 | + TN3270::Session & pop(int row, int col, std::string &text) override; | |
257 | + TN3270::Session & pop(std::string &text) override; | |
258 | + } | |
259 | + | |
260 | + } | |
261 | + | |
180 | 262 | } |
181 | 263 | |
182 | 264 | #endif // PRIVATE_H_INCLUDED | ... | ... |