added functions for getting/setting ISAKMP SPI to notify payload
This commit is contained in:
Regular → Executable
+33
@@ -600,6 +600,37 @@ METHOD(notify_payload_t, set_spi, void,
|
||||
compute_length(this);
|
||||
}
|
||||
|
||||
METHOD(notify_payload_t, get_spi_data, chunk_t,
|
||||
private_notify_payload_t *this)
|
||||
{
|
||||
switch (this->protocol_id)
|
||||
{
|
||||
case PROTO_IKE:
|
||||
if (this->spi.len == 16)
|
||||
{
|
||||
return this->spi;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return chunk_empty;
|
||||
}
|
||||
|
||||
METHOD(notify_payload_t, set_spi_data, void,
|
||||
private_notify_payload_t *this, chunk_t spi)
|
||||
{
|
||||
chunk_free(&this->spi);
|
||||
switch (this->protocol_id)
|
||||
{
|
||||
case PROTO_IKE:
|
||||
this->spi = chunk_clone(spi);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->spi_size = this->spi.len;
|
||||
compute_length(this);
|
||||
}
|
||||
|
||||
METHOD(notify_payload_t, get_notification_data, chunk_t,
|
||||
private_notify_payload_t *this)
|
||||
{
|
||||
@@ -647,6 +678,8 @@ notify_payload_t *notify_payload_create(payload_type_t type)
|
||||
.set_notify_type = _set_notify_type,
|
||||
.get_spi = _get_spi,
|
||||
.set_spi = _set_spi,
|
||||
.get_spi_data = _get_spi_data,
|
||||
.set_spi_data = _set_spi_data,
|
||||
.get_notification_data = _get_notification_data,
|
||||
.set_notification_data = _set_notification_data,
|
||||
.destroy = _destroy,
|
||||
|
||||
Regular → Executable
+18
@@ -209,6 +209,24 @@ struct notify_payload_t {
|
||||
*/
|
||||
void (*set_spi) (notify_payload_t *this, u_int32_t spi);
|
||||
|
||||
/**
|
||||
* Returns the currently set spi of this payload.
|
||||
*
|
||||
* This is only valid for notifys with protocol ISAKMP
|
||||
*
|
||||
* @return SPI value
|
||||
*/
|
||||
chunk_t (*get_spi_data) (notify_payload_t *this);
|
||||
|
||||
/**
|
||||
* Sets the spi of this payload.
|
||||
*
|
||||
* This is only valid for notifys with protocol ISAKMP
|
||||
*
|
||||
* @param spi SPI value
|
||||
*/
|
||||
void (*set_spi_data) (notify_payload_t *this, chunk_t spi);
|
||||
|
||||
/**
|
||||
* Returns the currently set notification data of payload.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user