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_e add_data (const void *const , const u32_t )
EAP_FUNC_IMPORT eap_status_e add_data (const eap_variable_data_c *const )
EAP_FUNC_IMPORT eap_status_e add_data_to_offset (const u32_t , const void *const , const u32_t )
EAP_FUNC_IMPORT eap_status_e add_data_to_offset (const u32_t , const eap_variable_data_c *const )
EAP_FUNC_IMPORT bool check_guards ()
EAP_FUNC_IMPORT u32_t get_buffer_length ()
EAP_FUNC_IMPORT u8_t * get_data (const u32_t )
EAP_FUNC_IMPORT u32_t get_data_length ()
EAP_FUNC_IMPORT u8_t * get_data_offset (const u32_t , const u32_t )
EAP_FUNC_IMPORT bool get_do_length_checks ()
EAP_FUNC_IMPORT bool get_do_packet_retransmission ()
EAP_FUNC_IMPORT bool get_encrypt ()
EAP_FUNC_IMPORT bool get_is_client ()
EAP_FUNC_IMPORT bool get_is_manipulated ()
EAP_FUNC_IMPORT bool get_is_valid ()
EAP_FUNC_IMPORT bool get_is_valid_data ()
EAP_FUNC_IMPORT u32_t get_mem_guard_length ()
EAP_FUNC_IMPORT eap_random_error_type get_random_error_type ()
EAP_FUNC_IMPORT u32_t get_send_packet_index ()
EAP_FUNC_IMPORT const void * get_stack_address ()
EAP_FUNC_IMPORT eap_status_e set_buffer_length (const u32_t )
EAP_FUNC_IMPORT eap_status_e set_data_length (const u32_t )
EAP_FUNC_IMPORT void set_do_length_checks (const bool)
EAP_FUNC_IMPORT void set_do_packet_retransmission (const bool)
EAP_FUNC_IMPORT void set_encrypt (const bool)
EAP_FUNC_IMPORT void set_is_client (const bool)
EAP_FUNC_IMPORT void set_is_manipulated ()
EAP_FUNC_IMPORT void set_random_error_type ( eap_random_error_type )
EAP_FUNC_IMPORT void set_send_packet_index (const u32_t )
EAP_FUNC_IMPORT void set_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 bool check_guard_bytes (const u8_t *const )
EAP_FUNC_IMPORT void force_inheritance ()
EAP_FUNC_IMPORT eap_status_e initialize (const u32_t )
EAP_FUNC_IMPORT void reset_data_buffer ()
EAP_FUNC_IMPORT void set_mem_guard_bytes ()
Private Attributes
abs_eap_am_tools_c *const m_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_IMPORT eap_buf_chain_base_c ( const eap_write_buffer_e,
abs_eap_am_tools_c *const tools,
u8_t *const data,
const u32_t data_length,
const bool reset_data,
const bool free_buffer,
const u32_t mem_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_e separates the write and read-only constructors.
abs_eap_am_tools_c *const tools parameter is pointer to the tools class.
u8_t *const data is pointer to the buffer containing the message.
const u32_t data_length parameter is count of bytes in the buffer.
const bool reset_data parameter indicates whether the data bytes must be set zero.
const bool free_buffer parameter indicates whether the destructor must free the data buffer.
const u32_t mem_guard_length indicates 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_IMPORT eap_buf_chain_base_c ( const eap_read_buffer_e,
abs_eap_am_tools_c *const tools,
const u8_t *const data,
const u32_t data_length,
const bool free_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_e separates the write and read-only constructors.
abs_eap_am_tools_c *const tools parameter is pointer to the tools class.
const u8_t *const data is pointer to the buffer containing the message.
const u32_t data_length parameter is count of bytes in the buffer.
const bool free_buffer parameter 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_IMPORT eap_buf_chain_base_c ( const eap_write_buffer_e,
abs_eap_am_tools_c *const tools,
const u32_t data_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_e separates the write and read-only constructors.
abs_eap_am_tools_c *const tools parameter is pointer to the tools class.
const u32_t data_length parameter 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_e add_data ( const void *const buffer,
const u32_t buffer_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 buffer points the data to be added.
const u32_t buffer_length is length of the buffer in bytes.

add_data(const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_e add_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 buffer points the data to be added.

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

EAP_FUNC_IMPORT eap_status_e add_data_to_offset ( const u32_t offset,
const void *const buffer,
const u32_t buffer_length
)

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

Parameters

const u32_t offset tells the place where data will begin.
const void *const buffer points the data to be added.
const u32_t buffer_length is length of the buffer in bytes.

add_data_to_offset(const u32_t, const eap_variable_data_c *const)

EAP_FUNC_IMPORT eap_status_e add_data_to_offset ( const u32_t offset,
const eap_variable_data_c *const buffer
)

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

Parameters

const u32_t offset tells the place where data will begin.
const eap_variable_data_c *const buffer points the data to be added.

check_guard_bytes(const u8_t *const)

EAP_FUNC_IMPORT bool check_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 bool check_guards ( ) const

Function checks the all memory guard bytes.

force_inheritance()

EAP_FUNC_IMPORT void force_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_t get_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_t p_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_bytes indicates how many bytes in continuous memory is needed.

get_data_length()

EAP_FUNC_IMPORT u32_t get_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_t p_offset,
const u32_t p_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_offset indicates the required offset.
const u32_t p_continuous_bytes indicates how many bytes in continuous memory is needed.

get_do_length_checks()

EAP_FUNC_IMPORT bool get_do_length_checks ( ) const

This is used in testing.

get_do_packet_retransmission()

EAP_FUNC_IMPORT bool get_do_packet_retransmission ( )

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

get_encrypt()

EAP_FUNC_IMPORT bool get_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 bool get_is_client ( ) const

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

get_is_manipulated()

EAP_FUNC_IMPORT bool get_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 bool get_is_valid ( ) const

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

get_is_valid_data()

EAP_FUNC_IMPORT bool get_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_t get_mem_guard_length ( )

get_random_error_type()

EAP_FUNC_IMPORT eap_random_error_type get_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_t get_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_e initialize ( const u32_t mem_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 void reset_data_buffer ( ) [private]

Function zeroes the data buffer.

set_buffer_length(const u32_t)

EAP_FUNC_IMPORT eap_status_e set_buffer_length ( const u32_t length )

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_e set_data_length ( const u32_t length )

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 void set_do_length_checks ( const bool do_length_checks )

This is used in testing.

Parameters

const bool do_length_checks

set_do_packet_retransmission(const bool)

EAP_FUNC_IMPORT void set_do_packet_retransmission ( const bool do_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 void set_encrypt ( const bool encrypt_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 void set_is_client ( const bool is_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 void set_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 void set_mem_guard_bytes ( ) [private]

Function sets the memory guard bytes.

set_random_error_type(eap_random_error_type)

EAP_FUNC_IMPORT void set_random_error_type ( eap_random_error_type error_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 void set_send_packet_index ( const u32_t send_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 void set_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 *const m_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.