netlink.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 <sys/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. /* Netlink Family Translations */
  79. extern char * nl_nlfamily2str(int, char *, size_t);
  80. extern int nl_str2nlfamily(const char *);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif