netlabel_user.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * NetLabel NETLINK Interface
  3. *
  4. * This file defines the NETLINK interface 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_USER_H
  30. #define _NETLABEL_USER_H
  31. #include <linux/types.h>
  32. #include <linux/skbuff.h>
  33. #include <linux/capability.h>
  34. #include <net/netlink.h>
  35. #include <net/genetlink.h>
  36. #include <net/netlabel.h>
  37. /* NetLabel NETLINK helper functions */
  38. /**
  39. * netlbl_netlink_hdr_put - Write the NETLINK buffers into a sk_buff
  40. * @skb: the packet
  41. * @pid: the PID of the receipient
  42. * @seq: the sequence number
  43. * @type: the generic NETLINK message family type
  44. * @cmd: command
  45. *
  46. * Description:
  47. * Write both a NETLINK nlmsghdr structure and a Generic NETLINK genlmsghdr
  48. * struct to the packet. Returns a pointer to the start of the payload buffer
  49. * on success or NULL on failure.
  50. *
  51. */
  52. static inline void *netlbl_netlink_hdr_put(struct sk_buff *skb,
  53. u32 pid,
  54. u32 seq,
  55. int type,
  56. int flags,
  57. u8 cmd)
  58. {
  59. return genlmsg_put(skb,
  60. pid,
  61. seq,
  62. type,
  63. 0,
  64. flags,
  65. cmd,
  66. NETLBL_PROTO_VERSION);
  67. }
  68. /* NetLabel NETLINK I/O functions */
  69. int netlbl_netlink_init(void);
  70. #endif