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 15#ifndef NETLINK_LOG_H_ 16#define NETLINK_LOG_H_ 17 18#include <netlink/netlink.h> 19 20#ifdef __cplusplus 21extern "C" { 22#endif 23 24struct nl_sock; 25struct nlmsghdr; 26struct nfnl_log; 27 28extern struct nl_object_ops log_obj_ops; 29 30enum nfnl_log_copy_mode { 31 NFNL_LOG_COPY_NONE, 32 NFNL_LOG_COPY_META, 33 NFNL_LOG_COPY_PACKET, 34}; 35 36enum nfnl_log_flags { 37 NFNL_LOG_FLAG_SEQ = 0x1, 38 NFNL_LOG_FLAG_SEQ_GLOBAL = 0x2, 39}; 40 41/* General */ 42extern struct nfnl_log * nfnl_log_alloc(void); 43extern int nfnlmsg_log_parse(struct nlmsghdr *, 44 struct nfnl_log **); 45 46extern void nfnl_log_get(struct nfnl_log *); 47extern void nfnl_log_put(struct nfnl_log *); 48 49/* Attributes */ 50extern void nfnl_log_set_group(struct nfnl_log *, uint16_t); 51extern int nfnl_log_test_group(const struct nfnl_log *); 52extern uint16_t nfnl_log_get_group(const struct nfnl_log *); 53 54extern void nfnl_log_set_copy_mode(struct nfnl_log *, 55 enum nfnl_log_copy_mode); 56extern int nfnl_log_test_copy_mode(const struct nfnl_log *); 57extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *); 58 59extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode, 60 char *, size_t); 61extern enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *); 62 63extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t); 64extern int nfnl_log_test_copy_range(const struct nfnl_log *); 65extern uint32_t nfnl_log_get_copy_range(const struct nfnl_log *); 66 67extern void nfnl_log_set_flush_timeout(struct nfnl_log *, uint32_t); 68extern int nfnl_log_test_flush_timeout(const struct nfnl_log *); 69extern uint32_t nfnl_log_get_flush_timeout(const struct nfnl_log *); 70 71extern void nfnl_log_set_alloc_size(struct nfnl_log *, uint32_t); 72extern int nfnl_log_test_alloc_size(const struct nfnl_log *); 73extern uint32_t nfnl_log_get_alloc_size(const struct nfnl_log *); 74 75extern void nfnl_log_set_queue_threshold(struct nfnl_log *, uint32_t); 76extern int nfnl_log_test_queue_threshold(const struct nfnl_log *); 77extern uint32_t nfnl_log_get_queue_threshold(const struct nfnl_log *); 78 79extern void nfnl_log_set_flags(struct nfnl_log *, unsigned int); 80extern void nfnl_log_unset_flags(struct nfnl_log *, unsigned int); 81extern unsigned int nfnl_log_get_flags(const struct nfnl_log *); 82 83extern char * nfnl_log_flags2str(unsigned int, char *, size_t); 84extern unsigned int nfnl_log_str2flags(const char *); 85 86extern int nfnl_log_build_pf_bind(uint8_t, struct nl_msg **); 87extern int nfnl_log_pf_bind(struct nl_sock *, uint8_t); 88 89extern int nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **); 90extern int nfnl_log_pf_unbind(struct nl_sock *, uint8_t); 91 92extern int nfnl_log_build_create_request(const struct nfnl_log *, 93 struct nl_msg **); 94extern int nfnl_log_create(struct nl_sock *, const struct nfnl_log *); 95 96extern int nfnl_log_build_change_request(const struct nfnl_log *, 97 struct nl_msg **); 98extern int nfnl_log_change(struct nl_sock *, const struct nfnl_log *); 99 100extern int nfnl_log_build_delete_request(const struct nfnl_log *, 101 struct nl_msg **); 102extern int nfnl_log_delete(struct nl_sock *, const struct nfnl_log *); 103 104#ifdef __cplusplus 105} 106#endif 107 108#endif 109 110