Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 1 | #ifndef _NF_LOG_H |
| 2 | #define _NF_LOG_H |
| 3 | |
Eric Leblond | ca735b3 | 2009-03-16 14:54:21 +0100 | [diff] [blame] | 4 | #include <linux/netfilter.h> |
| 5 | |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 6 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will |
| 7 | * disappear once iptables is replaced with pkttables. Please DO NOT use them |
| 8 | * for any new code! */ |
| 9 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 10 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ |
| 11 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ |
| 12 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ |
| 13 | #define NF_LOG_MASK 0x0f |
| 14 | |
| 15 | #define NF_LOG_TYPE_LOG 0x01 |
| 16 | #define NF_LOG_TYPE_ULOG 0x02 |
| 17 | |
| 18 | struct nf_loginfo { |
| 19 | u_int8_t type; |
| 20 | union { |
| 21 | struct { |
| 22 | u_int32_t copy_len; |
| 23 | u_int16_t group; |
| 24 | u_int16_t qthreshold; |
| 25 | } ulog; |
| 26 | struct { |
| 27 | u_int8_t level; |
| 28 | u_int8_t logflags; |
| 29 | } log; |
| 30 | } u; |
| 31 | }; |
| 32 | |
Jan Engelhardt | 76108ce | 2008-10-08 11:35:00 +0200 | [diff] [blame] | 33 | typedef void nf_logfn(u_int8_t pf, |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 34 | unsigned int hooknum, |
| 35 | const struct sk_buff *skb, |
| 36 | const struct net_device *in, |
| 37 | const struct net_device *out, |
| 38 | const struct nf_loginfo *li, |
| 39 | const char *prefix); |
| 40 | |
| 41 | struct nf_logger { |
| 42 | struct module *me; |
| 43 | nf_logfn *logfn; |
| 44 | char *name; |
Eric Leblond | ca735b3 | 2009-03-16 14:54:21 +0100 | [diff] [blame] | 45 | struct list_head list[NFPROTO_NUMPROTO]; |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | /* Function to register/unregister log function. */ |
Eric Leblond | ca735b3 | 2009-03-16 14:54:21 +0100 | [diff] [blame] | 49 | int nf_log_register(u_int8_t pf, struct nf_logger *logger); |
| 50 | void nf_log_unregister(struct nf_logger *logger); |
| 51 | |
| 52 | int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); |
| 53 | void nf_log_unbind_pf(u_int8_t pf); |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 54 | |
| 55 | /* Calls the registered backend logging function */ |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 56 | __printf(7, 8) |
Jan Engelhardt | 76108ce | 2008-10-08 11:35:00 +0200 | [diff] [blame] | 57 | void nf_log_packet(u_int8_t pf, |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 58 | unsigned int hooknum, |
| 59 | const struct sk_buff *skb, |
| 60 | const struct net_device *in, |
| 61 | const struct net_device *out, |
Patrick McHardy | 7b2f963 | 2007-12-17 22:39:08 -0800 | [diff] [blame] | 62 | const struct nf_loginfo *li, |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 63 | const char *fmt, ...); |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame] | 64 | |
| 65 | #endif /* _NF_LOG_H */ |