- began to clean code documentation
[strongswan.git] / Source / charon / types.h
1 /**
2 * @file types.h
3 *
4 * @brief Generic type definitions
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23
24 #ifndef TYPES_H_
25 #define TYPES_H_
26
27 #include <gmp.h>
28 #include <sys/types.h>
29 #include <stdlib.h>
30
31 #include <definitions.h>
32
33 typedef enum status_t status_t;
34
35 /**
36 * return status for function calls
37 */
38 enum status_t {
39 SUCCESS,
40 FAILED,
41 OUT_OF_RES,
42 ALREADY_DONE,
43 NOT_SUPPORTED,
44 INVALID_ARG,
45 NOT_FOUND,
46 PARSE_ERROR,
47 VERIFY_ERROR,
48 INVALID_STATE
49 };
50
51 extern mapping_t status_m[];
52
53
54 typedef struct timeval timeval_t;
55
56 typedef struct timespec timespec_t;
57
58 typedef struct sockaddr sockaddr_t;
59
60 typedef struct chunk_t chunk_t;
61
62 /**
63 * General purpose pointer/length abstraction
64 */
65 struct chunk_t {
66 u_char *ptr;
67 size_t len;
68 };
69
70 /**
71 * {NULL, 0}-chunk, handy for initialization
72 * of chunks.
73 */
74 extern chunk_t CHUNK_INITIALIZER;
75
76 /**
77 * General purpose boolean type
78 */
79 typedef int bool;
80 #define FALSE 0
81 #define TRUE 1
82
83
84
85 #endif /*TYPES_H_*/