Fixed some typos; whitespace cleanup.
This commit is contained in:
@@ -47,7 +47,7 @@ typedef struct payload_rule_t payload_rule_t;
|
||||
|
||||
/**
|
||||
* A payload rule defines the rules for a payload
|
||||
* in a specific message rule. It defines if and how
|
||||
* in a specific message rule. It defines if and how
|
||||
* many times a payload must/can occur in a message
|
||||
* and if it must be encrypted.
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ struct payload_rule_t {
|
||||
|
||||
/**
|
||||
* If this payload occurs, the message rule is
|
||||
* fullfilled in any case. This applies e.g. to
|
||||
* fullfilled in any case. This applies e.g. to
|
||||
* notify_payloads.
|
||||
*/
|
||||
bool sufficient;
|
||||
@@ -88,11 +88,11 @@ typedef struct payload_order_t payload_order_t;
|
||||
struct payload_order_t {
|
||||
|
||||
/**
|
||||
* payload type
|
||||
* payload type
|
||||
*/
|
||||
payload_type_t type;
|
||||
|
||||
/**
|
||||
/**
|
||||
* notify type, if payload == NOTIFY
|
||||
*/
|
||||
notify_type_t notify;
|
||||
@@ -516,7 +516,7 @@ static message_rule_t message_rules[] = {
|
||||
(sizeof(me_connect_r_payload_order)/sizeof(payload_order_t)),
|
||||
me_connect_r_payload_order,
|
||||
},
|
||||
#endif /* ME */
|
||||
#endif /* ME */
|
||||
};
|
||||
|
||||
|
||||
@@ -791,7 +791,7 @@ static void add_payload(private_message_t *this, payload_t *payload)
|
||||
/**
|
||||
* Implementation of message_t.add_notify.
|
||||
*/
|
||||
static void add_notify(private_message_t *this, bool flush, notify_type_t type,
|
||||
static void add_notify(private_message_t *this, bool flush, notify_type_t type,
|
||||
chunk_t data)
|
||||
{
|
||||
notify_payload_t *notify;
|
||||
@@ -799,7 +799,7 @@ static void add_notify(private_message_t *this, bool flush, notify_type_t type,
|
||||
|
||||
if (flush)
|
||||
{
|
||||
while (this->payloads->remove_last(this->payloads,
|
||||
while (this->payloads->remove_last(this->payloads,
|
||||
(void**)&payload) == SUCCESS)
|
||||
{
|
||||
payload->destroy(payload);
|
||||
@@ -912,7 +912,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
|
||||
len--;
|
||||
|
||||
written = snprintf(pos, len, "%N %s %d [",
|
||||
exchange_type_names, this->exchange_type,
|
||||
exchange_type_names, this->exchange_type,
|
||||
this->is_request ? "request" : "response",
|
||||
this->message_id);
|
||||
if (written >= len || written < 0)
|
||||
@@ -992,7 +992,7 @@ static void order_payloads(private_message_t *this)
|
||||
list->remove_at(list, enumerator);
|
||||
add_payload(this, payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
@@ -1056,7 +1056,7 @@ static status_t encrypt_payloads(private_message_t *this,
|
||||
|
||||
status = get_payload_rule(this,
|
||||
current_payload->get_type(current_payload),&payload_rule);
|
||||
/* for payload types which are not found in supported payload list,
|
||||
/* for payload types which are not found in supported payload list,
|
||||
* it is presumed that they don't have to be encrypted */
|
||||
if ((status == SUCCESS) && (payload_rule->encrypted))
|
||||
{
|
||||
@@ -1119,7 +1119,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter,
|
||||
}
|
||||
|
||||
if (this->packet->get_source(this->packet) == NULL ||
|
||||
this->packet->get_destination(this->packet) == NULL)
|
||||
this->packet->get_destination(this->packet) == NULL)
|
||||
{
|
||||
DBG1(DBG_ENC, "%s not defined",
|
||||
!this->packet->get_source(this->packet) ? "source" : "destination");
|
||||
@@ -1391,7 +1391,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
|
||||
}
|
||||
|
||||
/* encryption payload is processed, payloads are moved. Destroy it. */
|
||||
encryption_payload->destroy(encryption_payload);
|
||||
encryption_payload->destroy(encryption_payload);
|
||||
}
|
||||
|
||||
/* we allow unknown payloads of any type and don't bother if it was encrypted. Not our problem. */
|
||||
@@ -1465,7 +1465,7 @@ static status_t verify(private_message_t *this)
|
||||
DBG1(DBG_ENC, "%N is not supported, but its critical!",
|
||||
payload_type_names, current_payload_type);
|
||||
enumerator->destroy(enumerator);
|
||||
return NOT_SUPPORTED;
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
else if (current_payload_type == rule->payload_type)
|
||||
@@ -1475,7 +1475,7 @@ static status_t verify(private_message_t *this)
|
||||
DBG2(DBG_ENC, "found payload of type %N", payload_type_names,
|
||||
rule->payload_type);
|
||||
|
||||
/* as soon as ohe payload occures more then specified,
|
||||
/* as soon as ohe payload occures more then specified,
|
||||
* the verification fails */
|
||||
if (found_payloads >
|
||||
rule->max_occurence)
|
||||
@@ -1502,7 +1502,7 @@ static status_t verify(private_message_t *this)
|
||||
this->payloads->get_count(this->payloads) == total_found_payloads)
|
||||
{
|
||||
enumerator->destroy(enumerator);
|
||||
return SUCCESS;
|
||||
return SUCCESS;
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
@@ -1518,7 +1518,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
|
||||
payload_type_t current_payload_type;
|
||||
char str[256];
|
||||
|
||||
current_payload_type = this->first_payload;
|
||||
current_payload_type = this->first_payload;
|
||||
|
||||
DBG2(DBG_ENC, "parsing body of message, first payload is %N",
|
||||
payload_type_names, current_payload_type);
|
||||
@@ -1528,7 +1528,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
|
||||
{
|
||||
payload_t *current_payload;
|
||||
|
||||
DBG2(DBG_ENC, "starting parsing a %N payload",
|
||||
DBG2(DBG_ENC, "starting parsing a %N payload",
|
||||
payload_type_names, current_payload_type);
|
||||
|
||||
/* parse current payload */
|
||||
@@ -1652,7 +1652,7 @@ message_t *message_create_from_packet(packet_t *packet)
|
||||
/* private values */
|
||||
if (packet == NULL)
|
||||
{
|
||||
packet = packet_create();
|
||||
packet = packet_create();
|
||||
}
|
||||
this->message_rule = NULL;
|
||||
this->packet = packet;
|
||||
|
||||
@@ -27,7 +27,6 @@ typedef struct private_ike_header_t private_ike_header_t;
|
||||
|
||||
/**
|
||||
* Private data of an ike_header_t object.
|
||||
*
|
||||
*/
|
||||
struct private_ike_header_t {
|
||||
/**
|
||||
@@ -56,19 +55,18 @@ struct private_ike_header_t {
|
||||
|
||||
/**
|
||||
* IKE minor version.
|
||||
*/
|
||||
*/
|
||||
u_int8_t min_version;
|
||||
|
||||
/**
|
||||
* Exchange type .
|
||||
*/
|
||||
*/
|
||||
u_int8_t exchange_type;
|
||||
|
||||
/**
|
||||
* Flags of the Message.
|
||||
*
|
||||
*/
|
||||
struct {
|
||||
struct {
|
||||
/**
|
||||
* Sender is initiator of the associated IKE_SA_INIT-Exchange.
|
||||
*/
|
||||
@@ -93,7 +91,7 @@ struct private_ike_header_t {
|
||||
/**
|
||||
* Length of the whole IKEv2-Message (header and all payloads).
|
||||
*/
|
||||
u_int32_t length;
|
||||
u_int32_t length;
|
||||
};
|
||||
|
||||
ENUM_BEGIN(exchange_type_names, EXCHANGE_TYPE_UNDEFINED, EXCHANGE_TYPE_UNDEFINED,
|
||||
@@ -114,9 +112,8 @@ ENUM_END(exchange_type_names, INFORMATIONAL);
|
||||
/**
|
||||
* Encoding rules to parse or generate a IKEv2-Header.
|
||||
*
|
||||
* The defined offsets are the positions in a object of type
|
||||
* The defined offsets are the positions in a object of type
|
||||
* ike_header_t.
|
||||
*
|
||||
*/
|
||||
encoding_rule_t ike_header_encodings[] = {
|
||||
/* 8 Byte SPI, stored in the field initiator_spi */
|
||||
@@ -132,10 +129,10 @@ encoding_rule_t ike_header_encodings[] = {
|
||||
/* 8 Bit for the exchange type */
|
||||
{ U_INT_8, offsetof(private_ike_header_t, exchange_type) },
|
||||
/* 2 Bit reserved bits, nowhere stored */
|
||||
{ RESERVED_BIT, 0 },
|
||||
{ RESERVED_BIT, 0 },
|
||||
{ RESERVED_BIT, 0 },
|
||||
{ RESERVED_BIT, 0 },
|
||||
/* 3 Bit flags, stored in the fields response, version and initiator */
|
||||
{ FLAG, offsetof(private_ike_header_t, flags.response) },
|
||||
{ FLAG, offsetof(private_ike_header_t, flags.response) },
|
||||
{ FLAG, offsetof(private_ike_header_t, flags.version) },
|
||||
{ FLAG, offsetof(private_ike_header_t, flags.initiator) },
|
||||
/* 3 Bit reserved bits, nowhere stored */
|
||||
@@ -212,7 +209,7 @@ static void set_next_type(payload_t *this,payload_type_t type)
|
||||
*/
|
||||
static u_int64_t get_initiator_spi(private_ike_header_t *this)
|
||||
{
|
||||
return this->initiator_spi;
|
||||
return this->initiator_spi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,7 +225,7 @@ static void set_initiator_spi(private_ike_header_t *this, u_int64_t initiator_sp
|
||||
*/
|
||||
static u_int64_t get_responder_spi(private_ike_header_t *this)
|
||||
{
|
||||
return this->responder_spi;
|
||||
return this->responder_spi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +241,7 @@ static void set_responder_spi(private_ike_header_t *this, u_int64_t responder_sp
|
||||
*/
|
||||
static u_int8_t get_maj_version(private_ike_header_t *this)
|
||||
{
|
||||
return this->maj_version;
|
||||
return this->maj_version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,7 +249,7 @@ static u_int8_t get_maj_version(private_ike_header_t *this)
|
||||
*/
|
||||
static u_int8_t get_min_version(private_ike_header_t *this)
|
||||
{
|
||||
return this->min_version;
|
||||
return this->min_version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,7 +257,7 @@ static u_int8_t get_min_version(private_ike_header_t *this)
|
||||
*/
|
||||
static bool get_response_flag(private_ike_header_t *this)
|
||||
{
|
||||
return this->flags.response;
|
||||
return this->flags.response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +265,7 @@ static bool get_response_flag(private_ike_header_t *this)
|
||||
*/
|
||||
static void set_response_flag(private_ike_header_t *this, bool response)
|
||||
{
|
||||
this->flags.response = response;
|
||||
this->flags.response = response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +273,7 @@ static void set_response_flag(private_ike_header_t *this, bool response)
|
||||
*/
|
||||
static bool get_version_flag(private_ike_header_t *this)
|
||||
{
|
||||
return this->flags.version;
|
||||
return this->flags.version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +281,7 @@ static bool get_version_flag(private_ike_header_t *this)
|
||||
*/
|
||||
static bool get_initiator_flag(private_ike_header_t *this)
|
||||
{
|
||||
return this->flags.initiator;
|
||||
return this->flags.initiator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +289,7 @@ static bool get_initiator_flag(private_ike_header_t *this)
|
||||
*/
|
||||
static void set_initiator_flag(private_ike_header_t *this, bool initiator)
|
||||
{
|
||||
this->flags.initiator = initiator;
|
||||
this->flags.initiator = initiator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,7 +297,7 @@ static void set_initiator_flag(private_ike_header_t *this, bool initiator)
|
||||
*/
|
||||
static u_int8_t get_exchange_type(private_ike_header_t *this)
|
||||
{
|
||||
return this->exchange_type;
|
||||
return this->exchange_type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,7 +305,7 @@ static u_int8_t get_exchange_type(private_ike_header_t *this)
|
||||
*/
|
||||
static void set_exchange_type(private_ike_header_t *this, u_int8_t exchange_type)
|
||||
{
|
||||
this->exchange_type = exchange_type;
|
||||
this->exchange_type = exchange_type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,7 +314,7 @@ static void set_exchange_type(private_ike_header_t *this, u_int8_t exchange_type
|
||||
*/
|
||||
static u_int32_t get_message_id(private_ike_header_t *this)
|
||||
{
|
||||
return this->message_id;
|
||||
return this->message_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,11 +94,11 @@ enum exchange_type_t{
|
||||
extern enum_name_t *exchange_type_names;
|
||||
|
||||
/**
|
||||
* An object of this type represents an IKEv2 header and is used to
|
||||
* An object of this type represents an IKEv2 header and is used to
|
||||
* generate and parse IKEv2 headers.
|
||||
*
|
||||
* The header format of an IKEv2-Message is compatible to the
|
||||
* ISAKMP-Header format to allow implementations supporting
|
||||
*
|
||||
* The header format of an IKEv2-Message is compatible to the
|
||||
* ISAKMP-Header format to allow implementations supporting
|
||||
* both versions of the IKE-protocol.
|
||||
*/
|
||||
struct ike_header_t {
|
||||
@@ -160,7 +160,6 @@ struct ike_header_t {
|
||||
* Set the response flag-
|
||||
*
|
||||
* @param response response flag
|
||||
*
|
||||
*/
|
||||
void (*set_response_flag) (ike_header_t *this, bool response);
|
||||
/**
|
||||
@@ -220,7 +219,7 @@ struct ike_header_t {
|
||||
|
||||
/**
|
||||
* Create an ike_header_t object
|
||||
*
|
||||
*
|
||||
* @return ike_header_t object
|
||||
*/
|
||||
ike_header_t *ike_header_create(void);
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct payload_t payload_t;
|
||||
/**
|
||||
* Payload-Types of a IKEv2-Message.
|
||||
*
|
||||
* Header and substructures are also defined as
|
||||
* Header and substructures are also defined as
|
||||
* payload types with values from PRIVATE USE space.
|
||||
*/
|
||||
enum payload_type_t{
|
||||
@@ -126,63 +126,63 @@ enum payload_type_t{
|
||||
#ifdef ME
|
||||
/**
|
||||
* Identification payload for peers has a value from
|
||||
* the PRIVATE USE space.
|
||||
* the PRIVATE USE space.
|
||||
*/
|
||||
ID_PEER = 128,
|
||||
#endif /* ME */
|
||||
|
||||
/**
|
||||
* Header has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle IKEv2-Header like a payload.
|
||||
*/
|
||||
HEADER = 140,
|
||||
|
||||
/**
|
||||
* PROPOSAL_SUBSTRUCTURE has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a proposal substructure like a payload.
|
||||
*/
|
||||
PROPOSAL_SUBSTRUCTURE = 141,
|
||||
|
||||
/**
|
||||
* TRANSFORM_SUBSTRUCTURE has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a transform substructure like a payload.
|
||||
*/
|
||||
TRANSFORM_SUBSTRUCTURE = 142,
|
||||
|
||||
/**
|
||||
* TRANSFORM_ATTRIBUTE has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a transform attribute like a payload.
|
||||
*/
|
||||
TRANSFORM_ATTRIBUTE = 143,
|
||||
|
||||
/**
|
||||
* TRAFFIC_SELECTOR_SUBSTRUCTURE has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a transform selector like a payload.
|
||||
*/
|
||||
*/
|
||||
TRAFFIC_SELECTOR_SUBSTRUCTURE = 144,
|
||||
|
||||
/**
|
||||
* CONFIGURATION_ATTRIBUTE has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a transform attribute like a payload.
|
||||
*/
|
||||
CONFIGURATION_ATTRIBUTE = 145,
|
||||
|
||||
/**
|
||||
* A unknown payload has a value of PRIVATE USE space.
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
*
|
||||
* This payload type is not sent over wire and just
|
||||
* used internally to handle a unknown payload.
|
||||
*/
|
||||
UNKNOWN_PAYLOAD = 146,
|
||||
@@ -201,7 +201,7 @@ extern enum_name_t *payload_type_short_names;
|
||||
|
||||
/**
|
||||
* Generic interface for all payload types (incl.header and substructures).
|
||||
*
|
||||
*
|
||||
* To handle all kinds of payloads on a generic way, this interface must
|
||||
* be implemented by every payload. This allows parser_t/generator_t a simple
|
||||
* handling of all payloads.
|
||||
@@ -259,11 +259,11 @@ struct payload_t {
|
||||
|
||||
/**
|
||||
* Create an empty payload.
|
||||
*
|
||||
*
|
||||
* Useful for the parser, who wants a generic constructor for all payloads.
|
||||
* It supports all payload_t methods. If a payload type is not known,
|
||||
* It supports all payload_t methods. If a payload type is not known,
|
||||
* an unknwon_paylod is created with the chunk of data in it.
|
||||
*
|
||||
*
|
||||
* @param type type of the payload to create
|
||||
* @return payload_t object
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user