From 5f9dcff39d5e25c6bef30d569e405635633f3c69 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Mon, 1 Aug 2016 04:59:13 +0200 Subject: VPP Python language binding - plugin support - Moved Python generator tool to tools directory - Added build-vpp-api Makefile target - Generator now only creates a Python representation of the .api the rest of the framework is in the vpp_papi script - Each plugin has its own namespace. - Plugin Python files are installed in vpp_papi_plugins for easy use inside the build tree. Change-Id: I272c83bb7e5d5e416bdbd8a790a3cc35c5a04e38 Signed-off-by: Ole Troan --- vpp-api/python/pneum/pneum.c | 20 +++++++------------- vpp-api/python/pneum/pneum.h | 5 ++--- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'vpp-api/python/pneum') diff --git a/vpp-api/python/pneum/pneum.c b/vpp-api/python/pneum/pneum.c index ac518493163..2637d43f5d9 100644 --- a/vpp-api/python/pneum/pneum.c +++ b/vpp-api/python/pneum/pneum.c @@ -10,7 +10,7 @@ * 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. + * limitations under the License. */ #include #include @@ -36,11 +36,11 @@ #include "pneum.h" #define vl_typedefs /* define message structures */ -#include +#include #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include +#include #undef vl_endianfun typedef struct { @@ -54,12 +54,12 @@ pneum_main_t pneum_main; extern int wrap_pneum_callback(char *data, int len); -/* +/* * Satisfy external references when -lvlib is not available. */ void vlib_cli_output (struct vlib_main_t * vm, char * fmt, ...) { - clib_warning ("vlib_cli_output callled..."); + clib_warning ("vlib_cli_output called..."); } #define vl_api_version(n,v) static u32 vpe_api_version = v; @@ -89,7 +89,7 @@ pneum_api_handler (void *msg) int l = ntohl(msgbuf->data_len); if (l == 0) clib_warning("Message ID %d has wrong length: %d\n", id, l); - + /* Call Python callback */ (void)wrap_pneum_callback(msg, l); vl_msg_api_free(msg); @@ -121,12 +121,6 @@ pneum_connect (char *name) int rv = 0; pneum_main_t *pm = &pneum_main; - /* - * Bail out now if we're not running as root - */ - if (geteuid() != 0) - return (-1); - if ((rv = vl_client_api_map("/vpe-api"))) { clib_warning ("vl_client_api map rv %d", rv); return rv; @@ -199,7 +193,7 @@ pneum_read (char **p, int *l) *p = (char *)msg; } else { printf("Read failed with %d\n", rv); - } + } return (rv); } diff --git a/vpp-api/python/pneum/pneum.h b/vpp-api/python/pneum/pneum.h index b99cbd4e3ec..75fccf84bcf 100644 --- a/vpp-api/python/pneum/pneum.h +++ b/vpp-api/python/pneum/pneum.h @@ -12,10 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __included_pneum_h__ -#define __included_pneum_h__ +#ifndef included_pneum_h +#define included_pneum_h -unsigned int vpe_client_index(void); int pneum_connect(char *name); int pneum_disconnect(void); int pneum_read(char **data, int *l); -- cgit 1.2.3-korg