2 * @file nonce_payload.h
4 * @brief Declaration of the class nonce_payload_t.
6 * An object of this type represents an IKEv2 Nonce-Payload.
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 #ifndef NONCE_PAYLOAD_H_
26 #define NONCE_PAYLOAD_H_
29 #include <encoding/payloads/payload.h>
32 * length of a nonce payload without a nonce in int
34 #define NONCE_PAYLOAD_HEADER_LENGTH 4
37 * Object representing an IKEv2 Nonce payload
39 * The Nonce payload format is described in draft section 3.3.
42 typedef struct nonce_payload_s nonce_payload_t
;
44 struct nonce_payload_s
{
46 * implements payload_t interface
48 payload_t payload_interface
;
51 * @brief Set the nonce value.
53 * The nonce must have length between 16 and 256 bytes
55 * @param this calling nonce_payload_t object
56 * @param nonce chunk containing the nonce, will be cloned
59 * - INVALID_ARG, if nonce has an invalid size
61 status_t (*set_nonce
) (nonce_payload_t
*this, chunk_t nonce
);
64 * @brief Get the nonce value.
66 * @param this calling nonce_payload_t object
67 * @param[out] nonce chunk where nonce data is located (cloned)
68 * @return SUCCESS in any case
70 status_t (*get_nonce
) (nonce_payload_t
*this, chunk_t
*nonce
);
73 * @brief Destroys an nonce_payload_t object.
75 * @param this nonce_payload_t object to destroy
79 status_t (*destroy
) (nonce_payload_t
*this);
83 * @brief Creates an empty nonce_payload_t object
86 * - created nonce_payload_t object, or
90 nonce_payload_t
*nonce_payload_create();
93 #endif /*NONCE_PAYLOAD_H_*/