netlink.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * netlink/netlink.h Netlink Interface
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation version 2.1
  7. * of the License.
  8. *
  9. * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
  10. */
  11. #ifndef NETLINK_NETLINK_H_
  12. #define NETLINK_NETLINK_H_
  13. #include <stdio.h>
  14. #include <stdint.h>
  15. #include <string.h>
  16. #include <stdlib.h>
  17. #include <sys/poll.h>
  18. #include <sys/socket.h>
  19. #include <sys/types.h>
  20. #include <sys/time.h>
  21. #include <netlink/netlink-compat.h>
  22. #include <linux/netlink.h>
  23. #include <linux/rtnetlink.h>
  24. #include <linux/genetlink.h>
  25. #include <linux/netfilter/nfnetlink.h>
  26. #include <netlink/types.h>
  27. #include <netlink/handlers.h>
  28. #include <netlink/socket.h>
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. extern int nl_debug;
  33. extern struct nl_dump_params nl_debug_dp;
  34. /* Connection Management */
  35. extern int nl_connect(struct nl_handle *, int);
  36. extern void nl_close(struct nl_handle *);
  37. /* Send */
  38. extern int nl_sendto(struct nl_handle *, void *, size_t);
  39. extern int nl_sendmsg(struct nl_handle *, struct nl_msg *,
  40. struct msghdr *);
  41. extern int nl_send(struct nl_handle *, struct nl_msg *);
  42. extern int nl_send_auto_complete(struct nl_handle *,
  43. struct nl_msg *);
  44. extern int nl_send_simple(struct nl_handle *, int, int,
  45. void *, size_t);
  46. /* Receive */
  47. extern int nl_recv(struct nl_handle *,
  48. struct sockaddr_nl *, unsigned char **,
  49. struct ucred **);
  50. extern int nl_recvmsgs(struct nl_handle *, struct nl_cb *);
  51. #define nl_recvmsgs_def(handle) nl_recvmsgs_default(handle)
  52. extern int nl_recvmsgs_default(struct nl_handle *);
  53. extern int nl_wait_for_ack(struct nl_handle *);
  54. /* Netlink Family Translations */
  55. extern char * nl_nlfamily2str(int, char *, size_t);
  56. extern int nl_str2nlfamily(const char *);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif