ethernetgmii: updated kernel config, simpleImage.xilinx and other misc files
[ana-net.git] / src / xt_skb.h
blob876e9a5e6d6003716df4ccba2757a3050d06d33e
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;
24 enum path_type dir;
27 #define SKB_LANA_INF(skb) ((struct sock_lana_inf *) ((skb)->cb))
29 static inline void write_next_idp_to_skb(struct sk_buff *skb, idp_t from,
30 idp_t to)
32 struct sock_lana_inf *sli;
33 sli = SKB_LANA_INF(skb);
34 sli->idp_dst = to;
35 sli->idp_src = from;
38 static inline idp_t read_next_idp_from_skb(struct sk_buff *skb)
40 return SKB_LANA_INF(skb)->idp_dst;
43 static inline void write_path_to_skb(struct sk_buff *skb, enum path_type dir)
45 struct sock_lana_inf *sli;
46 sli = SKB_LANA_INF(skb);
47 sli->dir = dir;
50 static inline enum path_type read_path_from_skb(struct sk_buff *skb)
52 return SKB_LANA_INF(skb)->dir;
55 static inline void time_mark_skb_last(struct sk_buff *skb)
57 struct sock_lana_inf *sli = SKB_LANA_INF(skb);
58 sli->marker |= MARKER_TIME_MARKED_LAST;
61 static inline int skb_is_time_marked_last(struct sk_buff *skb)
63 return (SKB_LANA_INF(skb)->marker &
64 MARKER_TIME_MARKED_LAST) == MARKER_TIME_MARKED_LAST;
67 static inline void time_mark_skb_first(struct sk_buff *skb)
69 struct sock_lana_inf *sli = SKB_LANA_INF(skb);
70 sli->marker |= MARKER_TIME_MARKED_FIRST;
73 static inline int skb_is_time_marked_first(struct sk_buff *skb)
75 return (SKB_LANA_INF(skb)->marker &
76 MARKER_TIME_MARKED_FIRST) == MARKER_TIME_MARKED_FIRST;
79 #endif /* XT_SKB_H */