summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-12-07 15:40:11 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-09 13:23:15 +0000
commit6e73f7f6055a9ba1c4e604060934a0aa5e555f57 (patch)
tree84ad8d53635552c1a158d48d783b794f34e1d762 /src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
parentc42fc05bfbb26fd11fe92ac9d11587660a817ac1 (diff)
jvpp: do not hardcode event sufixes (VPP-940)
JVpp maps request messages with replies for Java API user convenience, e.g.: - do not polute send APIs with messages other than requests/dumps, - allow callback registration only for replies/details and events. Since there are no conventions for event message naming (https://wiki.fd.io/view/VPP/API_Concepts#API_Conventions), jvpp should not limit events to messages that end with 'event' or 'counters' suffix. Instead jvpp should treat all messages except for requests/dumps as potential events. Such behaviour was introduced on Java API level by https://gerrit.fd.io/r/#/c/8377/ in order support reusing details messages as events (e.g. BFD events). This patch goes one step forward by relaxing rules at jvpp generation level. Change-Id: I2a35e9eb2a288b2cf02d36ca95e6cb13e76e19e3 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py')
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
index a02f04d6ce7..df1312a1308 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
@@ -6,7 +6,7 @@
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
-# l
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -139,15 +139,19 @@ JNIEXPORT jint JNICALL Java_io_fd_vpp_jvpp_${plugin_name}_JVpp${java_plugin_name
return my_context_id;
}""")
+
def generate_jni_impl(func_list, plugin_name, inputfile):
jni_impl = []
for f in func_list:
f_name = f['name']
camel_case_function_name = util.underscore_to_camelcase(f_name)
- if is_manually_generated(f_name) or util.is_reply(camel_case_function_name) \
- or util.is_notification(f_name):
+ if is_manually_generated(f_name):
+ # Skip control ping managed by jvpp registry.
+ continue
+ if not (util.is_dump(f_name) or util.is_request(f_name, func_list)):
continue
+ # Generate jni bindings for sending dump and request messages.
arguments = ''
request_class = ''
jni_identifiers = ''
@@ -255,11 +259,12 @@ def generate_msg_handlers(func_list, plugin_name, inputfile):
ref_name = util.underscore_to_camelcase(handler_name)
if is_manually_generated(handler_name):
+ # Skip control ping managed by jvpp registry.
continue
-
- if not util.is_reply(dto_name) and not util.is_notification(handler_name):
+ if util.is_dump(handler_name) or util.is_request(handler_name, func_list):
continue
+ # Generate msg handlers for all messages except for dumps and requests (handled by vpp, not client).
dto_setters = ''
err_handler = ''
# dto setters
@@ -306,12 +311,15 @@ def generate_handler_registration(func_list):
handler_registration = ["#define foreach_api_reply_handler \\\n"]
for f in func_list:
name = f['name']
- camelcase_name = util.underscore_to_camelcase(f['name'])
+ camelcase_name = util.underscore_to_camelcase(name)
- if (not util.is_reply(camelcase_name) and not util.is_notification(name)) \
- or util.is_control_ping(camelcase_name):
+ if util.is_control_ping(camelcase_name):
+ # Skip control ping managed by registry.
+ continue
+ if util.is_dump(name) or util.is_request(name, func_list):
continue
+ # Generate msg handler registration for all messages except for dumps and requests.
handler_registration.append(handler_registration_template.substitute(
name=name,
crc=f['crc']))
@@ -357,6 +365,7 @@ $msg_handlers
$handler_registration
""")
+
def generate_jvpp(func_list, plugin_name, inputfile, path):
""" Generates jvpp C file """
print "Generating jvpp C"