log.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * netlink/netfilter/log.h Netfilter Log
  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. * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
  11. * Copyright (c) 2007 Secure Computing Corporation
  12. * Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
  13. */
  14. #ifndef NETLINK_LOG_H_
  15. #define NETLINK_LOG_H_
  16. #include <netlink/netlink.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. struct nl_sock;
  21. struct nlmsghdr;
  22. struct nfnl_log;
  23. extern struct nl_object_ops log_obj_ops;
  24. enum nfnl_log_copy_mode {
  25. NFNL_LOG_COPY_NONE,
  26. NFNL_LOG_COPY_META,
  27. NFNL_LOG_COPY_PACKET,
  28. };
  29. enum nfnl_log_flags {
  30. NFNL_LOG_FLAG_SEQ = 0x1,
  31. NFNL_LOG_FLAG_SEQ_GLOBAL = 0x2,
  32. };
  33. /* General */
  34. extern struct nfnl_log * nfnl_log_alloc(void);
  35. extern int nfnlmsg_log_parse(struct nlmsghdr *,
  36. struct nfnl_log **);
  37. extern void nfnl_log_get(struct nfnl_log *);
  38. extern void nfnl_log_put(struct nfnl_log *);
  39. /* Attributes */
  40. extern void nfnl_log_set_group(struct nfnl_log *, uint16_t);
  41. extern int nfnl_log_test_group(const struct nfnl_log *);
  42. extern uint16_t nfnl_log_get_group(const struct nfnl_log *);
  43. extern void nfnl_log_set_copy_mode(struct nfnl_log *,
  44. enum nfnl_log_copy_mode);
  45. extern int nfnl_log_test_copy_mode(const struct nfnl_log *);
  46. extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *);
  47. extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
  48. char *, size_t);
  49. extern enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *);
  50. extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
  51. extern int nfnl_log_test_copy_range(const struct nfnl_log *);
  52. extern uint32_t nfnl_log_get_copy_range(const struct nfnl_log *);
  53. extern void nfnl_log_set_flush_timeout(struct nfnl_log *, uint32_t);
  54. extern int nfnl_log_test_flush_timeout(const struct nfnl_log *);
  55. extern uint32_t nfnl_log_get_flush_timeout(const struct nfnl_log *);
  56. extern void nfnl_log_set_alloc_size(struct nfnl_log *, uint32_t);
  57. extern int nfnl_log_test_alloc_size(const struct nfnl_log *);
  58. extern uint32_t nfnl_log_get_alloc_size(const struct nfnl_log *);
  59. extern void nfnl_log_set_queue_threshold(struct nfnl_log *, uint32_t);
  60. extern int nfnl_log_test_queue_threshold(const struct nfnl_log *);
  61. extern uint32_t nfnl_log_get_queue_threshold(const struct nfnl_log *);
  62. extern void nfnl_log_set_flags(struct nfnl_log *, unsigned int);
  63. extern void nfnl_log_unset_flags(struct nfnl_log *, unsigned int);
  64. extern unsigned int nfnl_log_get_flags(const struct nfnl_log *);
  65. extern char * nfnl_log_flags2str(unsigned int, char *, size_t);
  66. extern unsigned int nfnl_log_str2flags(const char *);
  67. extern int nfnl_log_build_pf_bind(uint8_t, struct nl_msg **);
  68. extern int nfnl_log_pf_bind(struct nl_sock *, uint8_t);
  69. extern int nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **);
  70. extern int nfnl_log_pf_unbind(struct nl_sock *, uint8_t);
  71. extern int nfnl_log_build_create_request(const struct nfnl_log *,
  72. struct nl_msg **);
  73. extern int nfnl_log_create(struct nl_sock *, const struct nfnl_log *);
  74. extern int nfnl_log_build_change_request(const struct nfnl_log *,
  75. struct nl_msg **);
  76. extern int nfnl_log_change(struct nl_sock *, const struct nfnl_log *);
  77. extern int nfnl_log_build_delete_request(const struct nfnl_log *,
  78. struct nl_msg **);
  79. extern int nfnl_log_delete(struct nl_sock *, const struct nfnl_log *);
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif