]>
Commit | Line | Data |
---|---|---|
53232d58 RB |
1 | /* |
2 | * Copyright (C) 2012 Reto Buerki | |
3 | * Copyright (C) 2012 Adrian-Ken Rueegsegger | |
19ef2aec TB |
4 | * |
5 | * Copyright (C) secunet Security Networks AG | |
53232d58 RB |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2 of the License, or (at your | |
10 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | * for more details. | |
16 | */ | |
17 | ||
7f21523a AKR |
18 | /** |
19 | * @defgroup tkm-utils utils | |
20 | * @{ @ingroup tkm | |
21 | */ | |
22 | ||
53232d58 RB |
23 | #ifndef TKM_UTILS_H_ |
24 | #define TKM_UTILS_H_ | |
25 | ||
26 | #include <utils/chunk.h> | |
27 | #include <tkm/types.h> | |
28 | ||
29 | /** | |
30 | * Convert byte sequence to chunk. | |
31 | * | |
32 | * @param first pointer to first byte of sequence | |
33 | * @param len length of byte sequence | |
34 | * @param chunk pointer to chunk struct | |
35 | */ | |
36 | void sequence_to_chunk(const byte_t * const first, const uint32_t len, | |
7cc6fa1a | 37 | chunk_t * const chunk); |
53232d58 | 38 | |
0327fac6 RB |
39 | /** |
40 | * Convert chunk to variable-length byte sequence. | |
41 | * | |
42 | * @param chunk pointer to chunk struct | |
43 | * @param sequence pointer to variable-length sequence | |
0f0165c8 | 44 | * @param typelen length of sequence type |
0327fac6 | 45 | */ |
0f0165c8 | 46 | void chunk_to_sequence(const chunk_t * const chunk, void *sequence, |
7cc6fa1a | 47 | const uint32_t typelen); |
0327fac6 | 48 | |
7f21523a | 49 | #endif /** TKM_UTILS_H_ @}*/ |