payload: Use common prefixes for all payload type identifiers
[strongswan.git] / src / libcharon / encoding / payloads / hash_payload.h
1 /*
2 * Copyright (C) 2011 Martin Willi
3 * Copyright (C) 2011 revosec AG
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup hash_payload hash_payload
18 * @{ @ingroup payloads
19 */
20
21 #ifndef HASH_PAYLOAD_H_
22 #define HASH_PAYLOAD_H_
23
24 typedef struct hash_payload_t hash_payload_t;
25
26 #include <library.h>
27 #include <encoding/payloads/payload.h>
28
29 /**
30 * Object representing an IKEv1 hash payload.
31 */
32 struct hash_payload_t {
33
34 /**
35 * The payload_t interface.
36 */
37 payload_t payload_interface;
38
39 /**
40 * Set the hash value.
41 *
42 * @param hash chunk containing the hash, will be cloned
43 */
44 void (*set_hash) (hash_payload_t *this, chunk_t hash);
45
46 /**
47 * Get the hash value.
48 *
49 * @return chunkt to internal hash data
50 */
51 chunk_t (*get_hash) (hash_payload_t *this);
52
53 /**
54 * Destroys an hash_payload_t object.
55 */
56 void (*destroy) (hash_payload_t *this);
57 };
58
59 /**
60 * Creates an empty hash_payload_t object.
61 *
62 * @param type either PLV1_HASH or PLV1_NAT_D
63 * @return hash_payload_t object
64 */
65 hash_payload_t *hash_payload_create(payload_type_t type);
66
67 #endif /** HASH_PAYLOAD_H_ @}*/