- authentication with preshared key working but code MUST be cleaned
This commit is contained in:
@@ -639,6 +639,14 @@ static packet_t *get_packet (private_message_t *this)
|
||||
return this->packet->clone(this->packet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of message_t.get_packet_data.
|
||||
*/
|
||||
static chunk_t get_packet_data (private_message_t *this)
|
||||
{
|
||||
return allocator_clone_chunk(this->packet->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of message_t.parse_header.
|
||||
*/
|
||||
@@ -1163,6 +1171,7 @@ message_t *message_create_from_packet(packet_t *packet)
|
||||
this->public.parse_body = (status_t (*) (message_t *,crypter_t*,signer_t*)) parse_body;
|
||||
this->public.verify = (status_t (*) (message_t*)) verify;
|
||||
this->public.get_packet = (packet_t * (*) (message_t*)) get_packet;
|
||||
this->public.get_packet_data = (chunk_t (*) (message_t *this)) get_packet_data;
|
||||
this->public.destroy = (void(*)(message_t*))destroy;
|
||||
|
||||
/* private values */
|
||||
|
||||
@@ -289,6 +289,15 @@ struct message_t {
|
||||
*/
|
||||
packet_t * (*get_packet) (message_t *this);
|
||||
|
||||
/**
|
||||
* Returns a clone of the internal stored packet_t data.
|
||||
*
|
||||
* @param this message_t object
|
||||
* @return clone of the internal stored packet_t data.
|
||||
*/
|
||||
chunk_t (*get_packet_data) (message_t *this);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Destroys a message and all including objects.
|
||||
*
|
||||
|
||||
@@ -214,6 +214,14 @@ static void set_data (private_auth_payload_t *this, chunk_t data)
|
||||
* Implementation of auth_payload_t.get_data.
|
||||
*/
|
||||
static chunk_t get_data (private_auth_payload_t *this)
|
||||
{
|
||||
return (this->auth_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of auth_payload_t.get_data_clone.
|
||||
*/
|
||||
static chunk_t get_data_clone (private_auth_payload_t *this)
|
||||
{
|
||||
chunk_t cloned_data;
|
||||
if (this->auth_data.ptr == NULL)
|
||||
@@ -259,6 +267,7 @@ auth_payload_t *auth_payload_create()
|
||||
this->public.set_auth_method = (void (*) (auth_payload_t *,auth_method_t)) set_auth_method;
|
||||
this->public.get_auth_method = (auth_method_t (*) (auth_payload_t *)) get_auth_method;
|
||||
this->public.set_data = (void (*) (auth_payload_t *,chunk_t)) set_data;
|
||||
this->public.get_data_clone = (chunk_t (*) (auth_payload_t *)) get_data_clone;
|
||||
this->public.get_data = (chunk_t (*) (auth_payload_t *)) get_data;
|
||||
|
||||
/* private variables */
|
||||
|
||||
@@ -115,6 +115,16 @@ struct auth_payload_t {
|
||||
* @param this calling auth_payload_t object
|
||||
* @return AUTH data as chunk_t
|
||||
*/
|
||||
chunk_t (*get_data_clone) (auth_payload_t *this);
|
||||
|
||||
/**
|
||||
* @brief Get the AUTH data.
|
||||
*
|
||||
* Returned data are NOT copied
|
||||
*
|
||||
* @param this calling auth_payload_t object
|
||||
* @return AUTH data as chunk_t
|
||||
*/
|
||||
chunk_t (*get_data) (auth_payload_t *this);
|
||||
|
||||
/**
|
||||
|
||||
@@ -214,10 +214,19 @@ static void set_data (private_id_payload_t *this, chunk_t data)
|
||||
this->payload_length = ID_PAYLOAD_HEADER_LENGTH + this->id_data.len;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of id_payload_t.get_data.
|
||||
* Implementation of id_payload_t.get_data_clone.
|
||||
*/
|
||||
static chunk_t get_data (private_id_payload_t *this)
|
||||
{
|
||||
return (this->id_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of id_payload_t.get_data_clone.
|
||||
*/
|
||||
static chunk_t get_data_clone (private_id_payload_t *this)
|
||||
{
|
||||
chunk_t cloned_data;
|
||||
if (this->id_data.ptr == NULL)
|
||||
@@ -288,6 +297,8 @@ id_payload_t *id_payload_create(bool is_initiator)
|
||||
this->public.get_id_type = (id_type_t (*) (id_payload_t *)) get_id_type;
|
||||
this->public.set_data = (void (*) (id_payload_t *,chunk_t)) set_data;
|
||||
this->public.get_data = (chunk_t (*) (id_payload_t *)) get_data;
|
||||
this->public.get_data_clone = (chunk_t (*) (id_payload_t *)) get_data_clone;
|
||||
|
||||
this->public.get_initiator = (bool (*) (id_payload_t *)) get_initiator;
|
||||
this->public.set_initiator = (void (*) (id_payload_t *,bool)) set_initiator;
|
||||
this->public.get_identification = (identification_t * (*) (id_payload_t *this)) get_identification;
|
||||
|
||||
@@ -87,8 +87,18 @@ struct id_payload_t {
|
||||
* @param this calling id_payload_t object
|
||||
* @return ID data as chunk_t
|
||||
*/
|
||||
chunk_t (*get_data) (id_payload_t *this);
|
||||
chunk_t (*get_data_clone) (id_payload_t *this);
|
||||
|
||||
/**
|
||||
* @brief Get the ID data.
|
||||
*
|
||||
* Returned data are NOT copied.
|
||||
*
|
||||
* @param this calling id_payload_t object
|
||||
* @return ID data as chunk_t
|
||||
*/
|
||||
chunk_t (*get_data) (id_payload_t *this);
|
||||
|
||||
/**
|
||||
* @brief Creates an identification object of this id payload.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user