/*
- * em_can.c
+ * em_canid.c
*
* This program is free software; you can distribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * Authors:
+ * Authors: Rostislav Lisovy <lisovy@gmail.com>
*/
#include <stdio.h>
#define EM_CAN_RULES_SIZE 32
-extern struct ematch_util can_ematch_util;
+extern struct ematch_util canid_ematch_util;
-static void can_print_usage(FILE *fd)
+static void canid_print_usage(FILE *fd)
{
fprintf(fd,
"Usage: can(MATCH)\n" \
"where: MATCH = {sff CANID | eff CANID}\n" \
" CANID := ID:MASK\n" \
"\n" \
- "Example: u32(sff 0x123 sff 0x124 sff 0x125:0xf)\n");
+ "Example: canid(sff 0x123 sff 0x124 sff 0x125:0xf)\n");
}
-static int can_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
+static int canid_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
{
unsigned int can_id = 0;
unsigned int can_mask = 0;
return 0;
}
-static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
+static int canid_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
struct bstr *args)
{
struct bstr *a;
memset(&rules_raw, 0, sizeof(rules_raw));
#define PARSE_ERR(CARG, FMT, ARGS...) \
- em_parse_error(EINVAL, args, CARG, &can_ematch_util, FMT ,##ARGS)
+ em_parse_error(EINVAL, args, CARG, &canid_ematch_util, FMT ,##ARGS)
if (args == NULL)
return PARSE_ERR(args, "can: missing arguments");
if (a == NULL)
return PARSE_ERR(a, "can: missing key");
- ret = can_parse_rule(&rules_raw[0], a, iseff);
+ ret = canid_parse_rule(&rules_raw[0], a, iseff);
if (ret == -1)
return PARSE_ERR(a, "can: Improperly formed CAN ID & mask\n");
if (a == NULL)
return PARSE_ERR(a, "can: missing argument");
- ret = can_parse_rule(&rules_raw[i], a, iseff);
+ ret = canid_parse_rule(&rules_raw[i], a, iseff);
if (ret == -1)
return PARSE_ERR(a, "can: Improperly formed CAN ID & mask\n");
}
return 0;
}
-static int can_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
+static int canid_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
int data_len)
{
struct can_filter *conf = data; /* Array with rules, fixed size EM_CAN_RULES_SIZE */
return 0;
}
-struct ematch_util can_ematch_util = {
- .kind = "can",
- .kind_num = TCF_EM_CAN,
- .parse_eopt = can_parse_eopt,
- .print_eopt = can_print_eopt,
- .print_usage = can_print_usage
+struct ematch_util canid_ematch_util = {
+ .kind = "canid",
+ .kind_num = TCF_EM_CANID,
+ .parse_eopt = canid_parse_eopt,
+ .print_eopt = canid_print_eopt,
+ .print_usage = canid_print_usage
};