eap_buf_chain_base_c Class Reference

class eap_buf_chain_base_c
Public Member Functions
eap_buf_chain_base_c(const , abs_eap_am_tools_c *const , u8_t *const , const u32_t, const bool, const bool, const u32_t)
eap_buf_chain_base_c(const , abs_eap_am_tools_c *const , const u8_t *const , const u32_t, const bool)
eap_buf_chain_base_c(const , abs_eap_am_tools_c *const , const u32_t)
~eap_buf_chain_base_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 boolcheck_guards()
EAP_FUNC_IMPORT u32_tget_buffer_length()
EAP_FUNC_IMPORT u8_t *get_data(const u32_t)
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_do_length_checks()
EAP_FUNC_IMPORT boolget_do_packet_retransmission()
EAP_FUNC_IMPORT boolget_encrypt()
EAP_FUNC_IMPORT boolget_is_client()
EAP_FUNC_IMPORT boolget_is_manipulated()
EAP_FUNC_IMPORT boolget_is_valid()
EAP_FUNC_IMPORT boolget_is_valid_data()
EAP_FUNC_IMPORT u32_tget_mem_guard_length()
EAP_FUNC_IMPORT eap_random_error_typeget_random_error_type()
EAP_FUNC_IMPORT u32_tget_send_packet_index()
EAP_FUNC_IMPORT const void *get_stack_address()
EAP_FUNC_IMPORT eap_status_eset_buffer_length(const u32_t)
EAP_FUNC_IMPORT eap_status_eset_data_length(const u32_t)
EAP_FUNC_IMPORT voidset_do_length_checks(const bool)
EAP_FUNC_IMPORT voidset_do_packet_retransmission(const bool)
EAP_FUNC_IMPORT voidset_encrypt(const bool)
EAP_FUNC_IMPORT voidset_is_client(const bool)
EAP_FUNC_IMPORT voidset_is_manipulated()
EAP_FUNC_IMPORT voidset_random_error_type(eap_random_error_type)
EAP_FUNC_IMPORT voidset_send_packet_index(const u32_t)
EAP_FUNC_IMPORT voidset_stack_address(const void *const )
Protected Member Functions
EAP_FUNC_IMPORT abs_eap_am_tools_c *get_am_tools()
Private Member Functions
EAP_FUNC_IMPORT boolcheck_guard_bytes(const u8_t *const )
EAP_FUNC_IMPORT voidforce_inheritance()
EAP_FUNC_IMPORT eap_status_einitialize(const u32_t)
EAP_FUNC_IMPORT voidreset_data_buffer()
EAP_FUNC_IMPORT voidset_mem_guard_bytes()
Private Attributes
abs_eap_am_tools_c *constm_am_tools
eap_buf_chain_base_impl_str *m_data

Constructor & Destructor Documentation

eap_buf_chain_base_c(const, abs_eap_am_tools_c *const, u8_t *const, const u32_t, const bool, const bool, const u32_t)

EAP_FUNC_IMPORTeap_buf_chain_base_c(const eap_write_buffer_e,
abs_eap_am_tools_c *const tools,
u8_t *const data,
const u32_tdata_length,
const boolreset_data,
const boolfree_buffer,
const u32_tmem_guard_length
)

The constructor of the eap_buf_chain_wr class initializes attributes using the parameters passes to it. NOTE the buffer allocated from the stack or from the heap must allocate additional bytes for memory guards. The EAP_MEM_GUARDS(size) macro increases the size with count of memory guard bytes. The example use of eap_buf_chain_wr is as follows. NOTE all sanity checks are ignored in the example.

 u8_t packet_buffer[EAP_MEM_GUARDS(EAP_MAX_LOCAL_PACKET_BUFFER_LENGTH)];
 eap_buf_chain_wr_c response_packet(
     eap_write_buffer, m_am_tools, packet_buffer,
     sizeof(packet_buffer), true, false, EAP_MEM_GUARD_LENGTH);
 const u32_t eap_header_offset = get_type_partner()->get_header_offset(
     &MTU, &trailer_length);
 eap_header_wr_c * const eap_response = (eap_header_wr_c * const)
     response_packet.get_data_offset(eap_header_offset,
         (EAP_MAX_LOCAL_PACKET_BUFFER_LENGTH
         -(eap_header_offset+ trailer_length)));

Parameters

const eap_write_buffer_eseparates the write and read-only constructors.
abs_eap_am_tools_c *const toolsparameter is pointer to the tools class.
u8_t *const datais pointer to the buffer containing the message.
const u32_t data_lengthparameter is count of bytes in the buffer.
const bool reset_dataparameter indicates whether the data bytes must be set zero.
const bool free_bufferparameter indicates whether the destructor must free the data buffer.
const u32_t mem_guard_lengthindicates the length of guard bytes both pre-fix and post-fix.

eap_buf_chain_base_c(const, abs_eap_am_tools_c *const, const u8_t *const, const u32_t, const bool)

