xref: /openbmc/linux/net/netlabel/netlabel_mgmt.h (revision fd385855)
1d15c345fSPaul Moore /*
2d15c345fSPaul Moore  * NetLabel Management Support
3d15c345fSPaul Moore  *
4d15c345fSPaul Moore  * This file defines the management functions for the NetLabel system.  The
5d15c345fSPaul Moore  * NetLabel system manages static and dynamic label mappings for network
6d15c345fSPaul Moore  * protocols such as CIPSO and RIPSO.
7d15c345fSPaul Moore  *
8d15c345fSPaul Moore  * Author: Paul Moore <paul.moore@hp.com>
9d15c345fSPaul Moore  *
10d15c345fSPaul Moore  */
11d15c345fSPaul Moore 
12d15c345fSPaul Moore /*
13d15c345fSPaul Moore  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14d15c345fSPaul Moore  *
15d15c345fSPaul Moore  * This program is free software;  you can redistribute it and/or modify
16d15c345fSPaul Moore  * it under the terms of the GNU General Public License as published by
17d15c345fSPaul Moore  * the Free Software Foundation; either version 2 of the License, or
18d15c345fSPaul Moore  * (at your option) any later version.
19d15c345fSPaul Moore  *
20d15c345fSPaul Moore  * This program is distributed in the hope that it will be useful,
21d15c345fSPaul Moore  * but WITHOUT ANY WARRANTY;  without even the implied warranty of
22d15c345fSPaul Moore  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
23d15c345fSPaul Moore  * the GNU General Public License for more details.
24d15c345fSPaul Moore  *
25d15c345fSPaul Moore  * You should have received a copy of the GNU General Public License
26d15c345fSPaul Moore  * along with this program;  if not, write to the Free Software
27d15c345fSPaul Moore  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28d15c345fSPaul Moore  *
29d15c345fSPaul Moore  */
30d15c345fSPaul Moore 
31d15c345fSPaul Moore #ifndef _NETLABEL_MGMT_H
32d15c345fSPaul Moore #define _NETLABEL_MGMT_H
33d15c345fSPaul Moore 
34d15c345fSPaul Moore #include <net/netlabel.h>
35d15c345fSPaul Moore 
36d15c345fSPaul Moore /*
37fd385855SPaul Moore  * The following NetLabel payloads are supported by the management interface.
38d15c345fSPaul Moore  *
39d15c345fSPaul Moore  * o ADD:
40d15c345fSPaul Moore  *   Sent by an application to add a domain mapping to the NetLabel system.
41d15c345fSPaul Moore  *
42fd385855SPaul Moore  *   Required attributes:
43d15c345fSPaul Moore  *
44fd385855SPaul Moore  *     NLBL_MGMT_A_DOMAIN
45fd385855SPaul Moore  *     NLBL_MGMT_A_PROTOCOL
46d15c345fSPaul Moore  *
47fd385855SPaul Moore  *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
48d15c345fSPaul Moore  *
49fd385855SPaul Moore  *     NLBL_MGMT_A_CV4DOI
50d15c345fSPaul Moore  *
51fd385855SPaul Moore  *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
52d15c345fSPaul Moore  *
53d15c345fSPaul Moore  * o REMOVE:
54d15c345fSPaul Moore  *   Sent by an application to remove a domain mapping from the NetLabel
55fd385855SPaul Moore  *   system.
56d15c345fSPaul Moore  *
57fd385855SPaul Moore  *   Required attributes:
58d15c345fSPaul Moore  *
59fd385855SPaul Moore  *     NLBL_MGMT_A_DOMAIN
60d15c345fSPaul Moore  *
61fd385855SPaul Moore  * o LISTALL:
62d15c345fSPaul Moore  *   This message can be sent either from an application or by the kernel in
63fd385855SPaul Moore  *   response to an application generated LISTALL message.  When sent by an
64fd385855SPaul Moore  *   application there is no payload and the NLM_F_DUMP flag should be set.
65fd385855SPaul Moore  *   The kernel should respond with a series of the following messages.
66d15c345fSPaul Moore  *
67fd385855SPaul Moore  *   Required attributes:
68d15c345fSPaul Moore  *
69fd385855SPaul Moore  *     NLBL_MGMT_A_DOMAIN
70fd385855SPaul Moore  *     NLBL_MGMT_A_PROTOCOL
71d15c345fSPaul Moore  *
72fd385855SPaul Moore  *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
73d15c345fSPaul Moore  *
74fd385855SPaul Moore  *     NLBL_MGMT_A_CV4DOI
75d15c345fSPaul Moore  *
76fd385855SPaul Moore  *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
77d15c345fSPaul Moore  *
78d15c345fSPaul Moore  * o ADDDEF:
79d15c345fSPaul Moore  *   Sent by an application to set the default domain mapping for the NetLabel
80fd385855SPaul Moore  *   system.
81d15c345fSPaul Moore  *
82fd385855SPaul Moore  *   Required attributes:
83d15c345fSPaul Moore  *
84fd385855SPaul Moore  *     NLBL_MGMT_A_PROTOCOL
85d15c345fSPaul Moore  *
86fd385855SPaul Moore  *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
87d15c345fSPaul Moore  *
88fd385855SPaul Moore  *     NLBL_MGMT_A_CV4DOI
89d15c345fSPaul Moore  *
90fd385855SPaul Moore  *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
91d15c345fSPaul Moore  *
92d15c345fSPaul Moore  * o REMOVEDEF:
93d15c345fSPaul Moore  *   Sent by an application to remove the default domain mapping from the
94fd385855SPaul Moore  *   NetLabel system, there is no payload.
95d15c345fSPaul Moore  *
96d15c345fSPaul Moore  * o LISTDEF:
97d15c345fSPaul Moore  *   This message can be sent either from an application or by the kernel in
98d15c345fSPaul Moore  *   response to an application generated LISTDEF message.  When sent by an
99fd385855SPaul Moore  *   application there is no payload.  On success the kernel should send a
100fd385855SPaul Moore  *   response using the following format.
101d15c345fSPaul Moore  *
102fd385855SPaul Moore  *   Required attributes:
103d15c345fSPaul Moore  *
104fd385855SPaul Moore  *     NLBL_MGMT_A_PROTOCOL
105d15c345fSPaul Moore  *
106fd385855SPaul Moore  *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
107d15c345fSPaul Moore  *
108fd385855SPaul Moore  *     NLBL_MGMT_A_CV4DOI
109d15c345fSPaul Moore  *
110fd385855SPaul Moore  *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
111d15c345fSPaul Moore  *
112fd385855SPaul Moore  * o PROTOCOLS:
113fd385855SPaul Moore  *   Sent by an application to request a list of configured NetLabel protocols
114fd385855SPaul Moore  *   in the kernel.  When sent by an application there is no payload and the
115fd385855SPaul Moore  *   NLM_F_DUMP flag should be set.  The kernel should respond with a series of
116fd385855SPaul Moore  *   the following messages.
117d15c345fSPaul Moore  *
118fd385855SPaul Moore  *   Required attributes:
119d15c345fSPaul Moore  *
120fd385855SPaul Moore  *     NLBL_MGMT_A_PROTOCOL
121d15c345fSPaul Moore  *
122d15c345fSPaul Moore  * o VERSION:
123fd385855SPaul Moore  *   Sent by an application to request the NetLabel version.  When sent by an
124fd385855SPaul Moore  *   application there is no payload.  This message type is also used by the
125fd385855SPaul Moore  *   kernel to respond to an VERSION request.
126d15c345fSPaul Moore  *
127fd385855SPaul Moore  *   Required attributes:
128d15c345fSPaul Moore  *
129fd385855SPaul Moore  *     NLBL_MGMT_A_VERSION
130d15c345fSPaul Moore  *
131d15c345fSPaul Moore  */
132d15c345fSPaul Moore 
133d15c345fSPaul Moore /* NetLabel Management commands */
134d15c345fSPaul Moore enum {
135d15c345fSPaul Moore 	NLBL_MGMT_C_UNSPEC,
136d15c345fSPaul Moore 	NLBL_MGMT_C_ADD,
137d15c345fSPaul Moore 	NLBL_MGMT_C_REMOVE,
138fd385855SPaul Moore 	NLBL_MGMT_C_LISTALL,
139d15c345fSPaul Moore 	NLBL_MGMT_C_ADDDEF,
140d15c345fSPaul Moore 	NLBL_MGMT_C_REMOVEDEF,
141d15c345fSPaul Moore 	NLBL_MGMT_C_LISTDEF,
142fd385855SPaul Moore 	NLBL_MGMT_C_PROTOCOLS,
143d15c345fSPaul Moore 	NLBL_MGMT_C_VERSION,
144d15c345fSPaul Moore 	__NLBL_MGMT_C_MAX,
145d15c345fSPaul Moore };
146d15c345fSPaul Moore #define NLBL_MGMT_C_MAX (__NLBL_MGMT_C_MAX - 1)
147d15c345fSPaul Moore 
148fd385855SPaul Moore /* NetLabel Management attributes */
149fd385855SPaul Moore enum {
150fd385855SPaul Moore 	NLBL_MGMT_A_UNSPEC,
151fd385855SPaul Moore 	NLBL_MGMT_A_DOMAIN,
152fd385855SPaul Moore 	/* (NLA_NUL_STRING)
153fd385855SPaul Moore 	 * the NULL terminated LSM domain string */
154fd385855SPaul Moore 	NLBL_MGMT_A_PROTOCOL,
155fd385855SPaul Moore 	/* (NLA_U32)
156fd385855SPaul Moore 	 * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
157fd385855SPaul Moore 	NLBL_MGMT_A_VERSION,
158fd385855SPaul Moore 	/* (NLA_U32)
159fd385855SPaul Moore 	 * the NetLabel protocol version number (defined by
160fd385855SPaul Moore 	 * NETLBL_PROTO_VERSION) */
161fd385855SPaul Moore 	NLBL_MGMT_A_CV4DOI,
162fd385855SPaul Moore 	/* (NLA_U32)
163fd385855SPaul Moore 	 * the CIPSOv4 DOI value */
164fd385855SPaul Moore 	__NLBL_MGMT_A_MAX,
165fd385855SPaul Moore };
166fd385855SPaul Moore #define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
167fd385855SPaul Moore 
168d15c345fSPaul Moore /* NetLabel protocol functions */
169d15c345fSPaul Moore int netlbl_mgmt_genl_init(void);
170d15c345fSPaul Moore 
171d15c345fSPaul Moore #endif
172