2 * @file nonce_payload.h
4 * @brief Interface of nonce_payload_t.
9 * Copyright (C) 2005-2006 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 #ifndef NONCE_PAYLOAD_H_
25 #define NONCE_PAYLOAD_H_
27 typedef struct nonce_payload_t nonce_payload_t
;
30 #include <encoding/payloads/payload.h>
33 * Nonce size in bytes for nonces sending to other peer.
35 * @warning Nonce size MUST be between 16 and 256 bytes.
42 * Length of a nonce payload without a nonce in bytes.
46 #define NONCE_PAYLOAD_HEADER_LENGTH 4
49 * Object representing an IKEv2 Nonce payload.
51 * The Nonce payload format is described in RFC section 3.3.
54 * - nonce_payload_create()
58 struct nonce_payload_t
{
60 * The payload_t interface.
62 payload_t payload_interface
;
65 * @brief Set the nonce value.
67 * @param this calling nonce_payload_t object
68 * @param nonce chunk containing the nonce, will be cloned
70 void (*set_nonce
) (nonce_payload_t
*this, chunk_t nonce
);
73 * @brief Get the nonce value.
75 * @param this calling nonce_payload_t object
76 * @return a chunk containing the cloned nonce
78 chunk_t (*get_nonce
) (nonce_payload_t
*this);
81 * @brief Destroys an nonce_payload_t object.
83 * @param this nonce_payload_t object to destroy
85 void (*destroy
) (nonce_payload_t
*this);
89 * @brief Creates an empty nonce_payload_t object
91 * @return nonce_payload_t object
96 nonce_payload_t
*nonce_payload_create(void);
99 #endif /*NONCE_PAYLOAD_H_*/