Contiki 2.5
bundleslot.h
Go to the documentation of this file.
1 /**
2  * \addtogroup bprocess
3  * @{
4  */
5 
6 /**
7  * \file
8  * \brief Header for Bundle Slot memory management
9  *
10  * \author Daniel Willmann <daniel@totalueberwachung.de>
11  */
12 
13 #ifndef __BUNDLESLOT_H__
14 #define __BUNDLESLOT_H__
15 
16 #include <stddef.h>
17 
18 #include "mmem.h"
19 #include "contiki.h"
20 
21 /* Kernel container_of function
22  * WARNING: The ({}) macro extenstion is GCC-specific,
23  * but it's worth using it here */
24 #define container_of(ptr, type, member) ({ \
25  const typeof( ((type *)0)->member ) *__mptr = (ptr); \
26  (type *)( (char *)__mptr - offsetof(type,member) );})
27 
28 struct bundle_slot_t {
29  struct bundle_slot_t *next;
30  uint8_t ref;
31  int type;
32  struct mmem bundle;
33 };
34 
35 struct bundle_slot_t *bundleslot_get_free();
36 
37 void bundleslot_free(struct bundle_slot_t *bs);
38 
39 int bundleslot_increment(struct bundle_slot_t *bs);
40 
41 int bundleslot_decrement(struct bundle_slot_t *bs);
42 
43 
44 
45 #endif /* __BUNDLESLOT_H__ */