netlabel_mgmt.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. #include <asm/atomic.h>
  33. /*
  34. * The following NetLabel payloads are supported by the management interface.
  35. *
  36. * o ADD:
  37. * Sent by an application to add a domain mapping to the NetLabel system.
  38. *
  39. * Required attributes:
  40. *
  41. * NLBL_MGMT_A_DOMAIN
  42. * NLBL_MGMT_A_PROTOCOL
  43. *
  44. * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
  45. *
  46. * NLBL_MGMT_A_CV4DOI
  47. *
  48. * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
  49. *
  50. * o REMOVE:
  51. * Sent by an application to remove a domain mapping from the NetLabel
  52. * system.
  53. *
  54. * Required attributes:
  55. *
  56. * NLBL_MGMT_A_DOMAIN
  57. *
  58. * o LISTALL:
  59. * This message can be sent either from an application or by the kernel in
  60. * response to an application generated LISTALL message. When sent by an
  61. * application there is no payload and the NLM_F_DUMP flag should be set.
  62. * The kernel should respond with a series of the following messages.
  63. *
  64. * Required attributes:
  65. *
  66. * NLBL_MGMT_A_DOMAIN
  67. * NLBL_MGMT_A_PROTOCOL
  68. *
  69. * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
  70. *
  71. * NLBL_MGMT_A_CV4DOI
  72. *
  73. * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
  74. *
  75. * o ADDDEF:
  76. * Sent by an application to set the default domain mapping for the NetLabel
  77. * system.
  78. *
  79. * Required attributes:
  80. *
  81. * NLBL_MGMT_A_PROTOCOL
  82. *
  83. * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
  84. *
  85. * NLBL_MGMT_A_CV4DOI
  86. *
  87. * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
  88. *
  89. * o REMOVEDEF:
  90. * Sent by an application to remove the default domain mapping from the
  91. * NetLabel system, there is no payload.
  92. *
  93. * o LISTDEF:
  94. * This message can be sent either from an application or by the kernel in
  95. * response to an application generated LISTDEF message. When sent by an
  96. * application there is no payload. On success the kernel should send a
  97. * response using the following format.
  98. *
  99. * Required attributes:
  100. *
  101. * NLBL_MGMT_A_PROTOCOL
  102. *
  103. * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
  104. *
  105. * NLBL_MGMT_A_CV4DOI
  106. *
  107. * If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
  108. *
  109. * o PROTOCOLS:
  110. * Sent by an application to request a list of configured NetLabel protocols
  111. * in the kernel. When sent by an application there is no payload and the
  112. * NLM_F_DUMP flag should be set. The kernel should respond with a series of
  113. * the following messages.
  114. *
  115. * Required attributes:
  116. *
  117. * NLBL_MGMT_A_PROTOCOL
  118. *
  119. * o VERSION:
  120. * Sent by an application to request the NetLabel version. When sent by an
  121. * application there is no payload. This message type is also used by the
  122. * kernel to respond to an VERSION request.
  123. *
  124. * Required attributes:
  125. *
  126. * NLBL_MGMT_A_VERSION
  127. *
  128. */
  129. /* NetLabel Management commands */
  130. enum {
  131. NLBL_MGMT_C_UNSPEC,
  132. NLBL_MGMT_C_ADD,
  133. NLBL_MGMT_C_REMOVE,
  134. NLBL_MGMT_C_LISTALL,
  135. NLBL_MGMT_C_ADDDEF,
  136. NLBL_MGMT_C_REMOVEDEF,
  137. NLBL_MGMT_C_LISTDEF,
  138. NLBL_MGMT_C_PROTOCOLS,
  139. NLBL_MGMT_C_VERSION,
  140. __NLBL_MGMT_C_MAX,
  141. };
  142. #define NLBL_MGMT_C_MAX (__NLBL_MGMT_C_MAX - 1)
  143. /* NetLabel Management attributes */
  144. enum {
  145. NLBL_MGMT_A_UNSPEC,
  146. NLBL_MGMT_A_DOMAIN,
  147. /* (NLA_NUL_STRING)
  148. * the NULL terminated LSM domain string */
  149. NLBL_MGMT_A_PROTOCOL,
  150. /* (NLA_U32)
  151. * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
  152. NLBL_MGMT_A_VERSION,
  153. /* (NLA_U32)
  154. * the NetLabel protocol version number (defined by
  155. * NETLBL_PROTO_VERSION) */
  156. NLBL_MGMT_A_CV4DOI,
  157. /* (NLA_U32)
  158. * the CIPSOv4 DOI value */
  159. __NLBL_MGMT_A_MAX,
  160. };
  161. #define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
  162. /* NetLabel protocol functions */
  163. int netlbl_mgmt_genl_init(void);
  164. /* NetLabel configured protocol reference counter */
  165. extern atomic_t netlabel_mgmt_protocount;
  166. #endif