Added method to get encoded version if ID_V1 payload.
This commit is contained in:
@@ -327,6 +327,15 @@ METHOD(id_payload_t, get_ts, traffic_selector_t*,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(id_payload_t, get_encoded, chunk_t,
|
||||||
|
private_id_payload_t *this)
|
||||||
|
{
|
||||||
|
u_int16_t port = htons(this->port);
|
||||||
|
return chunk_cat("cccc", chunk_from_thing(this->id_type),
|
||||||
|
chunk_from_thing(this->protocol_id),
|
||||||
|
chunk_from_thing(port), this->id_data);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD2(payload_t, id_payload_t, destroy, void,
|
METHOD2(payload_t, id_payload_t, destroy, void,
|
||||||
private_id_payload_t *this)
|
private_id_payload_t *this)
|
||||||
{
|
{
|
||||||
@@ -354,6 +363,7 @@ id_payload_t *id_payload_create(payload_type_t type)
|
|||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.get_identification = _get_identification,
|
.get_identification = _get_identification,
|
||||||
|
.get_encoded = _get_encoded,
|
||||||
.get_ts = _get_ts,
|
.get_ts = _get_ts,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -54,6 +54,13 @@ struct id_payload_t {
|
|||||||
*/
|
*/
|
||||||
traffic_selector_t* (*get_ts)(id_payload_t *this);
|
traffic_selector_t* (*get_ts)(id_payload_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get encoded payload without fixed payload header (used for IKEv1).
|
||||||
|
*
|
||||||
|
* @return encoded payload (gets allocated)
|
||||||
|
*/
|
||||||
|
chunk_t (*get_encoded)(id_payload_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys an id_payload_t object.
|
* Destroys an id_payload_t object.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user