class eap_am_tools_c : public abs_eap_am_tools_c |
This class defines the common functions of tools. These are the platform independent functions used in tools.
Private Member Functions | |
---|---|
EAP_FUNC_IMPORT void | convert_selected_bytes_to_ascii_armor(const u8_t, u32_t *const , u8_t *const , u8_t *const , u32_t *const , const bool) |
EAP_FUNC_IMPORT u8_t | octet_from_ascii_armor(const u8_t) |
EAP_FUNC_IMPORT u8_t | octet_to_ascii_armor(const u8_t) |
EAP_FUNC_IMPORT void | restore_selected_bytes_from_ascii_armor(const u8_t, u32_t *const , u8_t *const , u32_t *const , const bool) |
Public Member Enumerations | |
---|---|
enum | anonymous { eap_trace_mask_none = (0u), eap_trace_mask_always = (1u << 0u), eap_trace_mask_error = (1u << 1u), eap_trace_mask_debug = (1u << 2u), eap_trace_mask_functions = (1u << 3u), eap_trace_mask_crypto = (1u << 4u), eap_trace_mask_timer = (1u << 5u), eap_trace_mask_eap_messages = (1u << 6u), eap_trace_mask_test_vectors = (1u << 7u), eap_trace_mask_crypto_sha1 = (1u << 8u), eap_trace_mask_crypto_md4 = (1u << 9u), eap_trace_mask_crypto_rc4 = (1u << 10u), eap_trace_mask_crypto_test_random = (1u << 11u), eap_trace_mask_message_data = (1u << 12u), eap_trace_mask_hash_map = (1u << 13u), eap_trace_mask_timer_queue = (1u << 14u), eap_trace_mask_ok_returns = (1u << 15u) } |
EAP_FUNC_IMPORT u8_t | ascii_to_octet | ( | i32_t | character | ) | [virtual] |
Function converts one ascii character to octet.
i32_t character | is the converted ascii character. |
EAP_FUNC_IMPORT i32_t | compare_u64 | ( | const u64_t | a, |
const u64_t | b | |||
) | [virtual] |
This function compares two 64-bit integers. If a is bigger function returns positive integer. If b is bigger function returns negative integer. If a == b function returns zero integer.
EAP_FUNC_IMPORT eap_status_e | convert_ascii_to_uppercase | ( | u8_t *const | source_bytes, |
const u32_t | source_bytes_length | |||
) | [virtual] |
Function converts lovercase ascii characters to uppercase.
EAP_FUNC_IMPORT eap_status_e | convert_bytes_to_ascii_armor | ( | const u8_t *const | source_bytes, |
const u32_t | source_bytes_length, | |||
u8_t *const | target, | |||
u32_t * | target_length | |||
) | [virtual] |
Function converts bytes to ascii armored bytes.
const u8_t *const source_bytes | is pointer to the source bytes. |
const u32_t source_bytes_length | is length of source bytes. |
u8_t *const target | is pointer to the target bytes. |
u32_t * target_length | is length of target bytes. Binary 6-bit blocks are converted to 8-bit ascii values. Ascii values can easily represent 2^6=64 values. If length of target array is not module 3, padding zero bits are ignored. |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5| | | | | | | + | | | | | | \ | | | | | + \ | | | | | \ \ | | | | + \ \ | | | | \ \ \ | | | + \ \ \ | | | \ \ \ \ | | + \ \ \ \ | | \ \ \ \ \ | + \ \ \ \ \ | \ \ \ \ \ \ | \ \ \ \ \ \ | + + + + + + | | | | | | | |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
EAP_FUNC_IMPORT eap_status_e | convert_bytes_to_hex_ascii | ( | const u8_t *const | source_bytes, |
const u32_t | source_bytes_length, | |||
u8_t *const | target, | |||
u32_t * | target_length | |||
) | [virtual] |
Function converts bytes to hex ascii.
EAP_FUNC_IMPORT eap_status_e | convert_bytes_to_hex_ascii | ( | const void *const | source_bytes, |
const u32_t | source_bytes_length, | |||
eap_variable_data_c *const | target | |||
) | [virtual] |
Function converts bytes to hex ascii.
const void *const source_bytes | is pointer to the source bytes. |
const u32_t source_bytes_length | is length of source bytes. |
eap_variable_data_c *const target | is pointer to the target buffer. |
EAP_FUNC_IMPORT eap_status_e | convert_hex_ascii_to_bytes | ( | const u8_t *const | source_bytes, |
const u32_t | source_bytes_length, | |||
u8_t *const | target, | |||
u32_t * | target_length | |||
) | [virtual] |
Function converts hex ascii to bytes.
EAP_FUNC_IMPORT eap_status_e | convert_hex_ascii_to_bytes | ( | const void *const | source_bytes, |
const u32_t | source_bytes_length, | |||
eap_variable_data_c *const | target | |||
) | [virtual] |
Function converts hex ascii to bytes.
const void *const source_bytes | is pointer to the source bytes. |
const u32_t source_bytes_length | is length of source bytes. |
eap_variable_data_c *const target | is pointer to the target bytes. |
EAP_FUNC_IMPORT void | convert_selected_bytes_to_ascii_armor | ( | const u8_t | source_byte, |
u32_t *const | saved_bit_count, | |||
u8_t *const | saved_bits, | |||
u8_t *const | target, | |||
u32_t *const | output_ind, | |||
const bool | last_input_byte | |||
) | [private] |
EAP_FUNC_IMPORT eap_status_e | create_uuid_v5 | ( | const void *const | ns_uuid, |
const u32_t | ns_uuid_length, | |||
const void *const | name, | |||
const u32_t | name_length, | |||
eap_variable_data_c *const | uuid | |||
) | [virtual] |
The create_uuid_v5() method creates an UUID version 5 (SHA-1) from the name space UUID and name (RFC 4122). The name space UUID should be in hex format (e.g. 3d813cbb47fb52ba91df831e1593ac29). The name space UUID and name must be in network byte order (little endiann).
const void *const ns_uuid | pointer to the UUID of the name space in hex format. |
const u32_t ns_uuid_length | lenght of the name space UUID in bytes (should be 16 bytes). |
const void *const name | pointer to the name (e.g. MAC address) in the name space in hex format. |
const u32_t name_length | length of the name in bytes. |
eap_variable_data_c *const uuid | pointer to an eap_variable_data_c instance to which the UUID will be created. |
EAP_FUNC_IMPORT eap_status_e | create_uuid_v5_from_mac_address | ( | const u8_t *const | mac_address, |
const u32_t | mac_address_length, | |||
eap_variable_data_c *const | uuid | |||
) | [virtual] |
The create_uuid_v5_from_mac_address() method creates an UUID version 5 from a MAC address. Uses an internally defined, fixed name space UUID allocated for EAP MAC addresses. The MAC address should be in hex format (little endiann).
const u8_t *const mac_address | pointer to the MAC address in hex format. |
const u32_t mac_address_length | length of the MAC address (should be 6 bytes). |
eap_variable_data_c *const uuid | pointer to an eap_variable_data_c instance to which the UUID will be created. |
EAP_FUNC_IMPORT eap_status_e | eap_status_return | ( | const bool | print_error_when_true, |
const eap_status_e | status, | |||
const eap_char *const | file_name, | |||
const i32_t | line_number | |||
) | [virtual] |
const bool print_error_when_true | |
const eap_status_e status | |
const eap_char *const file_name | |
const i32_t line_number |
EAP_FUNC_IMPORT eap_status_e | eap_status_return_file_number | ( | const bool | print_error_when_true, |
const eap_status_e | status, | |||
const u32_t | file_date, | |||
const u32_t | file_number, | |||
const i32_t | line_number | |||
) | [virtual] |
This function is global proxy for return values with file name and line number. This is used in traces.
const bool print_error_when_true | |
const eap_status_e status | |
const u32_t file_date | |
const u32_t file_number | |
const i32_t line_number |
EAP_FUNC_IMPORT eap_status_e | generic_convert_unicode_to_utf8 | ( | eap_variable_data_c & | dest, |
const eap_variable_data_c & | src | |||
) |
Function converts unicode characters into UTF8 characters.
eap_variable_data_c & dest | is reference to destination utf8 variable data. |
const eap_variable_data_c & src | is refrence to unicode variable data. |
EAP_FUNC_IMPORT eap_status_e | generic_convert_utf8_to_unicode | ( | eap_variable_data_c & | dest, |
const eap_variable_data_c & | src | |||
) |
Function converts UTF8 characters into unicode characters.
eap_variable_data_c & dest | is reference to destination unicode variable data. |
const eap_variable_data_c & src | is refrence to UTF8 variable data. |
EAP_FUNC_IMPORT bool | get_thread_stopped | ( | ) | [virtual] |
Returns true when timer thread is stopped. Returns false when timer thread is running.
EAP_FUNC_IMPORT bool | get_use_timer_queue | ( | ) | [virtual] |
Returns true when timer queue is used. Returns false when timer queue is not used.
EAP_FUNC_IMPORT eap_status_e | memory_store_add_data | ( | const eap_variable_data_c *const | key, |
eap_tlv_message_data_c *const | data, | |||
const u32_t | timeout | |||
) | [virtual] |
Memory store is visible only during the eap_am_tools_c object is alive. This function add flat data to memory store. You must format your data to eap_tlv_message_data_c object. Data is identified by key parameter. You can set timeout to data. Data will be automatically removed after timeout. Timeout value zero means no timeout is set. Serious WARNING: do use really good key values. Memory store is globally used by all EAP Core objects. Key must be good that other users do not use others data. Add the real data type as a string to the key and other identifiers that separate data between the other users that store same data type to the memory store.
const eap_variable_data_c *const key | |
eap_tlv_message_data_c *const data | |
const u32_t timeout |
EAP_FUNC_IMPORT eap_status_e | memory_store_get_data | ( | const eap_variable_data_c *const | key, |
eap_tlv_message_data_c *const | data | |||
) | [virtual] |
Memory store is visible only during the eap_am_tools_c object is alive. This function gets data from memory store. Data is returned in eap_tlv_message_data_c object. Data is identified by key parameter. Serious WARNING: do use really good key values. Memory store is globally used by all EAP Core objects. Key must be good that other users do not use others data. Add the real data type as a string to the key and other identifiers that separate data between the other users that store same data type to the memory store.
const eap_variable_data_c *const key | |
eap_tlv_message_data_c *const data |
EAP_FUNC_IMPORT eap_status_e | memory_store_remove_data | ( | const eap_variable_data_c *const | key | ) | [virtual] |
Memory store is visible only during the eap_am_tools_c object is alive. This function removes data from memory store. Data is identified by key parameter. Serious WARNING: do use really good key values. Memory store is globally used by all EAP Core objects. Key must be good that other users do not use others data. Add the real data type as a string to the key and other identifiers that separate data between the other users that store same data type to the memory store.
const eap_variable_data_c *const key |
EAP_FUNC_IMPORT u64_t | multiply_u64 | ( | const u64_t | a, |
const u64_t | b | |||
) | [virtual] |
This function multiplys two 64-bit integers. Returned value is remainder of 2^64, so overflow is not detected.
EAP_FUNC_IMPORT eap_status_e | number_string_to_u32 | ( | const u8_t *const | number_string, |
const u32_t | number_string_length, | |||
u32_t *const | integer | |||
) | [virtual] |
This function converts string to u32_t value.
EAP_FUNC_IMPORT u8_t | octet_from_ascii_armor | ( | const u8_t | source_byte | ) | [private] |
const u8_t source_byte |
EAP_FUNC_IMPORT u8_t | octet_to_ascii | ( | i32_t | octet | ) | [virtual] |
Function converts one octet to ascii character.
i32_t octet | is the converted octet. |
EAP_FUNC_IMPORT u8_t | octet_to_ascii_armor | ( | const u8_t | source_byte | ) | [private] |
const u8_t source_byte |
EAP_FUNC_IMPORT eap_status_e | parse_nai | ( | const eap_variable_data_c *const | nai, |
eap_variable_data_c *const | username, | |||
eap_variable_data_c *const | realm | |||
) | [virtual] |
Function parses NAI to usename and realm. If either is missing the corresponding value will be invalid.
const eap_variable_data_c *const nai | |
eap_variable_data_c *const username | |
eap_variable_data_c *const realm |
EAP_FUNC_IMPORT eap_status_e | restore_bytes_from_ascii_armor | ( | const u8_t *const | source_bytes, |
const u32_t | source_bytes_length, | |||
u8_t *const | target, | |||
u32_t * | target_length | |||
) | [virtual] |
Function converts ascii armored bytes to bytes.
const u8_t *const source_bytes | is pointer to the source bytes. |
const u32_t source_bytes_length | is length of source bytes. |
u8_t *const target | is pointer to the target bytes. |
u32_t * target_length | is length of target bytes. 8-bit ascii values are converted to binary 6-bit blocks. Ascii values can easily represent 2^6=64 values. If length of source array is not module 3, missing bits are padded with zero bits. |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : |0:0:0:0| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5|0 1 2 3 4 5| | | | | | | + | | | | | | \ | | | | | + \ | | | | | \ \ | | | | + \ \ | | | | \ \ \ | | | + \ \ \ | | | \ \ \ \ | | + \ \ \ \ | | \ \ \ \ \ | + \ \ \ \ \ | \ \ \ \ \ \ | \ \ \ \ \ \ | + + + + + + | | | | | | | |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | : : : : : : : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
EAP_FUNC_IMPORT void | restore_selected_bytes_from_ascii_armor | ( | const u8_t | source_byte, |
u32_t *const | missing_bit_count, | |||
u8_t *const | target, | |||
u32_t *const | output_ind, | |||
const bool | last_input_byte | |||
) | [private] |
EAP_FUNC_IMPORT void | set_activate_trace_on_error | ( | ) | [virtual] |
This functions allows activation of trace when the error occurs. Look at the set_activate_trace_on_error() and eap_status_return() functions. NOTE the always active traces are only left active. That means set_activate_trace_on_error() function calls set_trace_mask(eap_trace_mask_always).
EAP_FUNC_IMPORT void | set_trace_mask | ( | const u32_t | mask | ) | [virtual] |
This function sets the current trace mask.
const u32_t mask |
EAP_FUNC_IMPORT eap_status_e | timer_thread_function | ( | ) | [virtual] |
Function runs the timer thread loop. This function calls the pulse_timer() function to increase the elapsed time.
EAP_FUNC_IMPORT void | trace_configuration | ( | const eap_status_e | configuration_read_status, |
const eap_configuration_field_c *const | field, | |||
const eap_variable_data_c *const | data | |||
) | [virtual] |
This function traces read configure field and data.
const eap_status_e configuration_read_status | |
const eap_configuration_field_c *const field | |
const eap_variable_data_c *const data |
EAP_FUNC_IMPORT void | trace_data | ( | eap_const_string | prefix, |
const void *const | p_data, | |||
const u32_t | data_length | |||
) | [virtual] |
The trace_data() function traces null terminated prefix string and data_length bytes from p_data to file. This is used in macros EAP_TRACE_DATA_DEBUG(object_name, _parameter_list_) and EAP_TRACE_DATA_ERROR(object_name, _parameter_list_).
eap_const_string prefix | |
const void *const p_data | |
const u32_t data_length |
EAP_FUNC_IMPORT u64_t | xor_u64 | ( | const u64_t | a, |
const u64_t | b | |||
) | [virtual] |
This function xors two 64-bit integers.
eap_trace_mask_none = (0u) | |
eap_trace_mask_always = (1u << 0u) | |
eap_trace_mask_error = (1u << 1u) | |
eap_trace_mask_debug = (1u << 2u) | |
eap_trace_mask_functions = (1u << 3u) | |
eap_trace_mask_crypto = (1u << 4u) | |
eap_trace_mask_timer = (1u << 5u) | |
eap_trace_mask_eap_messages = (1u << 6u) | |
eap_trace_mask_test_vectors = (1u << 7u) | |
eap_trace_mask_crypto_sha1 = (1u << 8u) | |
eap_trace_mask_crypto_md4 = (1u << 9u) | |
eap_trace_mask_crypto_rc4 = (1u << 10u) | |
eap_trace_mask_crypto_test_random = (1u << 11u) | |
eap_trace_mask_message_data = (1u << 12u) | |
eap_trace_mask_hash_map = (1u << 13u) | |
eap_trace_mask_timer_queue = (1u << 14u) | |
eap_trace_mask_ok_returns = (1u << 15u) |
bool | m_activate_trace_on_error | [private] |
This flag allows activation of trace when the error occurs. Look at the set_activate_trace_on_error() and eap_status_return() functions.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.