Add IKE version information to ike_cfg_t
This commit is contained in:
@@ -44,6 +44,11 @@ struct private_ike_cfg_t {
|
||||
*/
|
||||
refcount_t refcount;
|
||||
|
||||
/**
|
||||
* IKE version to use
|
||||
*/
|
||||
ike_version_t version;
|
||||
|
||||
/**
|
||||
* Address of local host
|
||||
*/
|
||||
@@ -90,6 +95,12 @@ struct private_ike_cfg_t {
|
||||
linked_list_t *proposals;
|
||||
};
|
||||
|
||||
METHOD(ike_cfg_t, get_version, ike_version_t,
|
||||
private_ike_cfg_t *this)
|
||||
{
|
||||
return this->version;
|
||||
}
|
||||
|
||||
METHOD(ike_cfg_t, send_certreq, bool,
|
||||
private_ike_cfg_t *this)
|
||||
{
|
||||
@@ -254,6 +265,7 @@ METHOD(ike_cfg_t, equals, bool,
|
||||
e2->destroy(e2);
|
||||
|
||||
return (eq &&
|
||||
this->version == other->version &&
|
||||
this->certreq == other->certreq &&
|
||||
this->force_encap == other->force_encap &&
|
||||
streq(this->me, other->me) &&
|
||||
@@ -285,7 +297,7 @@ METHOD(ike_cfg_t, destroy, void,
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
|
||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||
char *me, bool my_allow_any, u_int16_t my_port,
|
||||
char *other, bool other_allow_any, u_int16_t other_port)
|
||||
{
|
||||
@@ -293,6 +305,7 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.get_version = _get_version,
|
||||
.send_certreq = _send_certreq,
|
||||
.force_encap = _force_encap_,
|
||||
.get_my_addr = _get_my_addr,
|
||||
@@ -308,6 +321,7 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.refcount = 1,
|
||||
.version = version,
|
||||
.certreq = certreq,
|
||||
.force_encap = force_encap,
|
||||
.me = strdup(me),
|
||||
|
||||
@@ -56,6 +56,13 @@ extern enum_name_t *ike_version_names;
|
||||
*/
|
||||
struct ike_cfg_t {
|
||||
|
||||
/**
|
||||
* Get the IKE version to use with this configuration.
|
||||
*
|
||||
* @return IKE major version
|
||||
*/
|
||||
ike_version_t (*get_version)(ike_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get own address.
|
||||
*
|
||||
@@ -167,6 +174,7 @@ struct ike_cfg_t {
|
||||
*
|
||||
* Supplied hosts become owned by ike_cfg, the name gets cloned.
|
||||
*
|
||||
* @param version IKE major version to use for this config
|
||||
* @param certreq TRUE to send a certificate request
|
||||
* @param force_encap enforce UDP encapsulation by faking NATD notify
|
||||
* @param me address/DNS name of local peer
|
||||
@@ -177,7 +185,7 @@ struct ike_cfg_t {
|
||||
* @param other_port IKE port to use as dest, 500 uses IKEv2 port floating
|
||||
* @return ike_cfg_t object.
|
||||
*/
|
||||
ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
|
||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||
char *me, bool my_allow_any, u_int16_t my_port,
|
||||
char *other, bool other_allow_any, u_int16_t other_port);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user