2 * @file nonce_payload.h
4 * @brief Interface of nonce_payload_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
23 #ifndef NONCE_PAYLOAD_H_
24 #define NONCE_PAYLOAD_H_
27 #include <encoding/payloads/payload.h>
30 * Length of a nonce payload without a nonce in bytes.
34 #define NONCE_PAYLOAD_HEADER_LENGTH 4
36 typedef struct nonce_payload_t nonce_payload_t
;
39 * Object representing an IKEv2 Nonce payload.
41 * The Nonce payload format is described in RFC section 3.3.
44 * - nonce_payload_create()
48 struct nonce_payload_t
{
50 * The payload_t interface.
52 payload_t payload_interface
;
55 * @brief Set the nonce value.
57 * @param this calling nonce_payload_t object
58 * @param nonce chunk containing the nonce, will be cloned
60 void (*set_nonce
) (nonce_payload_t
*this, chunk_t nonce
);
63 * @brief Get the nonce value.
65 * @param this calling nonce_payload_t object
66 * @return a chunk containing the cloned nonce
68 chunk_t (*get_nonce
) (nonce_payload_t
*this);
71 * @brief Destroys an nonce_payload_t object.
73 * @param this nonce_payload_t object to destroy
75 void (*destroy
) (nonce_payload_t
*this);
79 * @brief Creates an empty nonce_payload_t object
81 * @return nonce_payload_t object
86 nonce_payload_t
*nonce_payload_create();
89 #endif /*NONCE_PAYLOAD_H_*/