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