EAP_FUNC_IMPORTeap_buf_chain_base_c(const eap_read_buffer_e,
abs_eap_am_tools_c *const tools,
const u8_t *const data,
const u32_tdata_length,
const boolfree_buffer
)

The constructor of the eap_buf_chain_wr class initializes attributes using the parameters passes to it. The example use of eap_buf_chain_wr is as follows. NOTE all sanity checks are ignored in the example.

 u8_t packet_buffer[EAP_MEM_GUARDS(EAP_MAX_LOCAL_PACKET_BUFFER_LENGTH)];
 eap_buf_chain_rd_c response_packet(
     eap_read_buffer, m_am_tools, packet_buffer,
     sizeof(packet_buffer), false);
 const u32_t eap_header_offset = get_type_partner()->get_header_offset(
     &MTU, &trailer_length);
 eap_header_rd_c * const eap_response = (eap_header_rd_c * const)
     response_packet.get_data_offset(eap_header_offset,
         (EAP_MAX_LOCAL_PACKET_BUFFER_LENGTH
         -(eap_header_offset+ trailer_length)));

Parameters

const eap_read_buffer_eseparates the write and read-only constructors.
abs_eap_am_tools_c *const toolsparameter is pointer to the tools class.
const u8_t *const datais pointer to the buffer containing the message.
const u32_t data_lengthparameter is count of bytes in the buffer.
const bool free_bufferparameter indicates whether the destructor must free the data buffer.

eap_buf_chain_base_c(const, abs_eap_am_tools_c *const, const u32_t)

EAP_FUNC_IMPORTeap_buf_chain_base_c(const eap_write_buffer_e,
abs_eap_am_tools_c *const tools,
const u32_tdata_length
)

The constructor of the eap_buf_chain_wr class initializes attributes using the parameters passes to it. New buffer is allocated from heap. The example use of eap_buf_chain_wr is as follows. NOTE all sanity checks are ignored in the example.

 eap_buf_chain_rd_c response_packet(
     eap_write_buffer_e, m_am_tools,
     PACKET_BUFFER_LENGTH);
 const u32_t eap_header_offset = get_type_partner()->get_header_offset(
     &MTU, &trailer_length);
 eap_header_rd_c * const eap_response = (eap_header_rd_c * const)
     response_packet.get_data_offset(eap_header_offset,
         (PACKET_BUFFER_LENGTH
         -(eap_header_offset+ trailer_length)));

Parameters

const eap_write_buffer_eseparates the write and read-only constructors.
abs_eap_am_tools_c *const toolsparameter is pointer to the tools class.
const u32_t data_lengthparameter is count of bytes in the buffer.

~eap_buf_chain_base_c()

EAP_FUNC_IMPORT~eap_buf_chain_base_c()[virtual]

The destructor of the eap_buf_chain_base_c class checks memory guards and frees the allocated buffer.

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.

check_guard_bytes(const u8_t *const)

EAP_FUNC_IMPORT boolcheck_guard_bytes(const u8_t *const guard)const [private]

Function checks the memory guard bytes.

Parameters

const u8_t *const guard

check_guards()

EAP_FUNC_IMPORT boolcheck_guards()const

Function checks the all memory guard bytes.

force_inheritance()

EAP_FUNC_IMPORT voidforce_inheritance()[private, pure virtual]

Forses the inheritance.

get_am_tools()

EAP_FUNC_IMPORT abs_eap_am_tools_c *get_am_tools()[protected]

get_buffer_length()

EAP_FUNC_IMPORT u32_tget_buffer_length()const

The get_buffer_length() function returns the length of buffer in bytes.

get_data(const u32_t)

EAP_FUNC_IMPORT u8_t *get_data(const u32_tp_continuous_bytes)const

The get_data() function function returns pointer to the data. NOTE user of the eap_buf_chain_wr class must obtain the pointer to the data using this or the get_data_offset() function. These functions can handle the memory guard.

Parameters

const u32_t p_continuous_bytesindicates how many bytes in continuous memory is needed.

get_data_length()

EAP_FUNC_IMPORT u32_tget_data_length()const

The get_data_length() function returns count of data bytes in the buffer.

get_data_offset(const u32_t, const u32_t)

EAP_FUNC_IMPORT u8_t *get_data_offset(const u32_tp_offset,
const u32_tp_continuous_bytes
)const

The get_data_offset() function returns pointer to the data in offset (p_offset). NOTE user of the eap_buf_chain_wr class must obtain the pointer to the data using this or the get_data() function. These functions can handle the memory guard.

Parameters

const u32_t p_offsetindicates the required offset.
const u32_t p_continuous_bytesindicates how many bytes in continuous memory is needed.

get_do_length_checks()

EAP_FUNC_IMPORT boolget_do_length_checks()const

This is used in testing.

get_do_packet_retransmission()

EAP_FUNC_IMPORT boolget_do_packet_retransmission()

