Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /*
  2  * connection tracking event cache.
  3  */
  4 
  5 #ifndef _NF_CONNTRACK_ECACHE_H
  6 #define _NF_CONNTRACK_ECACHE_H
  7 #include <net/netfilter/nf_conntrack.h>
  8 
  9 #include <linux/notifier.h>
 10 #include <linux/interrupt.h>
 11 #include <net/netfilter/nf_conntrack_expect.h>
 12 
 13 #ifdef CONFIG_NF_CONNTRACK_EVENTS
 14 struct nf_conntrack_ecache {
 15         struct nf_conn *ct;
 16         unsigned int events;
 17 };
 18 DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
 19 
 20 #define CONNTRACK_ECACHE(x)     (__get_cpu_var(nf_conntrack_ecache).x)
 21 
 22 extern struct atomic_notifier_head nf_conntrack_chain;
 23 extern int nf_conntrack_register_notifier(struct notifier_block *nb);
 24 extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
 25 
 26 extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
 27 extern void __nf_ct_event_cache_init(struct nf_conn *ct);
 28 extern void nf_ct_event_cache_flush(void);
 29 
 30 static inline void
 31 nf_conntrack_event_cache(enum ip_conntrack_events event,
 32                          const struct sk_buff *skb)
 33 {
 34         struct nf_conn *ct = (struct nf_conn *)skb->nfct;
 35         struct nf_conntrack_ecache *ecache;
 36 
 37         local_bh_disable();
 38         ecache = &__get_cpu_var(nf_conntrack_ecache);
 39         if (ct != ecache->ct)
 40                 __nf_ct_event_cache_init(ct);
 41         ecache->events |= event;
 42         local_bh_enable();
 43 }
 44 
 45 static inline void nf_conntrack_event(enum ip_conntrack_events event,
 46                                       struct nf_conn *ct)
 47 {
 48         if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
 49                 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
 50 }
 51 
 52 extern struct atomic_notifier_head nf_ct_expect_chain;
 53 extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
 54 extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
 55 
 56 static inline void
 57 nf_ct_expect_event(enum ip_conntrack_expect_events event,
 58                    struct nf_conntrack_expect *exp)
 59 {
 60         atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp);
 61 }
 62 
 63 #else /* CONFIG_NF_CONNTRACK_EVENTS */
 64 
 65 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
 66                                             const struct sk_buff *skb) {}
 67 static inline void nf_conntrack_event(enum ip_conntrack_events event,
 68                                       struct nf_conn *ct) {}
 69 static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
 70 static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
 71                                       struct nf_conntrack_expect *exp) {}
 72 static inline void nf_ct_event_cache_flush(void) {}
 73 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
 74 
 75 #endif /*_NF_CONNTRACK_ECACHE_H*/
 76 
 77 
  This page was automatically generated by the LXR engine.