netlabel_mgmt.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  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. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  22. * the GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. *
  28. */
  29. #ifndef _NETLABEL_MGMT_H
  30. #define _NETLABEL_MGMT_H
  31. #include <net/netlabel.h>
  32. /*
  33. * The following NetLabel payloads are supported by the management interface,
  34. * all of which are preceeded by the nlmsghdr struct.
  35. *
  36. * o ACK:
  37. * Sent by the kernel in response to an applications message, applications
  38. * should never send this message.
  39. *
  40. * +----------------------+-----------------------+
  41. * | seq number (32 bits) | return code (32 bits) |
  42. * +----------------------+-----------------------+
  43. *
  44. * seq number: the sequence number of the original message, taken from the
  45. * nlmsghdr structure
  46. * return code: return value, based on errno values
  47. *
  48. * o ADD:
  49. * Sent by an application to add a domain mapping to the NetLabel system.
  50. * The kernel should respond with an ACK.
  51. *
  52. * +-------------------+
  53. * | domains (32 bits) | ...
  54. * +-------------------+
  55. *
  56. * domains: the number of domains in the message
  57. *
  58. * +--------------------------+-------------------------+
  59. * | domain string (variable) | protocol type (32 bits) | ...
  60. * +--------------------------+-------------------------+
  61. *
  62. * +-------------- ---- --- -- -
  63. * | mapping data ... repeated
  64. * +-------------- ---- --- -- -
  65. *
  66. * domain string: the domain string, NULL terminated
  67. * protocol type: the protocol type (defined by NETLBL_NLTYPE_*)
  68. * mapping data: specific to the map type (see below)
  69. *
  70. * NETLBL_NLTYPE_UNLABELED
  71. *
  72. * No mapping data for this protocol type.
  73. *
  74. * NETLBL_NLTYPE_CIPSOV4
  75. *
  76. * +---------------+
  77. * | doi (32 bits) |
  78. * +---------------+
  79. *
  80. * doi: the CIPSO DOI value
  81. *
  82. * o REMOVE:
  83. * Sent by an application to remove a domain mapping from the NetLabel
  84. * system. The kernel should ACK this message.
  85. *
  86. * +-------------------+
  87. * | domains (32 bits) | ...
  88. * +-------------------+
  89. *
  90. * domains: the number of domains in the message
  91. *
  92. * +--------------------------+
  93. * | domain string (variable) | ...
  94. * +--------------------------+
  95. *
  96. * domain string: the domain string, NULL terminated
  97. *
  98. * o LIST:
  99. * This message can be sent either from an application or by the kernel in
  100. * response to an application generated LIST message. When sent by an
  101. * application there is no payload. The kernel should respond to a LIST
  102. * message either with a LIST message on success or an ACK message on
  103. * failure.
  104. *
  105. * +-------------------+
  106. * | domains (32 bits) | ...
  107. * +-------------------+
  108. *
  109. * domains: the number of domains in the message
  110. *
  111. * +--------------------------+
  112. * | domain string (variable) | ...
  113. * +--------------------------+
  114. *
  115. * +-------------------------+-------------- ---- --- -- -
  116. * | protocol type (32 bits) | mapping data ... repeated
  117. * +-------------------------+-------------- ---- --- -- -
  118. *
  119. * domain string: the domain string, NULL terminated
  120. * protocol type: the protocol type (defined by NETLBL_NLTYPE_*)
  121. * mapping data: specific to the map type (see below)
  122. *
  123. * NETLBL_NLTYPE_UNLABELED
  124. *
  125. * No mapping data for this protocol type.
  126. *
  127. * NETLBL_NLTYPE_CIPSOV4
  128. *
  129. * +----------------+---------------+
  130. * | type (32 bits) | doi (32 bits) |
  131. * +----------------+---------------+
  132. *
  133. * type: the CIPSO mapping table type (defined in the cipso_ipv4.h header
  134. * as CIPSO_V4_MAP_*)
  135. * doi: the CIPSO DOI value
  136. *
  137. * o ADDDEF:
  138. * Sent by an application to set the default domain mapping for the NetLabel
  139. * system. The kernel should respond with an ACK.
  140. *
  141. * +-------------------------+-------------- ---- --- -- -
  142. * | protocol type (32 bits) | mapping data ... repeated
  143. * +-------------------------+-------------- ---- --- -- -
  144. *
  145. * protocol type: the protocol type (defined by NETLBL_NLTYPE_*)
  146. * mapping data: specific to the map type (see below)
  147. *
  148. * NETLBL_NLTYPE_UNLABELED
  149. *
  150. * No mapping data for this protocol type.
  151. *
  152. * NETLBL_NLTYPE_CIPSOV4
  153. *
  154. * +---------------+
  155. * | doi (32 bits) |
  156. * +---------------+
  157. *
  158. * doi: the CIPSO DOI value
  159. *
  160. * o REMOVEDEF:
  161. * Sent by an application to remove the default domain mapping from the
  162. * NetLabel system, there is no payload. The kernel should ACK this message.
  163. *
  164. * o LISTDEF:
  165. * This message can be sent either from an application or by the kernel in
  166. * response to an application generated LISTDEF message. When sent by an
  167. * application there is no payload. The kernel should respond to a
  168. * LISTDEF message either with a LISTDEF message on success or an ACK message
  169. * on failure.
  170. *
  171. * +-------------------------+-------------- ---- --- -- -
  172. * | protocol type (32 bits) | mapping data ... repeated
  173. * +-------------------------+-------------- ---- --- -- -
  174. *
  175. * protocol type: the protocol type (defined by NETLBL_NLTYPE_*)
  176. * mapping data: specific to the map type (see below)
  177. *
  178. * NETLBL_NLTYPE_UNLABELED
  179. *
  180. * No mapping data for this protocol type.
  181. *
  182. * NETLBL_NLTYPE_CIPSOV4
  183. *
  184. * +----------------+---------------+
  185. * | type (32 bits) | doi (32 bits) |
  186. * +----------------+---------------+
  187. *
  188. * type: the CIPSO mapping table type (defined in the cipso_ipv4.h header
  189. * as CIPSO_V4_MAP_*)
  190. * doi: the CIPSO DOI value
  191. *
  192. * o MODULES:
  193. * Sent by an application to request a list of configured NetLabel modules
  194. * in the kernel. When sent by an application there is no payload.
  195. *
  196. * +-------------------+
  197. * | modules (32 bits) | ...
  198. * +-------------------+
  199. *
  200. * modules: the number of modules in the message, if this is an application
  201. * generated message and the value is zero then return a list of
  202. * the configured modules
  203. *
  204. * +------------------+
  205. * | module (32 bits) | ... repeated
  206. * +------------------+
  207. *
  208. * module: the module number as defined by NETLBL_NLTYPE_*
  209. *
  210. * o VERSION:
  211. * Sent by an application to request the NetLabel version string. When sent
  212. * by an application there is no payload. This message type is also used by
  213. * the kernel to respond to an VERSION request.
  214. *
  215. * +-------------------+
  216. * | version (32 bits) |
  217. * +-------------------+
  218. *
  219. * version: the protocol version number
  220. *
  221. */
  222. /* NetLabel Management commands */
  223. enum {
  224. NLBL_MGMT_C_UNSPEC,
  225. NLBL_MGMT_C_ACK,
  226. NLBL_MGMT_C_ADD,
  227. NLBL_MGMT_C_REMOVE,
  228. NLBL_MGMT_C_LIST,
  229. NLBL_MGMT_C_ADDDEF,
  230. NLBL_MGMT_C_REMOVEDEF,
  231. NLBL_MGMT_C_LISTDEF,
  232. NLBL_MGMT_C_MODULES,
  233. NLBL_MGMT_C_VERSION,
  234. __NLBL_MGMT_C_MAX,
  235. };
  236. #define NLBL_MGMT_C_MAX (__NLBL_MGMT_C_MAX - 1)
  237. /* NetLabel protocol functions */
  238. int netlbl_mgmt_genl_init(void);
  239. #endif