summaryrefslogtreecommitdiff
path: root/lib/types.h
blob: 37eb80f5d8ca7bbf12fb829e8052e56e8d487949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef lib_types_h
#define lib_types_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    lib/types.h
 * \brief   Common types header.
 * \ingroup lib
 *
 * Define common types used almost everywhere.
 */

#include <stdbool.h>
#include <stddef.h>

#ifdef DOXYGEN_ONLY
/** Boolean value.  This C99 type comes from lib/stdbool.h.  It can store true or
 * false values. */
typedef _Bool bool;
#endif

/** Pointer value to use when debuging where a pointer is known to be
 * invalid. */
#define INVALID_PTR ((void *) 0xDEADDEAD)

/** Convenient shortcut for unsigned int. */
typedef unsigned int uint;

/**
 * \name Fixed size types
 * Theses types should only be used when a specific size is required, not as
 * general purpose types.  If the size does not matter, use an int or uint.
 */
/*@{*/
typedef unsigned long long u64;
typedef signed long long s64;
typedef unsigned int u32;
typedef signed int s32;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned char u8;
typedef signed char s8;
/*@}*/

/**
 * MAC Address.
 * Stored as little endian, i.e. the first MAC address byte is in the least
 * significant bits.
 *
 * Ex: 11:22:33:44:55:66 => 0x0000665544332211ull
 */
typedef u64 mac_t;

#endif /* lib_types_h */