2005-11-08 09:37:39 +00:00
|
|
|
/*
|
2011-11-16 11:06:55 +00:00
|
|
|
* Copyright (C) 2006-2011 Tobias Brunner
|
2009-04-14 10:34:24 +00:00
|
|
|
* Copyright (C) 2005-2009 Martin Willi
|
2007-10-02 11:42:27 +00:00
|
|
|
* Copyright (C) 2006 Daniel Roethlisberger
|
2006-07-07 08:49:06 +00:00
|
|
|
* Copyright (C) 2005 Jan Hutter
|
2005-11-08 09:37:39 +00:00
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
2008-03-13 14:14:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup message message
|
|
|
|
* @{ @ingroup encoding
|
2005-11-08 09:37:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MESSAGE_H_
|
|
|
|
#define MESSAGE_H_
|
|
|
|
|
2006-10-30 14:07:05 +00:00
|
|
|
typedef struct message_t message_t;
|
|
|
|
|
2006-10-31 12:27:59 +00:00
|
|
|
#include <library.h>
|
2005-11-23 09:57:18 +00:00
|
|
|
#include <encoding/payloads/ike_header.h>
|
2005-12-05 12:21:38 +00:00
|
|
|
#include <encoding/payloads/notify_payload.h>
|
2011-11-21 10:18:08 +00:00
|
|
|
#include <sa/keymat.h>
|
|
|
|
#include <sa/ike_sa_id.h>
|
2012-10-16 12:33:28 +00:00
|
|
|
#include <networking/packet.h>
|
2012-10-16 12:54:16 +00:00
|
|
|
#include <collections/linked_list.h>
|
2005-11-10 17:17:46 +00:00
|
|
|
|
2005-11-08 09:47:17 +00:00
|
|
|
/**
|
2011-11-21 10:18:08 +00:00
|
|
|
* This class is used to represent an IKE-Message.
|
2005-11-10 09:35:28 +00:00
|
|
|
*
|
2005-12-06 11:51:13 +00:00
|
|
|
* The message handles parsing and generation of payloads
|
|
|
|
* via parser_t/generator_t. Encryption is done transparently
|
|
|
|
* via the encryption_payload_t. A set of rules for messages
|
|
|
|
* and payloads does check parsed messages.
|
2005-11-08 09:47:17 +00:00
|
|
|
*/
|
2005-11-24 09:17:51 +00:00
|
|
|
struct message_t {
|
2005-11-08 09:47:17 +00:00
|
|
|
|
2005-11-17 08:45:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the IKE major version of the message.
|
2005-11-17 08:45:40 +00:00
|
|
|
*
|
|
|
|
* @param major_version major version to set
|
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_major_version) (message_t *this,u_int8_t major_version);
|
2005-11-17 08:45:40 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the IKE major version of the message.
|
2005-11-17 08:45:40 +00:00
|
|
|
*
|
|
|
|
* @return major version of the message
|
|
|
|
*/
|
|
|
|
u_int8_t (*get_major_version) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-17 08:45:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the IKE minor version of the message.
|
2005-11-17 08:45:40 +00:00
|
|
|
*
|
|
|
|
* @param minor_version minor version to set
|
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_minor_version) (message_t *this,u_int8_t minor_version);
|
2005-11-17 08:45:40 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the IKE minor version of the message.
|
2005-11-17 08:45:40 +00:00
|
|
|
*
|
|
|
|
* @return minor version of the message
|
|
|
|
*/
|
|
|
|
u_int8_t (*get_minor_version) (message_t *this);
|
|
|
|
|
2005-11-10 17:49:20 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the Message ID of the message.
|
2005-11-10 17:49:20 +00:00
|
|
|
*
|
2008-03-13 14:14:44 +00:00
|
|
|
* @param message_id message_id to set
|
2005-11-10 17:49:20 +00:00
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_message_id) (message_t *this,u_int32_t message_id);
|
2005-11-10 17:49:20 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the Message ID of the message.
|
2005-11-10 17:49:20 +00:00
|
|
|
*
|
|
|
|
* @return message_id type of the message
|
|
|
|
*/
|
|
|
|
u_int32_t (*get_message_id) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the initiator SPI of the message.
|
2006-06-22 06:36:28 +00:00
|
|
|
*
|
|
|
|
* @return initiator spi of the message
|
|
|
|
*/
|
|
|
|
u_int64_t (*get_initiator_spi) (message_t *this);
|
|
|
|
|
2005-11-22 15:38:22 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the responder SPI of the message.
|
2005-11-22 15:38:22 +00:00
|
|
|
*
|
|
|
|
* @return responder spi of the message
|
|
|
|
*/
|
|
|
|
u_int64_t (*get_responder_spi) (message_t *this);
|
2005-11-10 17:49:20 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the IKE_SA ID of the message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* ike_sa_id gets cloned.
|
2005-11-10 17:49:20 +00:00
|
|
|
*
|
|
|
|
* @param ike_sa_id ike_sa_id to set
|
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
void (*set_ike_sa_id) (message_t *this, ike_sa_id_t * ike_sa_id);
|
2005-11-10 17:49:20 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the IKE_SA ID of the message.
|
2006-07-05 10:53:20 +00:00
|
|
|
*
|
|
|
|
* The ike_sa_id points to the message internal id, do not modify.
|
2005-11-10 17:49:20 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* @return ike_sa_id of message
|
2005-11-10 17:49:20 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
ike_sa_id_t *(*get_ike_sa_id) (message_t *this);
|
2005-11-10 17:49:20 +00:00
|
|
|
|
2005-11-10 17:17:46 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the exchange type of the message.
|
2005-11-10 17:17:46 +00:00
|
|
|
*
|
|
|
|
* @param exchange_type exchange_type to set
|
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_exchange_type) (message_t *this,exchange_type_t exchange_type);
|
2005-11-10 17:17:46 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the exchange type of the message.
|
2005-11-10 17:17:46 +00:00
|
|
|
*
|
|
|
|
* @return exchange type of the message
|
|
|
|
*/
|
|
|
|
exchange_type_t (*get_exchange_type) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-02 11:42:27 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets the payload type of the first payload.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2007-10-02 11:42:27 +00:00
|
|
|
* @return payload type of the first payload
|
|
|
|
*/
|
|
|
|
payload_type_t (*get_first_payload_type) (message_t *this);
|
2005-11-10 17:17:46 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sets the request flag.
|
2005-11-10 17:17:46 +00:00
|
|
|
*
|
2008-03-13 14:14:44 +00:00
|
|
|
* @param request TRUE if message is a request, FALSE if it is a reply
|
2005-11-10 17:17:46 +00:00
|
|
|
*/
|
2008-03-13 14:14:44 +00:00
|
|
|
void (*set_request) (message_t *this, bool request);
|
2005-11-10 17:17:46 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Gets request flag.
|
2005-11-10 17:17:46 +00:00
|
|
|
*
|
|
|
|
* @return TRUE if message is a request, FALSE if it is a reply
|
|
|
|
*/
|
|
|
|
bool (*get_request) (message_t *this);
|
|
|
|
|
2010-11-24 16:45:12 +00:00
|
|
|
/**
|
|
|
|
* Set the version flag in the IKE header.
|
|
|
|
*/
|
|
|
|
void (*set_version_flag)(message_t *this);
|
|
|
|
|
2010-11-24 15:56:46 +00:00
|
|
|
/**
|
|
|
|
* Get a reserved bit in the IKE header.
|
|
|
|
*
|
|
|
|
* @param nr reserved bit to get in IKE header, 0-4
|
|
|
|
* @return TRUE if bit is set
|
|
|
|
*/
|
|
|
|
bool (*get_reserved_header_bit)(message_t *this, u_int nr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a reserved bit in the IKE header.
|
|
|
|
*
|
|
|
|
* @param nr reserved bit to set in IKE header, 0-4
|
|
|
|
*/
|
|
|
|
void (*set_reserved_header_bit)(message_t *this, u_int nr);
|
|
|
|
|
2005-11-16 16:09:15 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Append a payload to the message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2005-12-06 11:51:13 +00:00
|
|
|
* If the payload must be encrypted is not specified here. Encryption
|
|
|
|
* of payloads is evaluated via internal rules for the messages and
|
|
|
|
* is done before generation. The order of payloads may change, since
|
2009-09-04 11:46:09 +00:00
|
|
|
* all payloads to encrypt are added to the encryption payload, which is
|
2005-12-06 11:51:13 +00:00
|
|
|
* always the last one.
|
2005-11-16 16:09:15 +00:00
|
|
|
*
|
2011-11-16 11:06:55 +00:00
|
|
|
* @param payload payload to append
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*add_payload) (message_t *this, payload_t *payload);
|
2005-11-16 16:09:15 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Build a notify payload and add it to the message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2007-02-28 14:04:36 +00:00
|
|
|
* This is a helper method to create notify messages or add
|
|
|
|
* notify payload to messages. The flush parameter specifies if existing
|
|
|
|
* payloads should get removed before appending the notify.
|
|
|
|
*
|
|
|
|
* @param flush TRUE to remove existing payloads
|
|
|
|
* @param type type of the notify
|
|
|
|
* @param data a chunk of data to add to the notify, gets cloned
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
|
|
|
void (*add_notify) (message_t *this, bool flush, notify_type_t type,
|
2007-02-28 14:04:36 +00:00
|
|
|
chunk_t data);
|
|
|
|
|
2010-11-02 13:21:38 +00:00
|
|
|
/**
|
|
|
|
* Disable automatic payload sorting for this message.
|
|
|
|
*/
|
|
|
|
void (*disable_sort)(message_t *this);
|
|
|
|
|
2005-11-16 16:50:13 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Parses header of message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2011-11-16 11:06:55 +00:00
|
|
|
* Begins parsing of a message created via message_create_from_packet().
|
2005-12-06 11:51:13 +00:00
|
|
|
* The parsing context is stored, so a subsequent call to parse_body()
|
|
|
|
* will continue the parsing process.
|
2005-11-17 08:45:40 +00:00
|
|
|
*
|
|
|
|
* @return
|
2011-11-16 11:06:55 +00:00
|
|
|
* - SUCCESS if header could be parsed
|
2005-11-17 08:45:40 +00:00
|
|
|
* - PARSE_ERROR if corrupted/invalid data found
|
2011-11-16 11:06:55 +00:00
|
|
|
* - FAILED if consistency check of header failed
|
2005-11-17 08:45:40 +00:00
|
|
|
*/
|
|
|
|
status_t (*parse_header) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-17 08:45:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Parses body of message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
|
|
|
* The body gets not only parsed, but rather it gets verified.
|
|
|
|
* All payloads are verified if they are allowed to exist in the message
|
|
|
|
* of this type and if their own structure is ok.
|
2010-08-17 15:36:09 +00:00
|
|
|
* If there are encrypted payloads, they get decrypted and verified using
|
|
|
|
* the given aead transform (if given).
|
|
|
|
*
|
2011-11-21 10:18:08 +00:00
|
|
|
* @param keymat keymat to verify/decrypt message
|
2005-11-16 16:50:13 +00:00
|
|
|
* @return
|
2011-11-16 11:06:55 +00:00
|
|
|
* - SUCCESS if parsing successful
|
2006-07-05 10:53:20 +00:00
|
|
|
* - PARSE_ERROR if message parsing failed
|
2011-11-16 11:06:55 +00:00
|
|
|
* - VERIFY_ERROR if message verification failed (bad syntax)
|
|
|
|
* - FAILED if integrity check failed
|
|
|
|
* - INVALID_STATE if aead not supplied, but needed
|
2005-11-16 16:50:13 +00:00
|
|
|
*/
|
2011-11-21 10:18:08 +00:00
|
|
|
status_t (*parse_body) (message_t *this, keymat_t *keymat);
|
2005-11-17 11:19:45 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Generates the UDP packet of specific message.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2005-12-06 11:51:13 +00:00
|
|
|
* Payloads which must be encrypted are generated first and added to
|
2010-08-17 15:36:09 +00:00
|
|
|
* an encryption payload. This encryption payload will get encrypted and
|
|
|
|
* signed via the supplied aead transform (if given).
|
|
|
|
* Generation is only done once, multiple calls will just return a copy
|
|
|
|
* of the packet.
|
|
|
|
*
|
2011-11-21 10:18:08 +00:00
|
|
|
* @param keymat keymat to encrypt/sign message
|
2006-07-05 10:53:20 +00:00
|
|
|
* @param packet copy of generated packet
|
2005-11-17 11:19:45 +00:00
|
|
|
* @return
|
2011-11-16 11:06:55 +00:00
|
|
|
* - SUCCESS if packet could be generated
|
|
|
|
* - INVALID_STATE if exchange type is currently not set
|
|
|
|
* - NOT_FOUND if no rules found for message generation
|
|
|
|
* - INVALID_STATE if aead not supplied but needed.
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2011-11-21 10:18:08 +00:00
|
|
|
status_t (*generate) (message_t *this, keymat_t *keymat, packet_t **packet);
|
2005-12-06 11:51:13 +00:00
|
|
|
|
2010-11-24 17:09:06 +00:00
|
|
|
/**
|
|
|
|
* Check if the message has already been encoded using generate().
|
|
|
|
*
|
|
|
|
* @return TRUE if message has been encoded
|
|
|
|
*/
|
|
|
|
bool (*is_encoded)(message_t *this);
|
|
|
|
|
2005-11-30 12:58:57 +00:00
|
|
|
/**
|
2009-09-04 11:46:09 +00:00
|
|
|
* Gets the source host informations.
|
|
|
|
*
|
|
|
|
* @warning Returned host_t object is not getting cloned,
|
2005-12-06 11:51:13 +00:00
|
|
|
* do not destroy nor modify.
|
2005-11-30 12:58:57 +00:00
|
|
|
*
|
|
|
|
* @return host_t object representing source host
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-11-30 12:58:57 +00:00
|
|
|
host_t * (*get_source) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-30 12:58:57 +00:00
|
|
|
/**
|
2009-09-04 11:46:09 +00:00
|
|
|
* Sets the source host informations.
|
|
|
|
*
|
2005-11-30 12:58:57 +00:00
|
|
|
* @warning host_t object is not getting cloned and gets destroyed by
|
2011-11-16 11:06:55 +00:00
|
|
|
* message_t.destroy or next call of message_t.set_source.
|
2005-11-30 12:58:57 +00:00
|
|
|
*
|
|
|
|
* @param host host_t object representing source host
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_source) (message_t *this, host_t *host);
|
2005-11-30 12:58:57 +00:00
|
|
|
|
|
|
|
/**
|
2009-09-04 11:46:09 +00:00
|
|
|
* Gets the destination host informations.
|
|
|
|
*
|
|
|
|
* @warning Returned host_t object is not getting cloned,
|
2005-12-06 11:51:13 +00:00
|
|
|
* do not destroy nor modify.
|
2005-11-30 12:58:57 +00:00
|
|
|
*
|
|
|
|
* @return host_t object representing destination host
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-11-30 12:58:57 +00:00
|
|
|
host_t * (*get_destination) (message_t *this);
|
|
|
|
|
|
|
|
/**
|
2009-09-04 11:46:09 +00:00
|
|
|
* Sets the destination host informations.
|
|
|
|
*
|
2005-11-30 12:58:57 +00:00
|
|
|
* @warning host_t object is not getting cloned and gets destroyed by
|
2011-11-16 11:06:55 +00:00
|
|
|
* message_t.destroy or next call of message_t.set_destination.
|
2005-11-30 12:58:57 +00:00
|
|
|
*
|
|
|
|
* @param host host_t object representing destination host
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*set_destination) (message_t *this, host_t *host);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-30 12:58:57 +00:00
|
|
|
/**
|
2009-04-14 10:34:24 +00:00
|
|
|
* Create an enumerator over all payloads.
|
2005-11-30 12:58:57 +00:00
|
|
|
*
|
2009-04-14 10:34:24 +00:00
|
|
|
* @return enumerator over payload_t
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2009-04-14 10:34:24 +00:00
|
|
|
enumerator_t * (*create_payload_enumerator) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2010-11-02 13:30:45 +00:00
|
|
|
/**
|
|
|
|
* Remove the payload at the current enumerator position.
|
|
|
|
*
|
|
|
|
* @param enumerator enumerator created by create_payload_enumerator()
|
|
|
|
*/
|
|
|
|
void (*remove_payload_at)(message_t *this, enumerator_t *enumerator);
|
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Find a payload of a specific type.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2011-07-20 13:57:53 +00:00
|
|
|
* Returns the first occurrence.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
|
|
|
* @param type type of the payload to find
|
|
|
|
* @return payload, or NULL if no such payload found
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
payload_t* (*get_payload) (message_t *this, payload_type_t type);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-04-14 10:34:24 +00:00
|
|
|
/**
|
|
|
|
* Get the first notify payload of a specific type.
|
|
|
|
*
|
|
|
|
* @param type type of notification payload
|
|
|
|
* @return notify payload, NULL if no such notify found
|
|
|
|
*/
|
|
|
|
notify_payload_t* (*get_notify)(message_t *this, notify_type_t type);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-12-02 13:20:20 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Returns a clone of the internal stored packet_t object.
|
2005-12-02 13:20:20 +00:00
|
|
|
*
|
|
|
|
* @return packet_t object as clone of internal one
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-12-02 13:20:20 +00:00
|
|
|
packet_t * (*get_packet) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-12-03 14:47:58 +00:00
|
|
|
/**
|
2011-11-18 16:49:53 +00:00
|
|
|
* Returns a chunk pointing to internal packet_t data.
|
2005-12-03 14:47:58 +00:00
|
|
|
*
|
2011-11-18 16:49:53 +00:00
|
|
|
* @return packet data.
|
2009-09-04 11:46:09 +00:00
|
|
|
*/
|
2005-12-03 14:47:58 +00:00
|
|
|
chunk_t (*get_packet_data) (message_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-08 09:47:17 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Destroys a message and all including objects.
|
2005-11-08 09:47:17 +00:00
|
|
|
*/
|
2005-11-28 16:55:46 +00:00
|
|
|
void (*destroy) (message_t *this);
|
2005-11-08 09:47:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2011-11-16 11:06:55 +00:00
|
|
|
* Creates a message_t object from an incoming UDP packet.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2010-08-17 15:36:09 +00:00
|
|
|
* The given packet gets owned by the message. The message is uninitialized,
|
|
|
|
* call parse_header() to populate header fields.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
|
|
|
* @param packet packet_t object which is assigned to message
|
2011-11-16 11:06:55 +00:00
|
|
|
* @return message_t object
|
2005-11-08 09:47:17 +00:00
|
|
|
*/
|
2011-11-16 11:06:55 +00:00
|
|
|
message_t *message_create_from_packet(packet_t *packet);
|
2005-11-08 09:47:17 +00:00
|
|
|
|
2005-11-10 15:38:38 +00:00
|
|
|
/**
|
2011-11-16 11:06:55 +00:00
|
|
|
* Creates an empty message_t object for a specific major/minor version.
|
2005-11-10 15:38:38 +00:00
|
|
|
*
|
2005-11-10 17:17:46 +00:00
|
|
|
* - exchange_type is set to NOT_SET
|
|
|
|
* - original_initiator is set to TRUE
|
|
|
|
* - is_request is set to TRUE
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2011-11-16 11:06:55 +00:00
|
|
|
* @param major major IKE version of this message
|
|
|
|
* @param minor minor IKE version of this message
|
|
|
|
* @return message_t object
|
2005-11-10 15:38:38 +00:00
|
|
|
*/
|
2011-11-16 11:06:55 +00:00
|
|
|
message_t *message_create(int major, int minor);
|
2005-11-08 09:47:17 +00:00
|
|
|
|
2009-03-24 17:43:01 +00:00
|
|
|
#endif /** MESSAGE_H_ @}*/
|