diff options
Diffstat (limited to 'sys/netgraph/ng_ppp.c')
| -rw-r--r-- | sys/netgraph/ng_ppp.c | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c index 2097de1c5565..7cfb4b6a0127 100644 --- a/sys/netgraph/ng_ppp.c +++ b/sys/netgraph/ng_ppp.c @@ -57,6 +57,7 @@ #include <netgraph/ng_message.h> #include <netgraph/netgraph.h> +#include <netgraph/ng_parse.h> #include <netgraph/ng_ppp.h> #include <netgraph/ng_vjc.h> @@ -205,6 +206,78 @@ static int ng_ppp_config_valid(node_p node, static void ng_ppp_update(node_p node, int newConf); static void ng_ppp_free_frags(node_p node); +/* Parse type for struct ng_ppp_link_config */ +static const struct ng_parse_struct_info + ng_ppp_link_type_info = NG_PPP_LINK_TYPE_INFO; +static const struct ng_parse_type ng_ppp_link_type = { + &ng_parse_struct_type, + &ng_ppp_link_type_info, +}; + +/* Parse type for struct ng_ppp_node_config */ +struct ng_parse_fixedarray_info ng_ppp_array_info = { + &ng_ppp_link_type, + NG_PPP_MAX_LINKS +}; +static const struct ng_parse_type ng_ppp_link_array_type = { + &ng_parse_fixedarray_type, + &ng_ppp_array_info, +}; +static const struct ng_parse_struct_info ng_ppp_config_type_info + = NG_PPP_CONFIG_TYPE_INFO(&ng_ppp_link_array_type); +static const struct ng_parse_type ng_ppp_config_type = { + &ng_parse_struct_type, + &ng_ppp_config_type_info +}; + +/* Parse type for struct ng_ppp_link_stat */ +static const struct ng_parse_struct_info + ng_ppp_stats_type_info = NG_PPP_STATS_TYPE_INFO; +static const struct ng_parse_type ng_ppp_stats_type = { + &ng_parse_struct_type, + &ng_ppp_stats_type_info +}; + +/* List of commands and how to convert arguments to/from ASCII */ +static const struct ng_cmdlist ng_ppp_cmds[] = { + { + NGM_PPP_COOKIE, + NGM_PPP_SET_CONFIG, + "setconfig", + &ng_ppp_config_type, + NULL + }, + { + NGM_PPP_COOKIE, + NGM_PPP_GET_CONFIG, + "getconfig", + NULL, + &ng_ppp_config_type + }, + { + NGM_PPP_COOKIE, + NGM_PPP_GET_LINK_STATS, + "getstats", + &ng_parse_int16_type, + &ng_ppp_stats_type + }, + { + NGM_PPP_COOKIE, + NGM_PPP_CLR_LINK_STATS, + "clrstats", + &ng_parse_int16_type, + NULL + }, + { + NGM_PPP_COOKIE, + NGM_PPP_GETCLR_LINK_STATS, + "getclrstats", + &ng_parse_int16_type, + &ng_ppp_stats_type + }, + { 0 } +}; + /* Node type descriptor */ static struct ng_type ng_ppp_typestruct = { NG_VERSION, @@ -218,7 +291,8 @@ static struct ng_type ng_ppp_typestruct = { NULL, ng_ppp_rcvdata, ng_ppp_rcvdata, - ng_ppp_disconnect + ng_ppp_disconnect, + ng_ppp_cmds }; NETGRAPH_INIT(ppp, &ng_ppp_typestruct); @@ -334,7 +408,7 @@ ng_ppp_rcvmsg(node_p node, struct ng_mesg *msg, case NGM_PPP_SET_CONFIG: { struct ng_ppp_node_config *const newConf = - (struct ng_ppp_node_config *) msg->data; + (struct ng_ppp_node_config *) msg->data; /* Check for invalid or illegal config */ if (msg->header.arglen != sizeof(*newConf)) |
