queue.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * netlink/netfilter/queue.h Netfilter Queue
  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) 2007, 2008 Patrick McHardy <kaber@trash.net>
  10. */
  11. #ifndef NETLINK_QUEUE_H_
  12. #define NETLINK_QUEUE_H_
  13. #include <netlink/netlink.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. struct nl_sock;
  18. struct nlmsghdr;
  19. struct nfnl_queue;
  20. extern struct nl_object_ops queue_obj_ops;
  21. enum nfnl_queue_copy_mode {
  22. NFNL_QUEUE_COPY_NONE,
  23. NFNL_QUEUE_COPY_META,
  24. NFNL_QUEUE_COPY_PACKET,
  25. };
  26. /* General */
  27. extern struct nl_sock * nfnl_queue_socket_alloc(void);
  28. extern struct nfnl_queue * nfnl_queue_alloc(void);
  29. extern void nfnl_queue_get(struct nfnl_queue *);
  30. extern void nfnl_queue_put(struct nfnl_queue *);
  31. /* Attributes */
  32. extern void nfnl_queue_set_group(struct nfnl_queue *, uint16_t);
  33. extern int nfnl_queue_test_group(const struct nfnl_queue *);
  34. extern uint16_t nfnl_queue_get_group(const struct nfnl_queue *);
  35. extern void nfnl_queue_set_maxlen(struct nfnl_queue *, uint32_t);
  36. extern int nfnl_queue_test_maxlen(const struct nfnl_queue *);
  37. extern uint32_t nfnl_queue_get_maxlen(const struct nfnl_queue *);
  38. extern void nfnl_queue_set_copy_mode(struct nfnl_queue *,
  39. enum nfnl_queue_copy_mode);
  40. extern int nfnl_queue_test_copy_mode(const struct nfnl_queue *);
  41. extern enum nfnl_queue_copy_mode nfnl_queue_get_copy_mode(const struct nfnl_queue *);
  42. extern char * nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode,
  43. char *, size_t);
  44. extern enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *);
  45. extern void nfnl_queue_set_copy_range(struct nfnl_queue *,
  46. uint32_t);
  47. extern int nfnl_queue_test_copy_range(const struct nfnl_queue *);
  48. extern uint32_t nfnl_queue_get_copy_range(const struct nfnl_queue *);
  49. extern int nfnl_queue_build_pf_bind(uint8_t, struct nl_msg **);
  50. extern int nfnl_queue_pf_bind(struct nl_sock *, uint8_t);
  51. extern int nfnl_queue_build_pf_unbind(uint8_t, struct nl_msg **);
  52. extern int nfnl_queue_pf_unbind(struct nl_sock *, uint8_t);
  53. extern int nfnl_queue_build_create_request(const struct nfnl_queue *,
  54. struct nl_msg **);
  55. extern int nfnl_queue_create(struct nl_sock *,
  56. const struct nfnl_queue *);
  57. extern int nfnl_queue_build_change_request(const struct nfnl_queue *,
  58. struct nl_msg **);
  59. extern int nfnl_queue_change(struct nl_sock *,
  60. const struct nfnl_queue *);
  61. extern int nfnl_queue_build_delete_request(const struct nfnl_queue *,
  62. struct nl_msg **);
  63. extern int nfnl_queue_delete(struct nl_sock *,
  64. const struct nfnl_queue *);
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif