netlinkaccess.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _NETLINKACCESS_H
  16. #define _NETLINKACCESS_H 1
  17. #include <features.h>
  18. #include <stdint.h>
  19. #include <unistd.h>
  20. #include <sys/types.h>
  21. #if defined __ASSUME_NETLINK_SUPPORT || defined __UCLIBC_USE_NETLINK__
  22. #define _LINUX_TYPES_H
  23. typedef uint8_t __u8;
  24. typedef uint16_t __u16;
  25. typedef uint32_t __u32;
  26. typedef uint64_t __u64;
  27. typedef int32_t __s32;
  28. #include <linux/rtnetlink.h>
  29. #include <linux/netlink.h>
  30. struct netlink_res
  31. {
  32. struct netlink_res *next;
  33. struct nlmsghdr *nlh;
  34. size_t size; /* Size of response. */
  35. uint32_t seq; /* sequential number we used. */
  36. };
  37. struct netlink_handle
  38. {
  39. int fd; /* Netlink file descriptor. */
  40. pid_t pid; /* Process ID. */
  41. uint32_t seq; /* The sequence number we use currently. */
  42. struct netlink_res *nlm_list; /* Pointer to list of responses. */
  43. struct netlink_res *end_ptr; /* For faster append of new entries. */
  44. };
  45. #ifndef __ASSUME_NETLINK_SUPPORT
  46. #define __ASSUME_NETLINK_SUPPORT 1
  47. #endif
  48. extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
  49. extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
  50. extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;
  51. extern int __netlink_request (struct netlink_handle *h, int type) attribute_hidden;
  52. #else
  53. #define __ASSUME_NETLINK_SUPPORT 0
  54. #endif
  55. #endif /* _NETLINKACCESS_H */