MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipfw_nptv6_handler

Function ipfw_nptv6_handler

tools/ipfw/nptv6.c:90–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 */
89#define nptv6_check_name table_check_name
90void
91ipfw_nptv6_handler(int ac, char *av[])
92{
93 const char *name;
94 int tcmd;
95 uint8_t set;
96
97 if (g_co.use_set != 0)
98 set = g_co.use_set - 1;
99 else
100 set = 0;
101 ac--; av++;
102
103 NEED1("nptv6 needs instance name");
104 name = *av;
105 if (nptv6_check_name(name) != 0) {
106 if (strcmp(name, "all") == 0) {
107 name = NULL;
108 } else
109 errx(EX_USAGE, "nptv6 instance name %s is invalid",
110 name);
111 }
112 ac--; av++;
113 NEED1("nptv6 needs command");
114
115 tcmd = get_token(nptv6cmds, *av, "nptv6 command");
116 if (name == NULL && tcmd != TOK_DESTROY && tcmd != TOK_LIST)
117 errx(EX_USAGE, "nptv6 instance name required");
118 switch (tcmd) {
119 case TOK_CREATE:
120 ac--; av++;
121 nptv6_create(name, set, ac, av);
122 break;
123 case TOK_LIST:
124 nptv6_foreach(nptv6_show_cb, name, set, 1);
125 break;
126 case TOK_DESTROY:
127 if (name == NULL)
128 nptv6_foreach(nptv6_destroy_cb, NULL, set, 0);
129 else
130 nptv6_destroy(name, set);
131 break;
132 case TOK_STATS:
133 ac--; av++;
134 if (ac == 0) {
135 nptv6_stats(name, set);
136 break;
137 }
138 tcmd = get_token(nptv6statscmds, *av, "stats command");
139 if (tcmd == TOK_RESET)
140 nptv6_reset_stats(name, set);
141 }
142}
143
144
145static void

Callers 1

main.cFile · 0.85

Calls 7

strcmpFunction · 0.85
nptv6_foreachFunction · 0.85
get_tokenFunction · 0.70
nptv6_createFunction · 0.70
nptv6_destroyFunction · 0.70
nptv6_statsFunction · 0.70
nptv6_reset_statsFunction · 0.70

Tested by

no test coverage detected