netlinkaccess.h 2.4 KB

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