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

Function parse_sp6_tokens

dpdk/examples/ipsec-secgw/sp6.c:182–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void
183parse_sp6_tokens(char **tokens, uint32_t n_tokens,
184 struct parse_status *status)
185{
186 struct acl6_rules *rule_ipv6 = NULL;
187
188 uint32_t *ri = NULL; /* rule index */
189 uint32_t ti = 0; /* token index */
190 uint32_t tv;
191
192 uint32_t esp_p = 0;
193 uint32_t protect_p = 0;
194 uint32_t bypass_p = 0;
195 uint32_t discard_p = 0;
196 uint32_t pri_p = 0;
197 uint32_t src_p = 0;
198 uint32_t dst_p = 0;
199 uint32_t proto_p = 0;
200 uint32_t sport_p = 0;
201 uint32_t dport_p = 0;
202
203 if (strcmp(tokens[1], "in") == 0) {
204 ri = &nb_acl6_rules_in;
205
206 if (extend_sp_arr(&acl6_rules_in, nb_acl6_rules_in,
207 &sp_in_sz) < 0)
208 return;
209
210 rule_ipv6 = &acl6_rules_in[*ri];
211
212 } else if (strcmp(tokens[1], "out") == 0) {
213 ri = &nb_acl6_rules_out;
214
215 if (extend_sp_arr(&acl6_rules_out, nb_acl6_rules_out,
216 &sp_out_sz) < 0)
217 return;
218
219 rule_ipv6 = &acl6_rules_out[*ri];
220
221 } else {
222 APP_CHECK(0, status, "unrecognized input \"%s\", expect"
223 " \"in\" or \"out\"\n", tokens[ti]);
224 return;
225 }
226
227 rule_ipv6->data.category_mask = 1;
228
229
230 for (ti = 2; ti < n_tokens; ti++) {
231 if (strcmp(tokens[ti], "esp") == 0) {
232 /* currently do nothing */
233 APP_CHECK_PRESENCE(esp_p, tokens[ti], status);
234 if (status->status < 0)
235 return;
236 esp_p = 1;
237 continue;
238 }
239

Callers 1

Calls 4

strcmpFunction · 0.85
extend_sp_arrFunction · 0.70
parse_ipv6_addrFunction · 0.70
parse_rangeFunction · 0.70

Tested by

no test coverage detected