eapol/eapol_framework/eapol_common/am/include/eap_am_network_id.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    24 
    24 
    25 #include "eap_tools.h"
    25 #include "eap_tools.h"
    26 #include "abs_eap_am_tools.h"
    26 #include "abs_eap_am_tools.h"
    27 #include "eap_am_tools.h"
    27 #include "eap_am_tools.h"
    28 #include "eap_am_export.h"
    28 #include "eap_am_export.h"
       
    29 // Start: added by script change_export_macros.sh.
       
    30 #if defined(EAP_NO_EXPORT_EAP_AM_NETWORK_ID_H)
       
    31 	#define EAP_CLASS_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_NONSHARABLE 
       
    32 	#define EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H 
       
    33 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H 
       
    34 	#define EAP_FUNC_EXPORT_EAP_AM_NETWORK_ID_H 
       
    35 	#define EAP_C_FUNC_EXPORT_EAP_AM_NETWORK_ID_H 
       
    36 #elif defined(EAP_EXPORT_EAP_AM_NETWORK_ID_H)
       
    37 	#define EAP_CLASS_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_EXPORT 
       
    38 	#define EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_C_FUNC_EXPORT 
       
    40 	#define EAP_FUNC_EXPORT_EAP_AM_NETWORK_ID_H EAP_FUNC_EXPORT 
       
    41 	#define EAP_C_FUNC_EXPORT_EAP_AM_NETWORK_ID_H EAP_C_FUNC_EXPORT 
       
    42 #else
       
    43 	#define EAP_CLASS_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_IMPORT 
       
    44 	#define EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_FUNC_IMPORT 
       
    45 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H EAP_C_FUNC_IMPORT 
       
    46 	#define EAP_FUNC_EXPORT_EAP_AM_NETWORK_ID_H 
       
    47 	#define EAP_C_FUNC_EXPORT_EAP_AM_NETWORK_ID_H 
       
    48 #endif
       
    49 // End: added by script change_export_macros.sh.
    29 
    50 
    30 /// This class stores the protocol layer network identity.
    51 /// This class stores the protocol layer network identity.
    31 /**
    52 /**
    32  * A eap_am_network_id_c class.
    53  * A eap_am_network_id_c class.
    33  * Network addresses are handled through eap_am_network_id_c class.
    54  * Network addresses are handled through eap_am_network_id_c class.
    34  * It includes source and destination addresses and the type of packet. 
    55  * It includes source and destination addresses and the type of packet. 
    35  * Addresses are mostly Ethernet addresses. Packet type is the type of Ethernet packet.
    56  * Addresses are mostly Ethernet addresses. Packet type is the type of Ethernet packet.
    36  * The eap_am_network_id class stores the addresses using the eap_variable_data objects.
    57  * The eap_am_network_id class stores the addresses using the eap_variable_data objects.
    37  */
    58  */
    38 class EAP_EXPORT eap_am_network_id_c
    59 class EAP_CLASS_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c
    39 {
    60 {
    40 
    61 
    41 private:
    62 private:
    42 
    63 
    43 	/// This is pointer to the tools class.
    64 	/// This is pointer to the tools class.
    74 
    95 
    75 	/**
    96 	/**
    76 	 * The set_is_valid() function sets the state of the eap_core object valid.
    97 	 * The set_is_valid() function sets the state of the eap_core object valid.
    77 	 * The eap_core object calls this function after it is initialized.
    98 	 * The eap_core object calls this function after it is initialized.
    78 	 */
    99 	 */
    79 	EAP_FUNC_IMPORT void set_is_valid();
   100 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H void set_is_valid();
    80 
   101 
    81 public:
   102 public:
    82 
   103 
    83 	/**
   104 	/**
    84 	 * The destructor does nothing extra. The buffers of each address are 
   105 	 * The destructor does nothing extra. The buffers of each address are 
    85 	 * freed in the destructor of the eap_variable_data class.
   106 	 * freed in the destructor of the eap_variable_data class.
    86 	 */
   107 	 */
    87 	EAP_FUNC_IMPORT virtual ~eap_am_network_id_c();
   108 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H virtual ~eap_am_network_id_c();
    88 
   109 
    89 	/**
   110 	/**
    90 	 * This version initializes the object.
   111 	 * This version initializes the object.
    91 	 * @param tools parameter is pointer to the tools class.
   112 	 * @param tools parameter is pointer to the tools class.
    92 	 */
   113 	 */
    93 	EAP_FUNC_IMPORT eap_am_network_id_c(
   114 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c(
    94 		abs_eap_am_tools_c * const tools);
   115 		abs_eap_am_tools_c * const tools);
    95 
   116 
    96 	/**
   117 	/**
    97 	 * This version takes addresses as pointers to any data.
   118 	 * This version takes addresses as pointers to any data.
    98 	 * This could be used to initialize addresses from the received packet.
   119 	 * This could be used to initialize addresses from the received packet.
   105 	 * @param free_id parameter indicates whether the source and destination buffers must be freed in destructors.
   126 	 * @param free_id parameter indicates whether the source and destination buffers must be freed in destructors.
   106 	 * @param writable_id parameter indicates whether the source and destination buffers are writable.
   127 	 * @param writable_id parameter indicates whether the source and destination buffers are writable.
   107 	 *
   128 	 *
   108 	 * NOTE the data buffers are NOT copied.
   129 	 * NOTE the data buffers are NOT copied.
   109 	 */
   130 	 */
   110 	EAP_FUNC_IMPORT eap_am_network_id_c(
   131 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c(
   111 		abs_eap_am_tools_c * const tools,
   132 		abs_eap_am_tools_c * const tools,
   112 		const void * const source,
   133 		const void * const source,
   113 		const u32_t source_length,
   134 		const u32_t source_length,
   114 		const void * const destination,
   135 		const void * const destination,
   115 		const u32_t destination_length,
   136 		const u32_t destination_length,
   125 	 * @param type parameter is type of the packet. Mostly this is Ethernet type.
   146 	 * @param type parameter is type of the packet. Mostly this is Ethernet type.
   126 	 *
   147 	 *
   127 	 * NOTE the data buffers are NOT copied. This is used to swap addresses of existing
   148 	 * NOTE the data buffers are NOT copied. This is used to swap addresses of existing
   128 	 * eap_am_network_id_c object and create a new object using existing addresses.
   149 	 * eap_am_network_id_c object and create a new object using existing addresses.
   129 	 */
   150 	 */
   130 	EAP_FUNC_IMPORT eap_am_network_id_c(
   151 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c(
   131 		abs_eap_am_tools_c * const tools,
   152 		abs_eap_am_tools_c * const tools,
   132 		const eap_variable_data_c * const source,
   153 		const eap_variable_data_c * const source,
   133 		const eap_variable_data_c * const destination,
   154 		const eap_variable_data_c * const destination,
   134 		const u16_t type);
   155 		const u16_t type);
   135 
   156 
   138 	 * @param tools parameter is pointer to the tools class.
   159 	 * @param tools parameter is pointer to the tools class.
   139 	 * @param network_id parameter is pointer to the existing object.
   160 	 * @param network_id parameter is pointer to the existing object.
   140 	 *
   161 	 *
   141 	 * NOTE this copies the addresses.
   162 	 * NOTE this copies the addresses.
   142 	 */
   163 	 */
   143 	EAP_FUNC_IMPORT eap_am_network_id_c(
   164 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c(
   144 		abs_eap_am_tools_c * const tools,
   165 		abs_eap_am_tools_c * const tools,
   145 		const eap_am_network_id_c * const network_id);
   166 		const eap_am_network_id_c * const network_id);
   146 
   167 
   147 	/**
   168 	/**
   148 	 * This function uses the data from existing object.
   169 	 * This function uses the data from existing object.
   149 	 * @param network_id parameter is pointer to the existing object.
   170 	 * @param network_id parameter is pointer to the existing object.
   150 	 *
   171 	 *
   151 	 * NOTE this copies the addresses.
   172 	 * NOTE this copies the addresses.
   152 	 */
   173 	 */
   153 	EAP_FUNC_IMPORT eap_status_e set_copy_of_network_id(
   174 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_status_e set_copy_of_network_id(
   154 		const eap_am_network_id_c * const network_id);
   175 		const eap_am_network_id_c * const network_id);
   155 
   176 
   156 	EAP_FUNC_IMPORT eap_status_e set_copy_of_am_network_id(
   177 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_status_e set_copy_of_am_network_id(
   157 		const void * const source,
   178 		const void * const source,
   158 		const u32_t source_length,
   179 		const u32_t source_length,
   159 		const void * const destination,
   180 		const void * const destination,
   160 		const u32_t destination_length,
   181 		const u32_t destination_length,
   161 		const u16_t type);
   182 		const u16_t type);
   162 
   183 
   163 	/**
   184 	/**
   164 	 * The get_is_valid() function returns the status of the eap_core object.
   185 	 * The get_is_valid() function returns the status of the eap_core object.
   165 	 * True indicates the object is initialized succesfully.
   186 	 * True indicates the object is initialized succesfully.
   166 	 */
   187 	 */
   167 	EAP_FUNC_IMPORT bool get_is_valid() const;
   188 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H bool get_is_valid() const;
   168 
   189 
   169 	/**
   190 	/**
   170 	 * The get_is_valid_data() function returns the status of the eap_core object.
   191 	 * The get_is_valid_data() function returns the status of the eap_core object.
   171 	 * True indicates the object does include valid addresses.
   192 	 * True indicates the object does include valid addresses.
   172 	 */
   193 	 */
   173 	EAP_FUNC_IMPORT bool get_is_valid_data() const;
   194 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H bool get_is_valid_data() const;
   174 
   195 
   175 	/**
   196 	/**
   176 	 * The get_source_id() function returns pointer to the source address.
   197 	 * The get_source_id() function returns pointer to the source address.
   177 	 */
   198 	 */
   178 	EAP_FUNC_IMPORT const eap_variable_data_c * get_source_id() const;
   199 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H const eap_variable_data_c * get_source_id() const;
   179 
   200 
   180 	/**
   201 	/**
   181 	 * The get_destination_id() function returns pointer to the destination address.
   202 	 * The get_destination_id() function returns pointer to the destination address.
   182 	 */
   203 	 */
   183 	EAP_FUNC_IMPORT const eap_variable_data_c * get_destination_id() const;
   204 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H const eap_variable_data_c * get_destination_id() const;
   184 
   205 
   185 
   206 
   186 	/**
   207 	/**
   187 	 * The get_source() function returns pointer to the source data.
   208 	 * The get_source() function returns pointer to the source data.
   188 	 */
   209 	 */
   189 	EAP_FUNC_IMPORT const u8_t * get_source() const;
   210 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H const u8_t * get_source() const;
   190 
   211 
   191 	/**
   212 	/**
   192 	 * The get_destination() function returns pointer to the destination data.
   213 	 * The get_destination() function returns pointer to the destination data.
   193 	 */
   214 	 */
   194 	EAP_FUNC_IMPORT const u8_t * get_destination() const;
   215 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H const u8_t * get_destination() const;
   195 
   216 
   196 
   217 
   197 	/**
   218 	/**
   198 	 * The get_source_length() function returns length of the source address.
   219 	 * The get_source_length() function returns length of the source address.
   199 	 */
   220 	 */
   200 	EAP_FUNC_IMPORT u32_t get_source_length() const;
   221 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H u32_t get_source_length() const;
   201 
   222 
   202 	/**
   223 	/**
   203 	 * The get_destination_length() function returns length of the destination address.
   224 	 * The get_destination_length() function returns length of the destination address.
   204 	 */
   225 	 */
   205 	EAP_FUNC_IMPORT u32_t get_destination_length() const;
   226 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H u32_t get_destination_length() const;
   206 
   227 
   207 	/**
   228 	/**
   208 	 * The get_type() function returns type of the packet.
   229 	 * The get_type() function returns type of the packet.
   209 	 */
   230 	 */
   210 	EAP_FUNC_IMPORT u16_t get_type() const;
   231 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H u16_t get_type() const;
   211 
   232 
   212 	/**
   233 	/**
   213 	 * The get_network_id() function returns pointer to this.
   234 	 * The get_network_id() function returns pointer to this.
   214 	 */
   235 	 */
   215 	EAP_FUNC_IMPORT const eap_am_network_id_c * get_network_id() const;
   236 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H const eap_am_network_id_c * get_network_id() const;
   216 
   237 
   217 	/**
   238 	/**
   218 	 * The copy() function copies the eap_am_network_id object.
   239 	 * The copy() function copies the eap_am_network_id object.
   219 	 * The data of addresses are copied to new buffers.
   240 	 * The data of addresses are copied to new buffers.
   220 	 */
   241 	 */
   221 	EAP_FUNC_IMPORT eap_am_network_id_c * copy() const;
   242 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H eap_am_network_id_c * copy() const;
   222 
   243 
   223 	/**
   244 	/**
   224 	 * Compare the objects are identical.
   245 	 * Compare the objects are identical.
   225 	 * @return false if data of objects differs.
   246 	 * @return false if data of objects differs.
   226 	 * @return true if data of objects are the same.
   247 	 * @return true if data of objects are the same.
   227 	 */
   248 	 */
   228 	EAP_FUNC_IMPORT bool compare_network_id(const eap_am_network_id_c * const network_id) const;
   249 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H bool compare_network_id(const eap_am_network_id_c * const network_id) const;
   229 
   250 
   230 	/**
   251 	/**
   231 	 * The get_type() function sets type of the packet.
   252 	 * The get_type() function sets type of the packet.
   232 	 */
   253 	 */
   233 	EAP_FUNC_IMPORT void set_type(const u16_t type);
   254 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H void set_type(const u16_t type);
   234 
   255 
   235 	/**
   256 	/**
   236 	 * Resets the object.
   257 	 * Resets the object.
   237 	 */
   258 	 */
   238 	EAP_FUNC_IMPORT void reset();
   259 	EAP_FUNC_VISIBILITY_EAP_AM_NETWORK_ID_H void reset();
   239 };
   260 };
   240 
   261 
   241 
   262 
   242 #endif //#if !defined(_EAP_NETWORK_ID_H_)
   263 #endif //#if !defined(_EAP_NETWORK_ID_H_)
   243 
   264