Return to nonce_payload.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libcharon / encoding / payloads |
1.1 misho 1: /* 2: * Copyright (C) 2005-2006 Martin Willi 3: * Copyright (C) 2005 Jan Hutter 4: * HSR Hochschule fuer Technik Rapperswil 5: * 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>. 10: * 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 14: * for more details. 15: */ 16: 17: /** 18: * @defgroup nonce_payload nonce_payload 19: * @{ @ingroup payloads 20: */ 21: 22: #ifndef NONCE_PAYLOAD_H_ 23: #define NONCE_PAYLOAD_H_ 24: 25: typedef struct nonce_payload_t nonce_payload_t; 26: 27: #include <library.h> 28: #include <encoding/payloads/payload.h> 29: 30: /** 31: * Nonce size in bytes for nonces sending to other peer. 32: */ 33: #define NONCE_SIZE 32 34: 35: /** 36: * Object representing an IKEv1/IKEv2 Nonce payload. 37: */ 38: struct nonce_payload_t { 39: /** 40: * The payload_t interface. 41: */ 42: payload_t payload_interface; 43: 44: /** 45: * Set the nonce value. 46: * 47: * @param nonce chunk containing the nonce, will be cloned 48: */ 49: void (*set_nonce) (nonce_payload_t *this, chunk_t nonce); 50: 51: /** 52: * Get the nonce value. 53: * 54: * @return a chunk containing the cloned nonce 55: */ 56: chunk_t (*get_nonce) (nonce_payload_t *this); 57: 58: /** 59: * Destroys an nonce_payload_t object. 60: */ 61: void (*destroy) (nonce_payload_t *this); 62: }; 63: 64: /** 65: * Creates an empty nonce_payload_t object 66: * 67: * @param type PLV2_NONCE or PLV1_NONCE 68: * @return nonce_payload_t object 69: */ 70: nonce_payload_t *nonce_payload_create(payload_type_t type); 71: 72: #endif /** NONCE_PAYLOAD_H_ @}*/