The set_do_packet_retransmission() function gets the re-transmission flag of this packet.

get_encrypt()

EAP_FUNC_IMPORT boolget_encrypt()const

This gets whether this packet must be encrypted (true) or not (false). Encryption means the WLAN data encryption on the air (WEP, TKIP or CCMP). Using this flag to tell the encryption allows the configuration of the temporal key beforehand the key is used. This is optimization to fasten the key configuration.

get_is_client()

EAP_FUNC_IMPORT boolget_is_client()const

This gets whether the sender is client or server. This is used in testing.

get_is_manipulated()

EAP_FUNC_IMPORT boolget_is_manipulated()

The get_is_manipulated() function returns flag to indicate this packet is manipulated. This is used for testing purposes.

get_is_valid()

EAP_FUNC_IMPORT boolget_is_valid()const

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

get_is_valid_data()

EAP_FUNC_IMPORT boolget_is_valid_data()const

The get_is_valid() function returns the status of the data included in object.

get_mem_guard_length()

EAP_FUNC_IMPORT u32_tget_mem_guard_length()

get_random_error_type()

EAP_FUNC_IMPORT eap_random_error_typeget_random_error_type()

The get_random_error_type() function returns the type of manipulation of the packet. This is used for testing purposes.

get_send_packet_index()

EAP_FUNC_IMPORT u32_tget_send_packet_index()

This function returns the index of sent packet. This is used for testing purposes.

get_stack_address()

EAP_FUNC_IMPORT const void *get_stack_address()const

This gets the pointer of sender stack. This is used in testing.

initialize(const u32_t)

EAP_FUNC_IMPORT eap_status_einitialize(const u32_tmem_guard_length)[private]

This function initializes the eap_buf_chain_base_c object.

Parameters

const u32_t mem_guard_length

reset_data_buffer()

EAP_FUNC_IMPORT voidreset_data_buffer()[private]

Function zeroes the data buffer.

set_buffer_length(const u32_t)

EAP_FUNC_IMPORT eap_status_eset_buffer_length(const u32_tlength)

The set_buffer_length() function allocates the buffer of length bytes.

Parameters

const u32_t length

set_data_length(const u32_t)

EAP_FUNC_IMPORT eap_status_eset_data_length(const u32_tlength)

The set_data_length() function set the data length in the buffer.

Parameters

const u32_t length

set_do_length_checks(const bool)

EAP_FUNC_IMPORT voidset_do_length_checks(const booldo_length_checks)

This is used in testing.

Parameters

const bool do_length_checks

set_do_packet_retransmission(const bool)

EAP_FUNC_IMPORT voidset_do_packet_retransmission(const booldo_packet_retransmission_when_true)

The set_do_packet_retransmission() function sets the re-transmission flag of this packet. Packet will be re-transmitted by lower layer when do_packet_retransmission_when_true is true. Packet will not re-transmitted by lower layer when do_packet_retransmission_when_true is false.

Parameters

const bool do_packet_retransmission_when_true

set_encrypt(const bool)

EAP_FUNC_IMPORT voidset_encrypt(const boolencrypt_when_true)

This sets whether this packet must be encrypted (true) or not (false). Encryption means the WLAN data encryption on the air (WEP, TKIP or CCMP). Using this flag to tell the encryption allows the configuration of the temporal key beforehand the key is used. This is optimization to fasten the key configuration.

Parameters

const bool encrypt_when_true

set_is_client(const bool)

EAP_FUNC_IMPORT voidset_is_client(const boolis_client_when_true)

This sets whether the sender is client or server. This is used in testing.

Parameters

const bool is_client_when_true

set_is_manipulated()

EAP_FUNC_IMPORT voidset_is_manipulated()

The set_is_manipulated() function sets flag to indicate this packet is manipulated. This is used for testing purposes.

set_mem_guard_bytes()

EAP_FUNC_IMPORT voidset_mem_guard_bytes()[private]

Function sets the memory guard bytes.

set_random_error_type(eap_random_error_type)

EAP_FUNC_IMPORT voidset_random_error_type(eap_random_error_typeerror_type)

The set_random_error_type() function sets the type of manipulation of the packet. This is used for testing purposes.

Parameters

eap_random_error_type error_type

set_send_packet_index(const u32_t)

EAP_FUNC_IMPORT voidset_send_packet_index(const u32_tsend_packet_index)

This function sets the index of sent packet. This is used for testing purposes.

Parameters

const u32_t send_packet_index

set_stack_address(const void *const)

EAP_FUNC_IMPORT voidset_stack_address(const void *const stack_address)

This sets the pointer of sender stack. This is used in testing.

Parameters

const void *const stack_address

Member Data Documentation

abs_eap_am_tools_c *const m_am_tools

abs_eap_am_tools_c *constm_am_tools[private]

eap_buf_chain_base_impl_str * m_data

eap_buf_chain_base_impl_str *m_data[private]

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