4 #include <linux/netfilter.h>
5 #include <linux/netfilter/nf_log.h>
7 /* Log tcp sequence, tcp options, ip options and uid owning local socket */
8 #define NF_LOG_DEFAULT_MASK 0x0f
10 /* This flag indicates that copy_len field in nf_loginfo is set */
11 #define NF_LOG_F_COPY_LEN 0x1
23 /* copy_len will be used iff you set
24 * NF_LOG_F_COPY_LEN in flags
38 typedef void nf_logfn(struct net *net,
41 const struct sk_buff *skb,
42 const struct net_device *in,
43 const struct net_device *out,
44 const struct nf_loginfo *li,
49 enum nf_log_type type;
54 /* Function to register/unregister log function. */
55 int nf_log_register(u_int8_t pf, struct nf_logger *logger);
56 void nf_log_unregister(struct nf_logger *logger);
58 int nf_log_set(struct net *net, u_int8_t pf, const struct nf_logger *logger);
59 void nf_log_unset(struct net *net, const struct nf_logger *logger);
61 int nf_log_bind_pf(struct net *net, u_int8_t pf,
62 const struct nf_logger *logger);
63 void nf_log_unbind_pf(struct net *net, u_int8_t pf);
65 int nf_logger_find_get(int pf, enum nf_log_type type);
66 void nf_logger_put(int pf, enum nf_log_type type);
67 void nf_logger_request_module(int pf, enum nf_log_type type);
69 #define MODULE_ALIAS_NF_LOGGER(family, type) \
70 MODULE_ALIAS("nf-logger-" __stringify(family) "-" __stringify(type))
72 /* Calls the registered backend logging function */
74 void nf_log_packet(struct net *net,
77 const struct sk_buff *skb,
78 const struct net_device *in,
79 const struct net_device *out,
80 const struct nf_loginfo *li,
81 const char *fmt, ...);
84 void nf_log_trace(struct net *net,
87 const struct sk_buff *skb,
88 const struct net_device *in,
89 const struct net_device *out,
90 const struct nf_loginfo *li,
91 const char *fmt, ...);
95 struct nf_log_buf *nf_log_buf_open(void);
96 __printf(2, 3) int nf_log_buf_add(struct nf_log_buf *m, const char *f, ...);
97 void nf_log_buf_close(struct nf_log_buf *m);
99 /* common logging functions */
100 int nf_log_dump_udp_header(struct nf_log_buf *m, const struct sk_buff *skb,
101 u8 proto, int fragment, unsigned int offset);
102 int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb,
103 u8 proto, int fragment, unsigned int offset,
104 unsigned int logflags);
105 void nf_log_dump_sk_uid_gid(struct nf_log_buf *m, struct sock *sk);
106 void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf,
107 unsigned int hooknum, const struct sk_buff *skb,
108 const struct net_device *in,
109 const struct net_device *out,
110 const struct nf_loginfo *loginfo,
113 #endif /* _NF_LOG_H */