Lines Matching defs:doi_def
372 * @doi_def: the DOI structure
378 * ensure that the mapping table specified in @doi_def->map meets all of the
383 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def,
392 doi = doi_def->doi;
393 doi_type = doi_def->type;
395 if (doi_def->doi == CIPSO_V4_DOI_UNKNOWN)
398 switch (doi_def->tags[iter]) {
403 if (doi_def->type != CIPSO_V4_MAP_PASS)
407 if (doi_def->type != CIPSO_V4_MAP_LOCAL)
419 refcount_set(&doi_def->refcount, 1);
422 if (cipso_v4_doi_search(doi_def->doi)) {
427 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list);
459 * @doi_def: the DOI definition
465 void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
467 if (!doi_def)
470 switch (doi_def->type) {
472 kfree(doi_def->map.std->lvl.cipso);
473 kfree(doi_def->map.std->lvl.local);
474 kfree(doi_def->map.std->cat.cipso);
475 kfree(doi_def->map.std->cat.local);
476 kfree(doi_def->map.std);
479 kfree(doi_def);
494 struct cipso_v4_doi *doi_def;
496 doi_def = container_of(entry, struct cipso_v4_doi, rcu);
497 cipso_v4_doi_free(doi_def);
514 struct cipso_v4_doi *doi_def;
518 doi_def = cipso_v4_doi_search(doi);
519 if (!doi_def) {
524 list_del_rcu(&doi_def->list);
527 cipso_v4_doi_putdef(doi_def);
555 struct cipso_v4_doi *doi_def;
558 doi_def = cipso_v4_doi_search(doi);
559 if (!doi_def)
561 if (!refcount_inc_not_zero(&doi_def->refcount))
562 doi_def = NULL;
566 return doi_def;
571 * @doi_def: the DOI definition
577 void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def)
579 if (!doi_def)
582 if (!refcount_dec_and_test(&doi_def->refcount))
586 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu);
603 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
634 * @doi_def: the DOI definition
643 static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
645 switch (doi_def->type) {
649 if ((level < doi_def->map.std->lvl.cipso_size) &&
650 (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))
660 * @doi_def: the DOI definition
670 static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def,
674 switch (doi_def->type) {
679 if (host_lvl < doi_def->map.std->lvl.local_size &&
680 doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) {
681 *net_lvl = doi_def->map.std->lvl.local[host_lvl];
692 * @doi_def: the DOI definition
702 static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def,
708 switch (doi_def->type) {
713 map_tbl = doi_def->map.std;
716 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl];
727 * @doi_def: the DOI definition
737 static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def,
746 switch (doi_def->type) {
750 cipso_cat_size = doi_def->map.std->cat.cipso_size;
751 cipso_array = doi_def->map.std->cat.cipso;
774 * @doi_def: the DOI definition
785 static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def,
797 if (doi_def->type == CIPSO_V4_MAP_TRANS) {
798 host_cat_size = doi_def->map.std->cat.local_size;
799 host_cat_array = doi_def->map.std->cat.local;
808 switch (doi_def->type) {
835 * @doi_def: the DOI definition
846 static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def,
858 if (doi_def->type == CIPSO_V4_MAP_TRANS) {
859 net_cat_size = doi_def->map.std->cat.cipso_size;
860 net_cat_array = doi_def->map.std->cat.cipso;
874 switch (doi_def->type) {
898 * @doi_def: the DOI definition
908 static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def,
916 if (doi_def->type != CIPSO_V4_MAP_PASS || enumcat_len & 0x01)
931 * @doi_def: the DOI definition
943 static int cipso_v4_map_cat_enum_hton(const struct cipso_v4_doi *doi_def,
967 * @doi_def: the DOI definition
978 static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def,
999 * @doi_def: the DOI definition
1009 static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def,
1018 if (doi_def->type != CIPSO_V4_MAP_PASS || rngcat_len & 0x01)
1039 * @doi_def: the DOI definition
1051 static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def,
1099 * @doi_def: the DOI definition
1110 static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def,
1144 * @doi_def: the DOI definition
1152 static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def,
1158 *(__be32 *)&buf[2] = htonl(doi_def->doi);
1163 * @doi_def: the DOI definition
1175 static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def,
1187 ret_val = cipso_v4_map_lvl_hton(doi_def,
1194 ret_val = cipso_v4_map_cat_rbm_hton(doi_def,
1221 * @doi_def: the DOI definition
1231 static int cipso_v4_parsetag_rbm(const struct cipso_v4_doi *doi_def,
1239 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1246 ret_val = cipso_v4_map_cat_rbm_ntoh(doi_def,
1264 * @doi_def: the DOI definition
1274 static int cipso_v4_gentag_enum(const struct cipso_v4_doi *doi_def,
1286 ret_val = cipso_v4_map_lvl_hton(doi_def,
1293 ret_val = cipso_v4_map_cat_enum_hton(doi_def,
1313 * @doi_def: the DOI definition
1323 static int cipso_v4_parsetag_enum(const struct cipso_v4_doi *doi_def,
1331 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1338 ret_val = cipso_v4_map_cat_enum_ntoh(doi_def,
1355 * @doi_def: the DOI definition
1365 static int cipso_v4_gentag_rng(const struct cipso_v4_doi *doi_def,
1377 ret_val = cipso_v4_map_lvl_hton(doi_def,
1384 ret_val = cipso_v4_map_cat_rng_hton(doi_def,
1404 * @doi_def: the DOI definition
1413 static int cipso_v4_parsetag_rng(const struct cipso_v4_doi *doi_def,
1421 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1428 ret_val = cipso_v4_map_cat_rng_ntoh(doi_def,
1446 * @doi_def: the DOI definition
1456 static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def,
1473 * @doi_def: the DOI definition
1482 static int cipso_v4_parsetag_loc(const struct cipso_v4_doi *doi_def,
1558 struct cipso_v4_doi *doi_def = NULL;
1569 doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2]));
1570 if (!doi_def) {
1578 for (tag_iter = 0; doi_def->tags[tag_iter] != tag[0];)
1579 if (doi_def->tags[tag_iter] == CIPSO_V4_TAG_INVALID ||
1610 if (cipso_v4_map_lvl_valid(doi_def,
1616 cipso_v4_map_cat_rbm_valid(doi_def,
1630 if (cipso_v4_map_lvl_valid(doi_def,
1636 cipso_v4_map_cat_enum_valid(doi_def,
1649 if (cipso_v4_map_lvl_valid(doi_def,
1655 cipso_v4_map_cat_rng_valid(doi_def,
1753 * @doi_def: the CIPSO DOI to use
1763 const struct cipso_v4_doi *doi_def,
1778 switch (doi_def->tags[iter]) {
1780 ret_val = cipso_v4_gentag_rbm(doi_def,
1786 ret_val = cipso_v4_gentag_enum(doi_def,
1792 ret_val = cipso_v4_gentag_rng(doi_def,
1798 ret_val = cipso_v4_gentag_loc(doi_def,
1810 doi_def->tags[iter] != CIPSO_V4_TAG_INVALID);
1813 cipso_v4_gentag_hdr(doi_def, buf, ret_val);
1820 * @doi_def: the CIPSO DOI to use
1832 const struct cipso_v4_doi *doi_def,
1860 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
1907 * @doi_def: the CIPSO DOI to use
1917 const struct cipso_v4_doi *doi_def,
1937 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
2090 struct cipso_v4_doi *doi_def;
2097 doi_def = cipso_v4_doi_search(doi);
2098 if (!doi_def)
2105 ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr);
2108 ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr);
2111 ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr);
2114 ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr);
2156 * @doi_def: the DOI structure
2165 const struct cipso_v4_doi *doi_def,
2176 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);