eap_variable_data_c Class Reference

class eap_variable_data_c
Public Member Functions
eap_variable_data_c(abs_eap_am_tools_c *const )
eap_variable_data_c(abs_eap_am_tools_c *const , const void *const , const u32_t, bool, bool)
~eap_variable_data_c()
EAP_FUNC_IMPORT eap_status_eadd_data(const void *const , const u32_t)
EAP_FUNC_IMPORT eap_status_eadd_data(const eap_variable_data_c *const )
EAP_FUNC_IMPORT eap_status_eadd_data_to_offset(const u32_t, const void *const , const u32_t)
EAP_FUNC_IMPORT eap_status_eadd_data_to_offset(const u32_t, const eap_variable_data_c *const )
EAP_FUNC_IMPORT eap_status_eadd_end_null()
EAP_FUNC_IMPORT i32_tcompare(const void *const , const u32_t)
EAP_FUNC_IMPORT i32_tcompare(const eap_variable_data_c *const )
EAP_FUNC_IMPORT i32_tcompare_length(const void *const , const u32_t, const u32_t)
EAP_FUNC_IMPORT i32_tcompare_length(const eap_variable_data_c *const , const u32_t)
EAP_FUNC_IMPORT eap_variable_data_c *copy()
EAP_FUNC_IMPORT u8_t *get_buffer(const u32_t)
EAP_FUNC_IMPORT u32_tget_buffer_length()
EAP_FUNC_IMPORT u8_t *get_buffer_offset(const u32_t, const u32_t)
EAP_FUNC_IMPORT u8_t *get_data(const u32_t)
EAP_FUNC_IMPORT u8_t *get_data()
EAP_FUNC_IMPORT u32_tget_data_length()
EAP_FUNC_IMPORT u8_t *get_data_offset(const u32_t, const u32_t)
EAP_FUNC_IMPORT boolget_is_valid()
EAP_FUNC_IMPORT boolget_is_valid_data()
EAP_FUNC_IMPORT boolget_is_writable()
EAP_FUNC_IMPORT u32_thash(const u32_t)
EAP_FUNC_IMPORT eap_status_einit(const u32_t)
EAP_FUNC_IMPORT eap_status_ereset()
EAP_FUNC_IMPORT eap_status_ereset_start_offset_and_data_length()
EAP_FUNC_IMPORT eap_status_eset_buffer(const void *const , const u32_t, bool, bool)
EAP_FUNC_IMPORT eap_status_eset_buffer(void *const , const u32_t, bool, bool)
EAP_FUNC_IMPORT eap_status_eset_buffer(const eap_variable_data_c *const )
EAP_FUNC_IMPORT eap_status_eset_buffer_length(const u32_t)
EAP_FUNC_IMPORT eap_status_eset_copy_of_buffer(const void *const , const u32_t)
EAP_FUNC_IMPORT eap_status_eset_copy_of_buffer(const eap_variable_data_c *const )
EAP_FUNC_IMPORT eap_status_eset_data_length(const u32_t)
EAP_FUNC_IMPORT voidset_is_invalid()
EAP_FUNC_IMPORT voidset_is_valid()
EAP_FUNC_IMPORT eap_status_eset_start_offset(const u32_t)
Private Member Functions
EAP_FUNC_IMPORT eap_status_eallocate_buffer(const u32_t)
EAP_FUNC_IMPORT eap_status_einitialize_members()
Private Attributes
abs_eap_am_tools_c *constm_am_tools
eap_variable_data_impl_str *m_data

Constructor & Destructor Documentation

eap_variable_data_c(abs_eap_am_tools_c *const)

EAP_FUNC_IMPORTeap_variable_data_c(abs_eap_am_tools_c *const tools)

Constructor takes only one parameter called tools. abs_eap_am_tools_c.

Parameters

abs_eap_am_tools_c *const toolsis pointer to the tools class.

eap_variable_data_c(abs_eap_am_tools_c *const, const void *const, const u32_t, bool, bool)

EAP_FUNC_IMPORTeap_variable_data_c(abs_eap_am_tools_c *const tools,
const void *const buffer,
const u32_tbuffer_length,
boolfree_buffer,
boolis_writable
)

Constructor takes five parameters. abs_eap_am_tools_c.

Parameters

abs_eap_am_tools_c *const toolsis pointer to the tools class.
const void *const bufferis pointer to the buffer.
const u32_t buffer_lengthis size of the buffer.
bool free_bufferindicates whether the buffer must be freed in the destructor.
bool is_writableindicates whether the buffer is writable.

~eap_variable_data_c()

EAP_FUNC_IMPORT~eap_variable_data_c()[virtual]

Destructor of the eap_variable_data class will release the buffer if attribute m_free_buffer is true.

Member Functions Documentation

add_data(const void *const, const u32_t)

EAP_FUNC_IMPORT eap_status_eadd_data(const void *const buffer,
const u32_tbuffer_length
)

