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