ppp.h
Go to the documentation of this file.
1 /**
2  * @file ppp.h
3  * @brief PPP (Point-to-Point Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 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 1.9.6
29  **/
30 
31 #ifndef _PPP_H
32 #define _PPP_H
33 
34 //Forward declaration of structures
35 struct _PppPacket;
36 struct _PppContext;
37 #define PppPacket struct _PppPacket
38 #define PppContext struct _PppContext
39 
40 //Dependencies
41 #include "core/net.h"
42 #include "ppp/pap.h"
43 #include "ppp/chap.h"
44 
45 //PPP support
46 #ifndef PPP_SUPPORT
47  #define PPP_SUPPORT DISABLED
48 #elif (PPP_SUPPORT != ENABLED && PPP_SUPPORT != DISABLED)
49  #error PPP_SUPPORT parameter is not valid
50 #endif
51 
52 //TX buffer size
53 #ifndef PPP_TX_BUFFER_SIZE
54  #define PPP_TX_BUFFER_SIZE 4096
55 #elif (PPP_TX_BUFFER_SIZE < 3006)
56  #error PPP_TX_BUFFER_SIZE parameter is not valid
57 #endif
58 
59 //RX buffer size
60 #ifndef PPP_RX_BUFFER_SIZE
61  #define PPP_RX_BUFFER_SIZE 8192
62 #elif (PPP_RX_BUFFER_SIZE < 3006)
63  #error PPP_RX_BUFFER_SIZE parameter is not valid
64 #endif
65 
66 //Maximum user name length
67 #ifndef PPP_MAX_USERNAME_LEN
68  #define PPP_MAX_USERNAME_LEN 31
69 #elif (PPP_MAX_USERNAME_LEN < 7)
70  #error PPP_MAX_USERNAME_LEN parameter is not valid
71 #endif
72 
73 //Maximum password length
74 #ifndef PPP_MAX_PASSWORD_LEN
75  #define PPP_MAX_PASSWORD_LEN 31
76 #elif (PPP_MAX_PASSWORD_LEN < 7)
77  #error PPP_MAX_PASSWORD_LEN parameter is not valid
78 #endif
79 
80 //PPP tick interval
81 #ifndef PPP_TICK_INTERVAL
82  #define PPP_TICK_INTERVAL 500
83 #elif (PPP_TICK_INTERVAL < 10)
84  #error PPP_TICK_INTERVAL parameter is not valid
85 #endif
86 
87 //Polling interval for blocking functions
88 #ifndef PPP_POLLING_INTERVAL
89  #define PPP_POLLING_INTERVAL 50
90 #elif (PPP_POLLING_INTERVAL < 1)
91  #error PPP_POLLING_INTERVAL parameter is not valid
92 #endif
93 
94 //Restart timer
95 #ifndef PPP_RESTART_TIMER
96  #define PPP_RESTART_TIMER 3000
97 #elif (PPP_RESTART_TIMER < 1000)
98  #error PPP_RESTART_TIMER parameter is not valid
99 #endif
100 
101 //Maximum number of retransmissions for Configure-Requests
102 #ifndef PPP_MAX_CONFIGURE
103  #define PPP_MAX_CONFIGURE 10
104 #elif (PPP_MAX_CONFIGURE < 1)
105  #error PPP_MAX_CONFIGURE parameter is not valid
106 #endif
107 
108 //Maximum number of retransmissions for Terminate-Requests
109 #ifndef PPP_MAX_TERMINATE
110  #define PPP_MAX_TERMINATE 2
111 #elif (PPP_MAX_TERMINATE < 1)
112  #error PPP_MAX_TERMINATE parameter is not valid
113 #endif
114 
115 //Maximum number of Configure-Nak packets sent
116 #ifndef PPP_MAX_FAILURE
117  #define PPP_MAX_FAILURE 5
118 #elif (PPP_MAX_FAILURE < 1)
119  #error PPP_MAX_FAILURE parameter is not valid
120 #endif
121 
122 //PPP special characters
123 #define PPP_MASK_CHAR 0x20
124 #define PPP_ESC_CHAR 0x7D
125 #define PPP_FLAG_CHAR 0x7E
126 
127 //PPP default MRU
128 #define PPP_DEFAULT_MRU 1500
129 //PPP default async control character map
130 #define PPP_DEFAULT_ACCM 0xFFFFFFFF
131 //PPP default magic number
132 #define PPP_DEFAULT_MAGIC_NUMBER 0
133 
134 //Minimum acceptable value for MRU
135 #define PPP_MIN_MRU 32
136 //Maximum acceptable value for MRU
137 #define PPP_MAX_MRU 1500
138 
139 //Maximum size of Configure-Request packets
140 #define PPP_MAX_CONF_REQ_SIZE 128
141 
142 //Maximum size of PPP frame header
143 #define PPP_FRAME_HEADER_SIZE 4
144 //FCS field size
145 #define PPP_FCS_SIZE 2
146 //Maximum size of PPP frames
147 #define PPP_MAX_FRAME_SIZE (PPP_FRAME_HEADER_SIZE + PPP_MAX_MRU + PPP_FCS_SIZE)
148 
149 //PPP Address field
150 #define PPP_ADDR_FIELD 0xFF
151 ///PPP Control field
152 #define PPP_CTRL_FIELD 0x03
153 
154 //C++ guard
155 #ifdef __cplusplus
156 extern "C" {
157 #endif
158 
159 
160 /**
161  * @brief PPP phases
162  **/
163 
164 typedef enum
165 {
166  PPP_PHASE_DEAD = 0, ///<Link dead
167  PPP_PHASE_ESTABLISH = 1, ///<Link establishment phase
168  PPP_PHASE_AUTHENTICATE = 2, ///<Authentication phase
169  PPP_PHASE_NETWORK = 3, ///<Network-layer protocol phase
170  PPP_PHASE_TERMINATE = 4 ///<Link termination phase
171 } PppPhase;
172 
173 
174 /**
175  * @brief LCP/NCP states
176  **/
177 
178 typedef enum
179 {
190 } PppState;
191 
192 
193 /**
194  * @brief Protocol field values
195  **/
196 
197 typedef enum
198 {
199  PPP_PROTOCOL_IP = 0x0021, ///<Internet Protocol
200  PPP_PROTOCOL_IPV6 = 0x0057, ///<Internet Protocol version 6
201  PPP_PROTOCOL_IPCP = 0x8021, ///<IP Control Protocol
202  PPP_PROTOCOL_IPV6CP = 0x8057, ///<IPv6 Control Protocol
203  PPP_PROTOCOL_LCP = 0xC021, ///<Link Control Protocol
204  PPP_PROTOCOL_PAP = 0xC023, ///<Password Authentication Protocol
205  PPP_PROTOCOL_LQR = 0xC025, ///<Link Quality Report
206  PPP_PROTOCOL_CHAP = 0xC223 ///<Challenge Handshake Authentication Protocol
207 } PppProtocol;
208 
209 
210 /**
211  * @brief Code field values
212  **/
213 
214 typedef enum
215 {
216  PPP_CODE_CONFIGURE_REQ = 1, ///<Configure-Request
217  PPP_CODE_CONFIGURE_ACK = 2, ///<Configure-Ack
218  PPP_CODE_CONFIGURE_NAK = 3, ///<Configure-Nak
219  PPP_CODE_CONFIGURE_REJ = 4, ///<Configure-Reject
220  PPP_CODE_TERMINATE_REQ = 5, ///<Terminate-Request
221  PPP_CODE_TERMINATE_ACK = 6, ///<Terminate-Ack
222  PPP_CODE_CODE_REJ = 7, ///<Code-Reject
223  PPP_CODE_PROTOCOL_REJ = 8, ///<Protocol-Reject
224  PPP_CODE_ECHO_REQ = 9, ///<Echo-Request
225  PPP_CODE_ECHO_REP = 10, ///<Echo-Reply
226  PPP_CODE_DISCARD_REQ = 11 ///<Discard-Request
227 } PppCode;
228 
229 
230 /**
231  * @brief PPP authentication protocols
232  **/
233 
234 typedef enum
235 {
236  PPP_AUTH_PROTOCOL_PAP = 0x01, //PAP
237  PPP_AUTH_PROTOCOL_CHAP_MD5 = 0x02, //CHAP with MD5
238  PPP_AUTH_PROTOCOL_MS_CHAP = 0x04, //MS-CHAP
239  PPP_AUTH_PROTOCOL_MS_CHAP_2 = 0x08 //MS-CHAP-2
241 
242 
243 //CodeWarrior or Win32 compiler?
244 #if defined(__CWCC__) || defined(_WIN32)
245  #pragma pack(push, 1)
246 #endif
247 
248 
249 /**
250  * @brief LCP/NCP packet header
251  **/
252 
253 __start_packed struct _PppPacket
254 {
255  uint8_t code; //0
256  uint8_t identifier; //1
257  uint16_t length; //2-3
258  uint8_t data[]; //4
259 } __end_packed;
260 
261 
262 /**
263  * @brief Configure-Request, Configure-Ack, Configure-Nak and Configure-Reject packets
264  **/
265 
266 typedef __start_packed struct
267 {
268  uint8_t code; //0
269  uint8_t identifier; //1
270  uint16_t length; //2-3
271  uint8_t options[]; //4
273 
274 
275 /**
276  * @brief Terminate-Request and Terminate-Ack packet
277  **/
278 
279 typedef __start_packed struct
280 {
281  uint8_t code; //0
282  uint8_t identifier; //1
283  uint16_t length; //2-3
284  uint8_t data[]; //4
286 
287 
288 /**
289  * @brief Code-Reject packet
290  **/
291 
292 typedef __start_packed struct
293 {
294  uint8_t code; //0
295  uint8_t identifier; //1
296  uint16_t length; //2-3
297  uint8_t rejectedPacket[]; //4
299 
300 
301 /**
302  * @brief Protocol-Reject packet
303  **/
304 
305 typedef __start_packed struct
306 {
307  uint8_t code; //0
308  uint8_t identifier; //1
309  uint16_t length; //2-3
310  uint16_t rejectedProtocol; //4-5
311  uint8_t rejectedInfo[]; //6
313 
314 
315 /**
316  * @brief Echo-Request and Echo-Reply packet
317  **/
318 
319 typedef __start_packed struct
320 {
321  uint8_t code; //0
322  uint8_t identifier; //1
323  uint16_t length; //2-3
324  uint32_t magicNumber; //4-7
325  uint8_t data[]; //8
327 
328 
329 /**
330  * @brief PPP Discard-Request packet
331  **/
332 
333 typedef __start_packed struct
334 {
335  uint8_t code; //0
336  uint8_t identifier; //1
337  uint16_t length; //2-3
338  uint32_t magicNumber; //4-7
339  uint8_t data[]; //8
341 
342 
343 /**
344  * @brief LCP/NCP option
345  **/
346 
347 typedef __start_packed struct
348 {
349  uint8_t type; //0
350  uint8_t length; //1
351  uint8_t data[]; //2
353 
354 
355 //CodeWarrior or Win32 compiler?
356 #if defined(__CWCC__) || defined(_WIN32)
357  #pragma pack(pop)
358 #endif
359 
360 
361 /**
362  * @brief Random data generation callback function
363  **/
364 
365 typedef error_t (*PppRandCallback)(uint8_t *data, size_t length);
366 
367 
368 /**
369  * @brief PPP authentication callback function
370  **/
371 
372 typedef bool_t (*PppAuthCallback)(NetInterface *interface,
373  const char_t *username);
374 
375 
376 /**
377  * @brief PPP settings
378  **/
379 
380 typedef struct
381 {
382  NetInterface *interface; ///<Underlying network interface
383  uint16_t mru; ///<Default MRU
384  uint32_t accm; ///<Default async control character map
385  uint_t authProtocol; ///<Allowed authentication protocols
386  PppRandCallback randCallback; ///<Random data generation callback function
387  PppAuthCallback authCallback; ///<PPP authentication callback function
388 } PppSettings;
389 
390 
391 /**
392  * @brief PPP finite state machine
393  **/
394 
395 typedef struct
396 {
397  uint_t state; ///<FSM state
398  uint8_t identifier; ///<Identifier used to match requests and replies
399  uint_t restartCounter; ///<Restart counter
400  uint_t failureCounter; ///<Failure counter
401  systime_t timestamp; ///<Timestamp to manage retransmissions
402 } PppFsm;
403 
404 
405 /**
406  * @brief PPP configuration options
407  **/
408 
409 typedef struct
410 {
411  uint16_t mru;
413  uint32_t accm;
415  uint16_t authProtocol;
416  uint8_t authAlgo;
418  uint32_t magicNumber;
424 #if (IPV4_SUPPORT == ENABLED)
431 #endif
432 #if (IPV6_SUPPORT == ENABLED)
435 #endif
436 } PppConfig;
437 
438 
439 /**
440  * @brief PPP context
441  **/
442 
444 {
445  PppSettings settings; ///PPP settings
446  NetInterface *interface; ///<Underlying network interface
447  systime_t timeout; ///<Timeout for blocking operations
448 
451  char_t peerName[PPP_MAX_USERNAME_LEN + 1]; ///<Peer's name
452 
455 
456  PppPhase pppPhase; ///<PPP phase
457  PppFsm lcpFsm; ///<LCP finite state machine
458 #if (IPV4_SUPPORT == ENABLED)
459  PppFsm ipcpFsm; ///<IPCP finite state machine
460 #endif
461 #if (IPV6_SUPPORT == ENABLED)
462  PppFsm ipv6cpFsm; ///<IPV6CP finite state machine
463 #endif
464 #if (PAP_SUPPORT == ENABLED)
465  PapFsm papFsm; ///<PAP finite state machine
466 #endif
467 #if (CHAP_SUPPORT == ENABLED)
468  ChapFsm chapFsm; ///<CHAP finite state machine
469 #endif
470  PppConfig localConfig; ///<Local configuration options
471  PppConfig peerConfig; ///<Peer configuration options
472  bool_t ipRejected; ///<IPv4 protocol is not supported by the peer
473  bool_t ipv6Rejected; ///<IPv6 protocol is not support by the peer
474 
475  uint8_t frame[PPP_MAX_FRAME_SIZE]; ///<Incoming PPP frame
476 
477  uint8_t txBuffer[PPP_TX_BUFFER_SIZE]; ///<Transmit buffer
481 
482  uint8_t rxBuffer[PPP_RX_BUFFER_SIZE]; ///<Receive buffer
487 };
488 
489 
490 //Tick counter to handle periodic operations
492 
493 //PPP related functions
494 void pppGetDefaultSettings(PppSettings *settings);
495 error_t pppInit(PppContext *context, const PppSettings *settings);
496 
497 error_t pppSetTimeout(NetInterface *interface, systime_t timeout);
498 
500  const char_t *username, const char_t *password);
501 
502 bool_t pppCheckPassword(NetInterface *interface, const char_t *password);
503 
504 error_t pppSendAtCommand(NetInterface *interface, const char_t *data);
505 error_t pppReceiveAtCommand(NetInterface *interface, char_t *data, size_t size);
506 
507 error_t pppConnect(NetInterface *interface);
508 error_t pppClose(NetInterface *interface);
509 
510 void pppTick(NetInterface *interface);
511 
512 void pppProcessFrame(NetInterface *interface, uint8_t *frame, size_t length);
513 
515  NetBuffer *buffer, size_t offset, uint16_t protocol);
516 
517 size_t pppParseFrameHeader(const uint8_t *frame, size_t length, uint16_t *protocol);
518 
519 uint16_t pppCalcFcs(const uint8_t *data, size_t length);
520 uint16_t pppCalcFcsEx(const NetBuffer *buffer, size_t offset, size_t length);
521 
522 NetBuffer *pppAllocBuffer(size_t length, size_t *offset);
523 
524 //C++ guard
525 #ifdef __cplusplus
526 }
527 #endif
528 
529 #endif
error_t pppSetTimeout(NetInterface *interface, systime_t timeout)
Set timeout value for blocking operations.
Definition: ppp.c:197
uint8_t rxBuffer[PPP_RX_BUFFER_SIZE]
Receive buffer.
Definition: ppp.h:482
bool_t localAuthDone
Definition: ppp.h:453
Configure-Reject.
Definition: ppp.h:219
int bool_t
Definition: compiler_port.h:49
uint_t rxWriteIndex
Definition: ppp.h:484
Configure-Ack.
Definition: ppp.h:217
__start_packed struct @286 PppTerminatePacket
Terminate-Request and Terminate-Ack packet.
__start_packed struct @109 Eui64
EUI-64 identifier.
bool_t interfaceIdRejected
Definition: ppp.h:434
systime_t pppTickCounter
Definition: ppp.c:51
PPP context.
Definition: ppp.h:443
PppProtocol
Protocol field values.
Definition: ppp.h:197
NetBuffer * pppAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a PPP frame.
Definition: ppp.c:1265
Protocol-Reject.
Definition: ppp.h:223
CHAP (Challenge Handshake Authentication Protocol)
uint32_t accm
Definition: ppp.h:413
void pppTick(NetInterface *interface)
PPP timer handler.
Definition: ppp.c:846
Challenge Handshake Authentication Protocol.
Definition: ppp.h:206
#define PPP_RX_BUFFER_SIZE
Definition: ppp.h:61
bool_t mruRejected
Definition: ppp.h:412
uint_t authProtocol
Allowed authentication protocols.
Definition: ppp.h:385
bool_t accmRejected
Definition: ppp.h:414
bool_t secondaryDnsRejected
Definition: ppp.h:430
uint_t rxFrameCount
Definition: ppp.h:486
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:88
NetInterface * interface
PPP settings.
Definition: ppp.h:446
bool_t ipRejected
IPv4 protocol is not supported by the peer.
Definition: ppp.h:472
systime_t timestamp
Timestamp to manage retransmissions.
Definition: ppp.h:401
PAP finite state machine.
Definition: pap.h:152
char_t username[PPP_MAX_USERNAME_LEN+1]
User name.
Definition: ppp.h:449
PppAuthCallback authCallback
PPP authentication callback function.
Definition: ppp.h:387
__start_packed struct @291 PppOption
LCP/NCP option.
uint16_t mru
Default MRU.
Definition: ppp.h:383
PppState
LCP/NCP states.
Definition: ppp.h:178
uint16_t rejectedProtocol
Definition: ppp.h:310
bool_t pfc
Definition: ppp.h:420
uint8_t options[]
Definition: ppp.h:271
PPP finite state machine.
Definition: ppp.h:395
Network-layer protocol phase.
Definition: ppp.h:169
uint_t txReadIndex
Definition: ppp.h:480
__start_packed struct @289 PppEchoPacket
Echo-Request and Echo-Reply packet.
uint8_t data[]
Definition: ppp.h:258
uint16_t authProtocol
Definition: ppp.h:415
Eui64 interfaceId
Definition: ppp.h:433
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:239
uint_t state
FSM state.
Definition: ppp.h:397
uint32_t magicNumber
Definition: ppp.h:418
#define PppContext
Definition: ppp.h:38
#define PPP_TX_BUFFER_SIZE
Definition: ppp.h:54
uint32_t accm
Default async control character map.
Definition: ppp.h:384
uint_t rxReadIndex
Definition: ppp.h:485
Code-Reject.
Definition: ppp.h:222
Configure-Request.
Definition: ppp.h:216
error_t pppSendAtCommand(NetInterface *interface, const char_t *data)
Send AT command.
Definition: ppp.c:318
Ipv4Addr secondaryDns
Definition: ppp.h:429
bool_t pppCheckPassword(NetInterface *interface, const char_t *password)
Password verification.
Definition: ppp.c:271
uint8_t identifier
Definition: ppp.h:269
error_t pppClose(NetInterface *interface)
Close a PPP connection.
Definition: ppp.c:727
uint_t rxBufferLen
Definition: ppp.h:483
uint8_t frame[PPP_MAX_FRAME_SIZE]
Incoming PPP frame.
Definition: ppp.h:475
bool_t ipv6Rejected
IPv6 protocol is not support by the peer.
Definition: ppp.h:473
Echo-Reply.
Definition: ppp.h:225
void pppGetDefaultSettings(PppSettings *settings)
Initialize settings with default values.
Definition: ppp.c:96
error_t
Error codes.
Definition: error.h:42
char_t peerName[PPP_MAX_USERNAME_LEN+1]
Peer's name.
Definition: ppp.h:451
error_t(* PppRandCallback)(uint8_t *data, size_t length)
Random data generation callback function.
Definition: ppp.h:365
uint8_t protocol
bool_t pfcRejected
Definition: ppp.h:421
PapFsm papFsm
PAP finite state machine.
Definition: ppp.h:465
Authentication phase.
Definition: ppp.h:168
LCP/NCP packet header.
Definition: ppp.h:253
uint8_t code
Definition: ppp.h:268
systime_t timeout
Timeout for blocking operations.
Definition: ppp.h:447
#define NetInterface
Definition: net.h:36
PppCode
Code field values.
Definition: ppp.h:214
uint8_t code
Definition: ppp.h:255
__start_packed struct @290 PppDiscardReqPacket
PPP Discard-Request packet.
PppConfig localConfig
Local configuration options.
Definition: ppp.h:470
PppSettings settings
Definition: ppp.h:445
PppPhase pppPhase
PPP phase.
Definition: ppp.h:456
bool_t authProtocolRejected
Definition: ppp.h:417
uint8_t authAlgo
Definition: ppp.h:416
uint8_t rejectedPacket[]
Definition: ppp.h:297
Link dead.
Definition: ppp.h:166
Configure-Nak.
Definition: ppp.h:218
PppFsm ipv6cpFsm
IPV6CP finite state machine.
Definition: ppp.h:462
Ipv4Addr primaryDns
Definition: ppp.h:427
__start_packed struct @288 PppProtocolRejPacket
Protocol-Reject packet.
Internet Protocol version 6.
Definition: ppp.h:200
uint16_t pppCalcFcs(const uint8_t *data, size_t length)
FCS calculation.
Definition: ppp.c:1180
uint32_t magicNumber
Definition: ppp.h:324
IPv6 Control Protocol.
Definition: ppp.h:202
bool_t primaryDnsRejected
Definition: ppp.h:428
bool_t acfc
Definition: ppp.h:422
bool_t ipAddrRejected
Definition: ppp.h:426
bool_t(* PppAuthCallback)(NetInterface *interface, const char_t *username)
PPP authentication callback function.
Definition: ppp.h:372
Terminate-Ack.
Definition: ppp.h:221
bool_t magicNumberRejected
Definition: ppp.h:419
uint8_t txBuffer[PPP_TX_BUFFER_SIZE]
Transmit buffer.
Definition: ppp.h:477
uint8_t data[]
Definition: ppp.h:284
Discard-Request.
Definition: ppp.h:226
bool_t acfcRejected
Definition: ppp.h:423
error_t pppSendFrame(NetInterface *interface, NetBuffer *buffer, size_t offset, uint16_t protocol)
Send a PPP frame.
Definition: ppp.c:1006
ChapFsm chapFsm
CHAP finite state machine.
Definition: ppp.h:468
PppAuthProtocol
PPP authentication protocols.
Definition: ppp.h:234
char char_t
Definition: compiler_port.h:43
uint_t txBufferLen
Definition: ppp.h:478
Link Control Protocol.
Definition: ppp.h:203
uint8_t identifier
Definition: ppp.h:256
uint16_t mru
Definition: ppp.h:411
__start_packed struct @285 PppConfigurePacket
Configure-Request, Configure-Ack, Configure-Nak and Configure-Reject packets.
Echo-Request.
Definition: ppp.h:224
IP Control Protocol.
Definition: ppp.h:201
__start_packed struct _PppPacket __end_packed
Ipv4Addr ipAddr
Definition: ppp.h:425
PppPhase
PPP phases.
Definition: ppp.h:164
size_t pppParseFrameHeader(const uint8_t *frame, size_t length, uint16_t *protocol)
Parse PPP frame header.
Definition: ppp.c:1108
void pppProcessFrame(NetInterface *interface, uint8_t *frame, size_t length)
Process an incoming PPP frame.
Definition: ppp.c:889
PppFsm lcpFsm
LCP finite state machine.
Definition: ppp.h:457
PPP settings.
Definition: ppp.h:380
PPP configuration options.
Definition: ppp.h:409
PppConfig peerConfig
Peer configuration options.
Definition: ppp.h:471
error_t pppSetAuthInfo(NetInterface *interface, const char_t *username, const char_t *password)
Set PPP authentication information.
Definition: ppp.c:233
uint8_t identifier
Identifier used to match requests and replies.
Definition: ppp.h:398
uint16_t length
Definition: ppp.h:270
#define PPP_MAX_FRAME_SIZE
Definition: ppp.h:147
uint_t failureCounter
Failure counter.
Definition: ppp.h:400
NetInterface * interface
Underlying network interface.
Definition: ppp.h:382
#define PPP_MAX_PASSWORD_LEN
Definition: ppp.h:75
error_t pppInit(PppContext *context, const PppSettings *settings)
PPP initialization.
Definition: ppp.c:122
uint_t txWriteIndex
Definition: ppp.h:479
uint16_t pppCalcFcsEx(const NetBuffer *buffer, size_t offset, size_t length)
Calculate FCS over a multi-part buffer.
Definition: ppp.c:1208
error_t pppConnect(NetInterface *interface)
Establish a PPP connection.
Definition: ppp.c:459
Link termination phase.
Definition: ppp.h:170
Internet Protocol.
Definition: ppp.h:199
char_t password[PPP_MAX_PASSWORD_LEN+1]
Password.
Definition: ppp.h:450
bool_t peerAuthDone
Definition: ppp.h:454
unsigned int uint_t
Definition: compiler_port.h:45
TCP/IP stack core.
PppRandCallback randCallback
Random data generation callback function.
Definition: ppp.h:386
uint_t restartCounter
Restart counter.
Definition: ppp.h:399
Link Quality Report.
Definition: ppp.h:205
PAP (Password Authentication Protocol)
uint32_t systime_t
Definition: compiler_port.h:46
uint16_t length
Definition: ppp.h:257
Terminate-Request.
Definition: ppp.h:220
PppFsm ipcpFsm
IPCP finite state machine.
Definition: ppp.h:459
error_t pppReceiveAtCommand(NetInterface *interface, char_t *data, size_t size)
Wait for an incoming AT command.
Definition: ppp.c:381
CHAP finite state machine.
Definition: chap.h:179
Password Authentication Protocol.
Definition: ppp.h:204
uint8_t rejectedInfo[]
Definition: ppp.h:311
__start_packed struct @287 PppCodeRejPacket
Code-Reject packet.
Link establishment phase.
Definition: ppp.h:167
#define PPP_MAX_USERNAME_LEN
Definition: ppp.h:68
uint8_t type
Definition: ppp.h:349