Commit 45a332217067750a6c032662a9ff135409209f8c
1 parent
23efd9b2
Exists in
master
and in
1 other branch
Working on IPC service manager.
Showing
13 changed files
with
319 additions
and
10 deletions
Show diff stats
Makefile.in
configure.ac
| ... | ... | @@ -85,6 +85,7 @@ case "$host" in |
| 85 | 85 | app_win32_revision=$(date +%y.%m.%d.%H) |
| 86 | 86 | AC_SUBST(WIN32_VERSION,$app_win32_revision) |
| 87 | 87 | AC_CONFIG_FILES(src/core/windows/resources.rc) |
| 88 | + AC_CONFIG_FILES(src/service/windows/resources.rc) | |
| 88 | 89 | AC_CONFIG_FILES(src/plugin/windows/resources.rc) |
| 89 | 90 | ;; |
| 90 | 91 | ... | ... |
pw3270-plugin-ipc.cbp
| ... | ... | @@ -96,6 +96,15 @@ |
| 96 | 96 | <Unit filename="src/plugin/start.c"> |
| 97 | 97 | <Option compilerVar="CC" /> |
| 98 | 98 | </Unit> |
| 99 | + <Unit filename="src/service/getproperties.c"> | |
| 100 | + <Option compilerVar="CC" /> | |
| 101 | + </Unit> | |
| 102 | + <Unit filename="src/service/linux/start.c"> | |
| 103 | + <Option compilerVar="CC" /> | |
| 104 | + </Unit> | |
| 105 | + <Unit filename="src/service/methods.c"> | |
| 106 | + <Option compilerVar="CC" /> | |
| 107 | + </Unit> | |
| 99 | 108 | <Unit filename="src/service/private.h" /> |
| 100 | 109 | <Unit filename="src/service/service.c"> |
| 101 | 110 | <Option compilerVar="CC" /> |
| ... | ... | @@ -103,6 +112,10 @@ |
| 103 | 112 | <Unit filename="src/service/session.c"> |
| 104 | 113 | <Option compilerVar="CC" /> |
| 105 | 114 | </Unit> |
| 115 | + <Unit filename="src/service/setproperties.c"> | |
| 116 | + <Option compilerVar="CC" /> | |
| 117 | + </Unit> | |
| 118 | + <Unit filename="src/service/windows/resources.rc.in" /> | |
| 106 | 119 | <Unit filename="src/testprogram/testprogram.c"> |
| 107 | 120 | <Option compilerVar="CC" /> |
| 108 | 121 | </Unit> | ... | ... |
| ... | ... | @@ -0,0 +1,53 @@ |
| 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 getproperties.c e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Referências: | |
| 24 | + * | |
| 25 | + * https://github.com/joprietoe/gdbus/blob/master/gdbus-example-server.c | |
| 26 | + * https://github.com/bratsche/glib/blob/master/gio/tests/gdbus-example-export.c | |
| 27 | + * | |
| 28 | + * Contatos: | |
| 29 | + * | |
| 30 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 31 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 32 | + * | |
| 33 | + */ | |
| 34 | + | |
| 35 | +#include <config.h> | |
| 36 | +#include <lib3270/ipc.h> | |
| 37 | +#include <lib3270.h> | |
| 38 | +#include <lib3270/properties.h> | |
| 39 | + | |
| 40 | +GVariant * service_get_property(GObject *object, const gchar *property_name, GError **error) { | |
| 41 | + | |
| 42 | + debug("%s",__FUNCTION__); | |
| 43 | + | |
| 44 | + g_set_error (error, | |
| 45 | + G_IO_ERROR, | |
| 46 | + G_IO_ERROR_NOT_FOUND, | |
| 47 | + "Can't find any property named %s", property_name | |
| 48 | + ); | |
| 49 | + | |
| 50 | + return NULL; | |
| 51 | + | |
| 52 | +} | |
| 53 | + | ... | ... |
| ... | ... | @@ -0,0 +1,98 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como start.c e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Referências: | |
| 24 | + * | |
| 25 | + * https://github.com/joprietoe/gdbus/blob/master/gdbus-example-server.c | |
| 26 | + * https://github.com/bratsche/glib/blob/master/gio/tests/gdbus-example-export.c | |
| 27 | + * | |
| 28 | + * Contatos: | |
| 29 | + * | |
| 30 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 31 | + * | |
| 32 | + */ | |
| 33 | + | |
| 34 | +#include "../private.h" | |
| 35 | + | |
| 36 | +#define PW3270_SERVICE_DBUS_SERVICE_PATH "/br/com/bb/tn3270/service" | |
| 37 | +#define PW3270_SERVICE_DBUS_SERVICE "br.com.bb.tn3270.service" | |
| 38 | +#define PW3270_SERVICE_DBUS_SERVICE_INTERFACE "br.com.bb.tn3270.service" | |
| 39 | + | |
| 40 | +static const gchar introspection_xml[] = | |
| 41 | + "<node>" | |
| 42 | + " <interface name='" PW3270_SERVICE_DBUS_SERVICE_INTERFACE "'>" | |
| 43 | + " <property type='s' name='version' access='read'/>" | |
| 44 | + " </interface>" | |
| 45 | + "</node>"; | |
| 46 | + | |
| 47 | +static GDBusNodeInfo *introspection_data = NULL; | |
| 48 | +static guint owner_id = 0; | |
| 49 | + | |
| 50 | +static void on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data) { | |
| 51 | + | |
| 52 | + static const GDBusInterfaceVTable interface_vtable = { | |
| 53 | + service_method_call, | |
| 54 | + service_get_property, | |
| 55 | + service_set_property | |
| 56 | + }; | |
| 57 | + | |
| 58 | + guint registration_id; | |
| 59 | + | |
| 60 | + | |
| 61 | + registration_id = g_dbus_connection_register_object (connection, | |
| 62 | + PW3270_SERVICE_DBUS_SERVICE_PATH, | |
| 63 | + introspection_data->interfaces[0], | |
| 64 | + &interface_vtable, | |
| 65 | + NULL, /* user_data */ | |
| 66 | + NULL, /* user_data_free_func */ | |
| 67 | + NULL); /* GError** */ | |
| 68 | + g_assert (registration_id > 0); | |
| 69 | + | |
| 70 | +} | |
| 71 | + | |
| 72 | +static void on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) { | |
| 73 | + | |
| 74 | + g_message("Acquired %s",name); | |
| 75 | + | |
| 76 | +} | |
| 77 | + | |
| 78 | +static void on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data) { | |
| 79 | + g_message("Lost %s",name); | |
| 80 | + g_main_loop_quit(NULL); | |
| 81 | +} | |
| 82 | + | |
| 83 | +void service_start(void) { | |
| 84 | + | |
| 85 | + introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, NULL); | |
| 86 | + | |
| 87 | + owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, | |
| 88 | + PW3270_SERVICE_DBUS_SERVICE, | |
| 89 | + G_BUS_NAME_OWNER_FLAGS_NONE, | |
| 90 | + on_bus_acquired, | |
| 91 | + on_name_acquired, | |
| 92 | + on_name_lost, | |
| 93 | + NULL, | |
| 94 | + NULL); | |
| 95 | + | |
| 96 | + | |
| 97 | +} | |
| 98 | + | ... | ... |
| ... | ... | @@ -0,0 +1,50 @@ |
| 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 methods.c e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Referências: | |
| 24 | + * | |
| 25 | + * https://github.com/joprietoe/gdbus/blob/master/gdbus-example-server.c | |
| 26 | + * https://github.com/bratsche/glib/blob/master/gio/tests/gdbus-example-export.c | |
| 27 | + * | |
| 28 | + * Contatos: | |
| 29 | + * | |
| 30 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 31 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 32 | + * | |
| 33 | + */ | |
| 34 | + | |
| 35 | +#include <config.h> | |
| 36 | +#include <string.h> | |
| 37 | +#include <lib3270/ipc.h> | |
| 38 | +#include <lib3270.h> | |
| 39 | +#include <lib3270/actions.h> | |
| 40 | + | |
| 41 | +GVariant * service_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error) { | |
| 42 | + | |
| 43 | + g_set_error (error, | |
| 44 | + G_IO_ERROR, | |
| 45 | + G_IO_ERROR_NOT_FOUND, | |
| 46 | + "Can't find any method named %s", method_name | |
| 47 | + ); | |
| 48 | + | |
| 49 | + return NULL; | |
| 50 | +} | ... | ... |
src/service/private.h
| ... | ... | @@ -33,9 +33,6 @@ |
| 33 | 33 | |
| 34 | 34 | #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) |
| 35 | 35 | |
| 36 | - #define PW3270_SERVICE_DBUS_SERVICE_PATH "/br/com/bb/pw3270/service" | |
| 37 | - #define PW3270_SERVICE_DBUS_SERVICE "br.com.bb.pw3270.service" | |
| 38 | - | |
| 39 | 36 | #include <glib.h> |
| 40 | 37 | #include <gio/gio.h> |
| 41 | 38 | #include <lib3270.h> |
| ... | ... | @@ -52,6 +49,11 @@ |
| 52 | 49 | typedef struct _session session; |
| 53 | 50 | typedef struct _sessionClass sessionClass; |
| 54 | 51 | |
| 52 | + G_GNUC_INTERNAL void service_start(void); | |
| 53 | + G_GNUC_INTERNAL GVariant * service_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error); | |
| 54 | + G_GNUC_INTERNAL GVariant * service_get_property(GObject *object, const gchar *property_name, GError **error); | |
| 55 | + G_GNUC_INTERNAL gboolean service_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error); | |
| 56 | + | |
| 55 | 57 | G_END_DECLS |
| 56 | 58 | |
| 57 | 59 | ... | ... |
src/service/service.c
| ... | ... | @@ -0,0 +1,53 @@ |
| 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 main.c e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Referências: | |
| 24 | + * | |
| 25 | + * https://github.com/joprietoe/gdbus/blob/master/gdbus-example-server.c | |
| 26 | + * https://github.com/bratsche/glib/blob/master/gio/tests/gdbus-example-export.c | |
| 27 | + * | |
| 28 | + * Contatos: | |
| 29 | + * | |
| 30 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 31 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 32 | + * | |
| 33 | + */ | |
| 34 | + | |
| 35 | +#include <config.h> | |
| 36 | +#include <lib3270/ipc.h> | |
| 37 | +#include <lib3270.h> | |
| 38 | +#include <lib3270/properties.h> | |
| 39 | + | |
| 40 | +gboolean service_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error) { | |
| 41 | + | |
| 42 | + debug("%s",__FUNCTION__); | |
| 43 | + | |
| 44 | + /* | |
| 45 | + g_set_error (error, | |
| 46 | + G_IO_ERROR, | |
| 47 | + G_IO_ERROR_NOT_FOUND, | |
| 48 | + "Can't find any property named %s", property_name | |
| 49 | + ); | |
| 50 | + */ | |
| 51 | + | |
| 52 | + return FALSE; | |
| 53 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +#include <windows.h> | |
| 2 | + | |
| 3 | +VS_VERSION_INFO VERSIONINFO | |
| 4 | +FILEVERSION @PACKAGE_MAJOR_VERSION@,@PACKAGE_MINOR_VERSION@,@PACKAGE_MAJOR_RELEASE@,0 | |
| 5 | +PRODUCTVERSION @PACKAGE_MAJOR_VERSION@,@PACKAGE_MINOR_VERSION@,@PACKAGE_MAJOR_RELEASE@,0 | |
| 6 | + | |
| 7 | +BEGIN | |
| 8 | + | |
| 9 | + BLOCK "StringFileInfo" | |
| 10 | + BEGIN | |
| 11 | + BLOCK "080904E4" | |
| 12 | + BEGIN | |
| 13 | + VALUE "FileDescription", "@PACKAGE_NAME@ IPC Service\0" | |
| 14 | + VALUE "CompanyName", "Banco do Brasil S/A.\0" | |
| 15 | + VALUE "FileVersion", "@WIN32_VERSION@\0" | |
| 16 | + VALUE "LegalCopyright", "(C) 2017 Banco do Brasil S/A. All Rights Reserved\0" | |
| 17 | + VALUE "OriginalFilename", "ipc3270@DLLEXT@\0" | |
| 18 | + VALUE "ProductName", "@PACKAGE_NAME@\0" | |
| 19 | + VALUE "ProductVersion", "@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.0\0" | |
| 20 | + END | |
| 21 | + END | |
| 22 | + | |
| 23 | + BLOCK "VarFileInfo" | |
| 24 | + BEGIN | |
| 25 | + VALUE "Translation", 0x809, 0x04E4 | |
| 26 | + END | |
| 27 | + | |
| 28 | +END | |
| 29 | + | ... | ... |