- leak detective is usable, but does not show static function names
[strongswan.git] / Source / lib / asn1 / der_decoder.h
1 /**
2 * @file der_decoder.h
3 *
4 * @brief Interface of der_decoder_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 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 #ifndef DER_DECODER_H_
24 #define DER_DECODER_H_
25
26 #include <types.h>
27 #include <asn1/asn1.h>
28
29 typedef struct der_decoder_t der_decoder_t;
30
31 /**
32 * @brief Decode ASN1 DER encoded chunks.
33 *
34 * @b Constructors:
35 * - der_decoder_create()
36 *
37 * @todo A lot.
38 *
39 * @ingroup asn1
40 */
41 struct der_decoder_t {
42
43 /**
44 * @brief Decode a chunk of bytes to a data structure
45 *
46 * @param der_decoder calling object
47 * @param input chunk of data to decode
48 * @param output data structure where decoded data is written
49 * @return
50 * - PARSE_ERROR
51 * - FAILED
52 * - NOT_SUPPORTED
53 * - or SUCCESS sometimes
54 */
55 status_t (*decode) (der_decoder_t *this, chunk_t input, void *output);
56
57 /**
58 * @brief Destroys a der_decoder object.
59 *
60 * @param der_decoder calling object
61 */
62 void (*destroy) (der_decoder_t *this);
63 };
64
65
66 /**
67 * @brief Create a der_decoder instance.
68 *
69 * The instance needs ASN1 rules to know how to decode
70 * data...
71 *
72 * @param rules set of ASN1 coding rules
73 * @return der_decoder_t object
74 *
75 * @ingroup ans1
76 */
77 der_decoder_t * der_decoder_create(asn1_rule_t* rules);
78
79 #endif /* DER_DECODER_H_ */