netlinkaccess.h 2.0 KB

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