• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _NF_LOG_H
2 #define _NF_LOG_H
3 
4 /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
5  * disappear once iptables is replaced with pkttables.  Please DO NOT use them
6  * for any new code! */
7 #define NF_LOG_TCPSEQ		0x01	/* Log TCP sequence numbers */
8 #define NF_LOG_TCPOPT		0x02	/* Log TCP options */
9 #define NF_LOG_IPOPT		0x04	/* Log IP options */
10 #define NF_LOG_UID		0x08	/* Log UID owning local socket */
11 #define NF_LOG_MASK		0x0f
12 
13 #define NF_LOG_TYPE_LOG		0x01
14 #define NF_LOG_TYPE_ULOG	0x02
15 
16 struct nf_loginfo {
17 	u_int8_t type;
18 	union {
19 		struct {
20 			u_int32_t copy_len;
21 			u_int16_t group;
22 			u_int16_t qthreshold;
23 		} ulog;
24 		struct {
25 			u_int8_t level;
26 			u_int8_t logflags;
27 		} log;
28 	} u;
29 };
30 
31 typedef void nf_logfn(u_int8_t pf,
32 		      unsigned int hooknum,
33 		      const struct sk_buff *skb,
34 		      const struct net_device *in,
35 		      const struct net_device *out,
36 		      const struct nf_loginfo *li,
37 		      const char *prefix);
38 
39 struct nf_logger {
40 	struct module	*me;
41 	nf_logfn 	*logfn;
42 	char		*name;
43 };
44 
45 /* Function to register/unregister log function. */
46 int nf_log_register(u_int8_t pf, const struct nf_logger *logger);
47 void nf_log_unregister(const struct nf_logger *logger);
48 void nf_log_unregister_pf(u_int8_t pf);
49 
50 /* Calls the registered backend logging function */
51 void nf_log_packet(u_int8_t pf,
52 		   unsigned int hooknum,
53 		   const struct sk_buff *skb,
54 		   const struct net_device *in,
55 		   const struct net_device *out,
56 		   const struct nf_loginfo *li,
57 		   const char *fmt, ...) __attribute__ ((format(printf,7,8)));
58 
59 #endif /* _NF_LOG_H */
60