summaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Expand)AuthorFilesLines
2017-05-26Fix JNI templatesRobert Varga1-0/+3
2017-05-20API: Cleaning up message naming that does not follow the conventionsOle Troan2-10/+3
2017-05-16Place the vpp_papi*.egg file together with other build products.Igor Mikhailov (imichail)1-1/+2
2017-05-15Add GTP-U plugin. VPP-694Hongjun Ni3-0/+169
2017-05-15jvpp: fix memory allocation for variable lenght messages (VPP-841)Marek Gradzki4-22/+49
2017-05-10Produce vpp_papi*.egg for virtual environmentsIgor Mikhailov (imichail)1-1/+2
2017-04-27japi: fix compilation on 32-bit systemsDamjan Marion7-7/+7
2017-04-20vpp-api: rename libpneum to libvppapiclientDamjan Marion7-144/+159
2017-04-06jvpp: remove unused print&endian headers (fixes VPP-688)Marek Gradzki6-64/+10
2017-03-30Clean up more Debian packaging symbol warningsDave Barach1-1/+0
2017-03-17PNEUM: Fix Coverity error (missing unlock).Ole Troan1-1/+2
2017-03-15Python API: Change from cPython to CFFI.Ole Troan9-338/+123
2017-03-10Retire vpp_liteDamjan Marion4-8/+8
2017-03-07Python API: Synchronous mode.Ole Troan5-147/+365
2017-03-03python API: work towards python/vpp api separationKlement Sekera1-1/+30
2017-02-22jvpp: remove unnecessary msg_id_base cachingMarek Gradzki11-178/+90
2017-02-02LISP: enhance binary part of some APIsFilip Tehlar1-1/+2
2017-01-31jvpp: fix coverity warn: reliance on default encodingMarek Gradzki5-18/+35
2017-01-28Add files to CLEANFILES for robust make clean.Burt Silverman1-1/+1
2017-01-27jvpp: utilize per-message CRCs (VPP-544)Marek Gradzki11-15/+143
2017-01-27Python API: event_callback not initialised.Ole Troan1-0/+1
2017-01-26Change automake python macro to get python pathTomofumi Hayashi1-1/+2
2017-01-24Fix PAPI async responseWojciech Dec1-1/+1
2017-01-20Python API: Missing locking of results data structure.Ole Troan1-84/+219
2017-01-18jvpp: include libjvpp_common in rpm packagesMarek Gradzki1-0/+1
2017-01-16Fix linker warnings for jvpp shared libsMarek Gradzki1-1/+1
2017-01-12jvpp: include jvpp_common in vpp packagesMarek Gradzki1-1/+1
2017-01-11jvpp: add missing dependencies on various libsMarek Gradzki1-5/+23
2017-01-11Makefile.am cleanupDamjan Marion2-2/+4
2017-01-11jvpp: compile static Java files and include in generated jarsMarek Gradzki1-3/+3
2017-01-10japi: include tests in jar filesDamjan Marion1-0/+1
2017-01-09papi: fix building on aarch64Damjan Marion1-1/+1
2017-01-06python clients can set the API rx message queue lengthDave Barach5-10/+13
2017-01-05Added vpe.api java binding generationJan Srnicek1-0/+1
2017-01-03jvpp: install jvpp_common.h into include/Damjan Marion1-0/+3
2017-01-03vpp-python-api deb packaging - use easy_install to install the python apiroot1-0/+1
2017-01-01Move java,lua api and remaining plugins to src/Damjan Marion92-0/+11974
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion15-0/+1896
s="o">* pool, ip4_address_t addr, u32 count, u8 is_add, void *opaque) { int i, rv; for (i = 0; i < count; i++) { // TODO: // a) consider if we could benefit from pre and post cb // b) consider if we could benefit from add/del cb separation // pre call: // pool->add_del_pool_addr_pre_cb (&addr, is_add, opaque); if ((rv = nat_add_del_ip4_pool_addr (pool, addr, is_add)) != 0) return rv; // post call: // pool->add_del_pool_addr_post_cb (&addr, is_add, opaque); pool->add_del_pool_addr_cb (addr, is_add, opaque); nat_ip4_addr_increment (&addr); } return 0; } static_always_inline u16 nat_random_port (u32 * random_seed, u16 min, u16 max) { return min + random_u32 (random_seed) / (random_u32_max () / (max - min + 1) + 1); } int nat_alloc_ip4_addr_and_port_cb_default (nat_ip4_pool_t * pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t * out) { nat_ip4_pool_addr_t *a, *ga = 0; u32 i; u32 portnum; for (i = 0; i < vec_len (pool->pool_addr); i++) { a = pool->pool_addr + i; switch (protocol) { #define _(N, j, n, s) \ case NAT_PROTOCOL_##N: \ if (a->busy_##n##_ports_per_thread[thread_index] < port_per_thread) \ { \ if (a->fib_index == fib_index) \ { \ while (1) \ { \ portnum = (port_per_thread * \ nat_thread_index) + \ nat_random_port(&pool->random_seed, 1, port_per_thread) + 1024; \ if (clib_bitmap_get_no_check (a->busy_##n##_port_bitmap, portnum)) \ continue; \ clib_bitmap_set_no_check (a->busy_##n##_port_bitmap, portnum, 1); \ a->busy_##n##_ports_per_thread[thread_index]++; \ a->busy_##n##_ports++; \ out->addr = a->addr; \ out->port = clib_host_to_net_u16(portnum); \ return 0; \ } \ } \ else if (a->fib_index == ~0) \ { \ ga = a; \ } \ } \ break; foreach_nat_protocol #undef _ default: return NAT_ERROR_UNKNOWN_PROTOCOL; } } if (ga) { a = ga; switch (protocol) { #define _(N, j, n, s) \ case NAT_PROTOCOL_##N: \ while (1) \ { \ portnum = (port_per_thread * \ nat_thread_index) + \ nat_random_port(&pool->random_seed, 1, port_per_thread) + 1024; \ if (clib_bitmap_get_no_check (a->busy_##n##_port_bitmap, portnum)) \ continue; \ clib_bitmap_set_no_check (a->busy_##n##_port_bitmap, portnum, 1); \ a->busy_##n##_ports_per_thread[thread_index]++; \ a->busy_##n##_ports++; \ out->addr = a->addr; \ out->port = clib_host_to_net_u16(portnum); \ return 0; \ } break; foreach_nat_protocol #undef _ default: return NAT_ERROR_UNKNOWN_PROTOCOL; } } return NAT_ERROR_OUT_OF_TRANSLATIONS; } int nat_alloc_ip4_addr_and_port (nat_ip4_pool_t * pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t * out) { return pool->alloc_addr_and_port_cb (pool, fib_index, thread_index, nat_thread_index, port_per_thread, protocol, out); } // TODO: consider using standard u16 port and ip4_address_t as input ? int nat_free_ip4_addr_and_port (nat_ip4_pool_t * pool, u32 thread_index, u16 protocol, nat_ip4_addr_port_t * addr_port) { nat_ip4_pool_addr_t *a = 0; u32 i; u16 port = clib_net_to_host_u16 (addr_port->port); for (i = 0; i < vec_len (pool->pool_addr); i++) { if (pool->pool_addr[i].addr.as_u32 == addr_port->addr.as_u32) { a = pool->pool_addr + i; break; } } if (!a) { return NAT_ERROR_NO_SUCH_ENTRY; } switch (protocol) { #define _(N, i, n, s) \ case NAT_PROTOCOL_##N: \ ASSERT (clib_bitmap_get_no_check (a->busy_##n##_port_bitmap, \ port) == 1); \ clib_bitmap_set_no_check (a->busy_##n##_port_bitmap, \ port, 0); \ a->busy_##n##_ports--; \ a->busy_##n##_ports_per_thread[thread_index]--; \ break; foreach_nat_protocol #undef _ default: return NAT_ERROR_UNKNOWN_PROTOCOL; } return 0; } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */