netlinkaccess.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 <sys/types.h>
  20. #define _LINUX_TYPES_H
  21. typedef uint8_t __u8;
  22. typedef uint16_t __u16;
  23. typedef uint32_t __u32;
  24. typedef uint64_t __u64;
  25. typedef int32_t __s32;
  26. #include <linux/rtnetlink.h>
  27. #include <linux/netlink.h>
  28. /* Should prob be a configure option or something */
  29. #ifndef __ASSUME_NETLINK_SUPPORT
  30. #ifdef __UCLIBC_USE_NETLINK__
  31. # define __ASSUME_NETLINK_SUPPORT 1
  32. #else
  33. # define __ASSUME_NETLINK_SUPPORT 0
  34. #endif
  35. #endif
  36. struct netlink_res
  37. {
  38. struct netlink_res *next;
  39. struct nlmsghdr *nlh;
  40. size_t size; /* Size of response. */
  41. uint32_t seq; /* sequential number we used. */
  42. };
  43. struct netlink_handle
  44. {
  45. int fd; /* Netlink file descriptor. */
  46. pid_t pid; /* Process ID. */
  47. uint32_t seq; /* The sequence number we use currently. */
  48. struct netlink_res *nlm_list; /* Pointer to list of responses. */
  49. struct netlink_res *end_ptr; /* For faster append of new entries. */
  50. };
  51. #if 0 /* unused code */
  52. #if __ASSUME_NETLINK_SUPPORT == 0
  53. extern int __no_netlink_support attribute_hidden;
  54. #else
  55. # define __no_netlink_support 0
  56. #endif
  57. #endif /* unused code */
  58. extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
  59. extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
  60. extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;
  61. extern int __netlink_request (struct netlink_handle *h, int type) attribute_hidden;
  62. #endif /* netlinkaccess.h */