#define M_NOALLOC(T,t) \
do { \
result_ready = 0; \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T); \
mp->client_index = am->my_client_index; \
} while(0);
result_msg_id = ntohs(*((u16 *)data));
}
-int main (int argc, char ** argv)
+static void
+test_connect ()
+{
+ static int i;
+ int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/);
+ if (rv != 0) {
+ printf("Connect failed: %d\n", rv);
+ exit(rv);
+ }
+ printf(".");
+ vac_disconnect();
+ i++;
+}
+
+static void
+test_messages (void)
{
api_main_t * am = &api_main;
vl_api_show_version_t message;
vl_api_show_version_t *mp;
int async = 1;
- int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/);
+ int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/);
if (rv != 0) {
printf("Connect failed: %d\n", rv);
exit(rv);
}
-
- struct timeb timer_msec;
+ struct timeb timer_msec;
long long int timestamp_msec_start; /* timestamp in millisecond. */
if (!ftime(&timer_msec)) {
timestamp_msec_start = ((long long int) timer_msec.time) * 1000ll +
no_msgs/(timestamp_msec_end - timestamp_msec_start));
printf("Exiting...\n");
vac_disconnect();
+}
+
+int main (int argc, char ** argv)
+{
+ int i;
+
+ for (i = 0; i < 1000; i++) {
+ test_connect();
+ }
+ test_messages();
exit (0);
}