#include <vppinfra/time.h>
#include <vppinfra/hash.h>
#include <vppinfra/pool.h>
-#include <vpp/stats/stat_segment.h>
#include <vpp-api/client/stat_client.h>
#include <vppinfra/vec.h>
#include <mactime/mactime_device.h>
#include <vnet/api_errno.h>
#include <svm/queue.h>
-/* define message IDs */
-#include <mactime/mactime.api_enum.h>
+#include <vnet/format_fns.h>
#include <mactime/mactime.api_types.h>
+#include <mactime/mactime.api_enum.h>
typedef struct
{
}
#define vl_print(handle, ...) fformat(handle, __VA_ARGS__)
+#define vl_endianfun /* define message structures */
+#include <mactime/mactime.api.h>
+#undef vl_endianfun
-#define vl_endianfun
+/* instantiate all the print functions we know about */
#define vl_printfun
+#include <mactime/mactime.api.h>
+#undef vl_printfun
+
#define vl_api_version(n,v) static u32 api_version = v;
#include <mactime/mactime.api.h>
#undef vl_api_version
-#undef vl_printfun
-#undef vl_endianfun
static int
connect_to_vpp (char *name)
vec_free (msg_base_lookup_name);
- if (mm->msg_id_base == ~0)
+ if (mm->msg_id_base == (u16) ~ 0)
return -1;
#define _(N,n) \
{
vlib_counter_t **counters_by_thread;
vlib_counter_t *counters;
- u64 *offset_vector;
mactime_device_t *dev;
stat_segment_access_t sa;
stat_client_main_t *sm = mm->stat_client_main;
vec_reset_length (pool_indices);
/* *INDENT-OFF* */
- pool_foreach (dev, mm->devices,
- ({
+ pool_foreach (dev, mm->devices)
+ {
vec_add1 (pool_indices, dev->pool_index);
- }));
+ }
/* *INDENT-ON* */
/* Nothing to do... */
stat_segment_access_start (&sa, sm);
ep = vec_elt_at_index (sm->directory_vector, mm->ls_result1[0]);
- counters_by_thread = stat_segment_pointer (sm->shared_header, ep->offset);
- offset_vector = stat_segment_pointer (sm->shared_header, ep->offset_vector);
+ counters_by_thread = stat_segment_adjust (sm, ep->data);
for (i = 0; i < vec_len (pool_indices); i++)
{
for (j = 0; j < vec_len (counters_by_thread); j++)
{
- counters = stat_segment_pointer (sm->shared_header,
- offset_vector[j]);
+ counters = stat_segment_adjust (sm, counters_by_thread[j]);
mm->allow_counters[index].packets += counters[index].packets;
mm->allow_counters[index].bytes += counters[index].bytes;
}
stat_segment_access_start (&sa, sm);
ep = vec_elt_at_index (sm->directory_vector, mm->ls_result2[0]);
- counters_by_thread = stat_segment_pointer (sm->shared_header, ep->offset);
- offset_vector = stat_segment_pointer (sm->shared_header, ep->offset_vector);
+ counters_by_thread = stat_segment_adjust (sm, ep->data);
for (i = 0; i < vec_len (pool_indices); i++)
{
for (j = 0; j < vec_len (counters_by_thread); j++)
{
- counters = stat_segment_pointer (sm->shared_header,
- offset_vector[j]);
+ counters = stat_segment_adjust (sm, counters_by_thread[j]);
mm->drop_counters[index].packets += counters[index].packets;
mm->drop_counters[index].bytes += counters[index].bytes;
}
fformat (stdout, "%U", format_device, 0 /* header */ , 0 /* verbose */ );
/* *INDENT-OFF* */
- pool_foreach (dev, mm->devices,
- ({
+ pool_foreach (dev, mm->devices)
+ {
fformat (stdout, "%U", format_device, dev, 0 /* verbose */);
- }));
+ }
/* *INDENT-ON* */
}
clib_time_init (&mm->clib_time);
mm->timezone_offset = -5.0;
clib_timebase_init (&mm->timebase, mm->timezone_offset,
- CLIB_TIMEBASE_DAYLIGHT_USA);
+ CLIB_TIMEBASE_DAYLIGHT_USA,
+ 0 /* allocate a clib_time_t */ );
vec_add1 (mm->pattern1, (u8 *) "^/mactime/allow");
vec_add1 (mm->pattern2, (u8 *) "^/mactime/drop");