Lines Matching defs:doi_def
371 * @doi_def: the DOI structure
377 * ensure that the mapping table specified in @doi_def->map meets all of the
382 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def,
391 doi = doi_def->doi;
392 doi_type = doi_def->type;
394 if (doi_def->doi == CIPSO_V4_DOI_UNKNOWN)
397 switch (doi_def->tags[iter]) {
402 if (doi_def->type != CIPSO_V4_MAP_PASS)
406 if (doi_def->type != CIPSO_V4_MAP_LOCAL)
418 refcount_set(&doi_def->refcount, 1);
421 if (cipso_v4_doi_search(doi_def->doi)) {
426 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list);
458 * @doi_def: the DOI definition
464 void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
466 if (!doi_def)
469 switch (doi_def->type) {
471 kfree(doi_def->map.std->lvl.cipso);
472 kfree(doi_def->map.std->lvl.local);
473 kfree(doi_def->map.std->cat.cipso);
474 kfree(doi_def->map.std->cat.local);
475 kfree(doi_def->map.std);
478 kfree(doi_def);
493 struct cipso_v4_doi *doi_def;
495 doi_def = container_of(entry, struct cipso_v4_doi, rcu);
496 cipso_v4_doi_free(doi_def);
513 struct cipso_v4_doi *doi_def;
517 doi_def = cipso_v4_doi_search(doi);
518 if (!doi_def) {
523 list_del_rcu(&doi_def->list);
526 cipso_v4_doi_putdef(doi_def);
554 struct cipso_v4_doi *doi_def;
557 doi_def = cipso_v4_doi_search(doi);
558 if (!doi_def)
560 if (!refcount_inc_not_zero(&doi_def->refcount))
561 doi_def = NULL;
565 return doi_def;
570 * @doi_def: the DOI definition
576 void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def)
578 if (!doi_def)
581 if (!refcount_dec_and_test(&doi_def->refcount))
585 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu);
602 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
633 * @doi_def: the DOI definition
642 static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
644 switch (doi_def->type) {
648 if ((level < doi_def->map.std->lvl.cipso_size) &&
649 (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))
659 * @doi_def: the DOI definition
669 static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def,
673 switch (doi_def->type) {
678 if (host_lvl < doi_def->map.std->lvl.local_size &&
679 doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) {
680 *net_lvl = doi_def->map.std->lvl.local[host_lvl];
691 * @doi_def: the DOI definition
701 static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def,
707 switch (doi_def->type) {
712 map_tbl = doi_def->map.std;
715 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl];
726 * @doi_def: the DOI definition
736 static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def,
745 switch (doi_def->type) {
749 cipso_cat_size = doi_def->map.std->cat.cipso_size;
750 cipso_array = doi_def->map.std->cat.cipso;
773 * @doi_def: the DOI definition
784 static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def,
796 if (doi_def->type == CIPSO_V4_MAP_TRANS) {
797 host_cat_size = doi_def->map.std->cat.local_size;
798 host_cat_array = doi_def->map.std->cat.local;
807 switch (doi_def->type) {
834 * @doi_def: the DOI definition
845 static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def,
857 if (doi_def->type == CIPSO_V4_MAP_TRANS) {
858 net_cat_size = doi_def->map.std->cat.cipso_size;
859 net_cat_array = doi_def->map.std->cat.cipso;
873 switch (doi_def->type) {
897 * @doi_def: the DOI definition
907 static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def,
915 if (doi_def->type != CIPSO_V4_MAP_PASS || enumcat_len & 0x01)
930 * @doi_def: the DOI definition
942 static int cipso_v4_map_cat_enum_hton(const struct cipso_v4_doi *doi_def,
966 * @doi_def: the DOI definition
977 static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def,
998 * @doi_def: the DOI definition
1008 static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def,
1017 if (doi_def->type != CIPSO_V4_MAP_PASS || rngcat_len & 0x01)
1038 * @doi_def: the DOI definition
1050 static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def,
1098 * @doi_def: the DOI definition
1109 static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def,
1143 * @doi_def: the DOI definition
1151 static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def,
1157 put_unaligned_be32(doi_def->doi, &buf[2]);
1162 * @doi_def: the DOI definition
1174 static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def,
1186 ret_val = cipso_v4_map_lvl_hton(doi_def,
1193 ret_val = cipso_v4_map_cat_rbm_hton(doi_def,
1220 * @doi_def: the DOI definition
1230 static int cipso_v4_parsetag_rbm(const struct cipso_v4_doi *doi_def,
1238 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1245 ret_val = cipso_v4_map_cat_rbm_ntoh(doi_def,
1263 * @doi_def: the DOI definition
1273 static int cipso_v4_gentag_enum(const struct cipso_v4_doi *doi_def,
1285 ret_val = cipso_v4_map_lvl_hton(doi_def,
1292 ret_val = cipso_v4_map_cat_enum_hton(doi_def,
1312 * @doi_def: the DOI definition
1322 static int cipso_v4_parsetag_enum(const struct cipso_v4_doi *doi_def,
1330 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1337 ret_val = cipso_v4_map_cat_enum_ntoh(doi_def,
1354 * @doi_def: the DOI definition
1364 static int cipso_v4_gentag_rng(const struct cipso_v4_doi *doi_def,
1376 ret_val = cipso_v4_map_lvl_hton(doi_def,
1383 ret_val = cipso_v4_map_cat_rng_hton(doi_def,
1403 * @doi_def: the DOI definition
1412 static int cipso_v4_parsetag_rng(const struct cipso_v4_doi *doi_def,
1420 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level);
1427 ret_val = cipso_v4_map_cat_rng_ntoh(doi_def,
1445 * @doi_def: the DOI definition
1455 static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def,
1472 * @doi_def: the DOI definition
1481 static int cipso_v4_parsetag_loc(const struct cipso_v4_doi *doi_def,
1557 struct cipso_v4_doi *doi_def = NULL;
1568 doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2]));
1569 if (!doi_def) {
1577 for (tag_iter = 0; doi_def->tags[tag_iter] != tag[0];)
1578 if (doi_def->tags[tag_iter] == CIPSO_V4_TAG_INVALID ||
1609 if (cipso_v4_map_lvl_valid(doi_def,
1615 cipso_v4_map_cat_rbm_valid(doi_def,
1629 if (cipso_v4_map_lvl_valid(doi_def,
1635 cipso_v4_map_cat_enum_valid(doi_def,
1648 if (cipso_v4_map_lvl_valid(doi_def,
1654 cipso_v4_map_cat_rng_valid(doi_def,
1752 * @doi_def: the CIPSO DOI to use
1762 const struct cipso_v4_doi *doi_def,
1777 switch (doi_def->tags[iter]) {
1779 ret_val = cipso_v4_gentag_rbm(doi_def,
1785 ret_val = cipso_v4_gentag_enum(doi_def,
1791 ret_val = cipso_v4_gentag_rng(doi_def,
1797 ret_val = cipso_v4_gentag_loc(doi_def,
1809 doi_def->tags[iter] != CIPSO_V4_TAG_INVALID);
1812 cipso_v4_gentag_hdr(doi_def, buf, ret_val);
1819 * @doi_def: the CIPSO DOI to use
1831 const struct cipso_v4_doi *doi_def,
1859 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
1906 * @doi_def: the CIPSO DOI to use
1916 const struct cipso_v4_doi *doi_def,
1936 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
2089 struct cipso_v4_doi *doi_def;
2096 doi_def = cipso_v4_doi_search(doi);
2097 if (!doi_def)
2104 ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr);
2107 ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr);
2110 ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr);
2113 ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr);
2155 * @doi_def: the DOI structure
2164 const struct cipso_v4_doi *doi_def,
2175 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);