netlink.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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-2013 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 <poll.h>
  18. #include <sys/socket.h>
  19. #include <sys/types.h>
  20. #include <sys/time.h>
  21. #include <netdb.h>
  22. #include <netlink/netlink-compat.h>
  23. #include <linux/netlink.h>
  24. #include <linux/rtnetlink.h>
  25. #include <linux/genetlink.h>
  26. #include <linux/netfilter/nfnetlink.h>
  27. #include <netinet/tcp.h>
  28. #include <netlink/version.h>
  29. #include <netlink/errno.h>
  30. #include <netlink/types.h>
  31. #include <netlink/handlers.h>
  32. #include <netlink/socket.h>
  33. #include <netlink/object.h>
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. struct ucred;
  38. struct nl_cache_ops;
  39. struct nl_parser_param;
  40. struct nl_object;
  41. struct nl_sock;
  42. extern int nl_debug;
  43. extern struct nl_dump_params nl_debug_dp;
  44. /* Connection Management */
  45. extern int nl_connect(struct nl_sock *, int);
  46. extern void nl_close(struct nl_sock *);
  47. /* Send */
  48. extern int nl_sendto(struct nl_sock *, void *, size_t);
  49. extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
  50. struct msghdr *);
  51. extern int nl_send(struct nl_sock *, struct nl_msg *);
  52. extern int nl_send_iovec(struct nl_sock *, struct nl_msg *,
  53. struct iovec *, unsigned);
  54. extern void nl_complete_msg(struct nl_sock *,
  55. struct nl_msg *);
  56. extern void nl_auto_complete(struct nl_sock *,
  57. struct nl_msg *);
  58. extern int nl_send_auto(struct nl_sock *, struct nl_msg *);
  59. extern int nl_send_auto_complete(struct nl_sock *,
  60. struct nl_msg *);
  61. extern int nl_send_sync(struct nl_sock *, struct nl_msg *);
  62. extern int nl_send_simple(struct nl_sock *, int, int,
  63. void *, size_t);
  64. /* Receive */
  65. extern int nl_recv(struct nl_sock *,
  66. struct sockaddr_nl *, unsigned char **,
  67. struct ucred **);
  68. extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
  69. extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
  70. extern int nl_recvmsgs_default(struct nl_sock *);
  71. extern int nl_wait_for_ack(struct nl_sock *);
  72. extern int nl_pickup(struct nl_sock *,
  73. int (*parser)(struct nl_cache_ops *,
  74. struct sockaddr_nl *,
  75. struct nlmsghdr *,
  76. struct nl_parser_param *),
  77. struct nl_object **);
  78. extern int nl_pickup_keep_syserr(struct nl_sock *sk,
  79. int (*parser)(struct nl_cache_ops *, struct sockaddr_nl *,
  80. struct nlmsghdr *, struct nl_parser_param *),
  81. struct nl_object **result,
  82. int *syserror);
  83. /* Netlink Family Translations */
  84. extern char * nl_nlfamily2str(int, char *, size_t);
  85. extern int nl_str2nlfamily(const char *);
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89. #endif