aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp-snat
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/java/jvpp-snat')
-rw-r--r--src/vpp-api/java/jvpp-snat/jvpp_snat.c50
-rw-r--r--src/vpp-api/java/jvpp-snat/jvpp_snat.h3
2 files changed, 18 insertions, 35 deletions
diff --git a/src/vpp-api/java/jvpp-snat/jvpp_snat.c b/src/vpp-api/java/jvpp-snat/jvpp_snat.c
index c4d1afe8d34..312657720ab 100644
--- a/src/vpp-api/java/jvpp-snat/jvpp_snat.c
+++ b/src/vpp-api/java/jvpp-snat/jvpp_snat.c
@@ -29,11 +29,6 @@
#include <snat/snat_all_api_h.h>
#undef vl_printfun
-/* Get the API version number */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <snat/snat_all_api_h.h>
-#undef vl_api_version
-
#include <vnet/api_errno.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
@@ -58,38 +53,29 @@
JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_snat_JVppSnatImpl_init0
(JNIEnv *env, jclass clazz, jobject callback, jlong queue_address, jint my_client_index) {
snat_main_t * plugin_main = &snat_main;
- u8 * name;
clib_warning ("Java_io_fd_vpp_jvpp_snat_JVppSnatImpl_init0");
plugin_main->my_client_index = my_client_index;
plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
- name = format (0, "snat_%08x%c", api_version, 0);
- plugin_main->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
-
- if (plugin_main->msg_id_base == (u16) ~0) {
- jclass exClass = (*env)->FindClass(env, "java/lang/IllegalStateException");
- (*env)->ThrowNew(env, exClass, "snat plugin is not loaded in VPP");
- } else {
- plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
- plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
-
- // verify API has not changed since jar generation
- #define _(N) \
- get_message_id(env, #N);
- foreach_supported_api_message;
- #undef _
-
- #define _(N,n) \
- vl_msg_api_set_handlers(get_message_id(env, #N), #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_api_reply_handler;
- #undef _
- }
+ plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
+ plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
+
+ // verify API has not changed since jar generation
+ #define _(N) \
+ get_message_id(env, #N);
+ foreach_supported_api_message;
+ #undef _
+
+ #define _(N,n) \
+ vl_msg_api_set_handlers(get_message_id(env, #N), #n, \
+ vl_api_##n##_t_handler, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_api_reply_handler;
+ #undef _
}
JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_snat_JVppSnatImpl_close0
diff --git a/src/vpp-api/java/jvpp-snat/jvpp_snat.h b/src/vpp-api/java/jvpp-snat/jvpp_snat.h
index 6426bda8834..7739a4114c1 100644
--- a/src/vpp-api/java/jvpp-snat/jvpp_snat.h
+++ b/src/vpp-api/java/jvpp-snat/jvpp_snat.h
@@ -24,9 +24,6 @@
/* Global state for JVPP-SNAT */
typedef struct {
- /* Base message index for the nsh plugin */
- u16 msg_id_base;
-
/* Pointer to shared memory queue */
unix_shared_memory_queue_t * vl_input_queue;