summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vpp-api/client/client.c11
-rw-r--r--src/vpp-api/client/vppapiclient.h9
2 files changed, 16 insertions, 4 deletions
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c
index 20adc957869..2de880d803b 100644
--- a/src/vpp-api/client/client.c
+++ b/src/vpp-api/client/client.c
@@ -423,12 +423,14 @@ vac_read (char **p, int *l, u16 timeout)
vl_shmem_hdr_t *shmem_hdr;
/* svm_queue_sub(below) returns {-1, -2} */
- if (!pm->connected_to_vlib) return -3;
+ if (!pm->connected_to_vlib)
+ return VAC_NOT_CONNECTED;
*l = 0;
/* svm_queue_sub(below) returns {-1, -2} */
- if (am->our_pid == 0) return (-4);
+ if (am->our_pid == 0)
+ return (VAC_SHM_NOT_READY);
/* Poke timeout thread */
if (timeout)
@@ -492,7 +494,7 @@ vac_read (char **p, int *l, u16 timeout)
vl_msg_api_free((void *) msg);
/* Client might forget to resume RX thread on failure */
vac_rx_resume ();
- return -1;
+ return VAC_TIMEOUT;
}
/*
@@ -518,7 +520,8 @@ vac_write (char *p, int l)
svm_queue_t *q;
vac_main_t *pm = &vac_main;
- if (!pm->connected_to_vlib) return -1;
+ if (!pm->connected_to_vlib)
+ return VAC_NOT_CONNECTED;
if (!mp) return (-1);
memcpy(mp, p, l);
diff --git a/src/vpp-api/client/vppapiclient.h b/src/vpp-api/client/vppapiclient.h
index 3ccd84ffc5f..5f319a42821 100644
--- a/src/vpp-api/client/vppapiclient.h
+++ b/src/vpp-api/client/vppapiclient.h
@@ -18,6 +18,15 @@
#include <stdint.h>
#include <stdbool.h>
+typedef enum
+{
+ VAC_SVM_QUEUE_SUB_1 = -1,
+ VAC_SVM_QUEUE_SUB_2 = -2,
+ VAC_NOT_CONNECTED = -3,
+ VAC_SHM_NOT_READY = -4,
+ VAC_TIMEOUT = -5,
+} vac_errno_t;
+
typedef void (*vac_callback_t)(unsigned char * data, int len);
typedef void (*vac_error_callback_t)(void *, unsigned char *, int);
int vac_connect(char * name, char * chroot_prefix, vac_callback_t cb,