4 * @brief Generic types.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
28 #include <sys/types.h>
31 #include <definitions.h>
34 typedef enum status_t status_t
;
37 * Return values of function calls.
66 * One of the arguments is invalid.
71 * Something could not be found.
76 * Error while parsing.
81 * Error while verifying.
86 * Object in invalid state.
91 * Delete object which function belongs to.
96 * An object got created.
103 * String mappings for type status_t.
105 extern mapping_t status_m
[];
108 * Handle struct timeval like an own type.
110 typedef struct timeval timeval_t
;
113 * Handle struct timespec like an own type.
115 typedef struct timespec timespec_t
;
118 * Handle struct chunk_t like an own type.
120 typedef struct sockaddr sockaddr_t
;
123 * Use struct chunk_t as chunk_t.
125 typedef struct chunk_t chunk_t
;
128 * General purpose pointer/length abstraction.
132 * Pointer to start of data
137 * Length of data in bytes
143 * {NULL, 0}-chunk, handy for initialization
146 extern chunk_t CHUNK_INITIALIZER
;
149 * Initialize a chunk to a static buffer
151 #define chunk_from_buf(str) { str, sizeof(str) }
154 * Clone chunk contents in a newly allocated chunk
156 chunk_t
chunk_clone(chunk_t chunk
);
159 * Free contents of a chunk
161 void chunk_free(chunk_t
*chunk
);
166 chunk_t
chunk_alloc(size_t bytes
);
169 * Clone a data to a newly allocated buffer
171 void *clalloc(void *pointer
, size_t size
);
175 * General purpose boolean type.