aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-06-06 12:36:09 +0200
committerDave Barach <openvpp@barachs.net>2016-06-07 11:28:58 +0000
commit97d99518d727d454895f201f1990475c8a738060 (patch)
treec1a3974f18ca91ca50d84817605d684d442f2e6b /vpp-api/java
parentcccd1bfdd0c870fbb60765bd2fd7209c1c0786ca (diff)
Add u32[] type handling in reply messages to jvpp
Change-Id: I9fd0cd49e4636d5d8978567fa914487785035c8a Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-api/java')
-rw-r--r--vpp-api/java/jvpp/gen/jvpp_c_gen.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_c_gen.py b/vpp-api/java/jvpp/gen/jvpp_c_gen.py
index 476a768d9a0..a92dd69c853 100644
--- a/vpp-api/java/jvpp/gen/jvpp_c_gen.py
+++ b/vpp-api/java/jvpp/gen/jvpp_c_gen.py
@@ -236,8 +236,20 @@ u8_array_dto_field_setter_template = Template("""
(*env)->SetObjectField(env, dto, ${java_name}FieldId, ${java_name});
""")
+u32_array_dto_field_setter_template = Template("""
+ {
+ jintArray ${java_name} = (*env)->NewIntArray(env, ${field_length});
+ jint * ${java_name}ArrayElements = (*env)->GetIntArrayElements(env, ${java_name}, NULL);
+ unsigned int _i;
+ for (_i = 0; _i < ${field_length}; _i++) {
+ ${java_name}ArrayElements[_i] = clib_net_to_host_u32(mp->${c_name}[_i]);
+ }
+ (*env)->SetObjectField(env, dto, ${java_name}FieldId, ${java_name});
+ }
+""")
+
# For each u64 array we get its elements. Then we convert values to host byte order.
-# All changes to jint* buffer are written to jlongArray (isCopy is set to NULL)
+# All changes to jlong* buffer are written to jlongArray (isCopy is set to NULL)
u64_array_dto_field_setter_template = Template("""
{
jlongArray ${java_name} = (*env)->NewLongArray(env, ${field_length});
@@ -256,8 +268,9 @@ dto_field_setter_templates = {'u8': default_dto_field_setter_template,
'i32': u32_dto_field_setter_template,
'u64': u64_dto_field_setter_template,
'f64': default_dto_field_setter_template, #fixme
- 'u64[]': u64_array_dto_field_setter_template,
- 'u8[]': u8_array_dto_field_setter_template
+ 'u8[]': u8_array_dto_field_setter_template,
+ 'u32[]': u32_array_dto_field_setter_template,
+ 'u64[]': u64_array_dto_field_setter_template
}
msg_handler_template = Template("""