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