diff --git a/client/lib3270++.cbp b/client/lib3270++.cbp index fff0a18..3c2f29c 100644 --- a/client/lib3270++.cbp +++ b/client/lib3270++.cbp @@ -62,7 +62,13 @@ - + + + + + + + diff --git a/client/src/include/ipc-client-internals.h b/client/src/include/ipc-client-internals.h index 955e4e6..df7abdb 100644 --- a/client/src/include/ipc-client-internals.h +++ b/client/src/include/ipc-client-internals.h @@ -167,167 +167,17 @@ } - /* - - /// @brief lib3270 direct access objects (no IPC); - namespace Local { - - class TN3270_PRIVATE Session : public TN3270::Abstract::Session { - private: - - /// @brief Handle of the related instance of lib3270 - H3270 * hSession; - - /// @brief Mutex to serialize access to lib3270 - std::mutex sync; - - /// @brief Popup Handler. - static void popupHandler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg); - - /// @brief Connect Handler. - static void connectHandler(H3270 *session, unsigned char connected); - - /// @brief Wait for network events - void wait(time_t timeout = 5); - - /// @brief Check lib3270 return codes, launch exception when failed. - static void chkResponse(int rc); - - public: - Session(); - virtual ~Session(); - - // Connect/disconnect - void connect(const char *url) override; - void disconnect() override; - - // Wait for session state. - void waitForReady(time_t timeout = 5) throw() override; - - // Get properties. - void getProperty(const char *name, int &value) const override; - void getProperty(const char *name, std::string &value) const override; - void getProperty(const char *name, bool &value) const override; - - // Set properties. - void setUnlockDelay(unsigned short delay = 350) override; - void setHostURL(const char *url) override; - - std::string getVersion() const override; - std::string getRevision() const override; - std::string getLUName() const override; - std::string getHostURL() const override; - SSLState getSSLState() const override; - - unsigned short getScreenWidth() const override; - unsigned short getScreenHeight() const override; - unsigned short getScreenLength() const override; - - // Gets - std::string toString(int baddr, size_t len, char lf) const override; - std::string toString(int row, int col, size_t sz, char lf) const override; - - ProgramMessage getProgramMessage() const override; - - ConnectionState getConnectionState() const override; - - TN3270::Session & setCursor(unsigned short addr) override; - TN3270::Session & setCursor(unsigned short row, unsigned short col) override; - unsigned short getCursorAddress() override; - - TN3270::Session & pfkey(unsigned short value); - TN3270::Session & pakey(unsigned short value); - - TN3270::Session & input(const char *text, size_t length) override; - - /// @brief Set field at current posicion, jumps to next writable field. - TN3270::Session & push(const char *text) override; - - TN3270::Session & push(int baddr, const char *text, int length = -1) override; - TN3270::Session & push(int row, int col, const char *text, int length = -1) override; - - TN3270::Session & push(const Action action) override; - - // Get contents. - TN3270::Session & pop(int baddr, std::string &text) override; - TN3270::Session & pop(int row, int col, std::string &text) override; - TN3270::Session & pop(std::string &text) override; - - /// @brief Execute action by name. - TN3270::Session & action(const char *action_name) override; - - /// @brief Wait. - TN3270::Session & wait(unsigned short seconds) override; - - /// @brief Wait for update. - TN3270::Session & waitForChange(unsigned short seconds) override; - - }; - - } - /// @brief IPC Based acess (Access an active instance of pw3270 or pw3270d) namespace IPC { + TN3270_PRIVATE Session * getSessionInstance(); + class Session; /// @brief PW3270 IPC Request/Response. class Request { private: -#ifdef _WIN32 - /// @brief Pipe Handle. - HANDLE hPipe; - - /// @brief IPC Data type. - enum Type : uint8_t { - String = 's', - Boolean = 'b', - Uchar = 'y', - Int16 = 'n', - Uint16 = 'q', - Int32 = 'i', - Int32x = 'h', - Uint32 = 'u', - Int64 = 'x', - Uint64 = 't' - }; - - struct { - DWORD length; ///< @brief Length of input buffer. - DWORD used; ///< @brief Length of used block. - DWORD current; ///< @brief Offset of the current argument. - uint8_t * block; - } in; - - struct { - DWORD length; - DWORD used; - uint8_t * block; - } out; - - struct DataBlock { - Type type; - }; - - /// @brief Store value on data block. - DataBlock * pushBlock(const void *ptr, size_t len); - - /// @brief Get next argument. - DataBlock * getNextBlock() const; - -#else - struct { - DBusMessage * in; - DBusMessage * out; - DBusMessageIter iter; - - } msg; - DBusConnection * conn; - -#endif // _WIN32 - - Request(const Session &session); public: @@ -359,6 +209,9 @@ }; + /* + + class TN3270_PRIVATE Session : public TN3270::Abstract::Session { private: @@ -453,8 +306,8 @@ }; - } */ + } } diff --git a/client/src/session/remote/actions.cc b/client/src/session/remote/actions.cc new file mode 100644 index 0000000..1f44103 --- /dev/null +++ b/client/src/session/remote/actions.cc @@ -0,0 +1,78 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + #include + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + void IPC::Session::action(const char *action_name) { + } + + void IPC::Session::connect(const char *url, int seconds) { + } + + void IPC::Session::disconnect() { + } + + void IPC::Session::wait(unsigned short seconds) const { + } + + void IPC::Session::waitForReady(time_t timeout) const { + } + + void IPC::Session::waitForChange(unsigned short seconds) const { + } + + void IPC::Session::pfkey(unsigned short value) { + } + + void IPC::Session::pakey(unsigned short value) { + } + + void IPC::Session::push(const Action action) { + } + + void IPC::Session::print(LIB3270_CONTENT_OPTION option) { + } + + } + + diff --git a/client/src/session/remote/get.cc b/client/src/session/remote/get.cc new file mode 100644 index 0000000..30b67ac --- /dev/null +++ b/client/src/session/remote/get.cc @@ -0,0 +1,66 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + std::string IPC::Session::get() const { + } + + std::string IPC::Session::get(int baddr, size_t len, char lf) const { + } + + std::string IPC::Session::get(int row, int col, size_t sz, char lf) const { + } + + ProgramMessage IPC::Session::getProgramMessage() const { + } + + ConnectionState IPC::Session::getConnectionState() const { + } + + SSLState IPC::Session::getSSLState() const { + } + + + } + + diff --git a/client/src/session/remote/init.cc b/client/src/session/remote/init.cc new file mode 100644 index 0000000..def63a2 --- /dev/null +++ b/client/src/session/remote/init.cc @@ -0,0 +1,62 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file src/session/local/init.cc + * + * @brief Implement lib3270 direct access layout (NO IPC). + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + + extern "C" { + #include + } + + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + Session * IPC::getSessionInstance() { + return new IPC::Session(); + } + + IPC::Session::Session() : Abstract::Session() { + } + + IPC::Session::~Session() { + } + + } + + diff --git a/client/src/session/remote/private.h b/client/src/session/remote/private.h new file mode 100644 index 0000000..0028b0a --- /dev/null +++ b/client/src/session/remote/private.h @@ -0,0 +1,176 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file private.h + * + * @brief Private definitions for local session. + * + * @author perry.werneck@gmail.com + * + */ + +#ifndef PRIVATE_H_INCLUDED + + #define PRIVATE_H_INCLUDED + + #include + #include + #include + #include + #include + + using std::string; + using std::runtime_error; + + namespace TN3270 { + + namespace IPC { + + class TN3270_PRIVATE Session : public TN3270::Abstract::Session { + private: + + friend class Request; + +#ifdef _WIN32 + /// @brief Pipe Handle. + HANDLE hPipe; + + /// @brief IPC Data type. + enum Type : uint8_t { + String = 's', + Boolean = 'b', + Uchar = 'y', + Int16 = 'n', + Uint16 = 'q', + Int32 = 'i', + Int32x = 'h', + Uint32 = 'u', + Int64 = 'x', + Uint64 = 't' + }; + + struct { + DWORD length; ///< @brief Length of input buffer. + DWORD used; ///< @brief Length of used block. + DWORD current; ///< @brief Offset of the current argument. + uint8_t * block; + } in; + + struct { + DWORD length; + DWORD used; + uint8_t * block; + } out; + + struct DataBlock { + Type type; + }; + + /// @brief Store value on data block. + DataBlock * pushBlock(const void *ptr, size_t len); + + /// @brief Get next argument. + DataBlock * getNextBlock() const; + +#else + struct { + DBusMessage * in; + DBusMessage * out; + DBusMessageIter iter; + + } msg; + DBusConnection * conn; + +#endif // _WIN32 + +// Request(const Session &session); + + protected: + + // Get strings from lib3270 without charset conversion. + std::string get() const override; + std::string get(int baddr, size_t len, char lf) const override; + std::string get(int row, int col, size_t sz, char lf) const override; + + // Set strings to lib3270 without charset conversion. + void set(const std::string &str) override; + void set(int baddr, const std::string &str) override; + void set(int row, int col, const std::string &str) override; + + public: + + Session(); + virtual ~Session(); + + // Actions + void action(const char *action_name) override; + void connect(const char *url, int seconds) override; + void disconnect() override; + void pfkey(unsigned short value) override; + void pakey(unsigned short value) override; + void push(const Action action) override; + void print(LIB3270_CONTENT_OPTION option = LIB3270_CONTENT_ALL) override; + + void wait(unsigned short seconds) const override; + void waitForReady(time_t timeout) const override; + void waitForChange(unsigned short seconds) const override; + + // States + ProgramMessage getProgramMessage() const override; + ConnectionState getConnectionState() const override; + SSLState getSSLState() const override; + + // Properties. + void getProperty(const char *name, int &value) const override; + void getProperty(const char *name, std::string &value) const override; + void getProperty(const char *name, bool &value) const override; + std::string getVersion() const override; + std::string getRevision() const override; + std::string getLUName() const override; + + std::string getHostURL() const override; + void setHostURL(const char *url) override; + + unsigned short getScreenWidth() const override; + unsigned short getScreenHeight() const override; + unsigned short getScreenLength() const override; + void setUnlockDelay(unsigned short delay) override; + void setCharSet(const char *charset = NULL) override; + void setCursor(unsigned short addr) override; + void setCursor(unsigned short row, unsigned short col) override; + unsigned short getCursorAddress() override; + + }; + + } + + } + +#endif // PRIVATE_H_INCLUDED diff --git a/client/src/session/remote/properties.cc b/client/src/session/remote/properties.cc new file mode 100644 index 0000000..7fc2031 --- /dev/null +++ b/client/src/session/remote/properties.cc @@ -0,0 +1,98 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + #include + #include + #include + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + void IPC::Session::getProperty(const char *name, int &value) const { + } + + void IPC::Session::getProperty(const char *name, std::string &value) const { + } + + void IPC::Session::getProperty(const char *name, bool &value) const { + } + + void IPC::Session::setCharSet(const char *charset) { + } + + unsigned short IPC::Session::getScreenWidth() const { + } + + unsigned short IPC::Session::getScreenHeight() const { + } + + unsigned short IPC::Session::getScreenLength() const { + } + + void IPC::Session::setUnlockDelay(unsigned short delay) { + } + + void IPC::Session::setCursor(unsigned short addr) { + } + + void IPC::Session::setCursor(unsigned short row, unsigned short col) { + } + + unsigned short IPC::Session::getCursorAddress() { + } + + std::string IPC::Session::getVersion() const { + } + + std::string IPC::Session::getRevision() const { + } + + std::string IPC::Session::getLUName() const { + } + + std::string IPC::Session::getHostURL() const { + } + + void IPC::Session::setHostURL(const char *url) { + } + + } + + diff --git a/client/src/session/remote/set.cc b/client/src/session/remote/set.cc new file mode 100644 index 0000000..f8d898e --- /dev/null +++ b/client/src/session/remote/set.cc @@ -0,0 +1,56 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + void IPC::Session::set(const std::string &str) { + } + + void IPC::Session::set(int baddr, const std::string &str) { + } + + void IPC::Session::set(int row, int col, const std::string &str) { + } + + } + + diff --git a/client/src/session/remote/tools.cc b/client/src/session/remote/tools.cc new file mode 100644 index 0000000..8b6da9b --- /dev/null +++ b/client/src/session/remote/tools.cc @@ -0,0 +1,49 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + + #include "private.h" + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + + + } + + -- libgit2 0.21.2