supplicant.c
Go to the documentation of this file.
1 /**
2  * @file supplicant.c
3  * @brief 802.1X supplicant
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneEAP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL SUPPLICANT_TRACE_LEVEL
33 
34 //Dependencies
35 #include "supplicant/supplicant.h"
38 #include "debug.h"
39 
40 //Check EAP library configuration
41 #if (SUPPLICANT_SUPPORT == ENABLED)
42 
43 
44 /**
45  * @brief Initialize settings with default values
46  * @param[out] settings Structure that contains 802.1X supplicant settings
47  **/
48 
50 {
51  //Default task parameters
52  settings->task = OS_TASK_DEFAULT_PARAMS;
54  settings->task.priority = SUPPLICANT_PRIORITY;
55 
56  //The supplicant is not bound to any interface
57  settings->interface = NULL;
58  //Port index
59  settings->portIndex = 0;
60 
61 #if (EAP_TLS_SUPPORT == ENABLED)
62  //TLS negotiation initialization callback function
63  settings->tlsInitCallback = NULL;
64  //TLS negotiation completion callback function
65  settings->tlsCompleteCallback = NULL;
66 #endif
67 
68  //Supplicant PAE state change callback function
69  settings->paeStateChangeCallback = NULL;
70  //Supplicant backend state change callback function
71  settings->backendStateChangeCallback = NULL;
72  //EAP peer state change callback function
73  settings->eapPeerStateChangeCallback = NULL;
74  //Tick callback function
75  settings->tickCallback = NULL;
76 }
77 
78 
79 /**
80  * @brief Initialize 802.1X supplicant context
81  * @param[in] context Pointer to the 802.1X supplicant context
82  * @param[in] settings 802.1X supplicant specific settings
83  * @return Error code
84  **/
85 
87  const SupplicantSettings *settings)
88 {
89  error_t error;
90 
91  //Debug message
92  TRACE_INFO("Initializing 802.1X supplicant...\r\n");
93 
94  //Ensure the parameters are valid
95  if(context == NULL || settings == NULL)
97 
98  if(settings->interface == NULL)
100 
101  //Clear supplicant context
102  osMemset(context, 0, sizeof(SupplicantContext));
103 
104  //Initialize task parameters
105  context->taskParams = settings->task;
106  context->taskId = OS_INVALID_TASK_ID;
107 
108  //Initialize supplicant context
109  context->interface = settings->interface;
110  context->portIndex = settings->portIndex;
111  context->paeStateChangeCallback = settings->paeStateChangeCallback;
112  context->backendStateChangeCallback = settings->backendStateChangeCallback;
113  context->eapPeerStateChangeCallback = settings->eapPeerStateChangeCallback;
114  context->tickCallback = settings->tickCallback;
115 
116 #if (EAP_TLS_SUPPORT == ENABLED)
117  //TLS negotiation initialization callback function
118  context->tlsInitCallback = settings->tlsInitCallback;
119  //TLS negotiation completion callback function
120  context->tlsCompleteCallback = settings->tlsCompleteCallback;
121 #endif
122 
123  //Default value of parameters
124  context->portControl = SUPPLICANT_PORT_MODE_AUTO;
125  context->userLogoff = FALSE;
126  context->heldPeriod = SUPPLICANT_DEFAULT_HELD_PERIOD;
127  context->authPeriod = SUPPLICANT_DEFAULT_AUTH_PERIOD;
128  context->startPeriod = SUPPLICANT_DEFAULT_START_PERIOD;
129  context->maxStart = SUPPLICANT_DEFAULT_MAX_START;
130  context->clientTimeout = EAP_DEFAULT_CLIENT_TIMEOUT;
131 
132  //Initialize supplicant state machine
133  supplicantInitFsm(context);
134 
135  //Start of exception handling block
136  do
137  {
138  //Create a mutex to prevent simultaneous access to 802.1X supplicant
139  //context
140  if(!osCreateMutex(&context->mutex))
141  {
142  //Failed to create mutex
143  error = ERROR_OUT_OF_RESOURCES;
144  break;
145  }
146 
147  //Create an event object to poll the state of the raw socket
148  if(!osCreateEvent(&context->event))
149  {
150  //Failed to create event
151  error = ERROR_OUT_OF_RESOURCES;
152  break;
153  }
154 
155  //Successful initialization
156  error = NO_ERROR;
157 
158  //End of exception handling block
159  } while(0);
160 
161  //Any error to report?
162  if(error)
163  {
164  //Clean up side effects
165  supplicantDeinit(context);
166  }
167 
168  //Return status code
169  return error;
170 }
171 
172 
173 /**
174  * @brief Set user name
175  * @param[in] context Pointer to the 802.1X supplicant context
176  * @param[in] username NULL-terminated string containing the user name
177  * @return Error code
178  **/
179 
181  const char_t *username)
182 {
183  //Check parameters
184  if(context == NULL || username == NULL)
186 
187  //Make sure the length of the user name is acceptable
188  if(osStrlen(username) > SUPPLICANT_MAX_USERNAME_LEN)
189  return ERROR_INVALID_LENGTH;
190 
191  //Save user name
192  osStrcpy(context->username, username);
193 
194  //Successful processing
195  return NO_ERROR;
196 }
197 
198 
199 /**
200  * @brief Set password
201  * @param[in] context Pointer to the 802.1X supplicant context
202  * @param[in] password NULL-terminated string containing the password
203  * @return Error code
204  **/
205 
207  const char_t *password)
208 {
209 #if (EAP_MD5_SUPPORT == ENABLED)
210  //Check parameters
211  if(context == NULL || password == NULL)
213 
214  //Make sure the length of the password is acceptable
215  if(osStrlen(password) > SUPPLICANT_MAX_PASSWORD_LEN)
216  return ERROR_INVALID_LENGTH;
217 
218  //Save password
219  osStrcpy(context->password, password);
220 
221  //Successful processing
222  return NO_ERROR;
223 #else
224  //EAP-MD5 challenge is not implemented
225  return ERROR_NOT_IMPLEMENTED;
226 #endif
227 }
228 
229 
230 /**
231  * @brief Set the value of the heldPeriod parameter
232  * @param[in] context Pointer to the 802.1X supplicant context
233  * @param[in] heldPeriod Value of the heldPeriod parameter
234  * @return Error code
235  **/
236 
238 {
239  //Check parameters
240  if(context == NULL || heldPeriod == 0)
242 
243  //Acquire exclusive access to the 802.1X supplicant context
244  osAcquireMutex(&context->mutex);
245  //Save parameter value
246  context->heldPeriod = heldPeriod;
247  //Release exclusive access to the 802.1X supplicant context
248  osReleaseMutex(&context->mutex);
249 
250  //Successful processing
251  return NO_ERROR;
252 }
253 
254 
255 /**
256  * @brief Set the value of the authPeriod parameter
257  * @param[in] context Pointer to the 802.1X supplicant context
258  * @param[in] authPeriod Value of the authPeriod parameter
259  * @return Error code
260  **/
261 
263 {
264  //Check parameters
265  if(context == NULL || authPeriod == 0)
267 
268  //Acquire exclusive access to the 802.1X supplicant context
269  osAcquireMutex(&context->mutex);
270  //Save parameter value
271  context->authPeriod = authPeriod;
272  //Release exclusive access to the 802.1X supplicant context
273  osReleaseMutex(&context->mutex);
274 
275  //Successful processing
276  return NO_ERROR;
277 }
278 
279 
280 /**
281  * @brief Set the value of the startPeriod parameter
282  * @param[in] context Pointer to the 802.1X supplicant context
283  * @param[in] startPeriod Value of the startPeriod parameter
284  * @return Error code
285  **/
286 
288 {
289  //Check parameters
290  if(context == NULL || startPeriod == 0)
292 
293  //Acquire exclusive access to the 802.1X supplicant context
294  osAcquireMutex(&context->mutex);
295  //Save parameter value
296  context->startPeriod = startPeriod;
297  //Release exclusive access to the 802.1X supplicant context
298  osReleaseMutex(&context->mutex);
299 
300  //Successful processing
301  return NO_ERROR;
302 }
303 
304 
305 /**
306  * @brief Set the value of the maxStart parameter
307  * @param[in] context Pointer to the 802.1X supplicant context
308  * @param[in] maxStart Value of the maxStart parameter
309  * @return Error code
310  **/
311 
313 {
314  //Check parameters
315  if(context == NULL || maxStart == 0)
317 
318  //Acquire exclusive access to the 802.1X supplicant context
319  osAcquireMutex(&context->mutex);
320 
321  //Save parameter value
322  context->maxStart = maxStart;
323 
324  //Update supplicant state machines
325  if(context->running)
326  {
327  supplicantFsm(context);
328  }
329 
330  //Release exclusive access to the 802.1X supplicant context
331  osReleaseMutex(&context->mutex);
332 
333  //Successful processing
334  return NO_ERROR;
335 }
336 
337 
338 /**
339  * @brief Set the value of the clientTimeout parameter
340  * @param[in] context Pointer to the 802.1X supplicant context
341  * @param[in] clientTimeout Value of the clientTimeout parameter
342  * @return Error code
343  **/
344 
346  uint_t clientTimeout)
347 {
348  //Check parameters
349  if(context == NULL || clientTimeout == 0)
351 
352  //Acquire exclusive access to the 802.1X supplicant context
353  osAcquireMutex(&context->mutex);
354  //Save parameter value
355  context->clientTimeout = clientTimeout;
356  //Release exclusive access to the 802.1X supplicant context
357  osReleaseMutex(&context->mutex);
358 
359  //Successful processing
360  return NO_ERROR;
361 }
362 
363 
364 /**
365  * @brief Set the value of the portControl variable
366  * @param[in] context Pointer to the 802.1X supplicant context
367  * @param[in] portControl Value of the portControl variable
368  * @return Error code
369  **/
370 
372  SupplicantPortMode portControl)
373 {
374  //Make sure the 802.1X supplicant context is valid
375  if(context == NULL)
377 
378  //Acquire exclusive access to the 802.1X supplicant context
379  osAcquireMutex(&context->mutex);
380 
381  //The portControl variable is used to switch between the auto and non-auto
382  //modes of operation of the supplicant PAE state machine
383  context->portControl = portControl;
384 
385  //Update supplicant state machines
386  if(context->running)
387  {
388  supplicantFsm(context);
389  }
390 
391  //Release exclusive access to the 802.1X supplicant context
392  osReleaseMutex(&context->mutex);
393 
394  //Successful processing
395  return NO_ERROR;
396 }
397 
398 
399 /**
400  * @brief Perform user logon
401  * @param[in] context Pointer to the 802.1X supplicant context
402  * @return Error code
403  **/
404 
406 {
407  //Make sure the 802.1X supplicant context is valid
408  if(context == NULL)
410 
411  //Acquire exclusive access to the 802.1X supplicant context
412  osAcquireMutex(&context->mutex);
413 
414  //The userLogoff variable is controlled externally to the state machine and
415  //reflects the operation of the process in the supplicant system that
416  //controls the logged on/logged off state of the user of the system
417  context->userLogoff = FALSE;
418 
419  //Update supplicant state machines
420  if(context->running)
421  {
422  supplicantFsm(context);
423  }
424 
425  //Release exclusive access to the 802.1X supplicant context
426  osReleaseMutex(&context->mutex);
427 
428  //Successful processing
429  return NO_ERROR;
430 }
431 
432 
433 /**
434  * @brief Perform user logoff
435  * @param[in] context Pointer to the 802.1X supplicant context
436  * @return Error code
437  **/
438 
440 {
441  //Make sure the 802.1X supplicant context is valid
442  if(context == NULL)
444 
445  //Acquire exclusive access to the 802.1X supplicant context
446  osAcquireMutex(&context->mutex);
447 
448  //The userLogoff variable is controlled externally to the state machine and
449  //reflects the operation of the process in the supplicant system that
450  //controls the logged on/logged off state of the user of the system
451  context->userLogoff = TRUE;
452 
453  //Update supplicant state machines
454  if(context->running)
455  {
456  supplicantFsm(context);
457  }
458 
459  //Release exclusive access to the 802.1X supplicant context
460  osReleaseMutex(&context->mutex);
461 
462  //Successful processing
463  return NO_ERROR;
464 }
465 
466 
467 /**
468  * @brief Start 802.1X supplicant
469  * @param[in] context Pointer to the 802.1X supplicant context
470  * @return Error code
471  **/
472 
474 {
475  error_t error;
476 
477  //Make sure the supplicant context is valid
478  if(context == NULL)
480 
481  //Debug message
482  TRACE_INFO("Starting 802.1X supplicant...\r\n");
483 
484  //Make sure the supplicant is not already running
485  if(context->running)
486  return ERROR_ALREADY_RUNNING;
487 
488  //Start of exception handling block
489  do
490  {
491  //Open a raw socket
492  context->socket = socketOpen(SOCKET_TYPE_RAW_ETH, ETH_TYPE_EAPOL);
493  //Failed to open socket?
494  if(context->socket == NULL)
495  {
496  //Report an error
497  error = ERROR_OPEN_FAILED;
498  break;
499  }
500 
501  //Force the socket to operate in non-blocking mode
502  error = socketSetTimeout(context->socket, 0);
503  //Any error to report?
504  if(error)
505  break;
506 
507  //Associate the socket with the relevant interface
508  error = socketBindToInterface(context->socket, context->interface);
509  //Any error to report?
510  if(error)
511  break;
512 
513  //The PAE group address is one of the reserved set of group MAC addresses
514  //that are not forwarded by MAC Bridges (refer to IEEE Std 802.1X-2010,
515  //section 7.8)
516  error = supplicantAcceptPaeGroupAddr(context);
517  //Any error to report?
518  if(error)
519  break;
520 
521  //Start the supplicant
522  context->stop = FALSE;
523  context->running = TRUE;
524 
525  //Save current time
526  context->timestamp = osGetSystemTime();
527 
528  //Reinitialize supplicant state machine
529  supplicantInitFsm(context);
530 
531  //Create a task
532  context->taskId = osCreateTask("Supplicant", (OsTaskCode) supplicantTask,
533  context, &context->taskParams);
534 
535  //Failed to create task?
536  if(context->taskId == OS_INVALID_TASK_ID)
537  {
538  //Report an error
539  error = ERROR_OUT_OF_RESOURCES;
540  break;
541  }
542 
543  //End of exception handling block
544  } while(0);
545 
546  //Any error to report?
547  if(error)
548  {
549  //Clean up side effects
550  context->running = FALSE;
551 
552  //Remove the PAE group address from the static MAC table
554 
555  //Close the raw socket
556  socketClose(context->socket);
557  context->socket = NULL;
558  }
559 
560  //Return status code
561  return error;
562 }
563 
564 
565 /**
566  * @brief Stop 802.1X supplicant
567  * @param[in] context Pointer to the 802.1X supplicant context
568  * @return Error code
569  **/
570 
572 {
573  //Make sure the supplicant context is valid
574  if(context == NULL)
576 
577  //Debug message
578  TRACE_INFO("Stopping 802.1X supplicant...\r\n");
579 
580  //Check whether the supplicant is running
581  if(context->running)
582  {
583 #if (NET_RTOS_SUPPORT == ENABLED)
584  //Stop the supplicant
585  context->stop = TRUE;
586  //Send a signal to the task to abort any blocking operation
587  osSetEvent(&context->event);
588 
589  //Wait for the task to terminate
590  while(context->running)
591  {
592  osDelayTask(1);
593  }
594 #endif
595 
596  //Remove the PAE group address from the static MAC table
598 
599  //Close the raw socket
600  socketClose(context->socket);
601  context->socket = NULL;
602  }
603 
604  //Successful processing
605  return NO_ERROR;
606 }
607 
608 
609 /**
610  * @brief 802.1X supplicant task
611  * @param[in] context Pointer to the 802.1X supplicant context
612  **/
613 
615 {
616  systime_t time;
617  systime_t timeout;
618  SocketEventDesc eventDesc;
619 
620 #if (NET_RTOS_SUPPORT == ENABLED)
621  //Task prologue
622  osEnterTask();
623 
624  //Process events
625  while(1)
626  {
627 #endif
628  //Get current time
629  time = osGetSystemTime();
630 
631  //Maximum time to wait for an incoming datagram
632  if((time - context->timestamp) < SUPPLICANT_TICK_INTERVAL)
633  {
634  timeout = context->timestamp + SUPPLICANT_TICK_INTERVAL - time;
635  }
636  else
637  {
638  timeout = 0;
639  }
640 
641  //Specify the events the application is interested in
642  eventDesc.socket = context->socket;
643  eventDesc.eventMask = SOCKET_EVENT_RX_READY;
644  eventDesc.eventFlags = 0;
645 
646  //Wait for an event
647  socketPoll(&eventDesc, 1, &context->event, timeout);
648 
649  //Stop request?
650  if(context->stop)
651  {
652  //Stop supplicant operation
653  context->running = FALSE;
654  //Task epilogue
655  osExitTask();
656  //Kill ourselves
658  }
659 
660  //Any EAPOL packet received?
661  if(eventDesc.eventFlags != 0)
662  {
663  //Acquire exclusive access to the 802.1X supplicant context
664  osAcquireMutex(&context->mutex);
665  //Process incoming EAPOL packet
666  supplicantProcessEapolPdu(context);
667  //Release exclusive access to the 802.1X supplicant context
668  osReleaseMutex(&context->mutex);
669  }
670 
671  //Get current time
672  time = osGetSystemTime();
673 
674  //Timers have a resolution of one second
675  if((time - context->timestamp) >= SUPPLICANT_TICK_INTERVAL)
676  {
677  //Acquire exclusive access to the 802.1X supplicant context
678  osAcquireMutex(&context->mutex);
679  //Handle periodic operations
680  supplicantTick(context);
681  //Release exclusive access to the 802.1X supplicant context
682  osReleaseMutex(&context->mutex);
683 
684  //Save current time
685  context->timestamp = time;
686  }
687 
688 #if (NET_RTOS_SUPPORT == ENABLED)
689  }
690 #endif
691 }
692 
693 
694 /**
695  * @brief Release 802.1X supplicant context
696  * @param[in] context Pointer to the 802.1X supplicant context
697  **/
698 
700 {
701  //Make sure the 802.1X supplicant context is valid
702  if(context != NULL)
703  {
704  //Free previously allocated resources
705  osDeleteMutex(&context->mutex);
706  osDeleteEvent(&context->event);
707 
708  //Clear supplicant context
709  osMemset(context, 0, sizeof(SupplicantContext));
710  }
711 }
712 
713 #endif
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.
SupplicantPortMode
Port modes.
error_t supplicantAcceptPaeGroupAddr(SupplicantContext *context)
Add the PAE group address to the static MAC table.
Supplicant state machine.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
#define osExitTask()
@ ERROR_NOT_IMPLEMENTED
Definition: error.h:66
802.1X supplicant
OsTaskParameters task
Task parameters.
Definition: supplicant.h:194
#define TRUE
Definition: os_port.h:50
void supplicantGetDefaultSettings(SupplicantSettings *settings)
Initialize settings with default values.
Definition: supplicant.c:49
#define OS_INVALID_TASK_ID
void socketClose(Socket *socket)
Close an existing socket.
Definition: socket.c:2062
#define SupplicantContext
Definition: supplicant.h:36
@ ERROR_OUT_OF_RESOURCES
Definition: error.h:64
EapPeerStateChangeCallback eapPeerStateChangeCallback
EAP peer state change callback function.
Definition: supplicant.h:203
error_t supplicantSetClientTimeout(SupplicantContext *context, uint_t clientTimeout)
Set the value of the clientTimeout parameter.
Definition: supplicant.c:345
#define SUPPLICANT_DEFAULT_START_PERIOD
Definition: supplicant.h:114
error_t supplicantSetUsername(SupplicantContext *context, const char_t *username)
Set user name.
Definition: supplicant.c:180
error_t supplicantSetPortControl(SupplicantContext *context, SupplicantPortMode portControl)
Set the value of the portControl variable.
Definition: supplicant.c:371
#define osStrlen(s)
Definition: os_port.h:165
#define OS_SELF_TASK_ID
Structure describing socket events.
Definition: socket.h:426
void supplicantDeinit(SupplicantContext *context)
Release 802.1X supplicant context.
Definition: supplicant.c:699
void supplicantTask(SupplicantContext *context)
802.1X supplicant task
Definition: supplicant.c:614
@ ERROR_OPEN_FAILED
Definition: error.h:75
void osDeleteTask(OsTaskId taskId)
Delete a task.
#define FALSE
Definition: os_port.h:46
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
NetInterface * interface
Underlying network interface.
Definition: supplicant.h:195
error_t supplicantSetAuthPeriod(SupplicantContext *context, uint_t authPeriod)
Set the value of the authPeriod parameter.
Definition: supplicant.c:262
error_t
Error codes.
Definition: error.h:43
void(* OsTaskCode)(void *arg)
Task routine.
void supplicantFsm(SupplicantContext *context)
Supplicant state machine implementation.
#define SUPPLICANT_TICK_INTERVAL
Definition: supplicant.h:65
SupplicantTlsCompleteCallback tlsCompleteCallback
TLS negotiation completion callback function.
Definition: supplicant.h:199
void supplicantTick(SupplicantContext *context)
Handle periodic operations.
void osDeleteEvent(OsEvent *event)
Delete an event object.
@ ERROR_INVALID_LENGTH
Definition: error.h:111
error_t supplicantStop(SupplicantContext *context)
Stop 802.1X supplicant.
Definition: supplicant.c:571
#define SUPPLICANT_DEFAULT_MAX_START
Definition: supplicant.h:121
const OsTaskParameters OS_TASK_DEFAULT_PARAMS
error_t supplicantSetMaxStart(SupplicantContext *context, uint_t maxStart)
Set the value of the maxStart parameter.
Definition: supplicant.c:312
void supplicantInitFsm(SupplicantContext *context)
Supplicant state machine initialization.
#define TRACE_INFO(...)
Definition: debug.h:95
@ ETH_TYPE_EAPOL
Definition: ethernet.h:169
Socket * socketOpen(uint_t type, uint_t protocol)
Create a socket (UDP or TCP)
Definition: socket.c:125
#define SUPPLICANT_MAX_PASSWORD_LEN
Definition: supplicant.h:93
#define osEnterTask()
uint_t eventFlags
Returned events.
Definition: socket.h:429
error_t socketPoll(SocketEventDesc *eventDesc, uint_t size, OsEvent *extEvent, systime_t timeout)
Wait for one of a set of sockets to become ready to perform I/O.
Definition: socket.c:2149
#define socketBindToInterface
Definition: net_legacy.h:193
SupplicantBackendStateChangeCallback backendStateChangeCallback
Supplicant backend state change callback function.
Definition: supplicant.h:202
void supplicantProcessEapolPdu(SupplicantContext *context)
Process incoming EAPOL PDU.
error_t supplicantSetPassword(SupplicantContext *context, const char_t *password)
Set password.
Definition: supplicant.c:206
uint32_t systime_t
System time.
error_t supplicantLogOn(SupplicantContext *context)
Perform user logon.
Definition: supplicant.c:405
802.1X supplicant settings
Definition: supplicant.h:193
char char_t
Definition: compiler_port.h:48
SupplicantTickCallback tickCallback
Tick callback function.
Definition: supplicant.h:204
SupplicantPaeStateChangeCallback paeStateChangeCallback
Supplicant PAE state change callback function.
Definition: supplicant.h:201
uint32_t time
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
#define SUPPLICANT_DEFAULT_HELD_PERIOD
Definition: supplicant.h:100
@ SOCKET_EVENT_RX_READY
Definition: socket.h:179
#define EAP_DEFAULT_CLIENT_TIMEOUT
Definition: eap.h:105
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
error_t supplicantSetHeldPeriod(SupplicantContext *context, uint_t heldPeriod)
Set the value of the heldPeriod parameter.
Definition: supplicant.c:237
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
#define SUPPLICANT_MAX_USERNAME_LEN
Definition: supplicant.h:86
uint_t portIndex
Port index.
Definition: supplicant.h:196
error_t supplicantStart(SupplicantContext *context)
Start 802.1X supplicant.
Definition: supplicant.c:473
error_t supplicantLogOff(SupplicantContext *context)
Perform user logoff.
Definition: supplicant.c:439
@ SOCKET_TYPE_RAW_ETH
Definition: socket.h:95
void osDelayTask(systime_t delay)
Delay routine.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
SupplicantTlsInitCallback tlsInitCallback
TLS negotiation initialization callback function.
Definition: supplicant.h:198
#define SUPPLICANT_STACK_SIZE
Definition: supplicant.h:53
Socket * socket
Handle to a socket to monitor.
Definition: socket.h:427
unsigned int uint_t
Definition: compiler_port.h:50
#define osMemset(p, value, length)
Definition: os_port.h:135
error_t supplicantSetStartPeriod(SupplicantContext *context, uint_t startPeriod)
Set the value of the startPeriod parameter.
Definition: supplicant.c:287
#define SUPPLICANT_DEFAULT_AUTH_PERIOD
Definition: supplicant.h:107
#define SUPPLICANT_PRIORITY
Definition: supplicant.h:60
@ SUPPLICANT_PORT_MODE_AUTO
#define osStrcpy(s1, s2)
Definition: os_port.h:207
error_t socketSetTimeout(Socket *socket, systime_t timeout)
Set timeout value for blocking operations.
Definition: socket.c:148
error_t supplicantDropPaeGroupAddr(SupplicantContext *context)
Remove the PAE group address from the static MAC table.
uint_t eventMask
Requested events.
Definition: socket.h:428
@ ERROR_ALREADY_RUNNING
Definition: error.h:293
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
Helper functions for 802.1X supplicant.
error_t supplicantInit(SupplicantContext *context, const SupplicantSettings *settings)
Initialize 802.1X supplicant context.
Definition: supplicant.c:86
systime_t osGetSystemTime(void)
Retrieve system time.