1cb72d382SHuw Davies /*
2cb72d382SHuw Davies  * NetLabel CALIPSO Support
3cb72d382SHuw Davies  *
4cb72d382SHuw Davies  * This file defines the CALIPSO functions for the NetLabel system.  The
5cb72d382SHuw Davies  * NetLabel system manages static and dynamic label mappings for network
6cb72d382SHuw Davies  * protocols such as CIPSO and RIPSO.
7cb72d382SHuw Davies  *
8cb72d382SHuw Davies  * Authors: Paul Moore <paul@paul-moore.com>
9cb72d382SHuw Davies  *          Huw Davies <huw@codeweavers.com>
10cb72d382SHuw Davies  *
11cb72d382SHuw Davies  */
12cb72d382SHuw Davies 
13cb72d382SHuw Davies /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14cb72d382SHuw Davies  * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
15cb72d382SHuw Davies  *
16cb72d382SHuw Davies  * This program is free software;  you can redistribute it and/or modify
17cb72d382SHuw Davies  * it under the terms of the GNU General Public License as published by
18cb72d382SHuw Davies  * the Free Software Foundation; either version 2 of the License, or
19cb72d382SHuw Davies  * (at your option) any later version.
20cb72d382SHuw Davies  *
21cb72d382SHuw Davies  * This program is distributed in the hope that it will be useful,
22cb72d382SHuw Davies  * but WITHOUT ANY WARRANTY;  without even the implied warranty of
23cb72d382SHuw Davies  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
24cb72d382SHuw Davies  * the GNU General Public License for more details.
25cb72d382SHuw Davies  *
26cb72d382SHuw Davies  * You should have received a copy of the GNU General Public License
27cb72d382SHuw Davies  * along with this program;  if not, see <http://www.gnu.org/licenses/>.
28cb72d382SHuw Davies  *
29cb72d382SHuw Davies  */
30cb72d382SHuw Davies 
31cb72d382SHuw Davies #ifndef _NETLABEL_CALIPSO
32cb72d382SHuw Davies #define _NETLABEL_CALIPSO
33cb72d382SHuw Davies 
34cb72d382SHuw Davies #include <net/netlabel.h>
35cb72d382SHuw Davies #include <net/calipso.h>
36cb72d382SHuw Davies 
37cb72d382SHuw Davies /* The following NetLabel payloads are supported by the CALIPSO subsystem.
38cb72d382SHuw Davies  *
39cb72d382SHuw Davies  * o ADD:
40cb72d382SHuw Davies  *   Sent by an application to add a new DOI mapping table.
41cb72d382SHuw Davies  *
42cb72d382SHuw Davies  *   Required attributes:
43cb72d382SHuw Davies  *
44cb72d382SHuw Davies  *     NLBL_CALIPSO_A_DOI
45cb72d382SHuw Davies  *     NLBL_CALIPSO_A_MTYPE
46cb72d382SHuw Davies  *
47cb72d382SHuw Davies  *   If using CALIPSO_MAP_PASS no additional attributes are required.
48cb72d382SHuw Davies  *
49cb72d382SHuw Davies  */
50cb72d382SHuw Davies 
51cb72d382SHuw Davies /* NetLabel CALIPSO commands */
52cb72d382SHuw Davies enum {
53cb72d382SHuw Davies 	NLBL_CALIPSO_C_UNSPEC,
54cb72d382SHuw Davies 	NLBL_CALIPSO_C_ADD,
55cb72d382SHuw Davies 	NLBL_CALIPSO_C_REMOVE,
56cb72d382SHuw Davies 	NLBL_CALIPSO_C_LIST,
57cb72d382SHuw Davies 	NLBL_CALIPSO_C_LISTALL,
58cb72d382SHuw Davies 	__NLBL_CALIPSO_C_MAX,
59cb72d382SHuw Davies };
60cb72d382SHuw Davies 
61cb72d382SHuw Davies /* NetLabel CALIPSO attributes */
62cb72d382SHuw Davies enum {
63cb72d382SHuw Davies 	NLBL_CALIPSO_A_UNSPEC,
64cb72d382SHuw Davies 	NLBL_CALIPSO_A_DOI,
65cb72d382SHuw Davies 	/* (NLA_U32)
66cb72d382SHuw Davies 	 * the DOI value */
67cb72d382SHuw Davies 	NLBL_CALIPSO_A_MTYPE,
68cb72d382SHuw Davies 	/* (NLA_U32)
69cb72d382SHuw Davies 	 * the mapping table type (defined in the calipso.h header as
70cb72d382SHuw Davies 	 * CALIPSO_MAP_*) */
71cb72d382SHuw Davies 	__NLBL_CALIPSO_A_MAX,
72cb72d382SHuw Davies };
73cb72d382SHuw Davies 
74cb72d382SHuw Davies #define NLBL_CALIPSO_A_MAX (__NLBL_CALIPSO_A_MAX - 1)
75cb72d382SHuw Davies 
76cb72d382SHuw Davies /* NetLabel protocol functions */
77cb72d382SHuw Davies #if IS_ENABLED(CONFIG_IPV6)
78cb72d382SHuw Davies int netlbl_calipso_genl_init(void);
79cb72d382SHuw Davies #else
80cb72d382SHuw Davies static inline int netlbl_calipso_genl_init(void)
81cb72d382SHuw Davies {
82cb72d382SHuw Davies 	return 0;
83cb72d382SHuw Davies }
84cb72d382SHuw Davies #endif
85cb72d382SHuw Davies 
86cb72d382SHuw Davies int calipso_doi_add(struct calipso_doi *doi_def,
87cb72d382SHuw Davies 		    struct netlbl_audit *audit_info);
88cb72d382SHuw Davies void calipso_doi_free(struct calipso_doi *doi_def);
89cb72d382SHuw Davies 
90cb72d382SHuw Davies #endif
91