pap.c
Go to the documentation of this file.
1 /**
2  * @file pap.c
3  * @brief PAP (Password Authentication Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP 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.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL PPP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ppp/ppp_debug.h"
37 #include "ppp/lcp.h"
38 #include "ppp/ipcp.h"
39 #include "ppp/ipv6cp.h"
40 #include "ppp/pap.h"
41 #include "debug.h"
42 
43 //Check TCP/IP stack configuration
44 #if (PPP_SUPPORT == ENABLED && PAP_SUPPORT == ENABLED)
45 
46 
47 /**
48  * @brief Start PAP authentication
49  * @param[in] context PPP context
50  * @return Error code
51  **/
52 
54 {
55  //Debug message
56  TRACE_INFO("\r\nStarting PAP authentication...\r\n");
57 
58  //Check whether the other end of the PPP link is being authenticated
59  if(context->localConfig.authProtocol == PPP_PROTOCOL_PAP)
60  {
61  //Switch to the Started state
62  context->papFsm.localState = PAP_STATE_1_STARTED;
63  }
64 
65  //Check whether the other end of the PPP link is the authenticator
66  if(context->peerConfig.authProtocol == PPP_PROTOCOL_PAP)
67  {
68  //Initialize restart counter
69  context->papFsm.restartCounter = PAP_MAX_REQUESTS;
70  //Send Authenticate-Request packet
71  papSendAuthReq(context);
72  //Switch to the Req-Sent state
73  context->papFsm.peerState = PAP_STATE_2_REQ_SENT;
74  }
75 
76  //Successful processing
77  return NO_ERROR;
78 }
79 
80 
81 /**
82  * @brief Abort PAP authentication
83  * @param[in] context PPP context
84  * @return Error code
85  **/
86 
88 {
89  //Debug message
90  TRACE_INFO("\r\nAborting PAP authentication...\r\n");
91 
92  //Abort PAP authentication process
93  context->papFsm.localState = PAP_STATE_0_INITIAL;
94  context->papFsm.peerState = PAP_STATE_0_INITIAL;
95 
96  //Successful processing
97  return NO_ERROR;
98 }
99 
100 
101 /**
102  * @brief PAP timer handler
103  *
104  * This routine must be periodically called by the TCP/IP stack to
105  * manage retransmissions
106  *
107  * @param[in] context PPP context
108  **/
109 
110 void papTick(PppContext *context)
111 {
112  //Check whether the restart timer is running
113  if(context->papFsm.peerState == PAP_STATE_2_REQ_SENT)
114  {
115  //Get current time
117 
118  //Check restart timer
119  if((time - context->papFsm.timestamp) >= PAP_RESTART_TIMER)
120  {
121  //Debug message
122  TRACE_INFO("\r\nPAP Timeout event\r\n");
123 
124  //Check whether the restart counter is greater than zero
125  if(context->papFsm.restartCounter > 0)
126  {
127  //Retransmit the Authenticate-Request packet
128  papSendAuthReq(context);
129  }
130  else
131  {
132  //Abort PAP authentication
133  context->papFsm.peerState = PAP_STATE_0_INITIAL;
134  //Authentication failed
135  lcpClose(context);
136  }
137  }
138  }
139 }
140 
141 
142 /**
143  * @brief Process an incoming PAP packet
144  * @param[in] context PPP context
145  * @param[in] packet PAP packet received from the peer
146  * @param[in] length Length of the packet, in bytes
147  **/
148 
150  const PppPacket *packet, size_t length)
151 {
152  //Ensure the length of the incoming PAP packet is valid
153  if(length < sizeof(PppPacket))
154  return;
155 
156  //Check the length field
157  if(ntohs(packet->length) > length)
158  return;
159  if(ntohs(packet->length) < sizeof(PppPacket))
160  return;
161 
162  //Save the length of the PAP packet
163  length = ntohs(packet->length);
164 
165  //Debug message
166  TRACE_INFO("PAP packet received (%" PRIuSIZE " bytes)...\r\n", length);
167  //Dump PAP packet contents for debugging purpose
169 
170  //Because the Authenticate-Ack might be lost, the authenticator must
171  //allow repeated Authenticate-Request packets after completing the
172  //Authentication phase
173  if(context->pppPhase != PPP_PHASE_AUTHENTICATE &&
174  context->pppPhase != PPP_PHASE_NETWORK)
175  {
176  //Any packets received during any other phase must be silently discarded
177  return;
178  }
179 
180  //Check PAP code field
181  switch(packet->code)
182  {
183  //Authenticate-Request packet?
184  case PAP_CODE_AUTH_REQ:
185  //Process Authenticate-Request packet
186  papProcessAuthReq(context, (PapAuthReqPacket *) packet, length);
187  break;
188  //Authenticate-Ack packet?
189  case PAP_CODE_AUTH_ACK:
190  //Process Authenticate-Ack packet
191  papProcessAuthAck(context, (PapAuthAckPacket *) packet, length);
192  break;
193  //Authenticate-Nak packet?
194  case PAP_CODE_AUTH_NAK:
195  //Process Authenticate-Nak packet
196  papProcessAuthNak(context, (PapAuthNakPacket *) packet, length);
197  break;
198  //Unknown code field
199  default:
200  //Silently drop the incoming packet
201  break;
202  }
203 }
204 
205 
206 /**
207  * @brief Process Authenticate-Request packet
208  * @param[in] context PPP context
209  * @param[in] authReqPacket Packet received from the peer
210  * @param[in] length Length of the packet, in bytes
211  * @return Error code
212  **/
213 
215  const PapAuthReqPacket *authReqPacket, size_t length)
216 {
217  bool_t status;
218  size_t usernameLen;
219  const uint8_t *p;
220 
221  //Debug message
222  TRACE_INFO("\r\nPAP Authenticate-Request packet received\r\n");
223 
224  //Make sure the Authenticate-Request packet is acceptable
225  if(context->localConfig.authProtocol != PPP_PROTOCOL_PAP)
226  return ERROR_FAILURE;
227 
228  //Check the length of the packet
229  if(length < sizeof(PapAuthReqPacket))
230  return ERROR_INVALID_LENGTH;
231 
232  //Retrieve the length of the Peer-ID field
233  usernameLen = authReqPacket->peerIdLength;
234 
235  //Malformed Authenticate-Request packet?
236  if(length < (sizeof(PapAuthReqPacket) + 1 + usernameLen))
237  return ERROR_INVALID_LENGTH;
238 
239  //Limit the length of the string
240  usernameLen = MIN(usernameLen, PPP_MAX_USERNAME_LEN);
241  //Copy the name of the peer to be identified
242  osMemcpy(context->peerName, authReqPacket->peerId, usernameLen);
243  //Properly terminate the string with a NULL character
244  context->peerName[usernameLen] = '\0';
245 
246  //Point to the Passwd-Length field
247  p = authReqPacket->peerId + usernameLen;
248 
249  //Save the length of Password field
250  context->papFsm.passwordLen = p[0];
251  //Point to the Password field
252  context->papFsm.password = p + 1;
253 
254  //Malformed Authenticate-Request packet?
255  if(length < (sizeof(PapAuthReqPacket) + 1 + usernameLen + context->papFsm.passwordLen))
256  return ERROR_INVALID_LENGTH;
257 
258  //Invoke user-defined callback, if any
259  if(context->settings.authCallback != NULL)
260  {
261  //Perfom username and password verification
262  status = context->settings.authCallback(context->interface,
263  context->peerName);
264  }
265  else
266  {
267  //Unable to perform authentication...
268  status = FALSE;
269  }
270 
271  //Successful authentication?
272  if(status)
273  {
274  //If the Peer-ID/Password pair received in the Authenticate-Request
275  //is both recognizable and acceptable, then the authenticator must
276  //transmit an Authenticate-Ack packet
277  papSendAuthAck(context, authReqPacket->identifier);
278 
279  //Switch to the Ack-Sent state
280  context->papFsm.localState = PAP_STATE_4_ACK_SENT;
281  //The user has been successfully authenticated
282  context->localAuthDone = TRUE;
283 
284  //Check whether PPP authentication is complete
285  if(context->localAuthDone && context->peerAuthDone)
286  {
287  //Check current PPP phase
288  if(context->pppPhase == PPP_PHASE_AUTHENTICATE)
289  {
290  //Advance to the Network phase
291  context->pppPhase = PPP_PHASE_NETWORK;
292 
293 #if (IPV4_SUPPORT == ENABLED)
294  //IPCP Open event
295  ipcpOpen(context);
296 #endif
297 #if (IPV6_SUPPORT == ENABLED)
298  //IPV6CP Open event
299  ipv6cpOpen(context);
300 #endif
301  }
302  }
303  }
304  else
305  {
306  //If the Peer-ID/Password pair received in the Authenticate-Request
307  //is not recognizable or acceptable, then the authenticator must
308  //transmit an Authenticate-Nak packet
309  papSendAuthNak(context, authReqPacket->identifier);
310 
311  //Switch to the Nak-Sent state
312  context->papFsm.localState = PAP_STATE_6_NAK_SENT;
313  //The authenticator should take action to terminate the link
314  lcpClose(context);
315  }
316 
317  //Successful processing
318  return NO_ERROR;
319 }
320 
321 
322 /**
323  * @brief Process Authenticate-Ack packet
324  * @param[in] context PPP context
325  * @param[in] authAckPacket Packet received from the peer
326  * @param[in] length Length of the packet, in bytes
327  * @return Error code
328  **/
329 
331  const PapAuthAckPacket *authAckPacket, size_t length)
332 {
333  //Debug message
334  TRACE_INFO("\r\nPAP Authenticate-Ack packet received\r\n");
335 
336  //Make sure the Authenticate-Ack packet is acceptable
337  if(context->peerConfig.authProtocol != PPP_PROTOCOL_PAP)
338  return ERROR_FAILURE;
339 
340  //Check the length of the packet
341  if(length < sizeof(PapAuthAckPacket))
342  return ERROR_INVALID_LENGTH;
343 
344  //When a packet is received with an invalid Identifier field, the
345  //packet is silently discarded without affecting the automaton
346  if(authAckPacket->identifier != context->papFsm.identifier)
347  return ERROR_WRONG_IDENTIFIER;
348 
349  //Switch to the Ack-Rcvd state
350  context->papFsm.peerState = PAP_STATE_5_ACK_RCVD;
351  //The user name has been accepted by the authenticator
352  context->peerAuthDone = TRUE;
353 
354  //Check whether PPP authentication is complete
355  if(context->localAuthDone && context->peerAuthDone)
356  {
357  //Check current PPP phase
358  if(context->pppPhase == PPP_PHASE_AUTHENTICATE)
359  {
360  //Advance to the Network phase
361  context->pppPhase = PPP_PHASE_NETWORK;
362 
363 #if (IPV4_SUPPORT == ENABLED)
364  //IPCP Open event
365  ipcpOpen(context);
366 #endif
367 #if (IPV6_SUPPORT == ENABLED)
368  //IPV6CP Open event
369  ipv6cpOpen(context);
370 #endif
371  }
372  }
373 
374  //Successful processing
375  return NO_ERROR;
376 }
377 
378 
379 /**
380  * @brief Process Authenticate-Nak packet
381  * @param[in] context PPP context
382  * @param[in] authNakPacket Packet received from the peer
383  * @param[in] length Length of the packet, in bytes
384  * @return Error code
385  **/
386 
388  const PapAuthNakPacket *authNakPacket, size_t length)
389 {
390  //Debug message
391  TRACE_INFO("\r\nPAP Authenticate-Nak packet received\r\n");
392 
393  //Make sure the Authenticate-Nak packet is acceptable
394  if(context->peerConfig.authProtocol != PPP_PROTOCOL_PAP)
395  return ERROR_FAILURE;
396 
397  //Check the length of the packet
398  if(length < sizeof(PapAuthNakPacket))
399  return ERROR_INVALID_LENGTH;
400 
401  //When a packet is received with an invalid Identifier field, the
402  //packet is silently discarded without affecting the automaton
403  if(authNakPacket->identifier != context->papFsm.identifier)
404  return ERROR_WRONG_IDENTIFIER;
405 
406  //Switch to the Nak-Rcvd state
407  context->papFsm.peerState = PAP_STATE_7_NAK_RCVD;
408  //Authentication failed
409  lcpClose(context);
410 
411  //Successful processing
412  return NO_ERROR;
413 }
414 
415 
416 /**
417  * @brief Send Authenticate-Request packet
418  * @param[in] context PPP context
419  * @return Error code
420  **/
421 
423 {
424  error_t error;
425  size_t usernameLen;
426  size_t passwordLen;
427  size_t length;
428  size_t offset;
429  uint8_t *p;
430  NetBuffer *buffer;
431  PapAuthReqPacket *authReqPacket;
432 
433  //Get the length of the user name
434  usernameLen = osStrlen(context->username);
435  //Get the length of the password
436  passwordLen = osStrlen(context->password);
437 
438  //Calculate the length of the Authenticate-Request packet
439  length = sizeof(PapAuthReqPacket) + 1 + usernameLen + passwordLen;
440 
441  //Allocate a buffer memory to hold the packet
442  buffer = pppAllocBuffer(length, &offset);
443  //Failed to allocate memory?
444  if(buffer == NULL)
445  return ERROR_OUT_OF_MEMORY;
446 
447  //Point to the Authenticate-Request packet
448  authReqPacket = netBufferAt(buffer, offset);
449 
450  //Format packet header
451  authReqPacket->code = PAP_CODE_AUTH_REQ;
452  authReqPacket->identifier = ++context->papFsm.identifier;
453  authReqPacket->length = htons(length);
454 
455  //The Peer-ID-Length field indicates the length of Peer-ID field
456  authReqPacket->peerIdLength = usernameLen;
457  //Append Peer-ID
458  osMemcpy(authReqPacket->peerId, context->username, usernameLen);
459 
460  //Point to the Passwd-Length field
461  p = authReqPacket->peerId + usernameLen;
462  //The Passwd-Length field indicates the length of Password field
463  p[0] = passwordLen;
464 
465  //Append Password
466  osMemcpy(p + 1, context->password, passwordLen);
467 
468  //Adjust the length of the multi-part buffer
469  netBufferSetLength(buffer, offset + length);
470 
471  //Debug message
472  TRACE_INFO("Sending PAP Authenticate-Request packet (%" PRIuSIZE " bytes)...\r\n", length);
473  //Dump packet contents for debugging purpose
474  pppDumpPacket((PppPacket *) authReqPacket, length, PPP_PROTOCOL_PAP);
475 
476  //Send PPP frame
477  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
478 
479  //The restart counter is decremented each time a Authenticate-Request is sent
480  if(context->papFsm.restartCounter > 0)
481  context->papFsm.restartCounter--;
482 
483  //Save the time at which the packet was sent
484  context->papFsm.timestamp = osGetSystemTime();
485 
486  //Free previously allocated memory block
487  netBufferFree(buffer);
488  //Return status code
489  return error;
490 }
491 
492 
493 /**
494  * @brief Send Authenticate-Ack packet
495  * @param[in] context PPP context
496  * @param[in] identifier Identifier field
497  * @return Error code
498  **/
499 
501 {
502  error_t error;
503  size_t length;
504  size_t offset;
505  NetBuffer *buffer;
506  PapAuthAckPacket *authAckPacket;
507 
508  //Retrieve the length of the Authenticate-Ack packet
509  length = sizeof(PapAuthAckPacket);
510 
511  //Allocate a buffer memory to hold the Authenticate-Ack packet
512  buffer = pppAllocBuffer(length, &offset);
513  //Failed to allocate memory?
514  if(buffer == NULL)
515  return ERROR_OUT_OF_MEMORY;
516 
517  //Point to the Authenticate-Ack packet
518  authAckPacket = netBufferAt(buffer, offset);
519 
520  //Format packet header
521  authAckPacket->code = PAP_CODE_AUTH_ACK;
522  authAckPacket->identifier = identifier;
523  authAckPacket->length = htons(length);
524 
525  //The Message field is zero or more octets, and its contents are
526  //implementation dependent
527  authAckPacket->msgLength = 0;
528 
529  //Debug message
530  TRACE_INFO("Sending PAP Authenticate-Ack packet (%" PRIuSIZE " bytes)...\r\n", length);
531  //Dump packet contents for debugging purpose
532  pppDumpPacket((PppPacket *) authAckPacket, length, PPP_PROTOCOL_PAP);
533 
534  //Send PPP frame
535  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
536 
537  //Free previously allocated memory block
538  netBufferFree(buffer);
539  //Return status code
540  return error;
541 }
542 
543 
544 /**
545  * @brief Send Authenticate-Nak packet
546  * @param[in] context PPP context
547  * @param[in] identifier Identifier field
548  * @return Error code
549  **/
550 
552 {
553  error_t error;
554  size_t length;
555  size_t offset;
556  NetBuffer *buffer;
557  PapAuthNakPacket *authNakPacket;
558 
559  //Retrieve the length of the Authenticate-Nak packet
560  length = sizeof(PapAuthNakPacket);
561 
562  //Allocate a buffer memory to hold the Authenticate-Nak packet
563  buffer = pppAllocBuffer(length, &offset);
564  //Failed to allocate memory?
565  if(buffer == NULL)
566  return ERROR_OUT_OF_MEMORY;
567 
568  //Point to the Authenticate-Nak packet
569  authNakPacket = netBufferAt(buffer, offset);
570 
571  //Format packet header
572  authNakPacket->code = PAP_CODE_AUTH_NAK;
573  authNakPacket->identifier = identifier;
574  authNakPacket->length = htons(length);
575 
576  //The Message field is zero or more octets, and its contents are
577  //implementation dependent
578  authNakPacket->msgLength = 0;
579 
580  //Debug message
581  TRACE_INFO("Sending PAP Authenticate-Nak packet (%" PRIuSIZE " bytes)...\r\n", length);
582  //Dump packet contents for debugging purpose
583  pppDumpPacket((PppPacket *) authNakPacket, length, PPP_PROTOCOL_PAP);
584 
585  //Send PPP frame
586  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
587 
588  //Free previously allocated memory block
589  netBufferFree(buffer);
590  //Return status code
591  return error;
592 }
593 
594 
595 /**
596  * @brief Password verification
597  * @param[in] context PPP context
598  * @param[in] password NULL-terminated string containing the password to be checked
599  * @return TRUE if the password is valid, else FALSE
600  **/
601 
602 bool_t papCheckPassword(PppContext *context, const char_t *password)
603 {
604  size_t n;
605  bool_t status;
606 
607  //This flag tells whether the password is valid
608  status = FALSE;
609 
610  //Retrieve the length of the password
611  n = osStrlen(password);
612 
613  //Compare the length of the password against the expected value
614  if(n == context->papFsm.passwordLen)
615  {
616  //Check whether the password is valid
617  if(!osMemcmp(password, context->papFsm.password, n))
618  status = TRUE;
619  }
620 
621  //Return TRUE is the password is valid, else FALSE
622  return status;
623 }
624 
625 #endif
#define PRIuSIZE
char char_t
Definition: compiler_port.h:48
int bool_t
Definition: compiler_port.h:53
#define htons(value)
Definition: cpu_endian.h:413
#define ntohs(value)
Definition: cpu_endian.h:421
Debugging facilities.
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t n
uint8_t identifier[]
uint32_t time
error_t
Error codes.
Definition: error.h:43
@ ERROR_WRONG_IDENTIFIER
Definition: error.h:89
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_OUT_OF_MEMORY
Definition: error.h:63
@ ERROR_INVALID_LENGTH
Definition: error.h:111
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
error_t ipcpOpen(PppContext *context)
IPCP Open event.
Definition: ipcp.c:76
IPCP (PPP Internet Protocol Control Protocol)
error_t ipv6cpOpen(PppContext *context)
IPV6CP Open event.
Definition: ipv6cp.c:77
IPV6CP (PPP IPv6 Control Protocol)
error_t lcpClose(PppContext *context)
LCP Close event.
Definition: lcp.c:103
LCP (PPP Link Control Protocol)
uint8_t p
Definition: ndp.h:300
TCP/IP stack core.
void * netBufferAt(const NetBuffer *buffer, size_t offset)
Returns a pointer to the data at the specified position.
Definition: net_mem.c:415
void netBufferFree(NetBuffer *buffer)
Dispose a multi-part buffer.
Definition: net_mem.c:282
error_t netBufferSetLength(NetBuffer *buffer, size_t length)
Adjust the length of a multi-part buffer.
Definition: net_mem.c:322
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
#define MIN(a, b)
Definition: os_port.h:63
#define osMemcmp(p1, p2, length)
Definition: os_port.h:153
#define osStrlen(s)
Definition: os_port.h:165
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
systime_t osGetSystemTime(void)
Retrieve system time.
uint32_t systime_t
System time.
error_t papSendAuthAck(PppContext *context, uint8_t identifier)
Send Authenticate-Ack packet.
Definition: pap.c:500
error_t papProcessAuthNak(PppContext *context, const PapAuthNakPacket *authNakPacket, size_t length)
Process Authenticate-Nak packet.
Definition: pap.c:387
error_t papSendAuthReq(PppContext *context)
Send Authenticate-Request packet.
Definition: pap.c:422
error_t papSendAuthNak(PppContext *context, uint8_t identifier)
Send Authenticate-Nak packet.
Definition: pap.c:551
error_t papStartAuth(PppContext *context)
Start PAP authentication.
Definition: pap.c:53
void papProcessPacket(PppContext *context, const PppPacket *packet, size_t length)
Process an incoming PAP packet.
Definition: pap.c:149
void papTick(PppContext *context)
PAP timer handler.
Definition: pap.c:110
bool_t papCheckPassword(PppContext *context, const char_t *password)
Password verification.
Definition: pap.c:602
error_t papAbortAuth(PppContext *context)
Abort PAP authentication.
Definition: pap.c:87
error_t papProcessAuthReq(PppContext *context, const PapAuthReqPacket *authReqPacket, size_t length)
Process Authenticate-Request packet.
Definition: pap.c:214
error_t papProcessAuthAck(PppContext *context, const PapAuthAckPacket *authAckPacket, size_t length)
Process Authenticate-Ack packet.
Definition: pap.c:330
PAP (Password Authentication Protocol)
@ PAP_CODE_AUTH_REQ
Authenticate-Request.
Definition: pap.h:88
@ PAP_CODE_AUTH_NAK
Authenticate-Nak.
Definition: pap.h:90
@ PAP_CODE_AUTH_ACK
Authenticate-Ack.
Definition: pap.h:89
#define PAP_MAX_REQUESTS
Definition: pap.h:54
PapAuthAckPacket
Definition: pap.h:127
PapAuthReqPacket
Definition: pap.h:113
@ PAP_STATE_7_NAK_RCVD
Definition: pap.h:78
@ PAP_STATE_1_STARTED
Definition: pap.h:72
@ PAP_STATE_4_ACK_SENT
Definition: pap.h:75
@ PAP_STATE_0_INITIAL
Definition: pap.h:71
@ PAP_STATE_5_ACK_RCVD
Definition: pap.h:76
@ PAP_STATE_2_REQ_SENT
Definition: pap.h:73
@ PAP_STATE_6_NAK_SENT
Definition: pap.h:77
PapAuthNakPacket
Definition: pap.h:141
#define PAP_RESTART_TIMER
Definition: pap.h:47
NetBuffer * pppAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a PPP frame.
Definition: ppp.c:1305
error_t pppSendFrame(NetInterface *interface, NetBuffer *buffer, size_t offset, uint16_t protocol)
Send a PPP frame.
Definition: ppp.c:1035
@ PPP_PROTOCOL_PAP
Password Authentication Protocol.
Definition: ppp.h:204
#define PppContext
Definition: ppp.h:38
@ PPP_PHASE_AUTHENTICATE
Authentication phase.
Definition: ppp.h:168
@ PPP_PHASE_NETWORK
Network-layer protocol phase.
Definition: ppp.h:169
#define PppPacket
Definition: ppp.h:37
#define PPP_MAX_USERNAME_LEN
Definition: ppp.h:68
error_t pppDumpPacket(const PppPacket *packet, size_t length, PppProtocol protocol)
Dump LCP/NCP packet for debugging purpose.
Definition: ppp_debug.c:143
Data logging functions for debugging purpose (PPP)
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t length
Definition: tcp.h:368