Update tx and output node runtime when recycling interface
[vpp.git] / vpp-api / python / pneum / pneum.c
index 971c79b..ebe47b2 100644 (file)
@@ -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 <stdio.h>
 #include <stdlib.h>
 #include <vlibapi/api.h>
 #include <vlibmemory/api.h>
 
-#include <api/vpe_msg_enum.h>
+#include <vpp-api/vpe_msg_enum.h>
 
 #include "pneum.h"
 
 #define vl_typedefs             /* define message structures */
-#include <api/vpe_all_api_h.h> 
+#include <vpp-api/vpe_all_api_h.h>
 #undef vl_typedefs
 
 #define vl_endianfun             /* define message structures */
-#include <api/vpe_all_api_h.h> 
+#include <vpp-api/vpe_all_api_h.h>
 #undef vl_endianfun
 
 typedef struct {
@@ -54,16 +54,16 @@ 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;
-#include <api/vpe.api.h>
+#include <vpp-api/vpe.api.h>
 #undef vl_api_version
 void
 vl_client_add_api_signatures (vl_api_memclnt_create_t *mp)
@@ -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);
@@ -116,16 +116,13 @@ pneum_rx_thread_fn (void *arg)
 }
 
 int
-pneum_connect (char *name)
+pneum_connect (char * name, char * chroot_prefix)
 {
   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 (chroot_prefix != NULL)
+    vl_set_memory_root_path (chroot_prefix);
 
   if ((rv = vl_client_api_map("/vpe-api"))) {
     clib_warning ("vl_client_api map rv %d", rv);
@@ -156,8 +153,6 @@ pneum_disconnect (void)
   api_main_t *am = &api_main;
   pneum_main_t *pm = &pneum_main;
 
-  fformat (stdout,"disconnecting from vpe \n");
-
   if (pm->rx_thread_jmpbuf_valid) {
     vl_api_rx_thread_exit_t *ep;
     uword junk;
@@ -199,7 +194,7 @@ pneum_read (char **p, int *l)
     *p = (char *)msg;
   } else {
     printf("Read failed with %d\n", rv);
-  }  
+  }
   return (rv);
 }