2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
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>.
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
20 * @defgroup nonce_payload nonce_payload
21 * @{ @ingroup payloads
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.
38 * Length of a nonce payload without a nonce in bytes.
40 #define NONCE_PAYLOAD_HEADER_LENGTH 4
43 * Object representing an IKEv2 Nonce payload.
45 * The Nonce payload format is described in RFC section 3.3.
47 struct nonce_payload_t
{
49 * The payload_t interface.
51 payload_t payload_interface
;
54 * Set the nonce value.
56 * @param nonce chunk containing the nonce, will be cloned
58 void (*set_nonce
) (nonce_payload_t
*this, chunk_t nonce
);
61 * Get the nonce value.
63 * @return a chunk containing the cloned nonce
65 chunk_t (*get_nonce
) (nonce_payload_t
*this);
68 * Destroys an nonce_payload_t object.
70 void (*destroy
) (nonce_payload_t
*this);
74 * Creates an empty nonce_payload_t object
76 * @return nonce_payload_t object
78 nonce_payload_t
*nonce_payload_create(void);
80 #endif /*NONCE_PAYLOAD_H_ @} */