blob: ccb2b3923591c9e45afe30e73d141704b1659396 [file] [log] [blame]
Paul Moored15c3452006-08-03 16:48:37 -07001/*
2 * NetLabel Management Support
3 *
4 * This file defines the management functions for the NetLabel system. The
5 * NetLabel system manages static and dynamic label mappings for network
6 * protocols such as CIPSO and RIPSO.
7 *
8 * Author: Paul Moore <paul.moore@hp.com>
9 *
10 */
11
12/*
13 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
23 * the GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31#ifndef _NETLABEL_MGMT_H
32#define _NETLABEL_MGMT_H
33
34#include <net/netlabel.h>
35
36/*
Paul Moorefd385852006-09-25 15:56:37 -070037 * The following NetLabel payloads are supported by the management interface.
Paul Moored15c3452006-08-03 16:48:37 -070038 *
39 * o ADD:
40 * Sent by an application to add a domain mapping to the NetLabel system.
Paul Moored15c3452006-08-03 16:48:37 -070041 *
Paul Moorefd385852006-09-25 15:56:37 -070042 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -070043 *
Paul Moorefd385852006-09-25 15:56:37 -070044 * NLBL_MGMT_A_DOMAIN
45 * NLBL_MGMT_A_PROTOCOL
Paul Moored15c3452006-08-03 16:48:37 -070046 *
Paul Moorefd385852006-09-25 15:56:37 -070047 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
Paul Moored15c3452006-08-03 16:48:37 -070048 *
Paul Moorefd385852006-09-25 15:56:37 -070049 * NLBL_MGMT_A_CV4DOI
Paul Moored15c3452006-08-03 16:48:37 -070050 *
Paul Moorefd385852006-09-25 15:56:37 -070051 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
Paul Moored15c3452006-08-03 16:48:37 -070052 *
53 * o REMOVE:
54 * Sent by an application to remove a domain mapping from the NetLabel
Paul Moorefd385852006-09-25 15:56:37 -070055 * system.
Paul Moored15c3452006-08-03 16:48:37 -070056 *
Paul Moorefd385852006-09-25 15:56:37 -070057 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -070058 *
Paul Moorefd385852006-09-25 15:56:37 -070059 * NLBL_MGMT_A_DOMAIN
Paul Moored15c3452006-08-03 16:48:37 -070060 *
Paul Moorefd385852006-09-25 15:56:37 -070061 * o LISTALL:
Paul Moored15c3452006-08-03 16:48:37 -070062 * This message can be sent either from an application or by the kernel in
Paul Moorefd385852006-09-25 15:56:37 -070063 * response to an application generated LISTALL message. When sent by an
64 * application there is no payload and the NLM_F_DUMP flag should be set.
65 * The kernel should respond with a series of the following messages.
Paul Moored15c3452006-08-03 16:48:37 -070066 *
Paul Moorefd385852006-09-25 15:56:37 -070067 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -070068 *
Paul Moorefd385852006-09-25 15:56:37 -070069 * NLBL_MGMT_A_DOMAIN
70 * NLBL_MGMT_A_PROTOCOL
Paul Moored15c3452006-08-03 16:48:37 -070071 *
Paul Moorefd385852006-09-25 15:56:37 -070072 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
Paul Moored15c3452006-08-03 16:48:37 -070073 *
Paul Moorefd385852006-09-25 15:56:37 -070074 * NLBL_MGMT_A_CV4DOI
Paul Moored15c3452006-08-03 16:48:37 -070075 *
Paul Moorefd385852006-09-25 15:56:37 -070076 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
Paul Moored15c3452006-08-03 16:48:37 -070077 *
78 * o ADDDEF:
79 * Sent by an application to set the default domain mapping for the NetLabel
Paul Moorefd385852006-09-25 15:56:37 -070080 * system.
Paul Moored15c3452006-08-03 16:48:37 -070081 *
Paul Moorefd385852006-09-25 15:56:37 -070082 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -070083 *
Paul Moorefd385852006-09-25 15:56:37 -070084 * NLBL_MGMT_A_PROTOCOL
Paul Moored15c3452006-08-03 16:48:37 -070085 *
Paul Moorefd385852006-09-25 15:56:37 -070086 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
Paul Moored15c3452006-08-03 16:48:37 -070087 *
Paul Moorefd385852006-09-25 15:56:37 -070088 * NLBL_MGMT_A_CV4DOI
Paul Moored15c3452006-08-03 16:48:37 -070089 *
Paul Moorefd385852006-09-25 15:56:37 -070090 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
Paul Moored15c3452006-08-03 16:48:37 -070091 *
92 * o REMOVEDEF:
93 * Sent by an application to remove the default domain mapping from the
Paul Moorefd385852006-09-25 15:56:37 -070094 * NetLabel system, there is no payload.
Paul Moored15c3452006-08-03 16:48:37 -070095 *
96 * o LISTDEF:
97 * This message can be sent either from an application or by the kernel in
98 * response to an application generated LISTDEF message. When sent by an
Paul Moorefd385852006-09-25 15:56:37 -070099 * application there is no payload. On success the kernel should send a
100 * response using the following format.
Paul Moored15c3452006-08-03 16:48:37 -0700101 *
Paul Moorefd385852006-09-25 15:56:37 -0700102 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -0700103 *
Paul Moorefd385852006-09-25 15:56:37 -0700104 * NLBL_MGMT_A_PROTOCOL
Paul Moored15c3452006-08-03 16:48:37 -0700105 *
Paul Moorefd385852006-09-25 15:56:37 -0700106 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
Paul Moored15c3452006-08-03 16:48:37 -0700107 *
Paul Moorefd385852006-09-25 15:56:37 -0700108 * NLBL_MGMT_A_CV4DOI
Paul Moored15c3452006-08-03 16:48:37 -0700109 *
Paul Moorefd385852006-09-25 15:56:37 -0700110 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
Paul Moored15c3452006-08-03 16:48:37 -0700111 *
Paul Moorefd385852006-09-25 15:56:37 -0700112 * o PROTOCOLS:
113 * Sent by an application to request a list of configured NetLabel protocols
114 * in the kernel. When sent by an application there is no payload and the
115 * NLM_F_DUMP flag should be set. The kernel should respond with a series of
116 * the following messages.
Paul Moored15c3452006-08-03 16:48:37 -0700117 *
Paul Moorefd385852006-09-25 15:56:37 -0700118 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -0700119 *
Paul Moorefd385852006-09-25 15:56:37 -0700120 * NLBL_MGMT_A_PROTOCOL
Paul Moored15c3452006-08-03 16:48:37 -0700121 *
122 * o VERSION:
Paul Moorefd385852006-09-25 15:56:37 -0700123 * Sent by an application to request the NetLabel version. When sent by an
124 * application there is no payload. This message type is also used by the
125 * kernel to respond to an VERSION request.
Paul Moored15c3452006-08-03 16:48:37 -0700126 *
Paul Moorefd385852006-09-25 15:56:37 -0700127 * Required attributes:
Paul Moored15c3452006-08-03 16:48:37 -0700128 *
Paul Moorefd385852006-09-25 15:56:37 -0700129 * NLBL_MGMT_A_VERSION
Paul Moored15c3452006-08-03 16:48:37 -0700130 *
131 */
132
133/* NetLabel Management commands */
134enum {
135 NLBL_MGMT_C_UNSPEC,
Paul Moored15c3452006-08-03 16:48:37 -0700136 NLBL_MGMT_C_ADD,
137 NLBL_MGMT_C_REMOVE,
Paul Moorefd385852006-09-25 15:56:37 -0700138 NLBL_MGMT_C_LISTALL,
Paul Moored15c3452006-08-03 16:48:37 -0700139 NLBL_MGMT_C_ADDDEF,
140 NLBL_MGMT_C_REMOVEDEF,
141 NLBL_MGMT_C_LISTDEF,
Paul Moorefd385852006-09-25 15:56:37 -0700142 NLBL_MGMT_C_PROTOCOLS,
Paul Moored15c3452006-08-03 16:48:37 -0700143 NLBL_MGMT_C_VERSION,
144 __NLBL_MGMT_C_MAX,
145};
146#define NLBL_MGMT_C_MAX (__NLBL_MGMT_C_MAX - 1)
147
Paul Moorefd385852006-09-25 15:56:37 -0700148/* NetLabel Management attributes */
149enum {
150 NLBL_MGMT_A_UNSPEC,
151 NLBL_MGMT_A_DOMAIN,
152 /* (NLA_NUL_STRING)
153 * the NULL terminated LSM domain string */
154 NLBL_MGMT_A_PROTOCOL,
155 /* (NLA_U32)
156 * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
157 NLBL_MGMT_A_VERSION,
158 /* (NLA_U32)
159 * the NetLabel protocol version number (defined by
160 * NETLBL_PROTO_VERSION) */
161 NLBL_MGMT_A_CV4DOI,
162 /* (NLA_U32)
163 * the CIPSOv4 DOI value */
164 __NLBL_MGMT_A_MAX,
165};
166#define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
167
Paul Moored15c3452006-08-03 16:48:37 -0700168/* NetLabel protocol functions */
169int netlbl_mgmt_genl_init(void);
170
Paul Moore23bcdc12007-07-18 12:28:45 -0400171/* NetLabel misc management functions */
172void netlbl_mgmt_protocount_inc(void);
173void netlbl_mgmt_protocount_dec(void);
174u32 netlbl_mgmt_protocount_value(void);
175
Paul Moored15c3452006-08-03 16:48:37 -0700176#endif