2 * Lightweight Autonomic Network Architecture
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
12 #include <linux/skbuff.h>
15 #define MARKER_TIME_MARKED_FIRST (1 << 0)
16 #define MARKER_TIME_MARKED_LAST (1 << 1)
18 struct sock_lana_inf
{
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
,
32 struct sock_lana_inf
*sli
;
33 sli
= SKB_LANA_INF(skb
);
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
);
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
;