android: Provide a public interface for Android IMC state
This commit is contained in:
parent
6bce8e1cfb
commit
0e53beda32
|
@ -20,17 +20,17 @@
|
|||
|
||||
#include <utils/debug.h>
|
||||
|
||||
typedef struct private_imc_state_t private_imc_state_t;
|
||||
typedef struct private_imc_android_state_t private_imc_android_state_t;
|
||||
|
||||
/**
|
||||
* Private data of an imc_state_t object.
|
||||
*/
|
||||
struct private_imc_state_t {
|
||||
struct private_imc_android_state_t {
|
||||
|
||||
/**
|
||||
* Public interface
|
||||
*/
|
||||
imc_state_t public;
|
||||
imc_android_state_t public;
|
||||
|
||||
/**
|
||||
* TNCCS connection ID
|
||||
|
@ -64,56 +64,56 @@ struct private_imc_state_t {
|
|||
};
|
||||
|
||||
METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
|
||||
private_imc_state_t *this)
|
||||
private_imc_android_state_t *this)
|
||||
{
|
||||
return this->connection_id;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, has_long, bool,
|
||||
private_imc_state_t *this)
|
||||
private_imc_android_state_t *this)
|
||||
{
|
||||
return this->has_long;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, has_excl, bool,
|
||||
private_imc_state_t *this)
|
||||
private_imc_android_state_t *this)
|
||||
{
|
||||
return this->has_excl;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, set_flags, void,
|
||||
private_imc_state_t *this, bool has_long, bool has_excl)
|
||||
private_imc_android_state_t *this, bool has_long, bool has_excl)
|
||||
{
|
||||
this->has_long = has_long;
|
||||
this->has_excl = has_excl;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, set_max_msg_len, void,
|
||||
private_imc_state_t *this, u_int32_t max_msg_len)
|
||||
private_imc_android_state_t *this, u_int32_t max_msg_len)
|
||||
{
|
||||
this->max_msg_len = max_msg_len;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, get_max_msg_len, u_int32_t,
|
||||
private_imc_state_t *this)
|
||||
private_imc_android_state_t *this)
|
||||
{
|
||||
return this->max_msg_len;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, change_state, void,
|
||||
private_imc_state_t *this, TNC_ConnectionState new_state)
|
||||
private_imc_android_state_t *this, TNC_ConnectionState new_state)
|
||||
{
|
||||
this->state = new_state;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, set_result, void,
|
||||
private_imc_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result result)
|
||||
private_imc_android_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result result)
|
||||
{
|
||||
this->result = result;
|
||||
}
|
||||
|
||||
METHOD(imc_state_t, get_result, bool,
|
||||
private_imc_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result *result)
|
||||
private_imc_android_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result *result)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ METHOD(imc_state_t, get_result, bool,
|
|||
}
|
||||
|
||||
METHOD(imc_state_t, destroy, void,
|
||||
private_imc_state_t *this)
|
||||
private_imc_android_state_t *this)
|
||||
{
|
||||
free(this);
|
||||
}
|
||||
|
@ -133,25 +133,27 @@ METHOD(imc_state_t, destroy, void,
|
|||
*/
|
||||
imc_state_t *imc_android_state_create(TNC_ConnectionID connection_id)
|
||||
{
|
||||
private_imc_state_t *this;
|
||||
private_imc_android_state_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.get_connection_id = _get_connection_id,
|
||||
.has_long = _has_long,
|
||||
.has_excl = _has_excl,
|
||||
.set_flags = _set_flags,
|
||||
.set_max_msg_len = _set_max_msg_len,
|
||||
.get_max_msg_len = _get_max_msg_len,
|
||||
.change_state = _change_state,
|
||||
.set_result = _set_result,
|
||||
.get_result = _get_result,
|
||||
.destroy = _destroy,
|
||||
.interface = {
|
||||
.get_connection_id = _get_connection_id,
|
||||
.has_long = _has_long,
|
||||
.has_excl = _has_excl,
|
||||
.set_flags = _set_flags,
|
||||
.set_max_msg_len = _set_max_msg_len,
|
||||
.get_max_msg_len = _get_max_msg_len,
|
||||
.change_state = _change_state,
|
||||
.set_result = _set_result,
|
||||
.get_result = _get_result,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
},
|
||||
.state = TNC_CONNECTION_STATE_CREATE,
|
||||
.result = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
|
||||
.connection_id = connection_id,
|
||||
);
|
||||
|
||||
return &this->public;
|
||||
return &this->public.interface;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,19 @@
|
|||
|
||||
#include <imc/imc_state.h>
|
||||
|
||||
typedef struct imc_android_state_t imc_android_state_t;
|
||||
|
||||
/**
|
||||
* Internal state of an imc_android_t connection instance
|
||||
*/
|
||||
struct imc_android_state_t {
|
||||
|
||||
/**
|
||||
* imc_state_t interface
|
||||
*/
|
||||
imc_state_t interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an imc_android_state_t instance
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue