netlinkaccess.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _NETLINKACCESS_H
  15. #define _NETLINKACCESS_H 1
  16. #include <features.h>
  17. #include <stdint.h>
  18. #include <unistd.h>
  19. #if defined __ASSUME_NETLINK_SUPPORT || defined __UCLIBC_USE_NETLINK__
  20. #include <asm/types.h>
  21. #include <linux/rtnetlink.h>
  22. #include <linux/netlink.h>
  23. struct netlink_res
  24. {
  25. struct netlink_res *next;
  26. struct nlmsghdr *nlh;
  27. size_t size; /* Size of response. */
  28. uint32_t seq; /* sequential number we used. */
  29. };
  30. struct netlink_handle
  31. {
  32. int fd; /* Netlink file descriptor. */
  33. pid_t pid; /* Process ID. */
  34. uint32_t seq; /* The sequence number we use currently. */
  35. struct netlink_res *nlm_list; /* Pointer to list of responses. */
  36. struct netlink_res *end_ptr; /* For faster append of new entries. */
  37. };
  38. #ifndef __ASSUME_NETLINK_SUPPORT
  39. #define __ASSUME_NETLINK_SUPPORT 1
  40. #endif
  41. extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
  42. extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
  43. extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;
  44. extern int __netlink_request (struct netlink_handle *h, int type) attribute_hidden;
  45. #else
  46. #define __ASSUME_NETLINK_SUPPORT 0
  47. #endif
  48. #endif /* _NETLINKACCESS_H */