child-sa: Add method that returns a reference to an allocated reqid
This commit is contained in:
@@ -361,6 +361,17 @@ METHOD(child_sa_t, get_reqid, uint32_t,
|
|||||||
return this->reqid;
|
return this->reqid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(child_sa_t, get_reqid_ref, uint32_t,
|
||||||
|
private_child_sa_t *this)
|
||||||
|
{
|
||||||
|
if ((this->reqid_allocated || (!this->static_reqid && this->reqid)) &&
|
||||||
|
charon->kernel->ref_reqid(charon->kernel, this->reqid) == SUCCESS)
|
||||||
|
{
|
||||||
|
return this->reqid;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(child_sa_t, get_unique_id, uint32_t,
|
METHOD(child_sa_t, get_unique_id, uint32_t,
|
||||||
private_child_sa_t *this)
|
private_child_sa_t *this)
|
||||||
{
|
{
|
||||||
@@ -2033,6 +2044,7 @@ child_sa_t *child_sa_create(host_t *me, host_t *other, child_cfg_t *config,
|
|||||||
.public = {
|
.public = {
|
||||||
.get_name = _get_name,
|
.get_name = _get_name,
|
||||||
.get_reqid = _get_reqid,
|
.get_reqid = _get_reqid,
|
||||||
|
.get_reqid_ref = _get_reqid_ref,
|
||||||
.get_unique_id = _get_unique_id,
|
.get_unique_id = _get_unique_id,
|
||||||
.get_config = _get_config,
|
.get_config = _get_config,
|
||||||
.get_state = _get_state,
|
.get_state = _get_state,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2006-2019 Tobias Brunner
|
* Copyright (C) 2006-2023 Tobias Brunner
|
||||||
* Copyright (C) 2006-2008 Martin Willi
|
* Copyright (C) 2006-2008 Martin Willi
|
||||||
* Copyright (C) 2006 Daniel Roethlisberger
|
* Copyright (C) 2006 Daniel Roethlisberger
|
||||||
*
|
*
|
||||||
@@ -174,6 +174,18 @@ struct child_sa_t {
|
|||||||
*/
|
*/
|
||||||
uint32_t (*get_reqid)(child_sa_t *this);
|
uint32_t (*get_reqid)(child_sa_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an additional reference to the allocated reqid of this CHILD SA.
|
||||||
|
*
|
||||||
|
* For static reqids or until the reqid is allocated (if none was passed
|
||||||
|
* in the constructor), this returns 0. The returned reqid must be released
|
||||||
|
* via kernel_interface_t::release_reqid().
|
||||||
|
*
|
||||||
|
* @return allocated reqid of the CHILD SA, 0 if reqid is static or
|
||||||
|
* not allocated yet
|
||||||
|
*/
|
||||||
|
uint32_t (*get_reqid_ref)(child_sa_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unique numerical identifier for this CHILD_SA.
|
* Get the unique numerical identifier for this CHILD_SA.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user