Commit 190f2b2d48166da30f6408bae8f5a6a30fb2ac27
1 parent
adecb5db
Exists in
master
and in
5 other branches
Iniciando implementacao do plugin dbus
Showing
20 changed files
with
997 additions
and
969 deletions
Show diff stats
... | ... | @@ -0,0 +1,119 @@ |
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., 59 Temple | |
19 | +# Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | +# | |
21 | +# Contatos: | |
22 | +# | |
23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | +# licinio@bb.com.br (Licínio Luis Branco) | |
26 | +# kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
27 | +# | |
28 | + | |
29 | +#---[ Sources ]---------------------------------------------------------------- | |
30 | + | |
31 | +MODULE_NAME=pw3270dbus | |
32 | +DEPENDS=Makefile dbus-glue.h | |
33 | +PLUGIN_SRC=main.c gobject.c | |
34 | +DAEMON_SRC=daemon.c gobject.c iocallback.c | |
35 | + | |
36 | +#---[ Paths ]------------------------------------------------------------------ | |
37 | + | |
38 | +ROOTDIR ?= . | |
39 | +OBJDIR ?= $(ROOTDIR)/.obj | |
40 | +BINDIR ?= $(ROOTDIR)/.bin | |
41 | +BINDBG ?= $(BINDIR)/Debug | |
42 | +BINRLS ?= $(BINDIR)/Release | |
43 | + | |
44 | +OBJDBG = $(OBJDIR)/Debug | |
45 | +OBJRLS = $(OBJDIR)/Release | |
46 | +OBJEXT = o | |
47 | + | |
48 | +#---[ Tools ]------------------------------------------------------------------ | |
49 | + | |
50 | +MKDIR=@MKDIR_P@ | |
51 | +CC=@CC@ | |
52 | +LD=@CC@ | |
53 | +DBUSBINDINGTOOL=@DBUSBINDINGTOOL@ | |
54 | + | |
55 | +#---[ Flags ]------------------------------------------------------------------ | |
56 | + | |
57 | +DLL_FLAGS=-shared | |
58 | +DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
59 | + | |
60 | +LIB3270_CFLAGS ?= `pkg-config --cflags lib3270` | |
61 | +DBUS_CFLAGS=@DBUS_CFLAGS@ | |
62 | +GLIB_CFLAGS=@GLIB_CFLAGS@ | |
63 | +GTK_CFLAGS=@GTK_CFLAGS@ | |
64 | + | |
65 | +LIB3270_LIBS ?= `pkg-config --libs lib3270` | |
66 | +DBUS_LIBS=@DBUS_LIBS@ | |
67 | +GLIB_LIBS=@GLIB_LIBS@ | |
68 | +GTK_LIBS=@GTK_LIBS@ | |
69 | + | |
70 | +#---[ Rules ]------------------------------------------------------------------ | |
71 | + | |
72 | +$(OBJDBG)/%.o: %.c $(DEPENDS) | |
73 | + @echo " CC `basename $@`" | |
74 | + @$(MKDIR) `dirname $@` | |
75 | + @$(CC) $(CFLAGS) $(DBUS_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) $(DEBUG_CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
76 | + | |
77 | +$(OBJRLS)/%.o: %.c $(DEPENDS) | |
78 | + @echo " CC `basename $@`" | |
79 | + @$(MKDIR) `dirname $@` | |
80 | + @$(CC) $(CFLAGS) $(DBUS_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
81 | + | |
82 | + | |
83 | +#---[ Release targets ]-------------------------------------------------------- | |
84 | + | |
85 | +Release: $(BINRLS)/plugins/$(MODULE_NAME).so | |
86 | + | |
87 | +$(BINRLS)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) | |
88 | + @echo " CCLD `basename $@`" | |
89 | + @$(MKDIR) `dirname $@` | |
90 | + @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | |
91 | + | |
92 | +#---[ Debug targets ]---------------------------------------------------------- | |
93 | + | |
94 | +Debug: $(BINDBG)/plugins/$(MODULE_NAME).so $(BINDBG)/libhllapi.so | |
95 | + | |
96 | +$(BINDBG)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) | |
97 | + @echo " CCLD `basename $@`" | |
98 | + @$(MKDIR) `dirname $@` | |
99 | + @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GLIB_LIBS) $(GTK_LIBS) | |
100 | + | |
101 | +#---[ Misc targets ]----------------------------------------------------------- | |
102 | + | |
103 | +debug-service: $(BINDBG)/@PACKAGE_NAME@d | |
104 | + | |
105 | +dbus-glue.h: pw3270dbus.xml | |
106 | + @$(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=pw3270_dbus $^ | |
107 | + | |
108 | +$(BINDBG)/@PACKAGE_NAME@d: $(foreach SRC, $(basename $(DAEMON_SRC)), $(OBJDBG)/$(SRC).o) | |
109 | + @echo " CCLD `basename $@`" | |
110 | + @$(MKDIR) `dirname $@` | |
111 | + @$(CC) $(CFLAGS) -o $@ $^ $(DBUS_LIBS) $(GLIB_LIBS) $(LIB3270_LIBS) | |
112 | + | |
113 | +cleandebug-service: clean | |
114 | + | |
115 | +clean: | |
116 | + @rm -fr $(OBJDIR) | |
117 | + @rm -fr $(BINDIR) | |
118 | + @rm -f dbus-glue.h | |
119 | + @find . -name "*~" -exec rm -f {} \; | ... | ... |
... | ... | @@ -0,0 +1,121 @@ |
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 daemon.c 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + * Referencias: | |
31 | + * | |
32 | + * https://live.gnome.org/DBusGlibBindings | |
33 | + * | |
34 | + */ | |
35 | + | |
36 | +#include <glib.h> | |
37 | +#include <dbus/dbus.h> | |
38 | +#include <dbus/dbus-glib-lowlevel.h> | |
39 | +#include <dbus/dbus-glib.h> | |
40 | + | |
41 | +#include "daemon.h" | |
42 | +#include "dbus-glue.h" | |
43 | + | |
44 | +/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
45 | + | |
46 | + static DBusGConnection * connection = NULL; | |
47 | + static DBusGProxy * proxy = NULL; | |
48 | + static H3270 * hSession = NULL; | |
49 | + | |
50 | + GMainLoop * main_loop = NULL; | |
51 | + | |
52 | + | |
53 | +/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
54 | + | |
55 | +static gpointer dbus_register_object (DBusGConnection *connection,DBusGProxy *proxy,GType object_type,const DBusGObjectInfo *info,const gchar *path) | |
56 | +{ | |
57 | + GObject *object = g_object_new (object_type, NULL); | |
58 | + dbus_g_object_type_install_info (object_type, info); | |
59 | + dbus_g_connection_register_g_object (connection, path, object); | |
60 | + return object; | |
61 | +} | |
62 | + | |
63 | +static int initialize(void) | |
64 | +{ | |
65 | + GError * error = NULL; | |
66 | + guint result; | |
67 | + | |
68 | + connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); | |
69 | + if(error) | |
70 | + { | |
71 | + g_message("Error \"%s\" getting session dbus",error->message); | |
72 | + g_error_free(error); | |
73 | + return -1; | |
74 | + } | |
75 | + | |
76 | + proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | |
77 | + | |
78 | + org_freedesktop_DBus_request_name(proxy, PW3270_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | |
79 | + | |
80 | + dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,PW3270_DBUS_SERVICE_PATH); | |
81 | + | |
82 | + return 0; | |
83 | +} | |
84 | + | |
85 | +int main(int numpar, char *param[]) | |
86 | +{ | |
87 | + g_type_init (); | |
88 | + | |
89 | + if (!g_thread_supported ()) | |
90 | + g_thread_init (NULL); | |
91 | + | |
92 | + dbus_g_thread_init (); | |
93 | + | |
94 | + pw3270_dbus_register_io_handlers(); | |
95 | + | |
96 | + hSession = lib3270_session_new(""); | |
97 | + | |
98 | + main_loop = g_main_loop_new (NULL, FALSE); | |
99 | + | |
100 | + if(initialize()) | |
101 | + return -1; | |
102 | + | |
103 | + | |
104 | + g_main_loop_run(main_loop); | |
105 | + | |
106 | + lib3270_session_free(hSession); | |
107 | + | |
108 | + return 0; | |
109 | +} | |
110 | + | |
111 | +void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context) | |
112 | +{ | |
113 | + g_main_loop_quit(main_loop); | |
114 | + dbus_g_method_return(context,0); | |
115 | +} | |
116 | + | |
117 | +H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object) | |
118 | +{ | |
119 | + return hSession; | |
120 | +} | |
121 | + | ... | ... |
... | ... | @@ -0,0 +1,46 @@ |
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 daemon.c 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + * Referencias: | |
31 | + * | |
32 | + * https://live.gnome.org/DBusGlibBindings | |
33 | + * | |
34 | + */ | |
35 | + | |
36 | + #include "service.h" | |
37 | + | |
38 | +/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
39 | + | |
40 | + G_GNUC_INTERNAL GMainLoop * main_loop; | |
41 | + | |
42 | + | |
43 | +/*---[ Prototipes ]------------------------------------------------------------------------------*/ | |
44 | + | |
45 | + G_GNUC_INTERNAL void pw3270_dbus_register_io_handlers(void); | |
46 | + | ... | ... |
... | ... | @@ -0,0 +1,92 @@ |
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 gobject.c 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + * Referencias: | |
31 | + * | |
32 | + * https://live.gnome.org/DBusGlibBindings | |
33 | + * | |
34 | + */ | |
35 | + | |
36 | +#include <glib.h> | |
37 | +#include <dbus/dbus.h> | |
38 | +#include <dbus/dbus-glib-lowlevel.h> | |
39 | +#include <dbus/dbus-glib.h> | |
40 | + | |
41 | +#include <lib3270/config.h> | |
42 | + | |
43 | +#include "service.h" | |
44 | + | |
45 | +/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
46 | + | |
47 | + | |
48 | +/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
49 | + | |
50 | +G_DEFINE_TYPE(PW3270Dbus, pw3270_dbus, G_TYPE_OBJECT) | |
51 | + | |
52 | +static void pw3270_dbus_finalize(GObject *object) | |
53 | +{ | |
54 | + G_OBJECT_CLASS(pw3270_dbus_parent_class)->finalize (object); | |
55 | +} | |
56 | + | |
57 | + | |
58 | +static void pw3270_dbus_class_init(PW3270DbusClass *klass) | |
59 | +{ | |
60 | + GObjectClass *object_class; | |
61 | + object_class = G_OBJECT_CLASS (klass); | |
62 | + object_class->finalize = pw3270_dbus_finalize; | |
63 | +} | |
64 | + | |
65 | +static void pw3270_dbus_init(PW3270Dbus *object) | |
66 | +{ | |
67 | + | |
68 | +} | |
69 | + | |
70 | +PW3270Dbus * pw3270_dbus_new(void) | |
71 | +{ | |
72 | + return g_object_new(PW3270_TYPE_DBUS, NULL); | |
73 | +} | |
74 | + | |
75 | +void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context) | |
76 | +{ | |
77 | + dbus_g_method_return(context,PACKAGE_REVISION); | |
78 | +} | |
79 | + | |
80 | +void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context) | |
81 | +{ | |
82 | + g_message("Connecting to \"%s\" by remote request",uri); | |
83 | + dbus_g_method_return(context,lib3270_connect(pw3270_dbus_get_session_handle(PW3270_DBUS(object)),uri,0)); | |
84 | +} | |
85 | + | |
86 | +void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context) | |
87 | +{ | |
88 | + g_message("Disconnecting by remote request"); | |
89 | + lib3270_disconnect(pw3270_dbus_get_session_handle(PW3270_DBUS(object))); | |
90 | + dbus_g_method_return(context,0); | |
91 | +} | |
92 | + | ... | ... |
... | ... | @@ -0,0 +1,349 @@ |
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 iocallback.c 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + */ | |
31 | + | |
32 | +#if defined(_WIN32) /*[*/ | |
33 | + #include <windows.h> | |
34 | +#elif defined(__APPLE__) | |
35 | + #include <poll.h> | |
36 | + #include <string.h> | |
37 | +#else | |
38 | + #include <poll.h> | |
39 | + #include <string.h> | |
40 | +#endif /*]*/ | |
41 | + | |
42 | +#include <stdio.h> | |
43 | +#include <glib.h> | |
44 | +#include "daemon.h" | |
45 | + | |
46 | +static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | |
47 | +static void static_RemoveSource(void *id); | |
48 | + | |
49 | +#ifdef WIN32 | |
50 | +static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | |
51 | +static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | |
52 | +#else | |
53 | +static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); | |
54 | +static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)); | |
55 | +#endif // WIN32 | |
56 | + | |
57 | +static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | |
58 | +static void static_RemoveTimeOut(void * timer); | |
59 | +static int static_Sleep(H3270 *hSession, int seconds); | |
60 | +static int static_RunPendingEvents(H3270 *hSession, int wait); | |
61 | + | |
62 | +static gboolean IO_prepare(GSource *source, gint *timeout); | |
63 | +static gboolean IO_check(GSource *source); | |
64 | +static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer user_data); | |
65 | +static void IO_finalize(GSource *source); /* Can be NULL */ | |
66 | +static gboolean IO_closure(gpointer data); | |
67 | + | |
68 | +/*---[ Structs ]-------------------------------------------------------------------------------------------*/ | |
69 | + | |
70 | + typedef struct _IO_Source | |
71 | + { | |
72 | + GSource gsrc; | |
73 | + GPollFD poll; | |
74 | +#if defined(_WIN32) | |
75 | + HANDLE source; | |
76 | +#else | |
77 | + int source; | |
78 | +#endif // WIN32 | |
79 | + void (*fn)(H3270 *session); | |
80 | + H3270 *session; | |
81 | + } IO_Source; | |
82 | + | |
83 | + typedef struct _timer | |
84 | + { | |
85 | + unsigned char remove; | |
86 | + void (*fn)(H3270 *session); | |
87 | + H3270 *session; | |
88 | + } TIMER; | |
89 | + | |
90 | + static GSourceFuncs IOSources = | |
91 | + { | |
92 | + IO_prepare, | |
93 | + IO_check, | |
94 | + IO_dispatch, | |
95 | + IO_finalize, | |
96 | + IO_closure, | |
97 | + NULL | |
98 | + }; | |
99 | + | |
100 | +/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
101 | + | |
102 | +#ifdef WIN32 | |
103 | +static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | |
104 | +#else | |
105 | +static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | |
106 | +#endif // WIN32 | |
107 | +{ | |
108 | + IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); | |
109 | + | |
110 | + src->source = source; | |
111 | + src->fn = fn; | |
112 | + src->poll.fd = (int) source; | |
113 | + src->poll.events = events; | |
114 | + src->session = session; | |
115 | + | |
116 | + g_source_attach((GSource *) src,NULL); | |
117 | + g_source_add_poll((GSource *) src,&src->poll); | |
118 | + | |
119 | + return src; | |
120 | +} | |
121 | + | |
122 | +#ifdef WIN32 | |
123 | +static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | |
124 | +#else | |
125 | +static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) | |
126 | +#endif // WIN32 | |
127 | +{ | |
128 | + return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); | |
129 | +} | |
130 | + | |
131 | +static void static_RemoveSource(void *id) | |
132 | +{ | |
133 | + if(id) | |
134 | + g_source_destroy((GSource *) id); | |
135 | +} | |
136 | + | |
137 | +#if defined(WIN32) | |
138 | +static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | |
139 | +{ | |
140 | + return 0; | |
141 | +} | |
142 | +#else | |
143 | +static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) | |
144 | +{ | |
145 | + return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); | |
146 | +} | |
147 | +#endif // WIN32 | |
148 | + | |
149 | +static gboolean do_timer(TIMER *t) | |
150 | +{ | |
151 | + if(!t->remove) | |
152 | + t->fn(t->session); | |
153 | + return FALSE; | |
154 | +} | |
155 | + | |
156 | +static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*proc)(H3270 *session)) | |
157 | +{ | |
158 | + TIMER *t = g_malloc0(sizeof(TIMER)); | |
159 | + | |
160 | + t->fn = proc; | |
161 | + t->session = session; | |
162 | + | |
163 | + g_timeout_add_full(G_PRIORITY_DEFAULT, (guint) interval, (GSourceFunc) do_timer, t, g_free); | |
164 | + | |
165 | + return t; | |
166 | +} | |
167 | + | |
168 | +static void static_RemoveTimeOut(void * timer) | |
169 | +{ | |
170 | + ((TIMER *) timer)->remove++; | |
171 | +} | |
172 | + | |
173 | +static gboolean IO_prepare(GSource *source, gint *timeout) | |
174 | +{ | |
175 | + /* | |
176 | + * Called before all the file descriptors are polled. | |
177 | + * If the source can determine that it is ready here | |
178 | + * (without waiting for the results of the poll() call) | |
179 | + * it should return TRUE. | |
180 | + * | |
181 | + * It can also return a timeout_ value which should be the maximum | |
182 | + * timeout (in milliseconds) which should be passed to the poll() call. | |
183 | + * The actual timeout used will be -1 if all sources returned -1, | |
184 | + * or it will be the minimum of all the timeout_ values | |
185 | + * returned which were >= 0. | |
186 | + * | |
187 | + */ | |
188 | + return 0; | |
189 | +} | |
190 | + | |
191 | +static gboolean IO_check(GSource *source) | |
192 | +{ | |
193 | + /* | |
194 | + * Called after all the file descriptors are polled. | |
195 | + * The source should return TRUE if it is ready to be dispatched. | |
196 | + * Note that some time may have passed since the previous prepare | |
197 | + * function was called, so the source should be checked again here. | |
198 | + * | |
199 | + */ | |
200 | +#if defined(_WIN32) /*[*/ | |
201 | + | |
202 | + if(WaitForSingleObject(((IO_Source *) source)->source,0) == WAIT_OBJECT_0) | |
203 | + return TRUE; | |
204 | + | |
205 | +#else /*][*/ | |
206 | + | |
207 | + struct pollfd fds; | |
208 | + | |
209 | + memset(&fds,0,sizeof(fds)); | |
210 | + | |
211 | + fds.fd = ((IO_Source *) source)->poll.fd; | |
212 | + fds.events = ((IO_Source *) source)->poll.events; | |
213 | + | |
214 | + if(poll(&fds,1,0) > 0) | |
215 | + return TRUE; | |
216 | + | |
217 | +#endif /*]*/ | |
218 | + | |
219 | + return FALSE; | |
220 | +} | |
221 | + | |
222 | +static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) | |
223 | +{ | |
224 | + /* | |
225 | + * Called to dispatch the event source, | |
226 | + * after it has returned TRUE in either its prepare or its check function. | |
227 | + * The dispatch function is passed in a callback function and data. | |
228 | + * The callback function may be NULL if the source was never connected | |
229 | + * to a callback using g_source_set_callback(). The dispatch function | |
230 | + * should call the callback function with user_data and whatever additional | |
231 | + * parameters are needed for this type of event source. | |
232 | + */ | |
233 | + ((IO_Source *) source)->fn(((IO_Source *) source)->session); | |
234 | + return TRUE; | |
235 | +} | |
236 | + | |
237 | +static void IO_finalize(GSource *source) | |
238 | +{ | |
239 | + | |
240 | +} | |
241 | + | |
242 | +static gboolean IO_closure(gpointer data) | |
243 | +{ | |
244 | + return 0; | |
245 | +} | |
246 | + | |
247 | +struct bgParameter | |
248 | +{ | |
249 | + gboolean running; | |
250 | + H3270 *session; | |
251 | + int rc; | |
252 | + int(*callback)(H3270 *session, void *); | |
253 | + void *parm; | |
254 | + | |
255 | +}; | |
256 | + | |
257 | +gpointer BgCall(struct bgParameter *p) | |
258 | +{ | |
259 | +// trace("%s starts",__FUNCTION__); | |
260 | + p->rc = p->callback(p->session, p->parm); | |
261 | + p->running = FALSE; | |
262 | +// trace("%s ends",__FUNCTION__); | |
263 | + return 0; | |
264 | +} | |
265 | + | |
266 | +static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm) | |
267 | +{ | |
268 | + struct bgParameter p = { TRUE, session, -1, callback, parm }; | |
269 | + GThread *thread; | |
270 | + | |
271 | +// trace("Starting auxiliary thread for callback %p",callback); | |
272 | + | |
273 | + p.running = TRUE; | |
274 | + thread = g_thread_create( (GThreadFunc) BgCall, &p, 0, NULL); | |
275 | + | |
276 | + if(!thread) | |
277 | + { | |
278 | + g_error("Can't start background thread"); | |
279 | + return -1; | |
280 | + } | |
281 | + | |
282 | + while(p.running) | |
283 | + g_main_context_iteration(g_main_loop_get_context(main_loop),TRUE); | |
284 | + | |
285 | + return p.rc; | |
286 | +} | |
287 | + | |
288 | +static int static_Sleep(H3270 *hSession, int seconds) | |
289 | +{ | |
290 | + time_t end = time(0) + seconds; | |
291 | + | |
292 | + while(time(0) < end) | |
293 | + g_main_iteration(TRUE); | |
294 | + | |
295 | + return 0; | |
296 | +} | |
297 | + | |
298 | +static int static_RunPendingEvents(H3270 *hSession, int wait) | |
299 | +{ | |
300 | + GMainContext *context = g_main_loop_get_context(main_loop); | |
301 | + int rc = 0; | |
302 | + while(g_main_context_pending(context)) | |
303 | + { | |
304 | + rc = 1; | |
305 | + g_main_context_iteration(context,FALSE); | |
306 | + } | |
307 | + | |
308 | + if(wait) | |
309 | + g_main_context_iteration(context,TRUE); | |
310 | + | |
311 | + return rc; | |
312 | +} | |
313 | + | |
314 | +static void beep(H3270 *session) | |
315 | +{ | |
316 | +} | |
317 | + | |
318 | +void pw3270_dbus_register_io_handlers(void) | |
319 | +{ | |
320 | + static const struct lib3270_callbacks hdl = | |
321 | + { | |
322 | + sizeof(struct lib3270_callbacks), | |
323 | + | |
324 | + static_AddTimeOut, | |
325 | + static_RemoveTimeOut, | |
326 | + | |
327 | + static_AddInput, | |
328 | + static_RemoveSource, | |
329 | + | |
330 | + static_AddExcept, | |
331 | + | |
332 | +#ifdef G_THREADS_ENABLED | |
333 | + static_CallAndWait, | |
334 | +#else | |
335 | + NULL, | |
336 | +#endif | |
337 | + | |
338 | + static_Sleep, | |
339 | + static_RunPendingEvents, | |
340 | + beep | |
341 | + | |
342 | + }; | |
343 | + | |
344 | + if(lib3270_register_handlers(&hdl)) | |
345 | + { | |
346 | + g_error("%s","Can't set lib3270 I/O handlers"); | |
347 | + } | |
348 | + | |
349 | +} | ... | ... |
... | ... | @@ -0,0 +1,102 @@ |
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 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + */ | |
31 | + | |
32 | +#include <glib.h> | |
33 | +#include <dbus/dbus.h> | |
34 | +#include <dbus/dbus-glib-lowlevel.h> | |
35 | +#include <dbus/dbus-glib.h> | |
36 | + | |
37 | +#include <pw3270.h> | |
38 | +#include <pw3270/plugin.h> | |
39 | + | |
40 | +#include "service.h" | |
41 | +#include "dbus-glue.h" | |
42 | + | |
43 | +#include <gtk/gtk.h> | |
44 | + | |
45 | +/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
46 | + | |
47 | + static DBusGConnection * connection = NULL; | |
48 | + static DBusGProxy * proxy = NULL; | |
49 | + | |
50 | +/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
51 | + | |
52 | + static gpointer dbus_register_object (DBusGConnection *connection,DBusGProxy *proxy,GType object_type,const DBusGObjectInfo *info,const gchar *path) | |
53 | + { | |
54 | + GObject *object = g_object_new (object_type, NULL); | |
55 | + dbus_g_object_type_install_info (object_type, info); | |
56 | + dbus_g_connection_register_g_object (connection, path, object); | |
57 | + return object; | |
58 | + } | |
59 | + | |
60 | + LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) | |
61 | + { | |
62 | + | |
63 | + GError * error = NULL; | |
64 | + guint result; | |
65 | + | |
66 | + connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); | |
67 | + if(error) | |
68 | + { | |
69 | + GtkWidget *dialog = gtk_message_dialog_new( | |
70 | + GTK_WINDOW(window), | |
71 | + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, | |
72 | + GTK_MESSAGE_ERROR, | |
73 | + GTK_BUTTONS_OK, | |
74 | + _( "Can't connect to DBUS server" )); | |
75 | + | |
76 | + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",error->message); | |
77 | + | |
78 | + g_message("Error \"%s\" getting session dbus",error->message); | |
79 | + | |
80 | + g_error_free(error); | |
81 | + | |
82 | + gtk_dialog_run(GTK_DIALOG(dialog)); | |
83 | + gtk_widget_destroy(dialog); | |
84 | + | |
85 | + return -1; | |
86 | + } | |
87 | + | |
88 | + | |
89 | + proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | |
90 | + | |
91 | + org_freedesktop_DBus_request_name(proxy, PW3270_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | |
92 | + | |
93 | + dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,PW3270_DBUS_SERVICE_PATH); | |
94 | + | |
95 | + return 0; | |
96 | + } | |
97 | + | |
98 | + LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) | |
99 | + { | |
100 | + | |
101 | + return 0; | |
102 | + } | ... | ... |
... | ... | @@ -0,0 +1,67 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | +<CodeBlocks_project_file> | |
3 | + <FileVersion major="1" minor="6" /> | |
4 | + <Project> | |
5 | + <Option title="pw3270dbus" /> | |
6 | + <Option makefile_is_custom="1" /> | |
7 | + <Option pch_mode="2" /> | |
8 | + <Option compiler="gcc" /> | |
9 | + <Build> | |
10 | + <Target title="Debug"> | |
11 | + <Option output=".bin/Debug/pw3270dbus" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | |
12 | + <Option object_output=".obj/Debug/" /> | |
13 | + <Option type="3" /> | |
14 | + <Option compiler="gcc" /> | |
15 | + <Compiler> | |
16 | + <Add option="-g" /> | |
17 | + </Compiler> | |
18 | + </Target> | |
19 | + <Target title="Release"> | |
20 | + <Option output=".bin/Release/pw3270dbus" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | |
21 | + <Option object_output=".obj/Release/" /> | |
22 | + <Option type="3" /> | |
23 | + <Option compiler="gcc" /> | |
24 | + <Compiler> | |
25 | + <Add option="-O2" /> | |
26 | + </Compiler> | |
27 | + <Linker> | |
28 | + <Add option="-s" /> | |
29 | + </Linker> | |
30 | + </Target> | |
31 | + <Target title="debug-service"> | |
32 | + <Option output=".bin/Debug/pw3270d" prefix_auto="1" extension_auto="1" /> | |
33 | + <Option object_output=".obj/Debug/" /> | |
34 | + <Option type="1" /> | |
35 | + <Option compiler="gcc" /> | |
36 | + <Compiler> | |
37 | + <Add option="-g" /> | |
38 | + </Compiler> | |
39 | + </Target> | |
40 | + </Build> | |
41 | + <Compiler> | |
42 | + <Add option="-Wall" /> | |
43 | + </Compiler> | |
44 | + <Unit filename="Makefile.in" /> | |
45 | + <Unit filename="daemon.c"> | |
46 | + <Option compilerVar="CC" /> | |
47 | + </Unit> | |
48 | + <Unit filename="daemon.h" /> | |
49 | + <Unit filename="dbus-glue.h" /> | |
50 | + <Unit filename="gobject.c"> | |
51 | + <Option compilerVar="CC" /> | |
52 | + </Unit> | |
53 | + <Unit filename="iocallback.c"> | |
54 | + <Option compilerVar="CC" /> | |
55 | + </Unit> | |
56 | + <Unit filename="main.c"> | |
57 | + <Option compilerVar="CC" /> | |
58 | + </Unit> | |
59 | + <Unit filename="pw3270dbus.xml" /> | |
60 | + <Unit filename="service.h" /> | |
61 | + <Unit filename="test.sh" /> | |
62 | + <Extensions> | |
63 | + <code_completion /> | |
64 | + <debugger /> | |
65 | + </Extensions> | |
66 | + </Project> | |
67 | +</CodeBlocks_project_file> | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<node name="/br/com/bb/pw3270"> | |
3 | + <interface name="br.com.bb.pw3270"> | |
4 | + <method name="getRevision"> | |
5 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
6 | + <arg type="s" name="revision" direction="out" /> | |
7 | + </method> | |
8 | + <method name="quit"> | |
9 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
10 | + <arg type="i" name="result" direction="out" /> | |
11 | + </method> | |
12 | + <method name="connect"> | |
13 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
14 | + <arg type="s" name="uri" direction="in" /> | |
15 | + <arg type="i" name="result" direction="out" /> | |
16 | + </method> | |
17 | + <method name="disconnect"> | |
18 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
19 | + <arg type="i" name="result" direction="out" /> | |
20 | + </method> | |
21 | + </interface> | |
22 | +</node> | ... | ... |
... | ... | @@ -0,0 +1,53 @@ |
1 | +#ifndef _PW3270_DBUS_SERVICE_H | |
2 | + | |
3 | + #define _PW3270_DBUS_SERVICE_H 1 | |
4 | + | |
5 | + #define ENABLE_NLS | |
6 | + #define GETTEXT_PACKAGE PACKAGE_NAME | |
7 | + | |
8 | + #include <libintl.h> | |
9 | + #include <glib/gi18n.h> | |
10 | + | |
11 | + #include <lib3270.h> | |
12 | + #include <glib.h> | |
13 | + #include <dbus/dbus-glib.h> | |
14 | + #include <dbus/dbus-glib-bindings.h> | |
15 | + #include <dbus/dbus-glib-lowlevel.h> | |
16 | + | |
17 | + #define PW3270_DBUS_SERVICE_PATH "/br/com/bb/pw3270" | |
18 | + #define PW3270_DBUS_SERVICE "br.com.bb.pw3270" | |
19 | + | |
20 | + #define PW3270_TYPE_DBUS (pw3270_dbus_get_type ()) | |
21 | + #define PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PW3270_TYPE_DBUS, PW3270Dbus)) | |
22 | + #define PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PW3270_TYPE_DBUS, PW3270DbusClass)) | |
23 | + #define IS_PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PW3270_TYPE_DBUS)) | |
24 | + #define IS_PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PW3270_TYPE_DBUS)) | |
25 | + #define PW3270_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PW3270_TYPE_DBUS, PW3270DbusClass)) | |
26 | + | |
27 | + G_BEGIN_DECLS | |
28 | + | |
29 | + typedef struct _PW3270Dbus PW3270Dbus; | |
30 | + typedef struct _PW3270DbusClass PW3270DbusClass; | |
31 | + | |
32 | + struct _PW3270Dbus | |
33 | + { | |
34 | + GObject parent; | |
35 | + }; | |
36 | + | |
37 | + struct _PW3270DbusClass | |
38 | + { | |
39 | + GObjectClass parent; | |
40 | + }; | |
41 | + | |
42 | + PW3270Dbus * pw3270_dbus_new (void); | |
43 | + GType pw3270_dbus_get_type (void); | |
44 | + | |
45 | + void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context); | |
46 | + void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context); | |
47 | + void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); | |
48 | + void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context); | |
49 | + H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object); | |
50 | + | |
51 | + G_END_DECLS | |
52 | + | |
53 | +#endif // _PW3270_DBUS_SERVICE_H | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +case $1 in | |
4 | + | |
5 | + revision) | |
6 | + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getRevision | |
7 | + ;; | |
8 | + | |
9 | + connect) | |
10 | + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.connect string:$2 | |
11 | + ;; | |
12 | + | |
13 | + disconnect) | |
14 | + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.disconnect | |
15 | + ;; | |
16 | + | |
17 | + quit) | |
18 | + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.quit | |
19 | + ;; | |
20 | + | |
21 | + *) | |
22 | + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getRevision | |
23 | + ;; | |
24 | + | |
25 | +esac | |
26 | + | ... | ... |
src/plugins/dbus/Makefile.in
... | ... | @@ -1,117 +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., 59 Temple | |
19 | -# Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | -# | |
21 | -# Contatos: | |
22 | -# | |
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | -# licinio@bb.com.br (Licínio Luis Branco) | |
26 | -# kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
27 | -# | |
28 | - | |
29 | -#---[ Sources ]---------------------------------------------------------------- | |
30 | - | |
31 | -MODULE_NAME=pw3270dbus | |
32 | -DEPENDS=Makefile dbus-glue.h | |
33 | -PLUGIN_SRC=main.c gobject.c | |
34 | -DAEMON_SRC=daemon.c gobject.c iocallback.c | |
35 | - | |
36 | -#---[ Paths ]------------------------------------------------------------------ | |
37 | - | |
38 | -ROOTDIR ?= . | |
39 | -OBJDIR ?= $(ROOTDIR)/.obj | |
40 | -BINDIR ?= $(ROOTDIR)/.bin | |
41 | -BINDBG ?= $(BINDIR)/Debug | |
42 | -BINRLS ?= $(BINDIR)/Release | |
43 | - | |
44 | -OBJDBG = $(OBJDIR)/Debug | |
45 | -OBJRLS = $(OBJDIR)/Release | |
46 | -OBJEXT = o | |
47 | - | |
48 | -#---[ Tools ]------------------------------------------------------------------ | |
49 | - | |
50 | -MKDIR=@MKDIR_P@ | |
51 | -CC=@CC@ | |
52 | -LD=@CC@ | |
53 | -DBUSBINDINGTOOL=@DBUSBINDINGTOOL@ | |
54 | - | |
55 | -#---[ Flags ]------------------------------------------------------------------ | |
56 | - | |
57 | -DLL_FLAGS=-shared | |
58 | -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
59 | - | |
60 | -LIB3270_CFLAGS ?= `pkg-config --cflags lib3270` | |
61 | -DBUS_CFLAGS=@DBUS_CFLAGS@ | |
62 | -GLIB_CFLAGS=@GLIB_CFLAGS@ | |
63 | - | |
64 | -LIB3270_LIBS ?= `pkg-config --libs lib3270` | |
65 | -DBUS_LIBS=@DBUS_LIBS@ | |
66 | -GLIB_LIBS=@GLIB_LIBS@ | |
67 | - | |
68 | -#---[ Rules ]------------------------------------------------------------------ | |
69 | - | |
70 | -$(OBJDBG)/%.o: %.c $(DEPENDS) | |
71 | - @echo " CC `basename $@`" | |
72 | - @$(MKDIR) `dirname $@` | |
73 | - @$(CC) $(CFLAGS) $(DBUS_CFLAGS) $(GLIB_CFLAGS) $(DEBUG_CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
74 | - | |
75 | -$(OBJRLS)/%.o: %.c $(DEPENDS) | |
76 | - @echo " CC `basename $@`" | |
77 | - @$(MKDIR) `dirname $@` | |
78 | - @$(CC) $(CFLAGS) $(DBUS_CFLAGS) $(GLIB_CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
79 | - | |
80 | - | |
81 | -#---[ Release targets ]-------------------------------------------------------- | |
82 | - | |
83 | -Release: $(BINRLS)/plugins/$(MODULE_NAME).so | |
84 | - | |
85 | -$(BINRLS)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) | |
86 | - @echo " CCLD `basename $@`" | |
87 | - @$(MKDIR) `dirname $@` | |
88 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | |
89 | - | |
90 | -#---[ Debug targets ]---------------------------------------------------------- | |
91 | - | |
92 | -Debug: $(BINDBG)/plugins/$(MODULE_NAME).so $(BINDBG)/libhllapi.so | |
93 | - | |
94 | -$(BINDBG)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) | |
95 | - @echo " CCLD `basename $@`" | |
96 | - @$(MKDIR) `dirname $@` | |
97 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GLIB_LIBS) | |
98 | - | |
99 | -#---[ Misc targets ]----------------------------------------------------------- | |
100 | - | |
101 | -debug-service: $(BINDBG)/@PACKAGE_NAME@d | |
102 | - | |
103 | -dbus-glue.h: pw3270dbus.xml | |
104 | - @$(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=pw3270_dbus $^ | |
105 | - | |
106 | -$(BINDBG)/@PACKAGE_NAME@d: $(foreach SRC, $(basename $(DAEMON_SRC)), $(OBJDBG)/$(SRC).o) | |
107 | - @echo " CCLD `basename $@`" | |
108 | - @$(MKDIR) `dirname $@` | |
109 | - @$(CC) $(CFLAGS) -o $@ $^ $(DBUS_LIBS) $(GLIB_LIBS) $(LIB3270_LIBS) | |
110 | - | |
111 | -cleandebug-service: clean | |
112 | - | |
113 | -clean: | |
114 | - @rm -fr $(OBJDIR) | |
115 | - @rm -fr $(BINDIR) | |
116 | - @rm -f dbus-glue.h | |
117 | - @find . -name "*~" -exec rm -f {} \; |
src/plugins/dbus/daemon.c
... | ... | @@ -1,121 +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 daemon.c 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - * Referencias: | |
31 | - * | |
32 | - * https://live.gnome.org/DBusGlibBindings | |
33 | - * | |
34 | - */ | |
35 | - | |
36 | -#include <glib.h> | |
37 | -#include <dbus/dbus.h> | |
38 | -#include <dbus/dbus-glib-lowlevel.h> | |
39 | -#include <dbus/dbus-glib.h> | |
40 | - | |
41 | -#include "daemon.h" | |
42 | -#include "dbus-glue.h" | |
43 | - | |
44 | -/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
45 | - | |
46 | - static DBusGConnection * connection = NULL; | |
47 | - static DBusGProxy * proxy = NULL; | |
48 | - static H3270 * hSession = NULL; | |
49 | - | |
50 | - GMainLoop * main_loop = NULL; | |
51 | - | |
52 | - | |
53 | -/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
54 | - | |
55 | -static gpointer dbus_register_object (DBusGConnection *connection,DBusGProxy *proxy,GType object_type,const DBusGObjectInfo *info,const gchar *path) | |
56 | -{ | |
57 | - GObject *object = g_object_new (object_type, NULL); | |
58 | - dbus_g_object_type_install_info (object_type, info); | |
59 | - dbus_g_connection_register_g_object (connection, path, object); | |
60 | - return object; | |
61 | -} | |
62 | - | |
63 | -static int initialize(void) | |
64 | -{ | |
65 | - GError * error = NULL; | |
66 | - guint result; | |
67 | - | |
68 | - connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); | |
69 | - if(error) | |
70 | - { | |
71 | - g_message("Error \"%s\" getting session dbus",error->message); | |
72 | - g_error_free(error); | |
73 | - return -1; | |
74 | - } | |
75 | - | |
76 | - proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | |
77 | - | |
78 | - org_freedesktop_DBus_request_name(proxy, PW3270_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | |
79 | - | |
80 | - dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,PW3270_DBUS_SERVICE_PATH); | |
81 | - | |
82 | - return 0; | |
83 | -} | |
84 | - | |
85 | -int main(int numpar, char *param[]) | |
86 | -{ | |
87 | - g_type_init (); | |
88 | - | |
89 | - if (!g_thread_supported ()) | |
90 | - g_thread_init (NULL); | |
91 | - | |
92 | - dbus_g_thread_init (); | |
93 | - | |
94 | - pw3270_dbus_register_io_handlers(); | |
95 | - | |
96 | - hSession = lib3270_session_new(""); | |
97 | - | |
98 | - main_loop = g_main_loop_new (NULL, FALSE); | |
99 | - | |
100 | - if(initialize()) | |
101 | - return -1; | |
102 | - | |
103 | - | |
104 | - g_main_loop_run(main_loop); | |
105 | - | |
106 | - lib3270_session_free(hSession); | |
107 | - | |
108 | - return 0; | |
109 | -} | |
110 | - | |
111 | -void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context) | |
112 | -{ | |
113 | - g_main_loop_quit(main_loop); | |
114 | - dbus_g_method_return(context,0); | |
115 | -} | |
116 | - | |
117 | -H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object) | |
118 | -{ | |
119 | - return hSession; | |
120 | -} | |
121 | - |
src/plugins/dbus/daemon.h
... | ... | @@ -1,46 +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 daemon.c 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - * Referencias: | |
31 | - * | |
32 | - * https://live.gnome.org/DBusGlibBindings | |
33 | - * | |
34 | - */ | |
35 | - | |
36 | - #include "service.h" | |
37 | - | |
38 | -/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
39 | - | |
40 | - G_GNUC_INTERNAL GMainLoop * main_loop; | |
41 | - | |
42 | - | |
43 | -/*---[ Prototipes ]------------------------------------------------------------------------------*/ | |
44 | - | |
45 | - G_GNUC_INTERNAL void pw3270_dbus_register_io_handlers(void); | |
46 | - |
src/plugins/dbus/gobject.c
... | ... | @@ -1,92 +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 gobject.c 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - * Referencias: | |
31 | - * | |
32 | - * https://live.gnome.org/DBusGlibBindings | |
33 | - * | |
34 | - */ | |
35 | - | |
36 | -#include <glib.h> | |
37 | -#include <dbus/dbus.h> | |
38 | -#include <dbus/dbus-glib-lowlevel.h> | |
39 | -#include <dbus/dbus-glib.h> | |
40 | - | |
41 | -#include <lib3270/config.h> | |
42 | - | |
43 | -#include "service.h" | |
44 | - | |
45 | -/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
46 | - | |
47 | - | |
48 | -/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
49 | - | |
50 | -G_DEFINE_TYPE(PW3270Dbus, pw3270_dbus, G_TYPE_OBJECT) | |
51 | - | |
52 | -static void pw3270_dbus_finalize(GObject *object) | |
53 | -{ | |
54 | - G_OBJECT_CLASS(pw3270_dbus_parent_class)->finalize (object); | |
55 | -} | |
56 | - | |
57 | - | |
58 | -static void pw3270_dbus_class_init(PW3270DbusClass *klass) | |
59 | -{ | |
60 | - GObjectClass *object_class; | |
61 | - object_class = G_OBJECT_CLASS (klass); | |
62 | - object_class->finalize = pw3270_dbus_finalize; | |
63 | -} | |
64 | - | |
65 | -static void pw3270_dbus_init(PW3270Dbus *object) | |
66 | -{ | |
67 | - | |
68 | -} | |
69 | - | |
70 | -PW3270Dbus * pw3270_dbus_new(void) | |
71 | -{ | |
72 | - return g_object_new(PW3270_TYPE_DBUS, NULL); | |
73 | -} | |
74 | - | |
75 | -void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context) | |
76 | -{ | |
77 | - dbus_g_method_return(context,PACKAGE_REVISION); | |
78 | -} | |
79 | - | |
80 | -void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context) | |
81 | -{ | |
82 | - g_message("Connecting to \"%s\" by remote request",uri); | |
83 | - dbus_g_method_return(context,lib3270_connect(pw3270_dbus_get_session_handle(PW3270_DBUS(object)),uri,0)); | |
84 | -} | |
85 | - | |
86 | -void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context) | |
87 | -{ | |
88 | - g_message("Disconnecting by remote request"); | |
89 | - lib3270_disconnect(pw3270_dbus_get_session_handle(PW3270_DBUS(object))); | |
90 | - dbus_g_method_return(context,0); | |
91 | -} | |
92 | - |
src/plugins/dbus/iocallback.c
... | ... | @@ -1,349 +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 iocallback.c 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - */ | |
31 | - | |
32 | -#if defined(_WIN32) /*[*/ | |
33 | - #include <windows.h> | |
34 | -#elif defined(__APPLE__) | |
35 | - #include <poll.h> | |
36 | - #include <string.h> | |
37 | -#else | |
38 | - #include <poll.h> | |
39 | - #include <string.h> | |
40 | -#endif /*]*/ | |
41 | - | |
42 | -#include <stdio.h> | |
43 | -#include <glib.h> | |
44 | -#include "daemon.h" | |
45 | - | |
46 | -static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | |
47 | -static void static_RemoveSource(void *id); | |
48 | - | |
49 | -#ifdef WIN32 | |
50 | -static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | |
51 | -static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | |
52 | -#else | |
53 | -static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); | |
54 | -static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)); | |
55 | -#endif // WIN32 | |
56 | - | |
57 | -static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | |
58 | -static void static_RemoveTimeOut(void * timer); | |
59 | -static int static_Sleep(H3270 *hSession, int seconds); | |
60 | -static int static_RunPendingEvents(H3270 *hSession, int wait); | |
61 | - | |
62 | -static gboolean IO_prepare(GSource *source, gint *timeout); | |
63 | -static gboolean IO_check(GSource *source); | |
64 | -static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer user_data); | |
65 | -static void IO_finalize(GSource *source); /* Can be NULL */ | |
66 | -static gboolean IO_closure(gpointer data); | |
67 | - | |
68 | -/*---[ Structs ]-------------------------------------------------------------------------------------------*/ | |
69 | - | |
70 | - typedef struct _IO_Source | |
71 | - { | |
72 | - GSource gsrc; | |
73 | - GPollFD poll; | |
74 | -#if defined(_WIN32) | |
75 | - HANDLE source; | |
76 | -#else | |
77 | - int source; | |
78 | -#endif // WIN32 | |
79 | - void (*fn)(H3270 *session); | |
80 | - H3270 *session; | |
81 | - } IO_Source; | |
82 | - | |
83 | - typedef struct _timer | |
84 | - { | |
85 | - unsigned char remove; | |
86 | - void (*fn)(H3270 *session); | |
87 | - H3270 *session; | |
88 | - } TIMER; | |
89 | - | |
90 | - static GSourceFuncs IOSources = | |
91 | - { | |
92 | - IO_prepare, | |
93 | - IO_check, | |
94 | - IO_dispatch, | |
95 | - IO_finalize, | |
96 | - IO_closure, | |
97 | - NULL | |
98 | - }; | |
99 | - | |
100 | -/*---[ Implement ]-----------------------------------------------------------------------------------------*/ | |
101 | - | |
102 | -#ifdef WIN32 | |
103 | -static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | |
104 | -#else | |
105 | -static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | |
106 | -#endif // WIN32 | |
107 | -{ | |
108 | - IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); | |
109 | - | |
110 | - src->source = source; | |
111 | - src->fn = fn; | |
112 | - src->poll.fd = (int) source; | |
113 | - src->poll.events = events; | |
114 | - src->session = session; | |
115 | - | |
116 | - g_source_attach((GSource *) src,NULL); | |
117 | - g_source_add_poll((GSource *) src,&src->poll); | |
118 | - | |
119 | - return src; | |
120 | -} | |
121 | - | |
122 | -#ifdef WIN32 | |
123 | -static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | |
124 | -#else | |
125 | -static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) | |
126 | -#endif // WIN32 | |
127 | -{ | |
128 | - return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); | |
129 | -} | |
130 | - | |
131 | -static void static_RemoveSource(void *id) | |
132 | -{ | |
133 | - if(id) | |
134 | - g_source_destroy((GSource *) id); | |
135 | -} | |
136 | - | |
137 | -#if defined(WIN32) | |
138 | -static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | |
139 | -{ | |
140 | - return 0; | |
141 | -} | |
142 | -#else | |
143 | -static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) | |
144 | -{ | |
145 | - return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); | |
146 | -} | |
147 | -#endif // WIN32 | |
148 | - | |
149 | -static gboolean do_timer(TIMER *t) | |
150 | -{ | |
151 | - if(!t->remove) | |
152 | - t->fn(t->session); | |
153 | - return FALSE; | |
154 | -} | |
155 | - | |
156 | -static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*proc)(H3270 *session)) | |
157 | -{ | |
158 | - TIMER *t = g_malloc0(sizeof(TIMER)); | |
159 | - | |
160 | - t->fn = proc; | |
161 | - t->session = session; | |
162 | - | |
163 | - g_timeout_add_full(G_PRIORITY_DEFAULT, (guint) interval, (GSourceFunc) do_timer, t, g_free); | |
164 | - | |
165 | - return t; | |
166 | -} | |
167 | - | |
168 | -static void static_RemoveTimeOut(void * timer) | |
169 | -{ | |
170 | - ((TIMER *) timer)->remove++; | |
171 | -} | |
172 | - | |
173 | -static gboolean IO_prepare(GSource *source, gint *timeout) | |
174 | -{ | |
175 | - /* | |
176 | - * Called before all the file descriptors are polled. | |
177 | - * If the source can determine that it is ready here | |
178 | - * (without waiting for the results of the poll() call) | |
179 | - * it should return TRUE. | |
180 | - * | |
181 | - * It can also return a timeout_ value which should be the maximum | |
182 | - * timeout (in milliseconds) which should be passed to the poll() call. | |
183 | - * The actual timeout used will be -1 if all sources returned -1, | |
184 | - * or it will be the minimum of all the timeout_ values | |
185 | - * returned which were >= 0. | |
186 | - * | |
187 | - */ | |
188 | - return 0; | |
189 | -} | |
190 | - | |
191 | -static gboolean IO_check(GSource *source) | |
192 | -{ | |
193 | - /* | |
194 | - * Called after all the file descriptors are polled. | |
195 | - * The source should return TRUE if it is ready to be dispatched. | |
196 | - * Note that some time may have passed since the previous prepare | |
197 | - * function was called, so the source should be checked again here. | |
198 | - * | |
199 | - */ | |
200 | -#if defined(_WIN32) /*[*/ | |
201 | - | |
202 | - if(WaitForSingleObject(((IO_Source *) source)->source,0) == WAIT_OBJECT_0) | |
203 | - return TRUE; | |
204 | - | |
205 | -#else /*][*/ | |
206 | - | |
207 | - struct pollfd fds; | |
208 | - | |
209 | - memset(&fds,0,sizeof(fds)); | |
210 | - | |
211 | - fds.fd = ((IO_Source *) source)->poll.fd; | |
212 | - fds.events = ((IO_Source *) source)->poll.events; | |
213 | - | |
214 | - if(poll(&fds,1,0) > 0) | |
215 | - return TRUE; | |
216 | - | |
217 | -#endif /*]*/ | |
218 | - | |
219 | - return FALSE; | |
220 | -} | |
221 | - | |
222 | -static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) | |
223 | -{ | |
224 | - /* | |
225 | - * Called to dispatch the event source, | |
226 | - * after it has returned TRUE in either its prepare or its check function. | |
227 | - * The dispatch function is passed in a callback function and data. | |
228 | - * The callback function may be NULL if the source was never connected | |
229 | - * to a callback using g_source_set_callback(). The dispatch function | |
230 | - * should call the callback function with user_data and whatever additional | |
231 | - * parameters are needed for this type of event source. | |
232 | - */ | |
233 | - ((IO_Source *) source)->fn(((IO_Source *) source)->session); | |
234 | - return TRUE; | |
235 | -} | |
236 | - | |
237 | -static void IO_finalize(GSource *source) | |
238 | -{ | |
239 | - | |
240 | -} | |
241 | - | |
242 | -static gboolean IO_closure(gpointer data) | |
243 | -{ | |
244 | - return 0; | |
245 | -} | |
246 | - | |
247 | -struct bgParameter | |
248 | -{ | |
249 | - gboolean running; | |
250 | - H3270 *session; | |
251 | - int rc; | |
252 | - int(*callback)(H3270 *session, void *); | |
253 | - void *parm; | |
254 | - | |
255 | -}; | |
256 | - | |
257 | -gpointer BgCall(struct bgParameter *p) | |
258 | -{ | |
259 | -// trace("%s starts",__FUNCTION__); | |
260 | - p->rc = p->callback(p->session, p->parm); | |
261 | - p->running = FALSE; | |
262 | -// trace("%s ends",__FUNCTION__); | |
263 | - return 0; | |
264 | -} | |
265 | - | |
266 | -static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm) | |
267 | -{ | |
268 | - struct bgParameter p = { TRUE, session, -1, callback, parm }; | |
269 | - GThread *thread; | |
270 | - | |
271 | -// trace("Starting auxiliary thread for callback %p",callback); | |
272 | - | |
273 | - p.running = TRUE; | |
274 | - thread = g_thread_create( (GThreadFunc) BgCall, &p, 0, NULL); | |
275 | - | |
276 | - if(!thread) | |
277 | - { | |
278 | - g_error("Can't start background thread"); | |
279 | - return -1; | |
280 | - } | |
281 | - | |
282 | - while(p.running) | |
283 | - g_main_context_iteration(g_main_loop_get_context(main_loop),TRUE); | |
284 | - | |
285 | - return p.rc; | |
286 | -} | |
287 | - | |
288 | -static int static_Sleep(H3270 *hSession, int seconds) | |
289 | -{ | |
290 | - time_t end = time(0) + seconds; | |
291 | - | |
292 | - while(time(0) < end) | |
293 | - g_main_iteration(TRUE); | |
294 | - | |
295 | - return 0; | |
296 | -} | |
297 | - | |
298 | -static int static_RunPendingEvents(H3270 *hSession, int wait) | |
299 | -{ | |
300 | - GMainContext *context = g_main_loop_get_context(main_loop); | |
301 | - int rc = 0; | |
302 | - while(g_main_context_pending(context)) | |
303 | - { | |
304 | - rc = 1; | |
305 | - g_main_context_iteration(context,FALSE); | |
306 | - } | |
307 | - | |
308 | - if(wait) | |
309 | - g_main_context_iteration(context,TRUE); | |
310 | - | |
311 | - return rc; | |
312 | -} | |
313 | - | |
314 | -static void beep(H3270 *session) | |
315 | -{ | |
316 | -} | |
317 | - | |
318 | -void pw3270_dbus_register_io_handlers(void) | |
319 | -{ | |
320 | - static const struct lib3270_callbacks hdl = | |
321 | - { | |
322 | - sizeof(struct lib3270_callbacks), | |
323 | - | |
324 | - static_AddTimeOut, | |
325 | - static_RemoveTimeOut, | |
326 | - | |
327 | - static_AddInput, | |
328 | - static_RemoveSource, | |
329 | - | |
330 | - static_AddExcept, | |
331 | - | |
332 | -#ifdef G_THREADS_ENABLED | |
333 | - static_CallAndWait, | |
334 | -#else | |
335 | - NULL, | |
336 | -#endif | |
337 | - | |
338 | - static_Sleep, | |
339 | - static_RunPendingEvents, | |
340 | - beep | |
341 | - | |
342 | - }; | |
343 | - | |
344 | - if(lib3270_register_handlers(&hdl)) | |
345 | - { | |
346 | - g_error("%s","Can't set lib3270 I/O handlers"); | |
347 | - } | |
348 | - | |
349 | -} |
src/plugins/dbus/main.c
... | ... | @@ -1,86 +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 main.c 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - */ | |
31 | - | |
32 | -#include <glib.h> | |
33 | -#include <dbus/dbus.h> | |
34 | -#include <dbus/dbus-glib-lowlevel.h> | |
35 | -#include <dbus/dbus-glib.h> | |
36 | - | |
37 | -#include <pw3270.h> | |
38 | -#include <pw3270/plugin.h> | |
39 | - | |
40 | -#include "service.h" | |
41 | -#include "dbus-glue.h" | |
42 | - | |
43 | -/*---[ Globals ]---------------------------------------------------------------------------------*/ | |
44 | - | |
45 | - static DBusGConnection * connection = NULL; | |
46 | - static DBusGProxy * proxy = NULL; | |
47 | - | |
48 | -/*---[ Implement ]-------------------------------------------------------------------------------*/ | |
49 | - | |
50 | - static gpointer dbus_register_object (DBusGConnection *connection,DBusGProxy *proxy,GType object_type,const DBusGObjectInfo *info,const gchar *path) | |
51 | - { | |
52 | - GObject *object = g_object_new (object_type, NULL); | |
53 | - dbus_g_object_type_install_info (object_type, info); | |
54 | - dbus_g_connection_register_g_object (connection, path, object); | |
55 | - return object; | |
56 | - } | |
57 | - | |
58 | - LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) | |
59 | - { | |
60 | - | |
61 | - GError * error = NULL; | |
62 | - guint result; | |
63 | - | |
64 | - connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); | |
65 | - if(error) | |
66 | - { | |
67 | - # Popup Error | |
68 | - g_message("Error \"%s\" getting session dbus",error->message); | |
69 | - g_error_free(error); | |
70 | - return -1; | |
71 | - } | |
72 | - | |
73 | - proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | |
74 | - | |
75 | - org_freedesktop_DBus_request_name(proxy, PW3270_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | |
76 | - | |
77 | - dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,PW3270_DBUS_SERVICE_PATH); | |
78 | - | |
79 | - return 0; | |
80 | - } | |
81 | - | |
82 | - LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) | |
83 | - { | |
84 | - | |
85 | - return 0; | |
86 | - } |
src/plugins/dbus/pw3270dbus.cbp
... | ... | @@ -1,63 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | -<CodeBlocks_project_file> | |
3 | - <FileVersion major="1" minor="6" /> | |
4 | - <Project> | |
5 | - <Option title="pw3270dbus" /> | |
6 | - <Option makefile_is_custom="1" /> | |
7 | - <Option pch_mode="2" /> | |
8 | - <Option compiler="gcc" /> | |
9 | - <Build> | |
10 | - <Target title="Debug"> | |
11 | - <Option output=".bin/Debug/pw3270dbus" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | |
12 | - <Option object_output=".obj/Debug/" /> | |
13 | - <Option type="3" /> | |
14 | - <Option compiler="gcc" /> | |
15 | - <Compiler> | |
16 | - <Add option="-g" /> | |
17 | - </Compiler> | |
18 | - </Target> | |
19 | - <Target title="Release"> | |
20 | - <Option output=".bin/Release/pw3270dbus" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | |
21 | - <Option object_output=".obj/Release/" /> | |
22 | - <Option type="3" /> | |
23 | - <Option compiler="gcc" /> | |
24 | - <Compiler> | |
25 | - <Add option="-O2" /> | |
26 | - </Compiler> | |
27 | - <Linker> | |
28 | - <Add option="-s" /> | |
29 | - </Linker> | |
30 | - </Target> | |
31 | - <Target title="debug-service"> | |
32 | - <Option output=".bin/Debug/pw3270d" prefix_auto="1" extension_auto="1" /> | |
33 | - <Option object_output=".obj/Debug/" /> | |
34 | - <Option type="1" /> | |
35 | - <Option compiler="gcc" /> | |
36 | - <Compiler> | |
37 | - <Add option="-g" /> | |
38 | - </Compiler> | |
39 | - </Target> | |
40 | - </Build> | |
41 | - <Compiler> | |
42 | - <Add option="-Wall" /> | |
43 | - </Compiler> | |
44 | - <Unit filename="Makefile.in" /> | |
45 | - <Unit filename="daemon.c"> | |
46 | - <Option compilerVar="CC" /> | |
47 | - </Unit> | |
48 | - <Unit filename="dbus-glue.h" /> | |
49 | - <Unit filename="gobject.c"> | |
50 | - <Option compilerVar="CC" /> | |
51 | - </Unit> | |
52 | - <Unit filename="main.c"> | |
53 | - <Option compilerVar="CC" /> | |
54 | - </Unit> | |
55 | - <Unit filename="pw3270dbus.xml" /> | |
56 | - <Unit filename="service.h" /> | |
57 | - <Unit filename="test.sh" /> | |
58 | - <Extensions> | |
59 | - <code_completion /> | |
60 | - <debugger /> | |
61 | - </Extensions> | |
62 | - </Project> | |
63 | -</CodeBlocks_project_file> |
src/plugins/dbus/pw3270dbus.xml
... | ... | @@ -1,22 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8" ?> | |
2 | -<node name="/br/com/bb/pw3270"> | |
3 | - <interface name="br.com.bb.pw3270"> | |
4 | - <method name="getRevision"> | |
5 | - <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
6 | - <arg type="s" name="revision" direction="out" /> | |
7 | - </method> | |
8 | - <method name="quit"> | |
9 | - <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
10 | - <arg type="i" name="result" direction="out" /> | |
11 | - </method> | |
12 | - <method name="connect"> | |
13 | - <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
14 | - <arg type="s" name="uri" direction="in" /> | |
15 | - <arg type="i" name="result" direction="out" /> | |
16 | - </method> | |
17 | - <method name="disconnect"> | |
18 | - <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
19 | - <arg type="i" name="result" direction="out" /> | |
20 | - </method> | |
21 | - </interface> | |
22 | -</node> |
src/plugins/dbus/service.h
... | ... | @@ -1,47 +0,0 @@ |
1 | -#ifndef _PW3270_DBUS_SERVICE_H | |
2 | - | |
3 | - #define _PW3270_DBUS_SERVICE_H 1 | |
4 | - | |
5 | - #include <lib3270.h> | |
6 | - #include <glib.h> | |
7 | - #include <dbus/dbus-glib.h> | |
8 | - #include <dbus/dbus-glib-bindings.h> | |
9 | - #include <dbus/dbus-glib-lowlevel.h> | |
10 | - | |
11 | - #define PW3270_DBUS_SERVICE_PATH "/br/com/bb/pw3270" | |
12 | - #define PW3270_DBUS_SERVICE "br.com.bb.pw3270" | |
13 | - | |
14 | - #define PW3270_TYPE_DBUS (pw3270_dbus_get_type ()) | |
15 | - #define PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PW3270_TYPE_DBUS, PW3270Dbus)) | |
16 | - #define PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PW3270_TYPE_DBUS, PW3270DbusClass)) | |
17 | - #define IS_PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PW3270_TYPE_DBUS)) | |
18 | - #define IS_PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PW3270_TYPE_DBUS)) | |
19 | - #define PW3270_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PW3270_TYPE_DBUS, PW3270DbusClass)) | |
20 | - | |
21 | - G_BEGIN_DECLS | |
22 | - | |
23 | - typedef struct _PW3270Dbus PW3270Dbus; | |
24 | - typedef struct _PW3270DbusClass PW3270DbusClass; | |
25 | - | |
26 | - struct _PW3270Dbus | |
27 | - { | |
28 | - GObject parent; | |
29 | - }; | |
30 | - | |
31 | - struct _PW3270DbusClass | |
32 | - { | |
33 | - GObjectClass parent; | |
34 | - }; | |
35 | - | |
36 | - PW3270Dbus * pw3270_dbus_new (void); | |
37 | - GType pw3270_dbus_get_type (void); | |
38 | - | |
39 | - void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context); | |
40 | - void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context); | |
41 | - void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); | |
42 | - void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context); | |
43 | - H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object); | |
44 | - | |
45 | - G_END_DECLS | |
46 | - | |
47 | -#endif // _PW3270_DBUS_SERVICE_H |
src/plugins/dbus/test.sh
... | ... | @@ -1,26 +0,0 @@ |
1 | -#!/bin/bash | |
2 | - | |
3 | -case $1 in | |
4 | - | |
5 | - revision) | |
6 | - dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getRevision | |
7 | - ;; | |
8 | - | |
9 | - connect) | |
10 | - dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.connect string:$2 | |
11 | - ;; | |
12 | - | |
13 | - disconnect) | |
14 | - dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.disconnect | |
15 | - ;; | |
16 | - | |
17 | - quit) | |
18 | - dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.quit | |
19 | - ;; | |
20 | - | |
21 | - *) | |
22 | - dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getRevision | |
23 | - ;; | |
24 | - | |
25 | -esac | |
26 | - |