log.h

00001 /*
00002  * netlink/netfilter/log.h      Netfilter Log
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
00010  * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
00011  * Copyright (c) 2007 Secure Computing Corporation
00012  * Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
00013  */
00014 
00015 #ifndef NETLINK_LOG_H_
00016 #define NETLINK_LOG_H_
00017 
00018 #include <netlink/netlink.h>
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 struct nl_sock;
00025 struct nlmsghdr;
00026 struct nfnl_log;
00027 
00028 extern struct nl_object_ops log_obj_ops;
00029 
00030 enum nfnl_log_copy_mode {
00031         NFNL_LOG_COPY_NONE,
00032         NFNL_LOG_COPY_META,
00033         NFNL_LOG_COPY_PACKET,
00034 };
00035 
00036 enum nfnl_log_flags {
00037         NFNL_LOG_FLAG_SEQ               = 0x1,
00038         NFNL_LOG_FLAG_SEQ_GLOBAL        = 0x2,
00039 };
00040 
00041 /* General */
00042 extern struct nfnl_log *        nfnl_log_alloc(void);
00043 extern int                      nfnlmsg_log_parse(struct nlmsghdr *,
00044                                                   struct nfnl_log **);
00045 
00046 extern void                     nfnl_log_get(struct nfnl_log *);
00047 extern void                     nfnl_log_put(struct nfnl_log *);
00048 
00049 /* Attributes */
00050 extern void                     nfnl_log_set_group(struct nfnl_log *, uint16_t);
00051 extern int                      nfnl_log_test_group(const struct nfnl_log *);
00052 extern uint16_t                 nfnl_log_get_group(const struct nfnl_log *);
00053 
00054 extern void                     nfnl_log_set_copy_mode(struct nfnl_log *,
00055                                                        enum nfnl_log_copy_mode);
00056 extern int                      nfnl_log_test_copy_mode(const struct nfnl_log *);
00057 extern enum nfnl_log_copy_mode  nfnl_log_get_copy_mode(const struct nfnl_log *);
00058 
00059 extern char *                   nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
00060                                                        char *, size_t);
00061 extern enum nfnl_log_copy_mode  nfnl_log_str2copy_mode(const char *);
00062 
00063 extern void                     nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
00064 extern int                      nfnl_log_test_copy_range(const struct nfnl_log *);
00065 extern uint32_t                 nfnl_log_get_copy_range(const struct nfnl_log *);
00066 
00067 extern void                     nfnl_log_set_flush_timeout(struct nfnl_log *, uint32_t);
00068 extern int                      nfnl_log_test_flush_timeout(const struct nfnl_log *);
00069 extern uint32_t                 nfnl_log_get_flush_timeout(const struct nfnl_log *);
00070 
00071 extern void                     nfnl_log_set_alloc_size(struct nfnl_log *, uint32_t);
00072 extern int                      nfnl_log_test_alloc_size(const struct nfnl_log *);
00073 extern uint32_t                 nfnl_log_get_alloc_size(const struct nfnl_log *);
00074 
00075 extern void                     nfnl_log_set_queue_threshold(struct nfnl_log *, uint32_t);
00076 extern int                      nfnl_log_test_queue_threshold(const struct nfnl_log *);
00077 extern uint32_t                 nfnl_log_get_queue_threshold(const struct nfnl_log *);
00078 
00079 extern void                     nfnl_log_set_flags(struct nfnl_log *, unsigned int);
00080 extern void                     nfnl_log_unset_flags(struct nfnl_log *, unsigned int);
00081 extern unsigned int             nfnl_log_get_flags(const struct nfnl_log *);
00082 
00083 extern char *                   nfnl_log_flags2str(unsigned int, char *, size_t);
00084 extern unsigned int             nfnl_log_str2flags(const char *);
00085 
00086 extern int      nfnl_log_build_pf_bind(uint8_t, struct nl_msg **);
00087 extern int      nfnl_log_pf_bind(struct nl_sock *, uint8_t);
00088 
00089 extern int      nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **);
00090 extern int      nfnl_log_pf_unbind(struct nl_sock *, uint8_t);
00091 
00092 extern int      nfnl_log_build_create_request(const struct nfnl_log *,
00093                                               struct nl_msg **);
00094 extern int      nfnl_log_create(struct nl_sock *, const struct nfnl_log *);
00095 
00096 extern int      nfnl_log_build_change_request(const struct nfnl_log *,
00097                                               struct nl_msg **);
00098 extern int      nfnl_log_change(struct nl_sock *, const struct nfnl_log *);
00099 
00100 extern int      nfnl_log_build_delete_request(const struct nfnl_log *,
00101                                               struct nl_msg **);
00102 extern int      nfnl_log_delete(struct nl_sock *, const struct nfnl_log *);
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif
00109