summaryrefslogtreecommitdiffstats
path: root/vlib/example
diff options
context:
space:
mode:
Diffstat (limited to 'vlib/example')
-rw-r--r--vlib/example/main_stub.c213
-rw-r--r--vlib/example/mc_test.c230
-rw-r--r--vlib/example/plex_test.c371
3 files changed, 449 insertions, 365 deletions
diff --git a/vlib/example/main_stub.c b/vlib/example/main_stub.c
index 4213d912acd..4d74bd77aaa 100644
--- a/vlib/example/main_stub.c
+++ b/vlib/example/main_stub.c
@@ -16,7 +16,8 @@
#include <vlib/unix/unix.h>
#include <math.h>
-int main (int argc, char * argv[])
+int
+main (int argc, char *argv[])
{
return vlib_unix_main (argc, argv);
}
@@ -24,30 +25,33 @@ int main (int argc, char * argv[])
static clib_error_t *
main_stub_init (vlib_main_t * vm)
{
- clib_error_t * error;
+ clib_error_t *error;
- if ((error = unix_physmem_init (vm, /* fail_if_physical_memory_not_present */ 0)))
+ if ((error =
+ unix_physmem_init (vm, /* fail_if_physical_memory_not_present */ 0)))
return error;
- if ((error = vlib_call_init_function (vm, unix_cli_init)))
- return error;
+ if ((error = vlib_call_init_function (vm, unix_cli_init)))
+ return error;
- return error;
+ return error;
}
VLIB_INIT_FUNCTION (main_stub_init);
#if 0
/* Node test code. */
-typedef struct {
+typedef struct
+{
int scalar;
int vector[0];
} my_frame_t;
-static u8 * format_my_node_frame (u8 * s, va_list * va)
+static u8 *
+format_my_node_frame (u8 * s, va_list * va)
{
- vlib_frame_t * f = va_arg (*va, vlib_frame_t *);
- my_frame_t * g = vlib_frame_args (f);
+ vlib_frame_t *f = va_arg (*va, vlib_frame_t *);
+ my_frame_t *g = vlib_frame_args (f);
int i;
s = format (s, "scalar %d, vector { ", g->scalar);
@@ -59,12 +63,10 @@ static u8 * format_my_node_frame (u8 * s, va_list * va)
}
static uword
-my_func (vlib_main_t * vm,
- vlib_node_runtime_t * rt,
- vlib_frame_t * f)
+my_func (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
{
- vlib_node_t * node;
- my_frame_t * y;
+ vlib_node_t *node;
+ my_frame_t *y;
u32 i, n_left = 0;
static int serial;
int verbose;
@@ -79,7 +81,7 @@ my_func (vlib_main_t * vm,
if (rt->n_next_nodes > 0)
{
- vlib_frame_t * next = vlib_get_next_frame (vm, rt, /* next index */ 0);
+ vlib_frame_t *next = vlib_get_next_frame (vm, rt, /* next index */ 0);
n_left = VLIB_FRAME_SIZE - next->n_vectors;
y = vlib_frame_args (next);
y->scalar = serial++;
@@ -105,6 +107,7 @@ my_func (vlib_main_t * vm,
return i;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_node1,static) = {
.function = my_func,
.type = VLIB_NODE_TYPE_INPUT,
@@ -116,40 +119,44 @@ VLIB_REGISTER_NODE (my_node1,static) = {
[0] = "my-node2",
},
};
+/* *INDENT-ON* */
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_node2,static) = {
.function = my_func,
.name = "my-node2",
.scalar_size = sizeof (my_frame_t),
.vector_size = STRUCT_SIZE_OF (my_frame_t, vector[0]),
};
+/* *INDENT-ON* */
#endif
#if 0
-typedef enum {
+typedef enum
+{
MY_EVENT_TYPE1,
MY_EVENT_TYPE2,
} my_process_completion_type_t;
-typedef struct {
+typedef struct
+{
int a;
f64 b;
} my_process_event_data_t;
-static u8 * format_my_process_event_data (u8 * s, va_list * va)
+static u8 *
+format_my_process_event_data (u8 * s, va_list * va)
{
- my_process_event_data_t * d = va_arg (*va, my_process_event_data_t *);
+ my_process_event_data_t *d = va_arg (*va, my_process_event_data_t *);
return format (s, "{ a %d b %.6f}", d->a, d->b);
}
static uword
-my_proc (vlib_main_t * vm,
- vlib_node_runtime_t * rt,
- vlib_frame_t * f)
+my_proc (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
{
- vlib_node_t * node;
+ vlib_node_t *node;
u32 i;
node = vlib_get_node (vm, rt->node_index);
@@ -159,14 +166,14 @@ my_proc (vlib_main_t * vm,
for (i = 0; i < 5; i++)
{
vlib_cli_output (vm, "%v: %d", node->name, i);
- vlib_process_suspend (vm, 1e0 /* secs */);
+ vlib_process_suspend (vm, 1e0 /* secs */ );
}
vlib_cli_output (vm, "%v: return frame %p", node->name, f);
if (0)
{
- uword n_events_seen, type, * data = 0;
+ uword n_events_seen, type, *data = 0;
for (n_events_seen = 0; n_events_seen < 2;)
{
@@ -174,8 +181,8 @@ my_proc (vlib_main_t * vm,
type = vlib_process_get_events (vm, &data);
n_events_seen += vec_len (data);
vlib_cli_output (vm, "%U %v: completion #%d type %d data 0x%wx",
- format_time_interval, "h:m:s:u", vlib_time_now (vm),
- node->name, i, type, data[0]);
+ format_time_interval, "h:m:s:u",
+ vlib_time_now (vm), node->name, i, type, data[0]);
_vec_len (data) = 0;
}
@@ -184,15 +191,17 @@ my_proc (vlib_main_t * vm,
else
{
uword n_events_seen, i, type;
- my_process_event_data_t * data;
+ my_process_event_data_t *data;
for (n_events_seen = 0; n_events_seen < 2;)
{
vlib_process_wait_for_event (vm);
data = vlib_process_get_event_data (vm, &type);
- vec_foreach_index (i, data) {
+ vec_foreach_index (i, data)
+ {
vlib_cli_output (vm, "%U event type %d data %U",
- format_time_interval, "h:m:s:u", vlib_time_now (vm),
- type, format_my_process_event_data, data);
+ format_time_interval, "h:m:s:u",
+ vlib_time_now (vm), type,
+ format_my_process_event_data, data);
}
n_events_seen += vec_len (data);
vlib_process_put_event_data (vm, data);
@@ -202,16 +211,16 @@ my_proc (vlib_main_t * vm,
return i;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_proc_node,static) = {
.function = my_proc,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "my-proc",
};
+/* *INDENT-ON* */
static uword
-my_proc_input (vlib_main_t * vm,
- vlib_node_runtime_t * rt,
- vlib_frame_t * f)
+my_proc_input (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
{
static int i;
@@ -223,13 +232,15 @@ my_proc_input (vlib_main_t * vm,
0x12340000 + i);
else
{
- my_process_event_data_t * d;
+ my_process_event_data_t *d;
f64 dt = 5;
d = vlib_process_signal_event_at_time (vm,
i * dt,
my_proc_node.index,
- i == 1 ? MY_EVENT_TYPE1 : MY_EVENT_TYPE2,
- 1 /* elts */,
+ i ==
+ 1 ? MY_EVENT_TYPE1 :
+ MY_EVENT_TYPE2,
+ 1 /* elts */ ,
sizeof (d[0]));
d->a = i;
d->b = vlib_time_now (vm);
@@ -238,23 +249,26 @@ my_proc_input (vlib_main_t * vm,
else
vlib_node_set_state (vm, rt->node_index, VLIB_NODE_STATE_DISABLED);
- return 0;
+ return 0;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_proc_input_node,static) = {
.function = my_proc_input,
.type = VLIB_NODE_TYPE_INPUT,
.name = "my-proc-input",
};
+/* *INDENT-ON* */
-static uword _unformat_farith (unformat_input_t * i, va_list * args)
+static uword
+_unformat_farith (unformat_input_t * i, va_list * args)
{
u32 prec = va_arg (*args, u32);
- f64 * result = va_arg (*args, f64 *);
+ f64 *result = va_arg (*args, f64 *);
f64 tmp[2];
/* Binary operations in from lowest to highest precedence. */
- char * binops[] = {
+ char *binops[] = {
"+%U", "-%U", "/%U", "*%U", "^%U",
};
@@ -264,17 +278,27 @@ static uword _unformat_farith (unformat_input_t * i, va_list * args)
int p;
for (p = prec; p < ARRAY_LEN (binops); p++)
{
- if (unformat (i, binops[p],
- _unformat_farith, prec + 0, &tmp[1]))
+ if (unformat (i, binops[p], _unformat_farith, prec + 0, &tmp[1]))
{
switch (binops[p][0])
{
- case '+': result[0] = tmp[0] + tmp[1]; break;
- case '-': result[0] = tmp[0] - tmp[1]; break;
- case '/': result[0] = tmp[0] / tmp[1]; break;
- case '*': result[0] = tmp[0] * tmp[1]; break;
- case '^': result[0] = pow (tmp[0], tmp[1]); break;
- default: abort ();
+ case '+':
+ result[0] = tmp[0] + tmp[1];
+ break;
+ case '-':
+ result[0] = tmp[0] - tmp[1];
+ break;
+ case '/':
+ result[0] = tmp[0] / tmp[1];
+ break;
+ case '*':
+ result[0] = tmp[0] * tmp[1];
+ break;
+ case '^':
+ result[0] = pow (tmp[0], tmp[1]);
+ break;
+ default:
+ abort ();
}
return 1;
}
@@ -283,15 +307,13 @@ static uword _unformat_farith (unformat_input_t * i, va_list * args)
return 1;
}
- else if (unformat (i, "-%U",
- _unformat_farith, prec + 0, &tmp[0]))
+ else if (unformat (i, "-%U", _unformat_farith, prec + 0, &tmp[0]))
{
result[0] = -tmp[0];
return 1;
}
- else if (unformat (i, "(%U)",
- _unformat_farith, 0, &tmp[0]))
+ else if (unformat (i, "(%U)", _unformat_farith, 0, &tmp[0]))
{
result[0] = tmp[0];
return 1;
@@ -304,64 +326,67 @@ static uword _unformat_farith (unformat_input_t * i, va_list * args)
return 0;
}
-static uword unformat_farith (unformat_input_t * i, va_list * args)
+static uword
+unformat_farith (unformat_input_t * i, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- f64 * result = va_arg (*args, f64 *);
+ f64 *result = va_arg (*args, f64 *);
return unformat_user (i, _unformat_farith, 0, result);
}
-static uword unformat_integer (unformat_input_t * i, va_list * args)
+static uword
+unformat_integer (unformat_input_t * i, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- u32 * data = va_arg (*args, u32 *);
+ u32 *data = va_arg (*args, u32 *);
return unformat (i, "%d", data);
}
-static VLIB_CLI_PARSE_RULE (my_parse_rule1) = {
- .name = "decimal_integer",
- .short_help = "a decimal integer",
- .unformat_function = unformat_integer,
- .data_size = sizeof (u32),
-};
+static VLIB_CLI_PARSE_RULE (my_parse_rule1) =
+{
+.name = "decimal_integer",.short_help =
+ "a decimal integer",.unformat_function = unformat_integer,.data_size =
+ sizeof (u32),};
-static VLIB_CLI_PARSE_RULE (my_parse_rule2) = {
- .name = "float_expression",
- .short_help = "floating point expression",
- .unformat_function = unformat_farith,
- .data_size = sizeof (f64),
-};
+static VLIB_CLI_PARSE_RULE (my_parse_rule2) =
+{
+.name = "float_expression",.short_help =
+ "floating point expression",.unformat_function =
+ unformat_farith,.data_size = sizeof (f64),};
static clib_error_t *
bar_command (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
+ unformat_input_t * input, vlib_cli_command_t * cmd)
{
switch (cmd->function_arg)
{
- case 2: {
- u32 * d, * e;
- d = vlib_cli_get_parse_rule_result (vm, 0);
- e = vlib_cli_get_parse_rule_result (vm, 1);
- vlib_cli_output (vm, "bar2 %d %d", d[0], e[0]);
- break;
- }
-
- case 1: {
- u32 * d = vlib_cli_get_parse_rule_result (vm, 0);
- vlib_cli_output (vm, "bar1 %d", d[0]);
- break;
- }
-
- case 3: {
- f64 * d = vlib_cli_get_parse_rule_result (vm, 0);
- vlib_cli_output (vm, "expr %.6f", d[0]);
- }
+ case 2:
+ {
+ u32 *d, *e;
+ d = vlib_cli_get_parse_rule_result (vm, 0);
+ e = vlib_cli_get_parse_rule_result (vm, 1);
+ vlib_cli_output (vm, "bar2 %d %d", d[0], e[0]);
+ break;
+ }
+
+ case 1:
+ {
+ u32 *d = vlib_cli_get_parse_rule_result (vm, 0);
+ vlib_cli_output (vm, "bar1 %d", d[0]);
+ break;
+ }
+
+ case 3:
+ {
+ f64 *d = vlib_cli_get_parse_rule_result (vm, 0);
+ vlib_cli_output (vm, "expr %.6f", d[0]);
+ }
}
return 0;
}
+/* *INDENT-OFF* */
VLIB_CLI_COMMAND (bar_command2, static) = {
.path = "bar %decimal_integer",
.short_help = "bar1 command",
@@ -380,6 +405,14 @@ VLIB_CLI_COMMAND (bar_command3, static) = {
.function = bar_command,
.function_arg = 3,
};
+/* *INDENT-ON* */
#endif
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vlib/example/mc_test.c b/vlib/example/mc_test.c
index 2a7fe9867fe..e84a713cc59 100644
--- a/vlib/example/mc_test.c
+++ b/vlib/example/mc_test.c
@@ -19,7 +19,8 @@
#include <vlib/unix/mc_socket.h>
#include <vppinfra/random.h>
-typedef struct {
+typedef struct
+{
u32 min_n_msg_bytes;
u32 max_n_msg_bytes;
u32 tx_serial;
@@ -37,17 +38,20 @@ choose_msg_size (mc_test_main_t * tm)
{
u32 r = tm->min_n_msg_bytes;
if (tm->max_n_msg_bytes > tm->min_n_msg_bytes)
- r += random_u32 (&tm->seed) % (1 + tm->max_n_msg_bytes - tm->min_n_msg_bytes);
+ r +=
+ random_u32 (&tm->seed) % (1 + tm->max_n_msg_bytes -
+ tm->min_n_msg_bytes);
return r;
}
static mc_test_main_t mc_test_main;
-static void serialize_test_msg (serialize_main_t * m, va_list * va)
+static void
+serialize_test_msg (serialize_main_t * m, va_list * va)
{
- mc_test_main_t * tm = &mc_test_main;
+ mc_test_main_t *tm = &mc_test_main;
u32 n_bytes = choose_msg_size (tm);
- u8 * msg;
+ u8 *msg;
int i;
serialize_integer (m, n_bytes, sizeof (n_bytes));
msg = serialize_get (m, n_bytes);
@@ -56,11 +60,12 @@ static void serialize_test_msg (serialize_main_t * m, va_list * va)
tm->tx_serial += n_bytes;
}
-static void unserialize_test_msg (serialize_main_t * m, va_list * va)
+static void
+unserialize_test_msg (serialize_main_t * m, va_list * va)
{
- mc_test_main_t * tm = &mc_test_main;
+ mc_test_main_t *tm = &mc_test_main;
u32 i, n_bytes, dump_msg = tm->verbose;
- u8 * p;
+ u8 *p;
unserialize_integer (m, &n_bytes, sizeof (n_bytes));
p = unserialize_get (m, n_bytes);
if (tm->validate)
@@ -76,45 +81,43 @@ static void unserialize_test_msg (serialize_main_t * m, va_list * va)
tm->rx_serial += n_bytes;
}
-MC_SERIALIZE_MSG (test_msg, static) = {
- .name = "test_msg",
- .serialize = serialize_test_msg,
- .unserialize = unserialize_test_msg,
-};
+MC_SERIALIZE_MSG (test_msg, static) =
+{
+.name = "test_msg",.serialize = serialize_test_msg,.unserialize =
+ unserialize_test_msg,};
#define SERIALIZE 1
#define EVENT_JOIN_STREAM 10
#define EVENT_SEND_DATA 11
-static void test_rx_callback (mc_main_t * mcm,
- mc_stream_t * stream,
- mc_peer_id_t peer_id,
- u32 buffer_index)
+static void
+test_rx_callback (mc_main_t * mcm,
+ mc_stream_t * stream,
+ mc_peer_id_t peer_id, u32 buffer_index)
{
if (SERIALIZE)
{
- return mc_unserialize (mcm, stream, buffer_index);
+ return mc_unserialize (mcm, stream, buffer_index);
}
else
{
#if DEBUG > 1
- vlib_main_t * vm = mcm->vlib_main;
- vlib_buffer_t * b = vlib_get_buffer (vm, buffer_index);
- u8 * dp = vlib_buffer_get_current (b);
-
- fformat(stdout, "RX from %U %U\n",
- stream->transport->format_peer_id, peer_id,
- format_hex_bytes, dp, tm->n_msg_bytes);
-
+ vlib_main_t *vm = mcm->vlib_main;
+ vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
+ u8 *dp = vlib_buffer_get_current (b);
+
+ fformat (stdout, "RX from %U %U\n",
+ stream->transport->format_peer_id, peer_id,
+ format_hex_bytes, dp, tm->n_msg_bytes);
+
#endif
}
}
static u8 *
test_snapshot_callback (mc_main_t * mcm,
- u8 * data_vector,
- u32 last_global_sequence_processed)
+ u8 * data_vector, u32 last_global_sequence_processed)
{
if (SERIALIZE)
{
@@ -133,9 +136,7 @@ test_snapshot_callback (mc_main_t * mcm,
}
static void
-test_handle_snapshot_callback (mc_main_t * mcm,
- u8 * data,
- u32 n_data_bytes)
+test_handle_snapshot_callback (mc_main_t * mcm, u8 * data, u32 n_data_bytes)
{
if (SERIALIZE)
{
@@ -150,19 +151,18 @@ static mc_socket_main_t mc_socket_main;
static uword
mc_test_process (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * f)
+ vlib_node_runtime_t * node, vlib_frame_t * f)
{
- mc_test_main_t * tm = &mc_test_main;
- mc_socket_main_t * msm = &mc_socket_main;
+ mc_test_main_t *tm = &mc_test_main;
+ mc_socket_main_t *msm = &mc_socket_main;
mc_main_t *mcm = &msm->mc_main;
uword event_type, *event_data = 0;
- u32 data_serial=0, stream_index;
+ u32 data_serial = 0, stream_index;
f64 delay;
mc_stream_config_t config;
- clib_error_t * error;
+ clib_error_t *error;
int i;
- char *intfcs[] = { "eth1", "eth0", "ce" };
+ char *intfcs[] = { "eth1", "eth0", "ce" };
memset (&config, 0, sizeof (config));
config.name = "test";
@@ -175,7 +175,7 @@ mc_test_process (vlib_main_t * vm,
msm->multicast_tx_ip4_address_host_byte_order = 0xefff0100;
msm->base_multicast_udp_port_host_byte_order = 0xffab;
- error = mc_socket_main_init (&mc_socket_main, intfcs, ARRAY_LEN(intfcs));
+ error = mc_socket_main_init (&mc_socket_main, intfcs, ARRAY_LEN (intfcs));
if (error)
{
clib_error_report (error);
@@ -195,61 +195,66 @@ mc_test_process (vlib_main_t * vm,
stream_index = mc_stream_join (mcm, &config);
break;
- case EVENT_SEND_DATA: {
- f64 times[2];
-
- if (stream_index == ~0)
- stream_index = mc_stream_join (mcm, &config);
-
- times[0] = vlib_time_now (vm);
- for (i = 0; i < event_data[0]; i++)
- {
- u32 bi;
- if (SERIALIZE)
- {
- mc_serialize_stream (mcm, stream_index, &test_msg, data_serial);
- }
- else
- {
- u8 * mp;
- mp = mc_get_vlib_buffer (vm, sizeof (mp[0]), &bi);
- mp[0] = data_serial;
- mc_stream_send (mcm, stream_index, bi);
- }
- if (tm->min_delay > 0)
- {
- delay = tm->min_delay + random_f64 (&tm->seed) * (tm->max_delay - tm->min_delay);
- vlib_process_suspend (vm, delay);
- }
- data_serial++;
- }
- times[1] = vlib_time_now (vm);
- clib_warning ("done sending %d; %.4e per sec",
- event_data[0],
- (f64) event_data[0] / (times[1] - times[0]));
- break;
- }
+ case EVENT_SEND_DATA:
+ {
+ f64 times[2];
+
+ if (stream_index == ~0)
+ stream_index = mc_stream_join (mcm, &config);
+
+ times[0] = vlib_time_now (vm);
+ for (i = 0; i < event_data[0]; i++)
+ {
+ u32 bi;
+ if (SERIALIZE)
+ {
+ mc_serialize_stream (mcm, stream_index, &test_msg,
+ data_serial);
+ }
+ else
+ {
+ u8 *mp;
+ mp = mc_get_vlib_buffer (vm, sizeof (mp[0]), &bi);
+ mp[0] = data_serial;
+ mc_stream_send (mcm, stream_index, bi);
+ }
+ if (tm->min_delay > 0)
+ {
+ delay =
+ tm->min_delay +
+ random_f64 (&tm->seed) * (tm->max_delay -
+ tm->min_delay);
+ vlib_process_suspend (vm, delay);
+ }
+ data_serial++;
+ }
+ times[1] = vlib_time_now (vm);
+ clib_warning ("done sending %d; %.4e per sec",
+ event_data[0],
+ (f64) event_data[0] / (times[1] - times[0]));
+ break;
+ }
default:
clib_warning ("bug");
break;
}
-
+
if (event_data)
_vec_len (event_data) = 0;
}
}
-VLIB_REGISTER_NODE (mc_test_process_node,static) = {
- .function = mc_test_process,
- .type = VLIB_NODE_TYPE_PROCESS,
- .name = "mc-test-process",
-};
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (mc_test_process_node, static) =
+{
+.function = mc_test_process,.type = VLIB_NODE_TYPE_PROCESS,.name =
+ "mc-test-process",};
+/* *INDENT-ON* */
static clib_error_t *
mc_test_command (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
+ unformat_input_t * input, vlib_cli_command_t * cmd)
{
f64 npkts = 10;
@@ -260,63 +265,63 @@ mc_test_command (vlib_main_t * vm,
EVENT_JOIN_STREAM, 0);
return 0;
}
- else if (unformat (input, "send %f", &npkts)
- || unformat(input, "send"))
+ else if (unformat (input, "send %f", &npkts) || unformat (input, "send"))
{
vlib_process_signal_event (vm, mc_test_process_node.index,
EVENT_SEND_DATA, (uword) npkts);
vlib_cli_output (vm, "Send %.0f pkts...\n", npkts);
-
+
return 0;
}
else
return unformat_parse_error (input);
}
-VLIB_CLI_COMMAND (test_mc_command, static) = {
- .path = "test mc",
- .short_help = "Test mc command",
- .function = mc_test_command,
-};
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (test_mc_command, static) =
+{
+.path = "test mc",.short_help = "Test mc command",.function =
+ mc_test_command,};
+/* *INDENT-ON* */
static clib_error_t *
mc_show_command (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
+ unformat_input_t * input, vlib_cli_command_t * cmd)
{
mc_main_t *mcm = &mc_socket_main.mc_main;
vlib_cli_output (vm, "%U", format_mc_main, mcm);
return 0;
}
-VLIB_CLI_COMMAND (show_mc_command, static) = {
- .path = "show mc",
- .short_help = "Show mc command",
- .function = mc_show_command,
-};
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (show_mc_command, static) =
+{
+.path = "show mc",.short_help = "Show mc command",.function =
+ mc_show_command,};
+/* *INDENT-ON* */
static clib_error_t *
mc_clear_command (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
+ unformat_input_t * input, vlib_cli_command_t * cmd)
{
- mc_main_t * mcm = &mc_socket_main.mc_main;
+ mc_main_t *mcm = &mc_socket_main.mc_main;
mc_clear_stream_stats (mcm);
return 0;
}
-VLIB_CLI_COMMAND (clear_mc_command, static) = {
- .path = "clear mc",
- .short_help = "Clear mc command",
- .function = mc_clear_command,
-};
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (clear_mc_command, static) =
+{
+.path = "clear mc",.short_help = "Clear mc command",.function =
+ mc_clear_command,};
+/* *INDENT-ON* */
static clib_error_t *
mc_config (vlib_main_t * vm, unformat_input_t * input)
{
- mc_test_main_t * tm = &mc_test_main;
- mc_socket_main_t * msm = &mc_socket_main;
- clib_error_t * error = 0;
+ mc_test_main_t *tm = &mc_test_main;
+ mc_socket_main_t *msm = &mc_socket_main;
+ clib_error_t *error = 0;
tm->min_n_msg_bytes = 4;
tm->max_n_msg_bytes = 4;
@@ -362,9 +367,18 @@ mc_config (vlib_main_t * vm, unformat_input_t * input)
if (tm->n_packets_to_send > 0)
vlib_process_signal_event (vm, mc_test_process_node.index,
- EVENT_SEND_DATA, (uword) tm->n_packets_to_send);
+ EVENT_SEND_DATA,
+ (uword) tm->n_packets_to_send);
return error;
}
VLIB_CONFIG_FUNCTION (mc_config, "mc");
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vlib/example/plex_test.c b/vlib/example/plex_test.c
index 947f25bc50b..ce0c8ef1141 100644
--- a/vlib/example/plex_test.c
+++ b/vlib/example/plex_test.c
@@ -15,23 +15,22 @@
#include <vlib/parse.h>
#include <vlib/unix/unix.h>
-static u8 * format_value_v4_address (u8 * s, va_list * args)
+static u8 *
+format_value_v4_address (u8 * s, va_list * args)
{
vlib_parse_value_t *v = va_arg (*args, vlib_parse_value_t *);
u32 a = v->value.as_uword;
s = format (s, "%d.%d.%d.%d",
- (a>>24) & 0xFF,
- (a>>16) & 0xFF,
- (a>>8) & 0xFF,
- (a>>0) & 0xFF);
+ (a >> 24) & 0xFF,
+ (a >> 16) & 0xFF, (a >> 8) & 0xFF, (a >> 0) & 0xFF);
return s;
}
static vlib_parse_match_t
-v4_address_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
- vlib_lex_token_t *t, vlib_parse_value_t *valuep)
+v4_address_match (vlib_parse_main_t * pm, vlib_parse_type_t * type,
+ vlib_lex_token_t * t, vlib_parse_value_t * valuep)
{
u32 digit;
u32 value = 0;
@@ -42,19 +41,23 @@ v4_address_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
/* NUMBER DOT NUMBER DOT NUMBER DOT NUMBER */
- for (i = 0; i < 7; i++) {
- if ((i & 1) == 0) {
- if (t[i].token != VLIB_LEX_number)
- return VLIB_PARSE_MATCH_FAIL;
- if (t[i].value.as_uword > 0xff)
- return VLIB_PARSE_MATCH_FAIL;
- digit = t[i].value.as_uword;
- value = (value << 8) | digit;
- } else {
- if (t[i].token != VLIB_LEX_dot)
- return VLIB_PARSE_MATCH_FAIL;
+ for (i = 0; i < 7; i++)
+ {
+ if ((i & 1) == 0)
+ {
+ if (t[i].token != VLIB_LEX_number)
+ return VLIB_PARSE_MATCH_FAIL;
+ if (t[i].value.as_uword > 0xff)
+ return VLIB_PARSE_MATCH_FAIL;
+ digit = t[i].value.as_uword;
+ value = (value << 8) | digit;
+ }
+ else
+ {
+ if (t[i].token != VLIB_LEX_dot)
+ return VLIB_PARSE_MATCH_FAIL;
+ }
}
- }
/* note: caller advances by 1 */
pm->current_token_index += 6;
valuep->value.as_uword = value;
@@ -62,25 +65,22 @@ v4_address_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
}
PARSE_TYPE_INIT (v4_address, v4_address_match, 0, format_value_v4_address)
-
-static u8 * format_value_v4_address_and_mask (u8 * s, va_list * args)
+ static u8 *format_value_v4_address_and_mask (u8 * s, va_list * args)
{
vlib_parse_value_t *v = va_arg (*args, vlib_parse_value_t *);
- u32 * a = v->value.as_pointer;
+ u32 *a = v->value.as_pointer;
s = format (s, "%d.%d.%d.%d",
- (a[0]>>24) & 0xFF,
- (a[0]>>16) & 0xFF,
- (a[0]>>8) & 0xFF,
- (a[0]>>0) & 0xFF);
+ (a[0] >> 24) & 0xFF,
+ (a[0] >> 16) & 0xFF, (a[0] >> 8) & 0xFF, (a[0] >> 0) & 0xFF);
s = format (s, "/%d", a[1]);
return s;
}
static vlib_parse_match_t
-v4_address_and_mask_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
- vlib_lex_token_t *t, vlib_parse_value_t *valuep)
+v4_address_and_mask_match (vlib_parse_main_t * pm, vlib_parse_type_t * type,
+ vlib_lex_token_t * t, vlib_parse_value_t * valuep)
{
u32 digit;
u32 address = 0;
@@ -92,19 +92,23 @@ v4_address_and_mask_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
/* NUMBER DOT NUMBER DOT NUMBER DOT NUMBER */
- for (i = 0; i < 7; i++) {
- if ((i & 1) == 0) {
- if (t[i].token != VLIB_LEX_number)
- return VLIB_PARSE_MATCH_FAIL;
- if (t[i].value.as_uword > 0xff)
- return VLIB_PARSE_MATCH_FAIL;
- digit = t[i].value.as_uword;
- address = (address << 8) | digit;
- } else {
- if (t[i].token != VLIB_LEX_dot)
- return VLIB_PARSE_MATCH_FAIL;
+ for (i = 0; i < 7; i++)
+ {
+ if ((i & 1) == 0)
+ {
+ if (t[i].token != VLIB_LEX_number)
+ return VLIB_PARSE_MATCH_FAIL;
+ if (t[i].value.as_uword > 0xff)
+ return VLIB_PARSE_MATCH_FAIL;
+ digit = t[i].value.as_uword;
+ address = (address << 8) | digit;
+ }
+ else
+ {
+ if (t[i].token != VLIB_LEX_dot)
+ return VLIB_PARSE_MATCH_FAIL;
+ }
}
- }
if (t[7].token != VLIB_LEX_slash || t[8].token != VLIB_LEX_number)
return VLIB_PARSE_MATCH_FAIL;
@@ -118,135 +122,143 @@ v4_address_and_mask_match (vlib_parse_main_t *pm, vlib_parse_type_t *type,
return VLIB_PARSE_MATCH_VALUE;
}
-void v4_address_and_mask_cleanup (vlib_parse_value_t *valuep)
+void
+v4_address_and_mask_cleanup (vlib_parse_value_t * valuep)
{
- u32 * trash = valuep->value.as_pointer;
+ u32 *trash = valuep->value.as_pointer;
vec_free (trash);
}
-PARSE_TYPE_INIT (v4_address_and_mask, v4_address_and_mask_match,
- v4_address_and_mask_cleanup,
- format_value_v4_address_and_mask)
-
-vlib_lex_main_t vlib_lex_main;
+PARSE_TYPE_INIT (v4_address_and_mask, v4_address_and_mask_match,
+ v4_address_and_mask_cleanup,
+ format_value_v4_address_and_mask)
+ vlib_lex_main_t vlib_lex_main;
-vlib_parse_match_t eval_factor0 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+ vlib_parse_match_t eval_factor0 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item,
+ vlib_parse_value_t * value)
{
clib_warning ("%U", format_vlib_parse_value, pm);
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_factor1 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_factor1 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
clib_warning ("%U", format_vlib_parse_value, pm);
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_factor2 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_factor2 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
word a;
- int index = vec_len (pm->parse_value)-1;
-
- a = pm->parse_value [index].value.as_word;
-
+ int index = vec_len (pm->parse_value) - 1;
+
+ a = pm->parse_value[index].value.as_word;
+
pm->parse_value[index].value.as_word = -a;
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_term0 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_term0 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
clib_warning ("%U", format_vlib_parse_value, pm);
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_term1 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_term1 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
uword a, b;
- int index = vec_len (pm->parse_value)-2;
-
- a = pm->parse_value [index].value.as_uword;
- b = pm->parse_value [index+1].value.as_uword;
-
+ int index = vec_len (pm->parse_value) - 2;
+
+ a = pm->parse_value[index].value.as_uword;
+ b = pm->parse_value[index + 1].value.as_uword;
+
pm->parse_value[index].value.as_uword = a * b;
_vec_len (pm->parse_value) -= 1;
clib_warning ("%U", format_vlib_parse_value, pm);
-
+
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_term2 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_term2 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
uword a, b;
- int index = vec_len (pm->parse_value)-2;
-
- a = pm->parse_value [index].value.as_uword;
- b = pm->parse_value [index+1].value.as_uword;
-
+ int index = vec_len (pm->parse_value) - 2;
+
+ a = pm->parse_value[index].value.as_uword;
+ b = pm->parse_value[index + 1].value.as_uword;
+
pm->parse_value[index].value.as_uword = a / b;
_vec_len (pm->parse_value) -= 1;
clib_warning ("%U", format_vlib_parse_value, pm);
-
+
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_exp0 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_exp0 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_exp1 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_exp1 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
uword a, b;
- int index = vec_len (pm->parse_value)-2;
-
- a = pm->parse_value [index].value.as_uword;
- b = pm->parse_value [index+1].value.as_uword;
-
+ int index = vec_len (pm->parse_value) - 2;
+
+ a = pm->parse_value[index].value.as_uword;
+ b = pm->parse_value[index + 1].value.as_uword;
+
pm->parse_value[index].value.as_uword = a + b;
_vec_len (pm->parse_value) -= 1;
clib_warning ("%U", format_vlib_parse_value, pm);
-
+
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_exp2 (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+
+vlib_parse_match_t
+eval_exp2 (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
uword a, b;
- int index = vec_len (pm->parse_value)-2;
-
- a = pm->parse_value [index].value.as_uword;
- b = pm->parse_value [index+1].value.as_uword;
-
+ int index = vec_len (pm->parse_value) - 2;
+
+ a = pm->parse_value[index].value.as_uword;
+ b = pm->parse_value[index + 1].value.as_uword;
+
pm->parse_value[index].value.as_uword = a - b;
_vec_len (pm->parse_value) -= 1;
clib_warning ("%U", format_vlib_parse_value, pm);
-
+
return VLIB_PARSE_MATCH_RULE;
}
-vlib_parse_match_t eval_result (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+vlib_parse_match_t
+eval_result (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
clib_warning ("%U", format_vlib_parse_value, pm);
return VLIB_PARSE_MATCH_DONE;
}
-vlib_parse_match_t noop_match_rule (vlib_parse_main_t *pm,
- vlib_parse_item_t *item,
- vlib_parse_value_t *value)
+vlib_parse_match_t
+noop_match_rule (vlib_parse_main_t * pm,
+ vlib_parse_item_t * item, vlib_parse_value_t * value)
{
clib_warning ("%U", format_vlib_parse_value, pm);
return VLIB_PARSE_MATCH_RULE;
@@ -330,18 +342,17 @@ vlib_parse_match_t eval##n (vlib_parse_main_t *pm, \
return VLIB_PARSE_MATCH_DONE; \
}
foreach_rule_evaluator
-
#undef _
-
PARSE_INIT (r1, "eval <moo>", eval_result);
PARSE_INIT (r2, "<moo> = cow", eval0);
PARSE_INIT (r4, "<moo> = ", eval1);
PARSE_TYPE_INIT (moo, rule_match, 0, 0);
-#endif
+#endif
-clib_error_t *test_init (vlib_main_t *vm)
+clib_error_t *
+test_init (vlib_main_t * vm)
{
clib_error_t *error;
@@ -356,13 +367,13 @@ VLIB_INIT_FUNCTION (test_init);
clib_error_t *
vlib_stdlex_init (vlib_main_t * vm)
{
- vlib_lex_main_t * lm = &vlib_lex_main;
+ vlib_lex_main_t *lm = &vlib_lex_main;
u16 top_index;
u16 slash_index, slash_star_index, slash_slash_index, slash_star_star_index;
u16 slash_token;
u16 word_index;
u16 zero_index, octal_index, decimal_index, hex_index, binary_index;
-
+
top_index = vlib_lex_add_table ("top");
#define foreach_top_level_single_character_token \
@@ -395,43 +406,52 @@ vlib_stdlex_init (vlib_main_t * vm)
binary_index = vlib_lex_add_table ("binary");
/* Support 0x 0b 0t and 0123 [octal] */
- vlib_lex_set_action_range (top_index, '0', '0', VLIB_LEX_START_NUMBER, 10, zero_index);
- vlib_lex_set_action_range (top_index, '1', '9', VLIB_LEX_START_NUMBER, 10, decimal_index);
-
- vlib_lex_set_action_range (zero_index, 0, 0x7F, VLIB_LEX_RETURN_AND_RESCAN, VLIB_LEX_number, top_index);
+ vlib_lex_set_action_range (top_index, '0', '0', VLIB_LEX_START_NUMBER, 10,
+ zero_index);
+ vlib_lex_set_action_range (top_index, '1', '9', VLIB_LEX_START_NUMBER, 10,
+ decimal_index);
+
+ vlib_lex_set_action_range (zero_index, 0, 0x7F, VLIB_LEX_RETURN_AND_RESCAN,
+ VLIB_LEX_number, top_index);
+
+ vlib_lex_set_action_range (zero_index, 'x', 'x', VLIB_LEX_IGNORE, ~0,
+ hex_index);
+ vlib_lex_set_action_range (zero_index, 'b', 'b', VLIB_LEX_IGNORE, ~0,
+ binary_index);
+ vlib_lex_set_action_range (zero_index, 't', 't', VLIB_LEX_IGNORE, ~0,
+ decimal_index);
+ vlib_lex_set_action_range (zero_index, '0', '7', VLIB_LEX_START_NUMBER, 8,
+ octal_index);
- vlib_lex_set_action_range (zero_index, 'x', 'x', VLIB_LEX_IGNORE, ~0, hex_index);
- vlib_lex_set_action_range (zero_index, 'b', 'b', VLIB_LEX_IGNORE, ~0, binary_index);
- vlib_lex_set_action_range (zero_index, 't', 't', VLIB_LEX_IGNORE, ~0, decimal_index);
- vlib_lex_set_action_range (zero_index, '0', '7', VLIB_LEX_START_NUMBER, 8, octal_index);
-
/* Octal */
vlib_lex_set_action_range (octal_index, 0, 0x7f, VLIB_LEX_RETURN_AND_RESCAN,
- VLIB_LEX_number, top_index);
- vlib_lex_set_action_range (octal_index, '0', '7', VLIB_LEX_ADD_TO_NUMBER, 8,
- octal_index);
+ VLIB_LEX_number, top_index);
+ vlib_lex_set_action_range (octal_index, '0', '7', VLIB_LEX_ADD_TO_NUMBER, 8,
+ octal_index);
/* Decimal */
- vlib_lex_set_action_range (decimal_index, 0, 0x7f, VLIB_LEX_RETURN_AND_RESCAN,
- VLIB_LEX_number, top_index);
- vlib_lex_set_action_range (decimal_index, '0', '9', VLIB_LEX_ADD_TO_NUMBER, 10,
- decimal_index);
-
+ vlib_lex_set_action_range (decimal_index, 0, 0x7f,
+ VLIB_LEX_RETURN_AND_RESCAN, VLIB_LEX_number,
+ top_index);
+ vlib_lex_set_action_range (decimal_index, '0', '9', VLIB_LEX_ADD_TO_NUMBER,
+ 10, decimal_index);
+
/* Hex */
vlib_lex_set_action_range (hex_index, 0, 0x7f, VLIB_LEX_RETURN_AND_RESCAN,
- VLIB_LEX_number, top_index);
- vlib_lex_set_action_range (hex_index, '0', '9', VLIB_LEX_ADD_TO_NUMBER, 16,
- hex_index);
- vlib_lex_set_action_range (hex_index, 'a', 'f', VLIB_LEX_ADD_TO_NUMBER, 16,
- hex_index);
- vlib_lex_set_action_range (hex_index, 'A', 'F', VLIB_LEX_ADD_TO_NUMBER, 16,
- hex_index);
-
+ VLIB_LEX_number, top_index);
+ vlib_lex_set_action_range (hex_index, '0', '9', VLIB_LEX_ADD_TO_NUMBER, 16,
+ hex_index);
+ vlib_lex_set_action_range (hex_index, 'a', 'f', VLIB_LEX_ADD_TO_NUMBER, 16,
+ hex_index);
+ vlib_lex_set_action_range (hex_index, 'A', 'F', VLIB_LEX_ADD_TO_NUMBER, 16,
+ hex_index);
+
/* Binary */
- vlib_lex_set_action_range (binary_index, 0, 0x7f, VLIB_LEX_RETURN_AND_RESCAN,
- VLIB_LEX_number, top_index);
- vlib_lex_set_action_range (binary_index, '0', '1', VLIB_LEX_ADD_TO_NUMBER, 2,
- binary_index);
+ vlib_lex_set_action_range (binary_index, 0, 0x7f,
+ VLIB_LEX_RETURN_AND_RESCAN, VLIB_LEX_number,
+ top_index);
+ vlib_lex_set_action_range (binary_index, '0', '1', VLIB_LEX_ADD_TO_NUMBER,
+ 2, binary_index);
/* c/c++ comment syntax is the worst... */
@@ -442,49 +462,66 @@ vlib_stdlex_init (vlib_main_t * vm)
slash_token = vlib_lex_add_token (lm, "slash");
/* Top level: see a slash, ignore, go to slash table */
- vlib_lex_set_action_range (top_index, '/', '/', VLIB_LEX_IGNORE, ~0, slash_index);
+ vlib_lex_set_action_range (top_index, '/', '/', VLIB_LEX_IGNORE, ~0,
+ slash_index);
/* default for slash table: return SLASH, go to top table */
- vlib_lex_set_action_range (slash_index, 1, 0x7F, VLIB_LEX_RETURN_AND_RESCAN, slash_token,
- top_index);
+ vlib_lex_set_action_range (slash_index, 1, 0x7F, VLIB_LEX_RETURN_AND_RESCAN,
+ slash_token, top_index);
/* see slash-slash, go to s-s table */
- vlib_lex_set_action_range (slash_index, '/', '/', VLIB_LEX_IGNORE, ~0,
- slash_slash_index);
+ vlib_lex_set_action_range (slash_index, '/', '/', VLIB_LEX_IGNORE, ~0,
+ slash_slash_index);
/* see slash-star, go to s-* table */
- vlib_lex_set_action_range (slash_index, '*', '*', VLIB_LEX_IGNORE, ~0,
- slash_star_index);
+ vlib_lex_set_action_range (slash_index, '*', '*', VLIB_LEX_IGNORE, ~0,
+ slash_star_index);
/* EOL in s-s table, ignore, go to top table */
- vlib_lex_set_action_range (slash_slash_index, '\n', '\n', VLIB_LEX_IGNORE, ~0,
- top_index);
+ vlib_lex_set_action_range (slash_slash_index, '\n', '\n', VLIB_LEX_IGNORE,
+ ~0, top_index);
/* slash-star blah blah star */
vlib_lex_set_action_range (slash_star_index, '*', '*', VLIB_LEX_IGNORE, ~0,
- slash_star_star_index);
+ slash_star_star_index);
/* slash star blah blah star slash */
- vlib_lex_set_action_range (slash_star_star_index, '/', '/', VLIB_LEX_IGNORE, ~0,
- top_index);
+ vlib_lex_set_action_range (slash_star_star_index, '/', '/', VLIB_LEX_IGNORE,
+ ~0, top_index);
/* LT, =, GT */
- vlib_lex_set_action_range (top_index, '<', '<', VLIB_LEX_RETURN, VLIB_LEX_lt, top_index);
- vlib_lex_set_action_range (top_index, '=', '=', VLIB_LEX_RETURN, VLIB_LEX_equals,
- top_index);
- vlib_lex_set_action_range (top_index, '>', '>', VLIB_LEX_RETURN, VLIB_LEX_gt, top_index);
+ vlib_lex_set_action_range (top_index, '<', '<', VLIB_LEX_RETURN,
+ VLIB_LEX_lt, top_index);
+ vlib_lex_set_action_range (top_index, '=', '=', VLIB_LEX_RETURN,
+ VLIB_LEX_equals, top_index);
+ vlib_lex_set_action_range (top_index, '>', '>', VLIB_LEX_RETURN,
+ VLIB_LEX_gt, top_index);
/* words, key and otherwise */
word_index = vlib_lex_add_table ("word");
- vlib_lex_set_action_range (top_index, 'a', 'z', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
- vlib_lex_set_action_range (top_index, 'A', 'Z', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
+ vlib_lex_set_action_range (top_index, 'a', 'z', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
+ vlib_lex_set_action_range (top_index, 'A', 'Z', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
- vlib_lex_set_action_range (word_index, 0, 0x7f, VLIB_LEX_KEYWORD_CHECK, ~0, top_index);
+ vlib_lex_set_action_range (word_index, 0, 0x7f, VLIB_LEX_KEYWORD_CHECK, ~0,
+ top_index);
+
+ vlib_lex_set_action_range (word_index, 'a', 'z', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
+ vlib_lex_set_action_range (word_index, 'A', 'Z', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
+ vlib_lex_set_action_range (word_index, '_', '_', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
+ vlib_lex_set_action_range (word_index, '0', '9', VLIB_LEX_ADD_TO_TOKEN, ~0,
+ word_index);
- vlib_lex_set_action_range (word_index, 'a', 'z', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
- vlib_lex_set_action_range (word_index, 'A', 'Z', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
- vlib_lex_set_action_range (word_index, '_', '_', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
- vlib_lex_set_action_range (word_index, '0', '9', VLIB_LEX_ADD_TO_TOKEN, ~0, word_index);
-
return 0;
}
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */