VPP-123: remove japi (the old Java API)
MANUAL_JAVA flag (used only by the japi) was also removed. Change-Id: Ied21521b2410af1c357afb04cbf9e849632ddc5f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
84bde8dc13
commit
948b95a9a0
@ -19,7 +19,7 @@ arm32_uses_dpdk = yes
|
|||||||
arm32_uses_openssl = no
|
arm32_uses_openssl = no
|
||||||
|
|
||||||
arm32_root_packages = vpp vlib vlib-api vnet svm vpp-api-test \
|
arm32_root_packages = vpp vlib vlib-api vnet svm vpp-api-test \
|
||||||
vpp-japi gmod
|
jvpp gmod
|
||||||
|
|
||||||
vlib_configure_args_arm32 = --with-pre-data=128
|
vlib_configure_args_arm32 = --with-pre-data=128
|
||||||
vnet_configure_args_arm32 = --with-dpdk --without-ipsec --without-ipv6sr
|
vnet_configure_args_arm32 = --with-dpdk --without-ipsec --without-ipv6sr
|
||||||
|
@ -21,80 +21,11 @@ bin_PROGRAMS =
|
|||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
lib_LTLIBRARIES =
|
lib_LTLIBRARIES =
|
||||||
|
|
||||||
nobase_include_HEADERS = \
|
|
||||||
japi/org_openvpp_vppjapi_vppApi.h \
|
|
||||||
japi/org_openvpp_vppjapi_vppConn.h
|
|
||||||
|
|
||||||
lib_LTLIBRARIES += libvppjni.la
|
|
||||||
|
|
||||||
libvppjni_la_SOURCES = japi/vppjni.c japi/vppapi.c japi/vppjni_env.h japi/vppjni_env.c
|
|
||||||
libvppjni_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
|
|
||||||
-lpthread -lm -lrt
|
|
||||||
libvppjni_la_LDFLAGS = -module
|
|
||||||
libvppjni_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
|
|
||||||
|
|
||||||
jarfile = vppjapi-$(PACKAGE_VERSION).jar
|
|
||||||
packagedir = org/openvpp/vppjapi
|
|
||||||
JAVAROOT = .
|
|
||||||
|
|
||||||
$(jarfile): libvppjni.la
|
|
||||||
cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libvppjni.so.0.0.0 ../$(packagedir)/*.class ; cd ..
|
|
||||||
|
|
||||||
BUILT_SOURCES += japi/org_openvpp_vppjapi_vppConn.h japi/vppapi.c
|
|
||||||
|
|
||||||
japi/org_openvpp_vppjapi_vppConn.h: \
|
|
||||||
japi/org/openvpp/vppjapi/vppVersion.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppInterfaceDetails.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppInterfaceCounters.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppBridgeDomainDetails.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppBridgeDomainInterfaceDetails.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppL2Fib.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppIPv4Address.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppIPv6Address.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppConn.java \
|
|
||||||
japi/org/openvpp/vppjapi/vppApiCallbacks.java \
|
|
||||||
../../vpp/vpp-api/vpe.api.h
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppVersion.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppVersion ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppInterfaceDetails.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppInterfaceDetails ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppInterfaceCounters.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppInterfaceCounters ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppBridgeDomainInterfaceDetails.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppBridgeDomainInterfaceDetails ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppBridgeDomainDetails.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppBridgeDomainDetails ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppL2Fib.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppL2Fib ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppIPv4Address.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppIPv4Address ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppIPv6Address.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppIPv6Address ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppVxlanTunnelDetails ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppConn.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppConn ;
|
|
||||||
|
|
||||||
japi/vppapi.c: japi/org_openvpp_vppjapi_vppConn.h
|
|
||||||
pushd .. ; dir=`pwd` ; popd ; \
|
|
||||||
instdir=`echo $${dir} | sed -e 's:build-root/build:build-root/install:'` ; \
|
|
||||||
vppapigen --input $${instdir}/../vpp/vpp-api/vpe.api --jni japi/vppapi.c --app vpe ; \
|
|
||||||
vppapigen --input $${instdir}/../vpp/vpp-api/vpe.api --java japi/vppApi.java --app vpe ; \
|
|
||||||
$(JAVAC) -classpath . -d . japi/vppApi.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppApi ; \
|
|
||||||
$(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppApiCallbacks.java ; \
|
|
||||||
$(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppApiCallbacks ;
|
|
||||||
|
|
||||||
demo = japi/test/demo.class
|
|
||||||
$(demo): $(jarfile)
|
|
||||||
$(JAVAC) -cp $(jarfile) -d $(JAVAROOT) @srcdir@/japi/test/demo.java
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# jVpp binding
|
# jVpp binding
|
||||||
#
|
#
|
||||||
|
|
||||||
nobase_include_HEADERS += \
|
nobase_include_HEADERS = \
|
||||||
jvpp/org_openvpp_jvpp_VppJNIConnection.h
|
jvpp/org_openvpp_jvpp_VppJNIConnection.h
|
||||||
|
|
||||||
lib_LTLIBRARIES += libjvpp.la
|
lib_LTLIBRARIES += libjvpp.la
|
||||||
@ -138,4 +69,4 @@ jvpp/org_openvpp_jvpp_VppJNIConnection.h: $(prefix)/../vpp/vpp-api/vpe.api
|
|||||||
$(jarfile_jvpp): libjvpp.la
|
$(jarfile_jvpp): libjvpp.la
|
||||||
cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libjvpp.so.0.0.0 ../$(packagedir_jvpp)/* ; cd ..;
|
cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libjvpp.so.0.0.0 ../$(packagedir_jvpp)/* ; cd ..;
|
||||||
|
|
||||||
all-local: $(jarfile) $(jarfile_jvpp) $(demo)
|
all-local: $(jarfile_jvpp)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
AC_INIT(vpp-japi, 16.09)
|
AC_INIT(jvpp, 16.09)
|
||||||
LT_INIT
|
LT_INIT
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import org.openvpp.vppjapi.vppApi;
|
|
||||||
|
|
||||||
public abstract class vppApiCallbacks extends vppApi {
|
|
||||||
public vppApiCallbacks(String clientName) throws IOException {
|
|
||||||
super(clientName);
|
|
||||||
}
|
|
||||||
/* Disabled!
|
|
||||||
*
|
|
||||||
* public abstract void interfaceDetails(
|
|
||||||
int ifIndex, String interfaceName, int supIfIndex, byte[] physAddr,
|
|
||||||
byte adminUp, byte linkUp, byte linkDuplex, byte linkSpeed,
|
|
||||||
int subId, byte subDot1ad, byte subNumberOfTags, int subOuterVlanId, int subInnerVlanId,
|
|
||||||
byte subExactMatch, byte subDefault, byte subOuterVlanIdAny, byte subInnerVlanIdAny,
|
|
||||||
int vtrOp, int vtrPushDot1q, int vtrTag1, int vtrTag2);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
import org.openvpp.vppjapi.vppBridgeDomainInterfaceDetails;
|
|
||||||
|
|
||||||
public final class vppBridgeDomainDetails {
|
|
||||||
public String name;
|
|
||||||
public int bdId;
|
|
||||||
public boolean flood;
|
|
||||||
public boolean uuFlood;
|
|
||||||
public boolean forward;
|
|
||||||
public boolean learn;
|
|
||||||
public boolean arpTerm;
|
|
||||||
public String bviInterfaceName;
|
|
||||||
public vppBridgeDomainInterfaceDetails[] interfaces;
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppBridgeDomainInterfaceDetails {
|
|
||||||
public String interfaceName;
|
|
||||||
public byte splitHorizonGroup;
|
|
||||||
}
|
|
@ -1,237 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
|
||||||
import java.nio.file.attribute.PosixFilePermissions;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.openvpp.vppjapi.vppVersion;
|
|
||||||
import org.openvpp.vppjapi.vppInterfaceDetails;
|
|
||||||
import org.openvpp.vppjapi.vppInterfaceCounters;
|
|
||||||
import org.openvpp.vppjapi.vppBridgeDomainDetails;
|
|
||||||
import org.openvpp.vppjapi.vppIPv4Address;
|
|
||||||
import org.openvpp.vppjapi.vppIPv6Address;
|
|
||||||
import org.openvpp.vppjapi.vppVxlanTunnelDetails;
|
|
||||||
|
|
||||||
public class vppConn implements AutoCloseable {
|
|
||||||
private static final String LIBNAME = "libvppjni.so.0.0.0";
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
loadLibrary();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.printf("Can't find vpp jni library: %s\n", LIBNAME);
|
|
||||||
throw new ExceptionInInitializerError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void loadStream(final InputStream is) throws IOException {
|
|
||||||
final Set<PosixFilePermission> perms = PosixFilePermissions.fromString("rwxr-x---");
|
|
||||||
final Path p = Files.createTempFile(LIBNAME, null, PosixFilePermissions.asFileAttribute(perms));
|
|
||||||
try {
|
|
||||||
Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Runtime.getRuntime().load(p.toString());
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
|
||||||
throw new IOException(String.format("Failed to load library %s", p), e);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
Files.deleteIfExists(p);
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void loadLibrary() throws IOException {
|
|
||||||
try (final InputStream is = vppConn.class.getResourceAsStream('/' + LIBNAME)) {
|
|
||||||
if (is == null) {
|
|
||||||
throw new IOException(String.format("Failed to open library resource %s",
|
|
||||||
LIBNAME));
|
|
||||||
}
|
|
||||||
loadStream(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static vppConn currentConnection = null;
|
|
||||||
private final String clientName;
|
|
||||||
private volatile boolean disconnected = false;
|
|
||||||
|
|
||||||
// Hidden on purpose to prevent external instantiation
|
|
||||||
vppConn(final String clientName) throws IOException {
|
|
||||||
this.clientName = clientName;
|
|
||||||
|
|
||||||
synchronized (vppConn.class) {
|
|
||||||
if (currentConnection != null) {
|
|
||||||
throw new IOException("Already connected as " + currentConnection.clientName);
|
|
||||||
}
|
|
||||||
|
|
||||||
final int ret = clientConnect(clientName);
|
|
||||||
if (ret != 0) {
|
|
||||||
throw new IOException("Connection returned error " + ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentConnection = this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized final void close() {
|
|
||||||
if (!disconnected) {
|
|
||||||
disconnected = true;
|
|
||||||
|
|
||||||
synchronized (vppConn.class) {
|
|
||||||
clientDisconnect();
|
|
||||||
currentConnection = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this instance is connected.
|
|
||||||
*
|
|
||||||
* @throws IllegalStateException if this instance was disconnected.
|
|
||||||
*/
|
|
||||||
protected final void checkConnected() {
|
|
||||||
if (disconnected) {
|
|
||||||
throw new IllegalStateException("Disconnected client " + clientName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getRetval(int context, int release) {
|
|
||||||
checkConnected();
|
|
||||||
return getRetval0(context, release);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getInterfaceList (String nameFilter) {
|
|
||||||
checkConnected();
|
|
||||||
return getInterfaceList0(nameFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int swIfIndexFromName (String interfaceName) {
|
|
||||||
checkConnected();
|
|
||||||
return swIfIndexFromName0(interfaceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String interfaceNameFromSwIfIndex (int swIfIndex) {
|
|
||||||
checkConnected();
|
|
||||||
return interfaceNameFromSwIfIndex0(swIfIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void clearInterfaceTable () {
|
|
||||||
checkConnected();
|
|
||||||
clearInterfaceTable0();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppInterfaceDetails[] swInterfaceDump (byte nameFilterValid, byte [] nameFilter) {
|
|
||||||
checkConnected();
|
|
||||||
return swInterfaceDump0(nameFilterValid, nameFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int bridgeDomainIdFromName(String bridgeDomain) {
|
|
||||||
checkConnected();
|
|
||||||
return bridgeDomainIdFromName0(bridgeDomain);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int findOrAddBridgeDomainId(String bridgeDomain) {
|
|
||||||
checkConnected();
|
|
||||||
return findOrAddBridgeDomainId0(bridgeDomain);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppVersion getVppVersion() {
|
|
||||||
checkConnected();
|
|
||||||
return getVppVersion0();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppInterfaceCounters getInterfaceCounters(int swIfIndex) {
|
|
||||||
checkConnected();
|
|
||||||
return getInterfaceCounters0(swIfIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int[] bridgeDomainDump(int bdId) {
|
|
||||||
checkConnected();
|
|
||||||
return bridgeDomainDump0(bdId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppBridgeDomainDetails getBridgeDomainDetails(int bdId) {
|
|
||||||
checkConnected();
|
|
||||||
return getBridgeDomainDetails0(bdId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppL2Fib[] l2FibTableDump(int bdId) {
|
|
||||||
checkConnected();
|
|
||||||
return l2FibTableDump0(bdId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int bridgeDomainIdFromInterfaceName(String interfaceName) {
|
|
||||||
checkConnected();
|
|
||||||
return bridgeDomainIdFromInterfaceName0(interfaceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppIPv4Address[] ipv4AddressDump(String interfaceName) {
|
|
||||||
checkConnected();
|
|
||||||
return ipv4AddressDump0(interfaceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppIPv6Address[] ipv6AddressDump(String interfaceName) {
|
|
||||||
checkConnected();
|
|
||||||
return ipv6AddressDump0(interfaceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final vppVxlanTunnelDetails[] vxlanTunnelDump(int swIfIndex) {
|
|
||||||
checkConnected();
|
|
||||||
return vxlanTunnelDump0(swIfIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int setInterfaceDescription(String ifName, String ifDesc) {
|
|
||||||
checkConnected();
|
|
||||||
return setInterfaceDescription0(ifName, ifDesc);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getInterfaceDescription(String ifName) {
|
|
||||||
checkConnected();
|
|
||||||
return getInterfaceDescription0(ifName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native int clientConnect(String clientName);
|
|
||||||
private static native void clientDisconnect();
|
|
||||||
private static native int getRetval0(int context, int release);
|
|
||||||
private static native String getInterfaceList0(String nameFilter);
|
|
||||||
private static native int swIfIndexFromName0(String interfaceName);
|
|
||||||
private static native String interfaceNameFromSwIfIndex0(int swIfIndex);
|
|
||||||
private static native void clearInterfaceTable0();
|
|
||||||
private static native vppInterfaceDetails[] swInterfaceDump0(byte nameFilterValid, byte [] nameFilter);
|
|
||||||
private static native int bridgeDomainIdFromName0(String bridgeDomain);
|
|
||||||
private static native int findOrAddBridgeDomainId0(String bridgeDomain);
|
|
||||||
private static native vppVersion getVppVersion0();
|
|
||||||
private static native vppInterfaceCounters getInterfaceCounters0(int swIfIndex);
|
|
||||||
private static native int[] bridgeDomainDump0(int bdId);
|
|
||||||
private static native vppBridgeDomainDetails getBridgeDomainDetails0(int bdId);
|
|
||||||
private static native vppL2Fib[] l2FibTableDump0(int bdId);
|
|
||||||
private static native int bridgeDomainIdFromInterfaceName0(String interfaceName);
|
|
||||||
private static native vppIPv4Address[] ipv4AddressDump0(String interfaceName);
|
|
||||||
private static native vppIPv6Address[] ipv6AddressDump0(String interfaceName);
|
|
||||||
private static native vppVxlanTunnelDetails[] vxlanTunnelDump0(int swIfIndex);
|
|
||||||
private static native int setInterfaceDescription0(String ifName, String ifDesc);
|
|
||||||
private static native String getInterfaceDescription0(String ifName);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppIPv4Address {
|
|
||||||
public final int ip;
|
|
||||||
public final byte prefixLength;
|
|
||||||
|
|
||||||
public vppIPv4Address(int ip, byte prefixLength) {
|
|
||||||
this.ip = ip;
|
|
||||||
this.prefixLength = prefixLength;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public class vppIPv6Address {
|
|
||||||
// FIXME: this is dangerous
|
|
||||||
public final byte[] ip;
|
|
||||||
public final byte prefixLength;
|
|
||||||
|
|
||||||
public vppIPv6Address(byte[] ip, byte prefixLength) {
|
|
||||||
this.ip = ip;
|
|
||||||
this.prefixLength = prefixLength;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppInterfaceCounters {
|
|
||||||
|
|
||||||
public final long rxOctets;
|
|
||||||
public final long rxIp4;
|
|
||||||
public final long rxIp6;
|
|
||||||
public final long rxUnicast;
|
|
||||||
public final long rxMulticast;
|
|
||||||
public final long rxBroadcast;
|
|
||||||
public final long rxDiscard;
|
|
||||||
public final long rxFifoFull;
|
|
||||||
public final long rxError;
|
|
||||||
public final long rxUnknownProto;
|
|
||||||
public final long rxMiss;
|
|
||||||
|
|
||||||
public final long txOctets;
|
|
||||||
public final long txIp4;
|
|
||||||
public final long txIp6;
|
|
||||||
public final long txUnicast;
|
|
||||||
public final long txMulticast;
|
|
||||||
public final long txBroadcast;
|
|
||||||
public final long txDiscard;
|
|
||||||
public final long txFifoFull;
|
|
||||||
public final long txError;
|
|
||||||
public final long txUnknownProto;
|
|
||||||
public final long txMiss;
|
|
||||||
|
|
||||||
public vppInterfaceCounters(
|
|
||||||
long rxOctets, long rxIp4, long rxIp6, long rxUni, long rxMulti,
|
|
||||||
long rxBcast, long rxDiscard, long rxFifoFull, long rxError,
|
|
||||||
long rxUnknownProto, long rxMiss,
|
|
||||||
long txOctets, long txIp4, long txIp6, long txUni, long txMulti,
|
|
||||||
long txBcast, long txDiscard, long txFifoFull, long txError,
|
|
||||||
long txUnknownProto, long txMiss)
|
|
||||||
{
|
|
||||||
this.rxOctets = rxOctets;
|
|
||||||
this.rxIp4 = rxIp4;
|
|
||||||
this.rxIp6 = rxIp6;
|
|
||||||
this.rxUnicast = rxUni;
|
|
||||||
this.rxMulticast = rxMulti;
|
|
||||||
this.rxBroadcast = rxBcast;
|
|
||||||
this.rxDiscard = rxDiscard;
|
|
||||||
this.rxFifoFull = rxFifoFull;
|
|
||||||
this.rxError = rxError;
|
|
||||||
this.rxUnknownProto = rxUnknownProto;
|
|
||||||
this.rxMiss = rxMiss;
|
|
||||||
|
|
||||||
this.txOctets = txOctets;
|
|
||||||
this.txIp4 = txIp4;
|
|
||||||
this.txIp6 = txIp6;
|
|
||||||
this.txUnicast = txUni;
|
|
||||||
this.txMulticast = txMulti;
|
|
||||||
this.txBroadcast = txBcast;
|
|
||||||
this.txDiscard = txDiscard;
|
|
||||||
this.txFifoFull = txFifoFull;
|
|
||||||
this.txError = txError;
|
|
||||||
this.txUnknownProto = txUnknownProto;
|
|
||||||
this.txMiss = txMiss;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppInterfaceDetails {
|
|
||||||
public final int ifIndex;
|
|
||||||
public final String interfaceName;
|
|
||||||
public final int supIfIndex;
|
|
||||||
// FIXME: this is dangerous
|
|
||||||
public final byte[] physAddr;
|
|
||||||
public final byte adminUp;
|
|
||||||
public final byte linkUp;
|
|
||||||
public final byte linkDuplex;
|
|
||||||
public final byte linkSpeed;
|
|
||||||
public final int subId;
|
|
||||||
public final byte subDot1ad;
|
|
||||||
public final byte subNumberOfTags;
|
|
||||||
public final int subOuterVlanId;
|
|
||||||
public final int subInnerVlanId;
|
|
||||||
public final byte subExactMatch;
|
|
||||||
public final byte subDefault;
|
|
||||||
public final byte subOuterVlanIdAny;
|
|
||||||
public final byte subInnerVlanIdAny;
|
|
||||||
public final int vtrOp;
|
|
||||||
public final int vtrPushDot1q;
|
|
||||||
public final int vtrTag1;
|
|
||||||
public final int vtrTag2;
|
|
||||||
public final int linkMtu;
|
|
||||||
|
|
||||||
public vppInterfaceDetails(int ifIndex, String interfaceName, int supIfIndex, byte[] physAddr, byte adminUp,
|
|
||||||
byte linkUp, byte linkDuplex, byte linkSpeed, int subId, byte subDot1ad, byte subNumberOfTags,
|
|
||||||
int subOuterVlanId, int subInnerVlanId, byte subExactMatch, byte subDefault, byte subOuterVlanIdAny,
|
|
||||||
byte subInnerVlanIdAny, int vtrOp, int vtrPushDot1q, int vtrTag1, int vtrTag2, int linkMtu)
|
|
||||||
{
|
|
||||||
this.ifIndex = ifIndex;
|
|
||||||
this.interfaceName = interfaceName;
|
|
||||||
this.supIfIndex = supIfIndex;
|
|
||||||
this.physAddr = physAddr;
|
|
||||||
this.adminUp = adminUp;
|
|
||||||
this.linkUp = linkUp;
|
|
||||||
this.linkDuplex = linkDuplex;
|
|
||||||
this.linkSpeed = linkSpeed;
|
|
||||||
this.subId = subId;
|
|
||||||
this.subDot1ad = subDot1ad;
|
|
||||||
this.subNumberOfTags = subNumberOfTags;
|
|
||||||
this.subOuterVlanId = subOuterVlanId;
|
|
||||||
this.subInnerVlanId = subInnerVlanId;
|
|
||||||
this.subExactMatch = subExactMatch;
|
|
||||||
this.subDefault = subDefault;
|
|
||||||
this.subOuterVlanIdAny = subOuterVlanIdAny;
|
|
||||||
this.subInnerVlanIdAny = subInnerVlanIdAny;
|
|
||||||
this.vtrOp = vtrOp;
|
|
||||||
this.vtrPushDot1q = vtrPushDot1q;
|
|
||||||
this.vtrTag1 = vtrTag1;
|
|
||||||
this.vtrTag2 = vtrTag2;
|
|
||||||
this.linkMtu = linkMtu;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppL2Fib {
|
|
||||||
// FIXME: this is dangerous
|
|
||||||
public final byte[] physAddress;
|
|
||||||
public final boolean staticConfig;
|
|
||||||
public final String outgoingInterface;
|
|
||||||
public final boolean filter;
|
|
||||||
public final boolean bridgedVirtualInterface;
|
|
||||||
|
|
||||||
public vppL2Fib(byte[] physAddress, boolean staticConfig,
|
|
||||||
String outgoingInterface, boolean filter,
|
|
||||||
boolean bridgedVirtualInterface) {
|
|
||||||
this.physAddress = physAddress;
|
|
||||||
this.staticConfig = staticConfig;
|
|
||||||
this.outgoingInterface = outgoingInterface;
|
|
||||||
this.filter = filter;
|
|
||||||
this.bridgedVirtualInterface = bridgedVirtualInterface;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppVersion {
|
|
||||||
public final String programName;
|
|
||||||
public final String buildDirectory;
|
|
||||||
public final String gitBranch;
|
|
||||||
public final String buildDate;
|
|
||||||
|
|
||||||
public vppVersion(String progName, String buildDir, String gitBranch, String buildDate) {
|
|
||||||
this.programName = progName;
|
|
||||||
this.buildDirectory = buildDir;
|
|
||||||
this.gitBranch = gitBranch;
|
|
||||||
this.buildDate = buildDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.openvpp.vppjapi;
|
|
||||||
|
|
||||||
public final class vppVxlanTunnelDetails {
|
|
||||||
public final byte[] srcAddress;
|
|
||||||
public final byte[] dstAddress;
|
|
||||||
public final int encapVrfId;
|
|
||||||
public final int vni;
|
|
||||||
public final int decapNextIndex;
|
|
||||||
public final boolean isIpv6;
|
|
||||||
|
|
||||||
public vppVxlanTunnelDetails(byte[] srcAddress, byte[] dstAddress,
|
|
||||||
int encapVrfId, int vni, int decapNextIndex, boolean isIpv6) {
|
|
||||||
this.srcAddress = srcAddress;
|
|
||||||
this.dstAddress = dstAddress;
|
|
||||||
this.encapVrfId = encapVrfId;
|
|
||||||
this.vni = vni;
|
|
||||||
this.decapNextIndex = decapNextIndex;
|
|
||||||
this.isIpv6 = isIpv6;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,170 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.openvpp.vppjapi.*;
|
|
||||||
|
|
||||||
public class demo {
|
|
||||||
public static void main (String[] args) throws Exception {
|
|
||||||
vppApi api = new vppApi ("JavaTest");
|
|
||||||
System.out.printf ("Connected OK...");
|
|
||||||
|
|
||||||
String intlist;
|
|
||||||
int [] contexts;
|
|
||||||
int i, limit;
|
|
||||||
int trips;
|
|
||||||
int rv, errors, saved_error;
|
|
||||||
long before, after;
|
|
||||||
|
|
||||||
if (false)
|
|
||||||
{
|
|
||||||
intlist = api.getInterfaceList ("");
|
|
||||||
System.out.printf ("Unfiltered interface list:\n%s", intlist);
|
|
||||||
|
|
||||||
trips = 0;
|
|
||||||
|
|
||||||
contexts = new int[6];
|
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
contexts[i] = api.swInterfaceSetFlags
|
|
||||||
(5 + i /* sw_if_index */,
|
|
||||||
(byte)1 /* admin_up */,
|
|
||||||
(byte)1 /* link_up (ignored) */,
|
|
||||||
(byte)0 /* deleted */);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Thread.sleep (1); */
|
|
||||||
errors = 0;
|
|
||||||
saved_error = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < 6; i ++)
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
rv = api.getRetval (contexts[i], 1 /* release */);
|
|
||||||
if (rv != -77)
|
|
||||||
break;
|
|
||||||
Thread.sleep (1);
|
|
||||||
trips++;
|
|
||||||
}
|
|
||||||
if (rv < 0)
|
|
||||||
{
|
|
||||||
saved_error = rv;
|
|
||||||
errors++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errors == 0)
|
|
||||||
System.out.printf ("intfcs up...\n");
|
|
||||||
else
|
|
||||||
System.out.printf
|
|
||||||
("%d errors, last error %d...\n", errors, saved_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
limit = 250000;
|
|
||||||
saved_error = 0;
|
|
||||||
errors = 0;
|
|
||||||
contexts = new int [limit];
|
|
||||||
byte [] address = new byte [4];
|
|
||||||
byte [] zeros = new byte [4];
|
|
||||||
|
|
||||||
address[0] = (byte)192;
|
|
||||||
address[1] = (byte)168;
|
|
||||||
address[2] = (byte)2;
|
|
||||||
address[3] = (byte)1;
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
zeros[i] = 0;
|
|
||||||
|
|
||||||
System.out.printf ("start %d route ops ...", limit);
|
|
||||||
|
|
||||||
before = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for (i = 0; i < limit; i++) {
|
|
||||||
contexts[i] = api.ipAddDelRoute
|
|
||||||
(0 /* int nextHopSwIfIndex */,
|
|
||||||
0 /* int vrfId */,
|
|
||||||
0 /* int lookupInVrf */,
|
|
||||||
0 /* int resolveAttempts */,
|
|
||||||
0 /* int classifyTableIndex */,
|
|
||||||
(byte)0 /* byte createVrfIfNeeded */,
|
|
||||||
(byte)0 /* byte resolveIfNeeded */,
|
|
||||||
(byte)1 /* byte isAdd */,
|
|
||||||
(byte)1 /* byte isDrop */,
|
|
||||||
(byte)0 /* byte isIpv6 */,
|
|
||||||
(byte)0 /* byte isLocal */,
|
|
||||||
(byte)0 /* byte isClassify */,
|
|
||||||
(byte)0 /* byte isMultipath */,
|
|
||||||
(byte)0 /* byte notLast */,
|
|
||||||
(byte)0 /* byte nextHopWeight */,
|
|
||||||
(byte)32 /* byte dstAddressLength */,
|
|
||||||
address,
|
|
||||||
zeros);
|
|
||||||
|
|
||||||
address[3] += 1;
|
|
||||||
if (address[3] == 0)
|
|
||||||
{
|
|
||||||
address[2] += 1;
|
|
||||||
if (address[2] == 0)
|
|
||||||
{
|
|
||||||
address[1] += 1;
|
|
||||||
{
|
|
||||||
if (address[1] == 0)
|
|
||||||
{
|
|
||||||
address[0] += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trips = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < limit; i++)
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
rv = api.getRetval (contexts[i], 1 /* release */);
|
|
||||||
if (rv != -77)
|
|
||||||
break;
|
|
||||||
Thread.sleep (1);
|
|
||||||
trips++;
|
|
||||||
}
|
|
||||||
if (rv < 0)
|
|
||||||
{
|
|
||||||
saved_error = rv;
|
|
||||||
errors++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
after = System.currentTimeMillis();
|
|
||||||
|
|
||||||
|
|
||||||
if (errors == 0)
|
|
||||||
System.out.printf ("done %d route ops (all OK)...\n", limit);
|
|
||||||
else
|
|
||||||
System.out.printf
|
|
||||||
("%d errors, last error %d...\n", errors, saved_error);
|
|
||||||
|
|
||||||
System.out.printf ("result in %d trips\n", trips);
|
|
||||||
|
|
||||||
System.out.printf ("%d routes in %d milliseconds, %d routes/msec\n",
|
|
||||||
limit, after - before,
|
|
||||||
limit / (after - before));
|
|
||||||
|
|
||||||
api.close();
|
|
||||||
System.out.printf ("Done...\n");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import org.openvpp.vppjapi.*;
|
|
||||||
|
|
||||||
public class vppApi {
|
|
||||||
|
|
||||||
native int controlPing();
|
|
||||||
native void test (byte[] array, byte[] array2);
|
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
|
||||||
vppConn api = new vppConn ();
|
|
||||||
String ipv6 = "db01::feed";
|
|
||||||
String ipv4 = "192.168.1.1";
|
|
||||||
InetAddress addr6 = InetAddress.getByName(ipv6);
|
|
||||||
InetAddress addr4 = InetAddress.getByName(ipv4);
|
|
||||||
byte[] ip4bytes = addr4.getAddress();
|
|
||||||
byte[] ip6bytes = addr6.getAddress();
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
api.test(ip4bytes,ip6bytes);
|
|
||||||
|
|
||||||
rv = api.clientConnect ("JavaTest");
|
|
||||||
if (rv == 0)
|
|
||||||
System.out.printf ("Connected OK...");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.printf ("clientConnect returned %d\n", rv);
|
|
||||||
System.exit (1);
|
|
||||||
}
|
|
||||||
rv = api.controlPing();
|
|
||||||
System.out.printf ("data plane pid is %d\n", rv);
|
|
||||||
|
|
||||||
Thread.sleep (5000);
|
|
||||||
|
|
||||||
api.clientDisconnect();
|
|
||||||
System.out.printf ("Done...\n");
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
#include <jni.h>
|
|
||||||
|
|
||||||
#include "vppjni_env.h"
|
|
||||||
|
|
||||||
// Head of the class registration list.
|
|
||||||
static vppjni_class_t *class_head;
|
|
||||||
// Head of the class registration list.
|
|
||||||
static vppjni_field_t *field_head;
|
|
||||||
|
|
||||||
void vppjni_register_class(vppjni_class_t *ptr)
|
|
||||||
{
|
|
||||||
vppjni_class_t **where = &class_head;
|
|
||||||
while (*where != NULL) {
|
|
||||||
where = &((*where)->next);
|
|
||||||
}
|
|
||||||
*where = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void vppjni_register_field(vppjni_field_t *ptr) {
|
|
||||||
vppjni_field_t **where = &field_head;
|
|
||||||
while (*where != NULL) {
|
|
||||||
where = &((*where)->next);
|
|
||||||
}
|
|
||||||
*where = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
jobject vppjni_new_object(JNIEnv *env, const vppjni_class_t *ptr, va_list ap) {
|
|
||||||
jobject obj = (*env)->NewObjectV(env, ptr->jclass, ptr->jinit, ap);
|
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
|
||||||
(*env)->ExceptionDescribe(env);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vppjni_init(JNIEnv *env)
|
|
||||||
{
|
|
||||||
vppjni_class_t *cwlk;
|
|
||||||
vppjni_field_t *fwlk;
|
|
||||||
|
|
||||||
for (cwlk = class_head; cwlk != NULL; cwlk = cwlk->next) {
|
|
||||||
jclass cls;
|
|
||||||
jmethodID method;
|
|
||||||
|
|
||||||
cls = (*env)->FindClass(env, cwlk->fqcn);
|
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
|
||||||
(*env)->ExceptionDescribe(env);
|
|
||||||
vppjni_uninit(env);
|
|
||||||
return JNI_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
method = (*env)->GetMethodID(env, cls, "<init>", cwlk->init_sig);
|
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
|
||||||
(*env)->ExceptionDescribe(env);
|
|
||||||
vppjni_uninit(env);
|
|
||||||
return JNI_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
cwlk->jclass = (*env)->NewGlobalRef(env, cls);
|
|
||||||
if (cwlk->jclass == NULL) {
|
|
||||||
vppjni_uninit(env);
|
|
||||||
return JNI_ERR;
|
|
||||||
}
|
|
||||||
cwlk->jinit = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (fwlk = field_head; fwlk != NULL; fwlk = fwlk->next) {
|
|
||||||
fwlk->jfield = (*env)->GetFieldID(env, fwlk->clsref->jclass, fwlk->name, fwlk->type);
|
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
|
||||||
(*env)->ExceptionDescribe(env);
|
|
||||||
vppjni_uninit(env);
|
|
||||||
return JNI_ERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void vppjni_uninit(JNIEnv *env) {
|
|
||||||
vppjni_class_t *cwlk;
|
|
||||||
vppjni_field_t *fwlk;
|
|
||||||
|
|
||||||
for (fwlk = field_head; fwlk != NULL; fwlk = fwlk->next) {
|
|
||||||
fwlk->jfield = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (cwlk = class_head; cwlk != NULL; cwlk = cwlk->next) {
|
|
||||||
if (cwlk->jclass != NULL ) {
|
|
||||||
(*env)->DeleteGlobalRef(env, cwlk->jclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
cwlk->jclass = NULL;
|
|
||||||
cwlk->jinit = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Utilities for accessing Java classes/method/fields in an efficient
|
|
||||||
* manner.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A potentially-uninitialized reference to a Java class
|
|
||||||
*/
|
|
||||||
typedef struct vppjni_class {
|
|
||||||
// Fully-Qualified Class Name
|
|
||||||
const char *fqcn;
|
|
||||||
// Constructor signature
|
|
||||||
const char *init_sig;
|
|
||||||
// Global reference to class handle
|
|
||||||
jclass jclass;
|
|
||||||
// Constructor method handle
|
|
||||||
jmethodID jinit;
|
|
||||||
// Next item in linked list
|
|
||||||
struct vppjni_class *next;
|
|
||||||
} vppjni_class_t;
|
|
||||||
|
|
||||||
typedef struct jenv_field {
|
|
||||||
// Field name
|
|
||||||
const char *name;
|
|
||||||
// Field type
|
|
||||||
const char *type;
|
|
||||||
// Defining class reference
|
|
||||||
const vppjni_class_t *clsref;
|
|
||||||
// Field handle
|
|
||||||
jfieldID jfield;
|
|
||||||
// Next item in linked list
|
|
||||||
struct jenv_field *next;
|
|
||||||
} vppjni_field_t;
|
|
||||||
|
|
||||||
#define VPPJNI_CLASS_SYMBOL(name) vppjni_class_##name
|
|
||||||
#define VPPJNI_CLASS_INIT(name) vppjni_class_##name##_init
|
|
||||||
#define BIND_JAPI_CLASS(name, sig) \
|
|
||||||
static vppjni_class_t VPPJNI_CLASS_SYMBOL(name); \
|
|
||||||
static void VPPJNI_CLASS_INIT(name)(void) __attribute__((__constructor__)); \
|
|
||||||
static void VPPJNI_CLASS_INIT(name)() \
|
|
||||||
{ \
|
|
||||||
VPPJNI_CLASS_SYMBOL(name).fqcn = "org/openvpp/vppjapi/" #name; \
|
|
||||||
VPPJNI_CLASS_SYMBOL(name).init_sig = sig; \
|
|
||||||
vppjni_register_class(&VPPJNI_CLASS_SYMBOL(name)); \
|
|
||||||
} \
|
|
||||||
static __attribute__((unused)) jobject name##Array(JNIEnv *env, jsize length) \
|
|
||||||
{ \
|
|
||||||
return (*env)->NewObjectArray(env, length, VPPJNI_CLASS_SYMBOL(name).jclass, NULL); \
|
|
||||||
} \
|
|
||||||
static jobject name##Object(JNIEnv *env, ...) \
|
|
||||||
{ \
|
|
||||||
va_list ap; \
|
|
||||||
va_start(ap, env); \
|
|
||||||
jobject obj = vppjni_new_object(env, &VPPJNI_CLASS_SYMBOL(name), ap); \
|
|
||||||
va_end(ap); \
|
|
||||||
return obj; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define VPPJNI_FIELD_SYMBOL(cls, name) vppjni_field_##cls##_##name
|
|
||||||
#define VPPJNI_FIELD_INIT(cls, name) vppjni_field_##cls##_##name##_init
|
|
||||||
#define BIND_JAPI_FIELD(cls, field, sig) \
|
|
||||||
static vppjni_field_t VPPJNI_FIELD_SYMBOL(cls, field); \
|
|
||||||
static void VPPJNI_FIELD_INIT(cls, field)(void) __attribute__((__constructor__)); \
|
|
||||||
static void VPPJNI_FIELD_INIT(cls, field)() \
|
|
||||||
{ \
|
|
||||||
VPPJNI_FIELD_SYMBOL(cls, field).name = #field; \
|
|
||||||
VPPJNI_FIELD_SYMBOL(cls, field).type = sig; \
|
|
||||||
VPPJNI_FIELD_SYMBOL(cls, field).clsref = &VPPJNI_CLASS_SYMBOL(cls); \
|
|
||||||
vppjni_register_field(&VPPJNI_FIELD_SYMBOL(cls, field)); \
|
|
||||||
}
|
|
||||||
#define BIND_JAPI_BOOL_FIELD(cls, field) \
|
|
||||||
BIND_JAPI_FIELD(cls, field, "Z"); \
|
|
||||||
static void set_##cls##_##field(JNIEnv *env, jobject obj, jboolean value) \
|
|
||||||
{ \
|
|
||||||
(*env)->SetBooleanField(env, obj, VPPJNI_FIELD_SYMBOL(cls, field).jfield, value); \
|
|
||||||
}
|
|
||||||
#define BIND_JAPI_BYTE_FIELD(cls, field) \
|
|
||||||
BIND_JAPI_FIELD(cls, field, "B"); \
|
|
||||||
static void set_##cls##_##field(JNIEnv *env, jobject obj, jbyte value) \
|
|
||||||
{ \
|
|
||||||
(*env)->SetByteField(env, obj, VPPJNI_FIELD_SYMBOL(cls, field).jfield, value); \
|
|
||||||
}
|
|
||||||
#define BIND_JAPI_INT_FIELD(cls, field) \
|
|
||||||
BIND_JAPI_FIELD(cls, field, "I"); \
|
|
||||||
static void set_##cls##_##field(JNIEnv *env, jobject obj, jint value) \
|
|
||||||
{ \
|
|
||||||
(*env)->SetIntField(env, obj, VPPJNI_FIELD_SYMBOL(cls, field).jfield, value); \
|
|
||||||
}
|
|
||||||
#define BIND_JAPI_OBJ_FIELD(cls, field, sig) \
|
|
||||||
BIND_JAPI_FIELD(cls, field, sig); \
|
|
||||||
static void set_##cls##_##field(JNIEnv *env, jobject obj, jobject value) \
|
|
||||||
{ \
|
|
||||||
(*env)->SetObjectField(env, obj, VPPJNI_FIELD_SYMBOL(cls, field).jfield, value); \
|
|
||||||
}
|
|
||||||
#define BIND_JAPI_STRING_FIELD(cls, field) \
|
|
||||||
BIND_JAPI_OBJ_FIELD(cls, field, "Ljava/lang/String;")
|
|
||||||
|
|
||||||
jobject vppjni_new_object(JNIEnv *env, const vppjni_class_t *ptr, va_list ap) __attribute__ ((visibility ("hidden")));
|
|
||||||
void vppjni_register_class(vppjni_class_t *ptr) __attribute__ ((visibility ("hidden")));
|
|
||||||
void vppjni_register_field(vppjni_field_t *ptr) __attribute__ ((visibility ("hidden")));
|
|
||||||
int vppjni_init(JNIEnv *env) __attribute__ ((visibility ("hidden")));
|
|
||||||
void vppjni_uninit(JNIEnv *env) __attribute__ ((visibility ("hidden")));
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,7 @@ void generate (YYSTYPE);
|
|||||||
%token NAME RPAR LPAR SEMI LBRACK RBRACK NUMBER PRIMTYPE BARF
|
%token NAME RPAR LPAR SEMI LBRACK RBRACK NUMBER PRIMTYPE BARF
|
||||||
%token TPACKED DEFINE LCURLY RCURLY STRING UNION
|
%token TPACKED DEFINE LCURLY RCURLY STRING UNION
|
||||||
%token HELPER_STRING COMMA
|
%token HELPER_STRING COMMA
|
||||||
%token NOVERSION MANUAL_PRINT MANUAL_ENDIAN MANUAL_JAVA TYPEONLY DONT_TRACE
|
%token NOVERSION MANUAL_PRINT MANUAL_ENDIAN TYPEONLY DONT_TRACE
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@ -62,7 +62,6 @@ flist: flist flag {$$ = (YYSTYPE)(unsigned long long)
|
|||||||
flag:
|
flag:
|
||||||
MANUAL_PRINT {$$ = $1;}
|
MANUAL_PRINT {$$ = $1;}
|
||||||
| MANUAL_ENDIAN {$$ = $1;}
|
| MANUAL_ENDIAN {$$ = $1;}
|
||||||
| MANUAL_JAVA {$$ = $1;}
|
|
||||||
| DONT_TRACE {$$ = $1;}
|
| DONT_TRACE {$$ = $1;}
|
||||||
| TYPEONLY {$$ = $1;}
|
| TYPEONLY {$$ = $1;}
|
||||||
;
|
;
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "gram.h"
|
#include "gram.h"
|
||||||
|
|
||||||
FILE *ifp, *ofp, *javafp, *jnifp, *pythonfp;
|
FILE *ifp, *ofp, *pythonfp;
|
||||||
char *java_class = "vppApi";
|
|
||||||
char *vlib_app_name = "vpp";
|
char *vlib_app_name = "vpp";
|
||||||
int dump_tree;
|
int dump_tree;
|
||||||
time_t starttime;
|
time_t starttime;
|
||||||
@ -258,8 +257,6 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int curarg = 1;
|
int curarg = 1;
|
||||||
char *ofile=0;
|
char *ofile=0;
|
||||||
char *jofile=0;
|
|
||||||
char *jnifile=0;
|
|
||||||
char *pythonfile=0;
|
char *pythonfile=0;
|
||||||
char *show_name=0;
|
char *show_name=0;
|
||||||
|
|
||||||
@ -331,40 +328,6 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp (argv [curarg], "--java", 4)) {
|
|
||||||
curarg++;
|
|
||||||
if (curarg < argc) {
|
|
||||||
javafp = fopen (argv[curarg], "w");
|
|
||||||
if (javafp == NULL) {
|
|
||||||
fprintf (stderr, "Couldn't open java output file %s\n",
|
|
||||||
argv[curarg]);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
jofile = argv[curarg];
|
|
||||||
curarg++;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Missing filename after --java\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strncmp (argv [curarg], "--jni", 4)) {
|
|
||||||
curarg++;
|
|
||||||
if (curarg < argc) {
|
|
||||||
jnifp = fopen (argv[curarg], "w");
|
|
||||||
if (jnifp == NULL) {
|
|
||||||
fprintf (stderr, "Couldn't open jni output file %s\n",
|
|
||||||
argv[curarg]);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
jnifile = argv[curarg];
|
|
||||||
curarg++;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Missing filename after --jni\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strncmp (argv [curarg], "--python", 8)) {
|
if (!strncmp (argv [curarg], "--python", 8)) {
|
||||||
curarg++;
|
curarg++;
|
||||||
if (curarg < argc) {
|
if (curarg < argc) {
|
||||||
@ -393,17 +356,6 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp (argv [curarg], "--class", 3)) {
|
|
||||||
curarg++;
|
|
||||||
if (curarg < argc) {
|
|
||||||
java_class = argv[curarg];
|
|
||||||
curarg++;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Missing class name after --class\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -411,12 +363,6 @@ int main (int argc, char **argv)
|
|||||||
if (ofp == NULL) {
|
if (ofp == NULL) {
|
||||||
ofile = 0;
|
ofile = 0;
|
||||||
}
|
}
|
||||||
if (javafp == NULL) {
|
|
||||||
jofile = 0;
|
|
||||||
}
|
|
||||||
if (jnifp == NULL) {
|
|
||||||
jnifile = 0;
|
|
||||||
}
|
|
||||||
if (pythonfp == NULL) {
|
if (pythonfp == NULL) {
|
||||||
pythonfile = 0;
|
pythonfile = 0;
|
||||||
}
|
}
|
||||||
@ -437,14 +383,6 @@ int main (int argc, char **argv)
|
|||||||
printf ("Output written to %s\n", ofile);
|
printf ("Output written to %s\n", ofile);
|
||||||
fclose (ofp);
|
fclose (ofp);
|
||||||
}
|
}
|
||||||
if (jofile) {
|
|
||||||
printf ("Java class defn written to %s\n", jofile);
|
|
||||||
fclose (javafp);
|
|
||||||
}
|
|
||||||
if (jnifile) {
|
|
||||||
printf ("Java native bindings written to %s\n", jnifile);
|
|
||||||
fclose (jnifp);
|
|
||||||
}
|
|
||||||
if (pythonfile) {
|
if (pythonfile) {
|
||||||
printf ("Python bindings written to %s\n", pythonfile);
|
printf ("Python bindings written to %s\n", pythonfile);
|
||||||
fclose (pythonfp);
|
fclose (pythonfp);
|
||||||
@ -457,15 +395,6 @@ int main (int argc, char **argv)
|
|||||||
printf ("Removing %s\n", ofile);
|
printf ("Removing %s\n", ofile);
|
||||||
unlink (ofile);
|
unlink (ofile);
|
||||||
}
|
}
|
||||||
fclose (javafp);
|
|
||||||
if (jofile) {
|
|
||||||
printf ("Removing %s\n", jofile);
|
|
||||||
unlink (jofile);
|
|
||||||
}
|
|
||||||
if (jnifile) {
|
|
||||||
printf ("Removing %s\n", jnifile);
|
|
||||||
unlink (jnifile);
|
|
||||||
}
|
|
||||||
if (pythonfile) {
|
if (pythonfile) {
|
||||||
printf ("Removing %s\n", pythonfile);
|
printf ("Removing %s\n", pythonfile);
|
||||||
unlink (pythonfile);
|
unlink (pythonfile);
|
||||||
@ -926,7 +855,6 @@ int yylex (void)
|
|||||||
case NOVERSION: crc = CRC16 (crc, 274); break;
|
case NOVERSION: crc = CRC16 (crc, 274); break;
|
||||||
case MANUAL_PRINT: crc = CRC16 (crc, 275); break;
|
case MANUAL_PRINT: crc = CRC16 (crc, 275); break;
|
||||||
case MANUAL_ENDIAN: crc = CRC16 (crc, 276); break;
|
case MANUAL_ENDIAN: crc = CRC16 (crc, 276); break;
|
||||||
case MANUAL_JAVA: crc = CRC16 (crc, 277); break;
|
|
||||||
case TYPEONLY: crc = CRC16 (crc, 278); break;
|
case TYPEONLY: crc = CRC16 (crc, 278); break;
|
||||||
case DONT_TRACE: crc = CRC16 (crc, 279); break;
|
case DONT_TRACE: crc = CRC16 (crc, 279); break;
|
||||||
|
|
||||||
@ -965,7 +893,6 @@ static struct keytab {
|
|||||||
{"i64", NODE_I64},
|
{"i64", NODE_I64},
|
||||||
{"i8", NODE_I8},
|
{"i8", NODE_I8},
|
||||||
{"manual_endian", NODE_MANUAL_ENDIAN},
|
{"manual_endian", NODE_MANUAL_ENDIAN},
|
||||||
{"manual_java", NODE_MANUAL_JAVA},
|
|
||||||
{"manual_print", NODE_MANUAL_PRINT},
|
{"manual_print", NODE_MANUAL_PRINT},
|
||||||
{"noversion", NODE_NOVERSION},
|
{"noversion", NODE_NOVERSION},
|
||||||
{"packed", NODE_PACKED},
|
{"packed", NODE_PACKED},
|
||||||
@ -1025,10 +952,6 @@ static int name_check (const char *s, YYSTYPE *token_value)
|
|||||||
*token_value = (YYSTYPE) NODE_FLAG_MANUAL_ENDIAN;
|
*token_value = (YYSTYPE) NODE_FLAG_MANUAL_ENDIAN;
|
||||||
return (MANUAL_ENDIAN);
|
return (MANUAL_ENDIAN);
|
||||||
|
|
||||||
case NODE_MANUAL_JAVA:
|
|
||||||
*token_value = (YYSTYPE) NODE_FLAG_MANUAL_JAVA;
|
|
||||||
return (MANUAL_JAVA);
|
|
||||||
|
|
||||||
case NODE_TYPEONLY:
|
case NODE_TYPEONLY:
|
||||||
*token_value = (YYSTYPE) NODE_FLAG_TYPEONLY;
|
*token_value = (YYSTYPE) NODE_FLAG_TYPEONLY;
|
||||||
return(TYPEONLY);
|
return(TYPEONLY);
|
||||||
|
756
vppapigen/node.c
756
vppapigen/node.c
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,6 @@ enum node_subclass { /* WARNING: indices must match the vft... */
|
|||||||
NODE_TYPEONLY,
|
NODE_TYPEONLY,
|
||||||
NODE_MANUAL_PRINT,
|
NODE_MANUAL_PRINT,
|
||||||
NODE_MANUAL_ENDIAN,
|
NODE_MANUAL_ENDIAN,
|
||||||
NODE_MANUAL_JAVA,
|
|
||||||
NODE_DONT_TRACE,
|
NODE_DONT_TRACE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,8 +60,6 @@ enum passid {
|
|||||||
UNION_DEF_PASS,
|
UNION_DEF_PASS,
|
||||||
ENDIANFUN_PASS,
|
ENDIANFUN_PASS,
|
||||||
PRINTFUN_PASS,
|
PRINTFUN_PASS,
|
||||||
JAVA_METHOD_PASS,
|
|
||||||
JAVA_JNI_PASS,
|
|
||||||
PYTHON_PASS,
|
PYTHON_PASS,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,7 +80,6 @@ typedef struct node_ {
|
|||||||
|
|
||||||
#define NODE_FLAG_MANUAL_PRINT (1<<0)
|
#define NODE_FLAG_MANUAL_PRINT (1<<0)
|
||||||
#define NODE_FLAG_MANUAL_ENDIAN (1<<1)
|
#define NODE_FLAG_MANUAL_ENDIAN (1<<1)
|
||||||
#define NODE_FLAG_MANUAL_JAVA (1<<2)
|
|
||||||
#define NODE_FLAG_TYPEONLY (1<<3)
|
#define NODE_FLAG_TYPEONLY (1<<3)
|
||||||
#define NODE_FLAG_DONT_TRACE (1<<4)
|
#define NODE_FLAG_DONT_TRACE (1<<4)
|
||||||
|
|
||||||
@ -91,11 +87,6 @@ typedef struct node_vft_ {
|
|||||||
void (*print)(struct node_ *);
|
void (*print)(struct node_ *);
|
||||||
void (*generate)(struct node_ *, enum passid id, FILE *ofp);
|
void (*generate)(struct node_ *, enum passid id, FILE *ofp);
|
||||||
char *endian_converter;
|
char *endian_converter;
|
||||||
void (*java_method_function)(struct node_ *, enum passid id, FILE *ofp);
|
|
||||||
void (*java_jni_parameter)(struct node_ *, enum passid id, FILE *ofp);
|
|
||||||
void (*java_jni_setup)(struct node_ *, enum passid id, FILE *ofp);
|
|
||||||
void (*java_jni_code)(struct node_ *, enum passid id, FILE *ofp);
|
|
||||||
void (*java_jni_teardown)(struct node_ *, enum passid id, FILE *ofp);
|
|
||||||
} node_vft_t;
|
} node_vft_t;
|
||||||
|
|
||||||
#endif /* _node_h */
|
#endif /* _node_h */
|
||||||
|
Reference in New Issue
Block a user