diff --git a/configure.ac b/configure.ac index 37e45ac..41dccb2 100644 --- a/configure.ac +++ b/configure.ac @@ -516,6 +516,7 @@ AC_SUBST(jnidir) AC_SUBST(jvmjardir) AC_SUBST(javadocdir) AC_SUBST(JAR) +AC_SUBST(jvm_arch) AC_SUBST(JDK_HOME) AC_SUBST(JRE_HOME) AC_SUBST(JNI_CPPFLAGS,"-I$JDK_HOME/include -I$jniinc") diff --git a/pw3270.cbp b/pw3270.cbp index 807fb36..2048eb6 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -69,8 +69,6 @@ - - diff --git a/src/classlib/local.cc b/src/classlib/local.cc index 668d352..95c557c 100644 --- a/src/classlib/local.cc +++ b/src/classlib/local.cc @@ -121,49 +121,51 @@ H3270 * hSession; // Lib3270 entry points - const char * (*_get_version)(void); - LIB3270_CSTATE (*_get_connection_state)(H3270 *h); - LIB3270_MESSAGE (*_get_program_message)(H3270 *h); - - int (*_disconnect)(H3270 *h); - int (*_connect)(H3270 *h,int wait); - const char (*_set_url)(H3270 *h, const char *n); - int (*_is_connected)(H3270 *h); - void (*_main_iterate)(H3270 *h, int wait); - int (*_wait)(H3270 *hSession, int seconds); - int (*_enter)(H3270 *hSession); - int (*_pfkey)(H3270 *hSession, int key); - int (*_pakey)(H3270 *hSession, int key); - int (*_wait_for_ready)(H3270 *hSession, int seconds); - char * (*_get_text)(H3270 *h, int offset, int len); - char * (*_get_text_at)(H3270 *h, int row, int col, int len); - int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); - int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); - int (*_is_ready)(H3270 *h); - int (*_set_cursor_position)(H3270 *h, int row, int col); - int (*_set_toggle)(H3270 *h, LIB3270_TOGGLE ix, int value); - int (*_get_field_start)(H3270 *h, int baddr); - int (*_get_field_len)(H3270 *h, int baddr); - int (*_set_cursor_addr)(H3270 *h, int addr); - int (*_get_cursor_addr)(H3270 *h); - int (*_emulate_input)(H3270 *session, const char *s, int len, int pasting); - int (*_get_next_unprotected)(H3270 *hSession, int baddr0); - int (*_get_is_protected)(H3270 *hSession, int baddr); - int (*_get_is_protected_at)(H3270 *hSession, int row, int col); - void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); - void * (*_free)(void *); - const char * (*_get_display_charset)(H3270 *hSession); - int (*_set_host_charset)(H3270 *hSession, const char *name); - const char * (*_get_host_charset)(H3270 *hSession); - int (*_print)(H3270 *hSession); - int (*_erase)(H3270 *hSession); - int (*_erase_eof)(H3270 *hSession); - int (*_erase_eol)(H3270 *hSession); - int (*_erase_input)(H3270 *hSession); - int (*_action)(H3270 *hSession, const char *name); - - const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); - const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); + const char * (*_get_version)(void); + LIB3270_CSTATE (*_get_connection_state)(H3270 *h); + LIB3270_MESSAGE (*_get_program_message)(H3270 *h); + LIB3270_SSL_STATE (*_get_secure)(H3270 *h); + + + int (*_disconnect)(H3270 *h); + int (*_connect)(H3270 *h,int wait); + const char (*_set_url)(H3270 *h, const char *n); + int (*_is_connected)(H3270 *h); + void (*_main_iterate)(H3270 *h, int wait); + int (*_wait)(H3270 *hSession, int seconds); + int (*_enter)(H3270 *hSession); + int (*_pfkey)(H3270 *hSession, int key); + int (*_pakey)(H3270 *hSession, int key); + int (*_wait_for_ready)(H3270 *hSession, int seconds); + char * (*_get_text)(H3270 *h, int offset, int len); + char * (*_get_text_at)(H3270 *h, int row, int col, int len); + int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); + int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); + int (*_is_ready)(H3270 *h); + int (*_set_cursor_position)(H3270 *h, int row, int col); + int (*_set_toggle)(H3270 *h, LIB3270_TOGGLE ix, int value); + int (*_get_field_start)(H3270 *h, int baddr); + int (*_get_field_len)(H3270 *h, int baddr); + int (*_set_cursor_addr)(H3270 *h, int addr); + int (*_get_cursor_addr)(H3270 *h); + int (*_emulate_input)(H3270 *session, const char *s, int len, int pasting); + int (*_get_next_unprotected)(H3270 *hSession, int baddr0); + int (*_get_is_protected)(H3270 *hSession, int baddr); + int (*_get_is_protected_at)(H3270 *hSession, int row, int col); + void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); + void * (*_free)(void *); + const char * (*_get_display_charset)(H3270 *hSession); + int (*_set_host_charset)(H3270 *hSession, const char *name); + const char * (*_get_host_charset)(H3270 *hSession); + int (*_print)(H3270 *hSession); + int (*_erase)(H3270 *hSession); + int (*_erase_eof)(H3270 *hSession); + int (*_erase_eol)(H3270 *hSession); + int (*_erase_input)(H3270 *hSession); + int (*_action)(H3270 *hSession, const char *name); + + const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); + const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); public: @@ -186,6 +188,7 @@ { (void **) & _is_connected, "lib3270_is_connected" }, { (void **) & _get_connection_state, "lib3270_get_connection_state" }, { (void **) & _get_program_message, "lib3270_get_program_message" }, + { (void **) & _get_secure, "lib3270_get_secure" }, { (void **) & _get_version, "lib3270_get_version" }, { (void **) & _disconnect, "lib3270_disconnect" }, @@ -273,6 +276,10 @@ return _get_program_message(hSession); } + LIB3270_SSL_STATE get_secure(void) { + return _get_secure(hSession); + }; + int connect(void) { return _connect(hSession,0); diff --git a/src/classlib/remote.cc b/src/classlib/remote.cc index aa00bda..fd3e555 100644 --- a/src/classlib/remote.cc +++ b/src/classlib/remote.cc @@ -52,6 +52,7 @@ #define HLLAPI_PACKET_IS_CONNECTED "isConnected" #define HLLAPI_PACKET_GET_CSTATE "getConnectionState" #define HLLAPI_PACKET_GET_PROGRAM_MESSAGE "getProgramMessage" + #define HLLAPI_PACKET_GET_SSL_STATE "getSecureState" #define HLLAPI_PACKET_IS_READY "isReady" #define HLLAPI_PACKET_DISCONNECT "disconnect" #define HLLAPI_PACKET_GET_CURSOR "getCursorAddress" @@ -730,6 +731,11 @@ return (LIB3270_MESSAGE) query_intval(HLLAPI_PACKET_GET_PROGRAM_MESSAGE); } + LIB3270_SSL_STATE get_secure(void) { + return (LIB3270_SSL_STATE) query_intval(HLLAPI_PACKET_GET_SSL_STATE); + } + + int connect(void) { int rc; diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h index d225ebd..07c95b3 100644 --- a/src/include/pw3270/class.h +++ b/src/include/pw3270/class.h @@ -147,6 +147,7 @@ virtual LIB3270_CSTATE get_cstate(void) = 0; virtual LIB3270_MESSAGE get_program_message(void) = 0; + virtual LIB3270_SSL_STATE get_secure(void) = 0; // charset #ifdef WIN32 diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h index 8a84d83..55ffab8 100644 --- a/src/include/pw3270/ipcpackets.h +++ b/src/include/pw3270/ipcpackets.h @@ -71,6 +71,8 @@ HLLAPI_PACKET_FILE_TRANSFER, + HLLAPI_PACKET_GET_SSL_STATE, + HLLAPI_PACKET_INVALID } HLLAPI_PACKET; diff --git a/src/java/Makefile.in b/src/java/Makefile.in index c783241..ba74e3f 100644 --- a/src/java/Makefile.in +++ b/src/java/Makefile.in @@ -142,16 +142,18 @@ $(BINRLS)/$(PACKAGE_NAME).jar: $(BINDIR)/java/$(PACKAGE_NAME)/terminal.class #---[ Release targets ]-------------------------------------------------------- -all: $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ +all: \ + $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ Release: \ $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ $(BINDIR)/java/testprogram.class \ $(BINRLS)/plugins/j3270@DLLEXT@ -zip: jni3270-@host_cpu@.zip +zip: \ + jni3270-@jvm_arch@.zip -jni3270-@host_cpu@.zip: \ +jni3270-@jvm_arch@.zip: \ $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ $(BINRLS)/$(PACKAGE_NAME).jar \ testprogram.java \ @@ -229,7 +231,10 @@ $(BINDBG)/plugins/j3270@DLLEXT@: \ -L../../.bin/Debug@DLLDIR@ -l3270 -lpw3270 \ -L$(BINDBG)@DLLDIR@ -ljni3270 -run: $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ $(BINDIR)/java/testprogram.class +run: \ + $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ + $(BINDIR)/java/testprogram.class + @LD_LIBRARY_PATH=../../.bin/Debug@DLLDIR@/ java -Djava.library.path=$(BINDBG)@DLLDIR@ -cp .bin/java/ testprogram #---[ Misc targets ]----------------------------------------------------------- diff --git a/src/java/info.cc b/src/java/info.cc index ff52b35..9cd7f04 100644 --- a/src/java/info.cc +++ b/src/java/info.cc @@ -55,3 +55,21 @@ JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1encoding(JNIEnv *env, jobjec return env->NewStringUTF(s->get_encoding()); } + +JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1secure(JNIEnv *env, jobject obj) { + + jint rc = -1; + + try { + + rc = java::getHandle(env,obj)->get_secure(); + + } catch(std::exception &e) { + + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); + + } + + return rc; + +} diff --git a/src/java/plugin.cc b/src/java/plugin.cc index 698034a..cc05255 100644 --- a/src/java/plugin.cc +++ b/src/java/plugin.cc @@ -98,6 +98,10 @@ return lib3270_get_program_message(hSession); } + LIB3270_SSL_STATE get_secure(void) { + return lib3270_get_secure(hSession); + } + int disconnect(void) { lib3270_disconnect(hSession); return 0; diff --git a/src/java/terminal.java b/src/java/terminal.java index e6356fc..7efa5ed 100644 --- a/src/java/terminal.java +++ b/src/java/terminal.java @@ -397,10 +397,18 @@ public class terminal public native void log(String msg); /** + * Get connection SSL state + * + * @return State of SSL connection (0 = Inseguro, 1 = CA válido, 2 = CA inválido ou auto-assinado, 3 = Negociando, 4 = Indefinido) + * + */ + public native int get_secure(); + + /** * Creates a tn3270 terminal associated with a * pw3270 window. * - * @param id String identifying the target window. + * @param id String identifying the target window ("pw3270:a") or "" to run without window. * */ public terminal(String id) { diff --git a/src/plugins/dbus3270/gobject.c b/src/plugins/dbus3270/gobject.c index 9d93832..4d1bdec 100644 --- a/src/plugins/dbus3270/gobject.c +++ b/src/plugins/dbus3270/gobject.c @@ -133,6 +133,11 @@ void pw3270_dbus_get_connection_state(PW3270Dbus *object, DBusGMethodInvocation dbus_g_method_return(context,lib3270_get_connection_state(pw3270_dbus_get_session_handle(object))); } +void pw3270_dbus_get_secure_state(PW3270Dbus *object, DBusGMethodInvocation *context) +{ + trace("%s object=%p context=%p",__FUNCTION__,object,context); + dbus_g_method_return(context,lib3270_get_secure(pw3270_dbus_get_session_handle(object))); +} GError * pw3270_dbus_get_error_from_errno(int code) { diff --git a/src/plugins/dbus3270/pw3270dbus.xml b/src/plugins/dbus3270/pw3270dbus.xml index 601b48e..2dbddf1 100644 --- a/src/plugins/dbus3270/pw3270dbus.xml +++ b/src/plugins/dbus3270/pw3270dbus.xml @@ -31,6 +31,10 @@ + + + + diff --git a/src/plugins/dbus3270/service.h b/src/plugins/dbus3270/service.h index 29420a0..1bec395 100644 --- a/src/plugins/dbus3270/service.h +++ b/src/plugins/dbus3270/service.h @@ -68,8 +68,11 @@ void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); void pw3270_dbus_set_host(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_message_id(PW3270Dbus *object, DBusGMethodInvocation *context); void pw3270_dbus_get_connection_state(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_secure_state(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_screen_contents(PW3270Dbus *object, DBusGMethodInvocation *context); H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object); GError * pw3270_dbus_get_error_from_errno(int code); diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c index 7524bc4..db64660 100644 --- a/src/plugins/hllapi/pluginmain.c +++ b/src/plugins/hllapi/pluginmain.c @@ -324,6 +324,10 @@ send_result(source,lib3270_get_program_message(lib3270_get_default_session_handle())); break; + case HLLAPI_PACKET_GET_SSL_STATE: + send_result(source,lib3270_get_secure(lib3270_get_default_session_handle())); + break; + case HLLAPI_PACKET_SET_TOGGLE: send_result(source,lib3270_set_toggle(lib3270_get_default_session_handle(), (LIB3270_TOGGLE) ((struct hllapi_packet_set *) source->buffer)->id, diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 7e5abea..b3b4003 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -90,6 +90,7 @@ LIB3270_CSTATE get_cstate(void); LIB3270_MESSAGE get_program_message(void); + LIB3270_SSL_STATE get_secure(void); int disconnect(void); int set_url(const char *uri); -- libgit2 0.21.2