netlinkaccess.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #ifdef __UCLIBC_USE_NETLINK__
  30. # define __ASSUME_NETLINK_SUPPORT 1
  31. #else
  32. # define __ASSUME_NETLINK_SUPPORT 0
  33. #endif
  34. struct netlink_res
  35. {
  36. struct netlink_res *next;
  37. struct nlmsghdr *nlh;
  38. size_t size; /* Size of response. */
  39. uint32_t seq; /* sequential number we used. */
  40. };
  41. struct netlink_handle
  42. {
  43. int fd; /* Netlink file descriptor. */
  44. pid_t pid; /* Process ID. */
  45. uint32_t seq; /* The sequence number we use currently. */
  46. struct netlink_res *nlm_list; /* Pointer to list of responses. */
  47. struct netlink_res *end_ptr; /* For faster append of new entries. */
  48. };
  49. #if 0 /* unused code */
  50. #if __ASSUME_NETLINK_SUPPORT == 0
  51. extern int __no_netlink_support attribute_hidden;
  52. #else
  53. # define __no_netlink_support 0
  54. #endif
  55. #endif /* unused code */
  56. extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
  57. extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
  58. extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;
  59. extern int __netlink_request (struct netlink_handle *h, int type) attribute_hidden;
  60. #endif /* netlinkaccess.h */