24 |
24 |
25 #include "eap_tools.h" |
25 #include "eap_tools.h" |
26 #include "eapol_header.h" |
26 #include "eapol_header.h" |
27 #include "eap_general_header_base.h" |
27 #include "eap_general_header_base.h" |
28 #include "eapol_ethernet_address.h" |
28 #include "eapol_ethernet_address.h" |
|
29 #include "eap_am_export.h" |
|
30 // Start: added by script change_export_macros.sh. |
|
31 #if defined(EAP_NO_EXPORT_EAPOL_ETHERNET_HEADER_H) |
|
32 #define EAP_CLASS_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_NONSHARABLE |
|
33 #define EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H |
|
34 #define EAP_C_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H |
|
35 #define EAP_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H |
|
36 #define EAP_C_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H |
|
37 #elif defined(EAP_EXPORT_EAPOL_ETHERNET_HEADER_H) |
|
38 #define EAP_CLASS_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_EXPORT |
|
39 #define EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_FUNC_EXPORT |
|
40 #define EAP_C_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_C_FUNC_EXPORT |
|
41 #define EAP_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H EAP_FUNC_EXPORT |
|
42 #define EAP_C_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H EAP_C_FUNC_EXPORT |
|
43 #else |
|
44 #define EAP_CLASS_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_IMPORT |
|
45 #define EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_FUNC_IMPORT |
|
46 #define EAP_C_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H EAP_C_FUNC_IMPORT |
|
47 #define EAP_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H |
|
48 #define EAP_C_FUNC_EXPORT_EAPOL_ETHERNET_HEADER_H |
|
49 #endif |
|
50 // End: added by script change_export_macros.sh. |
|
51 |
29 |
52 |
30 |
53 |
31 /** @file */ |
54 /** @file */ |
32 |
55 |
33 /** |
56 /** |
73 //-------------------------------------------------- |
96 //-------------------------------------------------- |
74 public: |
97 public: |
75 //-------------------------------------------------- |
98 //-------------------------------------------------- |
76 |
99 |
77 /// Destructor does nothing special. |
100 /// Destructor does nothing special. |
78 EAP_FUNC_IMPORT virtual ~eapol_ethernet_header_base_c(); |
101 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H virtual ~eapol_ethernet_header_base_c(); |
79 |
102 |
80 /// Constructor does nothing special. |
103 /// Constructor does nothing special. |
81 /// The tools parameter is pointer to tools object. |
104 /// The tools parameter is pointer to tools object. |
82 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
105 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
83 /// The header_buffer_length parameter is length of the header_buffer. |
106 /// The header_buffer_length parameter is length of the header_buffer. |
84 EAP_FUNC_IMPORT eapol_ethernet_header_base_c( |
107 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H eapol_ethernet_header_base_c( |
85 abs_eap_am_tools_c * const tools, |
108 abs_eap_am_tools_c * const tools, |
86 void * const header_buffer, |
109 void * const header_buffer, |
87 const u32_t header_buffer_length); |
110 const u32_t header_buffer_length); |
88 |
111 |
89 /// This function returns pointer to the destination address of the Ethernet-packet. |
112 /// This function returns pointer to the destination address of the Ethernet-packet. |
90 EAP_FUNC_IMPORT u8_t * get_destination() const; |
113 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_destination() const; |
91 |
114 |
92 /// This function returns pointer to the source address of the Ethernet-packet. |
115 /// This function returns pointer to the source address of the Ethernet-packet. |
93 EAP_FUNC_IMPORT u8_t * get_source() const; |
116 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_source() const; |
94 |
117 |
95 /// This function returns length of the destination address of the Ethernet-packet. |
118 /// This function returns length of the destination address of the Ethernet-packet. |
96 EAP_FUNC_IMPORT u32_t get_destination_length() const; |
119 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u32_t get_destination_length() const; |
97 |
120 |
98 /// This function returns length of the source address of the Ethernet-packet. |
121 /// This function returns length of the source address of the Ethernet-packet. |
99 EAP_FUNC_IMPORT u32_t get_source_length() const; |
122 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u32_t get_source_length() const; |
100 |
123 |
101 /// This function returns the packet type field of Ethernet-header. |
124 /// This function returns the packet type field of Ethernet-header. |
102 EAP_FUNC_IMPORT u16_t get_type() const; |
125 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u16_t get_type() const; |
103 |
126 |
104 /// This function returns pointer to the data of the Ethernet-packet. |
127 /// This function returns pointer to the data of the Ethernet-packet. |
105 EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const; |
128 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_data(const u32_t data_length) const; |
106 |
129 |
107 /// This function returns the length of the data of Ethernet-header. |
130 /// This function returns the length of the data of Ethernet-header. |
108 EAP_FUNC_IMPORT u32_t get_data_length() const; |
131 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u32_t get_data_length() const; |
109 |
132 |
110 /// This function returns the header length of the Ethernet-packet. |
133 /// This function returns the header length of the Ethernet-packet. |
111 EAP_FUNC_IMPORT static u16_t get_header_length(); |
134 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H static u16_t get_header_length(); |
112 |
135 |
113 /// This function sets the packet type field of the Ethernet-header. |
136 /// This function sets the packet type field of the Ethernet-header. |
114 EAP_FUNC_IMPORT void set_type(const eapol_ethernet_type_e type); |
137 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H void set_type(const eapol_ethernet_type_e type); |
115 |
138 |
116 /// This function checks the validity of Ethernet-header. |
139 /// This function checks the validity of Ethernet-header. |
117 EAP_FUNC_IMPORT eap_status_e check_header() const; |
140 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H eap_status_e check_header() const; |
118 |
141 |
119 // |
142 // |
120 //-------------------------------------------------- |
143 //-------------------------------------------------- |
121 }; // class eapol_ethernet_header_base_c |
144 }; // class eapol_ethernet_header_base_c |
122 |
145 |
123 |
146 |
124 |
147 |
125 |
148 |
126 |
149 |
127 /// @{ This class can be removed. eapol_ethernet_header_base_c could be used instead. } |
150 /// @{ This class can be removed. eapol_ethernet_header_base_c could be used instead. } |
128 class EAP_EXPORT eapol_ethernet_header_rd_c |
151 class EAP_CLASS_VISIBILITY_EAPOL_ETHERNET_HEADER_H eapol_ethernet_header_rd_c |
129 : public eapol_ethernet_header_base_c |
152 : public eapol_ethernet_header_base_c |
130 { |
153 { |
131 private: |
154 private: |
132 //-------------------------------------------------- |
155 //-------------------------------------------------- |
133 |
156 |
141 //-------------------------------------------------- |
164 //-------------------------------------------------- |
142 public: |
165 public: |
143 //-------------------------------------------------- |
166 //-------------------------------------------------- |
144 |
167 |
145 /// Destructor does nothing special. |
168 /// Destructor does nothing special. |
146 EAP_FUNC_IMPORT virtual ~eapol_ethernet_header_rd_c(); |
169 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H virtual ~eapol_ethernet_header_rd_c(); |
147 |
170 |
148 /// Constructor does nothing special. |
171 /// Constructor does nothing special. |
149 /// The tools parameter is pointer to tools object. |
172 /// The tools parameter is pointer to tools object. |
150 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
173 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
151 /// The header_buffer_length parameter is length of the header_buffer. |
174 /// The header_buffer_length parameter is length of the header_buffer. |
152 EAP_FUNC_IMPORT eapol_ethernet_header_rd_c( |
175 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H eapol_ethernet_header_rd_c( |
153 abs_eap_am_tools_c * const tools, |
176 abs_eap_am_tools_c * const tools, |
154 const u8_t * const header_buffer, |
177 const u8_t * const header_buffer, |
155 const u32_t header_buffer_length); |
178 const u32_t header_buffer_length); |
156 |
179 |
157 /// This function returns pointer to the header of the EAPOL-packet included in the Ethernet-packet. |
180 /// This function returns pointer to the header of the EAPOL-packet included in the Ethernet-packet. |
158 EAP_FUNC_IMPORT u8_t * get_eapol_header() const; |
181 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_eapol_header() const; |
159 |
182 |
160 // |
183 // |
161 //-------------------------------------------------- |
184 //-------------------------------------------------- |
162 }; // class eapol_ethernet_header_rd_c |
185 }; // class eapol_ethernet_header_rd_c |
163 |
186 |
164 |
187 |
165 |
188 |
166 /// @{ This class can be removed. eapol_ethernet_header_base_c could be used instead. } |
189 /// @{ This class can be removed. eapol_ethernet_header_base_c could be used instead. } |
167 class EAP_EXPORT eapol_ethernet_header_wr_c |
190 class EAP_CLASS_VISIBILITY_EAPOL_ETHERNET_HEADER_H eapol_ethernet_header_wr_c |
168 : public eapol_ethernet_header_base_c |
191 : public eapol_ethernet_header_base_c |
169 { |
192 { |
170 private: |
193 private: |
171 //-------------------------------------------------- |
194 //-------------------------------------------------- |
172 |
195 |
180 //-------------------------------------------------- |
203 //-------------------------------------------------- |
181 public: |
204 public: |
182 //-------------------------------------------------- |
205 //-------------------------------------------------- |
183 |
206 |
184 /// Destructor does nothing special. |
207 /// Destructor does nothing special. |
185 EAP_FUNC_IMPORT virtual ~eapol_ethernet_header_wr_c(); |
208 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H virtual ~eapol_ethernet_header_wr_c(); |
186 |
209 |
187 /// Constructor does nothing special. |
210 /// Constructor does nothing special. |
188 /// The tools parameter is pointer to tools object. |
211 /// The tools parameter is pointer to tools object. |
189 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
212 /// The header_buffer parameter is pointer to buffer of Ethernet-packet including header and data. |
190 /// The header_buffer_length parameter is length of the header_buffer. |
213 /// The header_buffer_length parameter is length of the header_buffer. |
191 EAP_FUNC_IMPORT eapol_ethernet_header_wr_c( |
214 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H eapol_ethernet_header_wr_c( |
192 abs_eap_am_tools_c * const tools, |
215 abs_eap_am_tools_c * const tools, |
193 const u8_t * const header_buffer, |
216 const u8_t * const header_buffer, |
194 const u32_t header_buffer_length); |
217 const u32_t header_buffer_length); |
195 |
218 |
196 /// This function returns pointer to the header of the EAPOL-packet included in the Ethernet-packet. |
219 /// This function returns pointer to the header of the EAPOL-packet included in the Ethernet-packet. |
197 EAP_FUNC_IMPORT u8_t * get_eapol_header() const; |
220 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_eapol_header() const; |
198 |
221 |
199 /// This function returns pointer to the destination address of the Ethernet-packet. |
222 /// This function returns pointer to the destination address of the Ethernet-packet. |
200 EAP_FUNC_IMPORT u8_t * get_destination(); |
223 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_destination(); |
201 |
224 |
202 /// This function returns pointer to the source address of the Ethernet-packet. |
225 /// This function returns pointer to the source address of the Ethernet-packet. |
203 EAP_FUNC_IMPORT u8_t * get_source(); |
226 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H u8_t * get_source(); |
204 |
227 |
205 /// This function resets the EAPOL-header. |
228 /// This function resets the EAPOL-header. |
206 /// The type parameter is the type of Ethernet-packet. |
229 /// The type parameter is the type of Ethernet-packet. |
207 /// The buffer_length parameter is the length of the EAPOL-header and the following data buffer. |
230 /// The buffer_length parameter is the length of the EAPOL-header and the following data buffer. |
208 EAP_FUNC_IMPORT void reset_header(const eapol_ethernet_type_e type, const u16_t buffer_length); |
231 EAP_FUNC_VISIBILITY_EAPOL_ETHERNET_HEADER_H void reset_header(const eapol_ethernet_type_e type, const u16_t buffer_length); |
209 |
232 |
210 // |
233 // |
211 //-------------------------------------------------- |
234 //-------------------------------------------------- |
212 }; // class eapol_ethernet_header_wr_c |
235 }; // class eapol_ethernet_header_wr_c |
213 |
236 |