The add_data() function adds data to the end of the buffer. If the buffer is empty the data is added to begin of the buffer.

Parameters

const void *const bufferpoints the data to be added.
const u32_t buffer_lengthis length of the buffer in bytes.

add_data(const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_eadd_data(const eap_variable_data_c *const buffer)

The add_data() function adds data to the end of the buffer. If the buffer is empty the data is added to begin of the buffer.

Parameters

const eap_variable_data_c *const bufferpoints the data to be added.

add_data_to_offset(const u32_t, const void *const, const u32_t)

EAP_FUNC_IMPORT eap_status_eadd_data_to_offset(const u32_toffset,
const void *const buffer,
const u32_tbuffer_length
)

The add_data_to_offset() function adds data to the offset of the buffer.

Parameters

const u32_t offsettells the place where data will begin.
const void *const bufferpoints the data to be added.
const u32_t buffer_lengthis length of the buffer in bytes.

add_data_to_offset(const u32_t, const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_eadd_data_to_offset(const u32_toffset,
const eap_variable_data_c *const buffer
)

The add_data() function adds data to the offset of the buffer.

Parameters

const u32_t offsettells the place where data will begin.
const eap_variable_data_c *const bufferpoints the data to be added.

add_end_null()

EAP_FUNC_IMPORT eap_status_eadd_end_null()

The add_end_null() function adds 16-bit null ('') to the end of the buffer. This does not increase the data length. This function is usefull when null terminated strings are stored to eap_variable_data_c object.

allocate_buffer(const u32_t)

EAP_FUNC_IMPORT eap_status_eallocate_buffer(const u32_trequired_buffer_length)[private]

Parameters

const u32_t required_buffer_length

compare(const void *const, const u32_t)

EAP_FUNC_IMPORT i32_tcompare(const void *const data,
const u32_tdata_length
)const

The compare() function compares the objects.

Parameters

const void *const data
const u32_t data_length

compare(const eap_variable_data_c *const)

EAP_FUNC_IMPORT i32_tcompare(const eap_variable_data_c *const data)const

The compare() function compares the objects.

Parameters

const eap_variable_data_c *const data

compare_length(const void *const, const u32_t, const u32_t)

EAP_FUNC_IMPORT i32_tcompare_length(const void *const data,
const u32_tdata_length,
const u32_tcompare_length_of_data
)const

The compare_length() function compares first compare_length bytes of the objects.

Parameters

const void *const data
const u32_t data_length
const u32_t compare_length_of_data

compare_length(const eap_variable_data_c *const, const u32_t)

EAP_FUNC_IMPORT i32_tcompare_length(const eap_variable_data_c *const data,
const u32_tcompare_length_of_data
)const

The compare_length() function compares first compare_length bytes of the objects.

Parameters

const eap_variable_data_c *const data
const u32_t compare_length_of_data

copy()

EAP_FUNC_IMPORT eap_variable_data_c *copy()const

The copy() function copies the eap_variable_data object and data.

get_buffer(const u32_t)

EAP_FUNC_IMPORT u8_t *get_buffer(const u32_tbuffer_length)const

The get_buffer() function returns the pointer to the buffer.

Parameters

const u32_t buffer_length

get_buffer_length()

EAP_FUNC_IMPORT u32_tget_buffer_length()const

The get_buffer_length() function returns the size of the buffer.

get_buffer_offset(const u32_t, const u32_t)

EAP_FUNC_IMPORT u8_t *get_buffer_offset(const u32_toffset,
const u32_tbuffer_length
)const

The get_data_offset() function returns the pointer to the buffer.

Parameters

const u32_t offsetis offset from the begin of the buffer.
const u32_t buffer_lengthis required count of bytes.

get_data(const u32_t)

EAP_FUNC_IMPORT u8_t *get_data(const u32_tdata_length)const

The get_data() function returns the pointer to the begin of the data.

Parameters

const u32_t data_length

get_data()

EAP_FUNC_IMPORT u8_t *get_data()const

The get_data() function returns the pointer to the begin of the data. This function assumes the whole data is needed. User should test the validity of object and the length of the data before use of it. The purpose of this function is reduce code size.

get_data_length()

EAP_FUNC_IMPORT u32_tget_data_length()const

The get_data_length() function returns the count of bytes stored to the buffer.

get_data_offset(const u32_t, const u32_t)

EAP_FUNC_IMPORT u8_t *get_data_offset(const u32_toffset,
const u32_tdata_length
)const

The get_data_offset() function returns the pointer to the data.

Parameters

const u32_t offsetis offset from the begin of the data.
const u32_t data_lengthis required count of bytes.

get_is_valid()

EAP_FUNC_IMPORT boolget_is_valid()const

The get_is_valid() function returns the status of the eap_variable_data object.

get_is_valid_data()

EAP_FUNC_IMPORT boolget_is_valid_data()const

The get_is_valid_data() function returns the status of the data included in eap_variable_data object. Note the object may include zero length data, and that is valid data.

get_is_writable()

EAP_FUNC_IMPORT boolget_is_writable()const

This function returns flag that indicates whether this buffer is writeble (true) or read only (false).

hash(const u32_t)

EAP_FUNC_IMPORT u32_thash(const u32_tsize)const

The hash() function returns HASH-value calculated from the data.

Parameters

const u32_t size

init(const u32_t)

EAP_FUNC_IMPORT eap_status_einit(const u32_tlength)

The init() function initializes the eap_variable_data object.

Parameters

const u32_t lengthis length of buffer in bytes that is allocated. Buffer is set empty, data length is set zero.

initialize_members()

EAP_FUNC_IMPORT eap_status_einitialize_members()[private]

reset()

EAP_FUNC_IMPORT eap_status_ereset()

The reset() function resets the eap_variable_data object. Memory of the buffer is freed if the m_free_buffer attribute is true. Object does not include data after this call and get_is_valid_data() returns false.

reset_start_offset_and_data_length()

EAP_FUNC_IMPORT eap_status_ereset_start_offset_and_data_length()

The reset_start_offset_and_data_length() function sets the begin offset of the data to zero and the length of data to zero.

set_buffer(const void *const, const u32_t, bool, bool)

EAP_FUNC_IMPORT eap_status_eset_buffer(const void *const buffer,
const u32_tbuffer_length,
boolfree_buffer,
boolis_writable
)

The set_buffer() function initializes the eap_variable_data object using existing buffer.

Parameters

const void *const bufferis pointer to the buffer.
const u32_t buffer_lengthis size of the buffer.
bool free_bufferindicates whether the buffer must be freed in the destructor.
bool is_writableindicates whether the buffer is writable.

set_buffer(void *const, const u32_t, bool, bool)

EAP_FUNC_IMPORT eap_status_eset_buffer(void *const buffer,
const u32_tbuffer_length,
boolfree_buffer,
boolis_writable
)

The set_buffer() function initializes the eap_variable_data object using existing buffer.

Parameters

void *const bufferis pointer to the buffer.
const u32_t buffer_lengthis size of the buffer.
bool free_bufferindicates whether the buffer must be freed in the destructor.
bool is_writableindicates whether the buffer is writable.

set_buffer(const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_eset_buffer(const eap_variable_data_c *const buffer)

The set_buffer() function initializes the eap_variable_data object using existing buffer. Note the data will be in the same buffer. Data can be modified through both eap_variable_data objects.

Parameters

const eap_variable_data_c *const bufferis pointer to the buffer.

set_buffer_length(const u32_t)

EAP_FUNC_IMPORT eap_status_eset_buffer_length(const u32_tbuffer_length)

The set_buffer_length() function sets length ot the buffer atleast to buffer_length bytes. If the buffer is empty or less than buffer_length bytes, length of the buffer is set to buffer_length bytes. If the buffer includes data, data is kept in the buffer.

Parameters

const u32_t buffer_lengthis length of the buffer in bytes.

set_copy_of_buffer(const void *const, const u32_t)

EAP_FUNC_IMPORT eap_status_eset_copy_of_buffer(const void *const buffer,
const u32_tbuffer_length
)

The set_copy_of_buffer() function copies the data of the buffer.

Parameters

const void *const bufferpoints the data to be copied.
const u32_t buffer_lengthis length of the buffer in bytes.

set_copy_of_buffer(const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_eset_copy_of_buffer(const eap_variable_data_c *const buffer)

The set_copy_of_buffer() function copies the data of the buffer. The first version copies data pointed by parameter buffer.

Parameters

const eap_variable_data_c *const bufferpoints the data to be copied.

set_data_length(const u32_t)

EAP_FUNC_IMPORT eap_status_eset_data_length(const u32_tlength)

The set_data_length() function changes the length of the data.

Parameters

const u32_t lengthis count of bytes in the buffer.

set_is_invalid()

EAP_FUNC_IMPORT voidset_is_invalid()

The set_is_invalid() function sets the state of the eap_variable_data object invalid. The eap_variable_data_c object calls this function after it is uninitialized.

set_is_valid()

EAP_FUNC_IMPORT voidset_is_valid()

The set_is_valid() function sets the state of the eap_variable_data object valid. The eap_variable_data_c object calls this function after it is initialized.

set_start_offset(const u32_t)

EAP_FUNC_IMPORT eap_status_eset_start_offset(const u32_tindex)

The set_start_offset() function sets the begin offset of the data to index. With this function data in the begin of the buffer can be removed without any copy operations.

Parameters

const u32_t index

Member Data Documentation

abs_eap_am_tools_c *const m_am_tools

abs_eap_am_tools_c *constm_am_tools[private]

eap_variable_data_impl_str * m_data

eap_variable_data_impl_str *m_data[private]

This is pointer to data of eap_variable_data_c. This decreases memory print of eap_variable_data_c. This decreases stack usage of EAP_Core.