use sk_receive_skb instead of sk_backlog_rcv
[ana-net.git] / src / xt_skb.h
blob231faf90070d98fe451077bfbefa37d7090aad65
1 /*
2 * Lightweight Autonomic Network Architecture
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL.
7 */
9 #ifndef XT_SKB_H
10 #define XT_SKB_H
12 #include <linux/skbuff.h>
13 #include "xt_idp.h"
15 #define MARKER_TIME_MARKED_FIRST (1 << 0)
16 #define MARKER_TIME_MARKED_LAST (1 << 1)
18 struct sock_lana_inf {
19 idp_t idp_dst;
20 idp_t idp_src;
21 __u32 flags;
22 __u32 errno;
23 __u32 marker;
26 #define SKB_LANA_INF(skb) ((struct sock_lana_inf *) ((skb)->cb))
28 static inline void write_next_idp_to_skb(struct sk_buff *skb, idp_t from,
29 idp_t to)
31 struct sock_lana_inf *sli;
32 sli = SKB_LANA_INF(skb);
33 sli->idp_dst = to;
34 sli->idp_src = from;
37 static inline idp_t read_next_idp_from_skb(struct sk_buff *skb)
39 return SKB_LANA_INF(skb)->idp_dst;
42 static inline void time_mark_skb_last(struct sk_buff *skb)
44 struct sock_lana_inf *sli = SKB_LANA_INF(skb);
45 sli->marker |= MARKER_TIME_MARKED_LAST;
48 static inline int skb_is_time_marked_last(struct sk_buff *skb)
50 return (SKB_LANA_INF(skb)->marker &
51 MARKER_TIME_MARKED_LAST) == MARKER_TIME_MARKED_LAST;
54 static inline void time_mark_skb_first(struct sk_buff *skb)
56 struct sock_lana_inf *sli = SKB_LANA_INF(skb);
57 sli->marker |= MARKER_TIME_MARKED_FIRST;
60 static inline int skb_is_time_marked_first(struct sk_buff *skb)
62 return (SKB_LANA_INF(skb)->marker &
63 MARKER_TIME_MARKED_FIRST) == MARKER_TIME_MARKED_FIRST;
66 #endif /* XT_SKB_H */