ip_conntrack_core.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _IP_CONNTRACK_CORE_H
  2. #define _IP_CONNTRACK_CORE_H
  3. #include <linux/netfilter_ipv4/lockhelp.h>
  4. /* This header is used to share core functionality between the
  5.    standalone connection tracking module, and the compatibility layer's use
  6.    of connection tracking. */
  7. extern unsigned int ip_conntrack_in(unsigned int hooknum,
  8.     struct sk_buff **pskb,
  9.     const struct net_device *in,
  10.     const struct net_device *out,
  11.     int (*okfn)(struct sk_buff *));
  12. extern int ip_conntrack_init(void);
  13. extern void ip_conntrack_cleanup(void);
  14. struct ip_conntrack_protocol;
  15. extern struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol);
  16. /* Like above, but you already have conntrack read lock. */
  17. extern struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol);
  18. extern struct list_head protocol_list;
  19. /* Returns conntrack if it dealt with ICMP, and filled in skb->nfct */
  20. extern struct ip_conntrack *icmp_error_track(struct sk_buff *skb,
  21.      enum ip_conntrack_info *ctinfo,
  22.      unsigned int hooknum);
  23. extern int get_tuple(const struct iphdr *iph, size_t len,
  24.      struct ip_conntrack_tuple *tuple,
  25.      struct ip_conntrack_protocol *protocol);
  26. /* Find a connection corresponding to a tuple. */
  27. struct ip_conntrack_tuple_hash *
  28. ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
  29.       const struct ip_conntrack *ignored_conntrack);
  30. extern int __ip_conntrack_confirm(struct nf_ct_info *nfct);
  31. /* Confirm a connection: returns NF_DROP if packet must be dropped. */
  32. static inline int ip_conntrack_confirm(struct sk_buff *skb)
  33. {
  34. if (skb->nfct
  35.     && !is_confirmed((struct ip_conntrack *)skb->nfct->master))
  36. return __ip_conntrack_confirm(skb->nfct);
  37. return NF_ACCEPT;
  38. }
  39. extern struct list_head *ip_conntrack_hash;
  40. extern struct list_head ip_conntrack_expect_list;
  41. DECLARE_RWLOCK_EXTERN(ip_conntrack_lock);
  42. #endif /* _IP_CONNTRACK_CORE_H */