20 Commits

Author SHA1 Message Date
Robert Varga
40223daf5e Remove strcasecmp(3) declaration
This should be coming from string.h.

Change-Id: Id88bb1d2a4681a9dcf6db9c7de2580a5219869d1
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-10 16:29:30 +01:00
Robert Varga
f0f54d8b7c GetStringUTFChars() may fail
GetStringUTFChars() can fail, returning NULL. Make sure we do not trip
over it.

Change-Id: I2d6b9c72c353c2423042fd035087f0d57fdc08ca
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-10 16:25:07 +01:00
Robert Varga
ec3034c2ba newIntArray() may fail
Allocation of the integer array may fail, guard against NPE.

Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-10 16:24:31 +01:00
Robert Varga
d0f9209d06 Indent vppjni.c to be consistent
Pure cleanup of indentation and brace placement, so the file ends up
being consisteny.

Change-Id: Idd2f20deda486d16b455f3e13cacbc2f3baa50f1
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-10 14:04:41 +00:00
Dave Wallace
ba474a2629 Modify hand-coded JNI function names to match refactoring of
vppConn.java in commit #169

Change-Id: Id9feaebdce199f239741a10d31bf7aa473a62806
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2016-02-09 23:24:32 -05:00
Robert Varga
190efbc0a5 Make cleanup_rx_thread static
The symbol is not referenced outside of the source file, hide it from
the world.

Change-Id: Id5db73efff0767657ebc5a0b25dcccd2b85e354d
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-09 22:00:27 +00:00
Robert Varga
c15cc30571 Mark internal implementation functions as hidden
Adding hidden attribute results in compilation failure if the symbol is
not found when linking the .so. It should also lead to better
performance, as it side-steps GOT.

Change-Id: I7b6f39e663ca2b3e432669a3e2b36d7395f555b6
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-09 17:07:07 +01:00
Robert Varga
5baafefa44 Fixup symbol names in vpp-japi
There is skew between symbol names of vppjni_env.[ch], causing the
library to fail to load. This patch fixes that up.

Change-Id: I972e6d0ce72fd05ee3518e7161e20946ff3426ca
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-09 11:23:26 +01:00
Robert Varga
7a224a0075 Free the temporary vector
vec_add1() seems to be allocating memory which we do not free. Correct
that.

Change-Id: I25dca1871121cdd11a218ff2289a3c51b42e843b
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-01 18:42:53 +01:00
Robert Varga
427ce22583 Do not copy data twice in swInterfaceDump()
Instead of performing getting the elements, memcpy()ing them and the
releasing, use GetByteArrayRegion().

Change-Id: I20ef181df214ac4fdcaff5a64b89ef4f879078f8
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-01 18:42:53 +01:00
Robert Varga
67ba3bed00 Refactor vpp-japi
vlib does not allow concurrent connections, hence make sure the Java API
does not allow the user to instantiate them.

Also hide native methods from direct user invocation behind defensive
methods also detect if a particular connection has been terminated.
Disconnect is hidden befind standard close() method, as specified by
AutoCloseable.

Change-Id: Ib5079200ae4216cad84358a2174a41e90271a30b
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-01 04:07:26 +00:00
Robert Varga
004da76d2b Make public fields final where possible
Class fields initialized via the constructor should be final.

Also mark leaking byte[] instances with a FIXME. API users consider them
immutable, but they are vulnerable to System.arrayCopy().

Also fixes constructor arguments so they do not use underscores, which
is prohibited by Java 9.

Change-Id: I393d55ed7234149cb3604bc92b2cb1d1207c55dc
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-01 03:00:39 +00:00
Robert Varga
52a3a4de07 Add a copyright header
Change-Id: Ib543249b8de2b26b64de82c35f74422d10a5ee66
Signed-off-by: Robert Varga <nite@hq.sk>
2016-02-01 01:39:06 +00:00
Robert Varga
81d99acf45 Cache jclass/jmethodID/jfieldID references
This patch introduces an initialization framework, which tracks required
references to Java classes and methods.

It works by declaring classes and their constructor signatures, which
are linked into a singly-linked list when the .so initializers are run.
Once JNI_OnLoad() is invoked, this list is walked and all classes and
their initializers are resolved. These are then used while the library
remains loaded. Once JNI_OnUnload() is called, global references are
released, so we can cleanly unload.

The class declaration results in static utility objects being emitted in
the scope of the declaration, hence to allocate an object or an array of
objects is done via simple calls.

Change-Id: I41984c13756339364dbcbf0144b947627e8e4fe1
Signed-off-by: Robert Varga <nite@hq.sk>
2016-01-30 22:20:30 +01:00
Damjan Marion
08ff7e00bf Rename vpe binary name to avoid collision with latex
Change-Id: I34a46b9ebbc0e36486fbef528b34ea1c3be2e8be
Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-01-20 16:33:01 +01:00
Dave Wallace
4afb281d8d Warning be gone.
Change-Id: I683298c9f1dbff4c1067fb3004b5554fdc8b4ee1
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2016-01-04 22:14:56 -05:00
Dave Wallace
bf8c15e042 Add ODL honeycomb VPP agent extensions to vppjapi jni java library.
Change-Id: I084ffcf36fbac55c2862035d10b028e35e1e648d
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2015-12-17 21:47:54 -05:00
Matus Fabian
d2dc3df90d replacing all vec_sort() invocations to vec_sort_with_function()
Change-Id: I05895827ed52be292112484cee7d0a2591b67335
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2015-12-15 00:09:46 +01:00
Damjan Marion
a0d4a1a6d1 new version handling
Change-Id: I90983f3df94a3b28199908b29ffd8f827ab0c379
Signed-off-by: Damjan Marion <damarion@cisco.com>
2015-12-13 18:18:27 +01:00
Ed Warnicke
cb9cadad57 Initial commit of vpp code.
Change-Id: Ib246f1fbfce93274020ee93ce461e3d8bd8b9f17
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2015-12-08 15:47:27 -07:00