Go to the documentation of this file.
37 #define PppPacket struct _PppPacket
38 #define PppContext struct _PppContext
47 #define PPP_SUPPORT DISABLED
48 #elif (PPP_SUPPORT != ENABLED && PPP_SUPPORT != DISABLED)
49 #error PPP_SUPPORT parameter is not valid
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
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
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
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
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
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
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
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
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
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
123 #define PPP_MASK_CHAR 0x20
124 #define PPP_ESC_CHAR 0x7D
125 #define PPP_FLAG_CHAR 0x7E
128 #define PPP_DEFAULT_MRU 1500
130 #define PPP_DEFAULT_ACCM 0xFFFFFFFF
132 #define PPP_DEFAULT_MAGIC_NUMBER 0
135 #define PPP_MIN_MRU 32
137 #define PPP_MAX_MRU 1500
140 #define PPP_MAX_CONF_REQ_SIZE 128
143 #define PPP_FRAME_HEADER_SIZE 4
145 #define PPP_FCS_SIZE 2
147 #define PPP_MAX_FRAME_SIZE (PPP_FRAME_HEADER_SIZE + PPP_MAX_MRU + PPP_FCS_SIZE)
150 #define PPP_ADDR_FIELD 0xFF
152 #define PPP_CTRL_FIELD 0x03
244 #if defined(__CCRX__)
246 #elif defined(__CWCC__) || defined(_WIN32)
247 #pragma pack(push, 1)
358 #if defined(__CCRX__)
360 #elif defined(__CWCC__) || defined(_WIN32)
428 #if (IPV4_SUPPORT == ENABLED)
436 #if (IPV6_SUPPORT == ENABLED)
462 #if (IPV4_SUPPORT == ENABLED)
465 #if (IPV6_SUPPORT == ENABLED)
468 #if (PAP_SUPPORT == ENABLED)
471 #if (CHAP_SUPPORT == ENABLED)
error_t pppSetTimeout(NetInterface *interface, systime_t timeout)
Set timeout value for blocking operations.
uint8_t rxBuffer[PPP_RX_BUFFER_SIZE]
Receive buffer.
@ PPP_CODE_CONFIGURE_REJ
Configure-Reject.
@ PPP_CODE_CONFIGURE_ACK
Configure-Ack.
bool_t interfaceIdRejected
PppProtocol
Protocol field values.
NetBuffer * pppAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a PPP frame.
@ PPP_CODE_PROTOCOL_REJ
Protocol-Reject.
@ PPP_AUTH_PROTOCOL_MS_CHAP_2
CHAP (Challenge Handshake Authentication Protocol)
void pppTick(NetInterface *interface)
PPP timer handler.
@ PPP_PROTOCOL_CHAP
Challenge Handshake Authentication Protocol.
#define PPP_RX_BUFFER_SIZE
uint_t authProtocol
Allowed authentication protocols.
bool_t secondaryDnsRejected
Structure describing a buffer that spans multiple chunks.
void pppProcessFrame(NetInterface *interface, uint8_t *frame, size_t length, NetRxAncillary *ancillary)
Process an incoming PPP frame.
NetInterface * interface
PPP settings.
bool_t ipRejected
IPv4 protocol is not supported by the peer.
systime_t timestamp
Timestamp to manage retransmissions.
PAP finite state machine.
char_t username[PPP_MAX_USERNAME_LEN+1]
User name.
PppAuthCallback authCallback
PPP authentication callback function.
@ PPP_AUTH_PROTOCOL_MS_CHAP
uint16_t rejectedProtocol
PPP finite state machine.
@ PPP_PHASE_NETWORK
Network-layer protocol phase.
uint32_t Ipv4Addr
IPv4 network address.
#define PPP_TX_BUFFER_SIZE
uint32_t accm
Default async control character map.
@ PPP_CODE_CODE_REJ
Code-Reject.
@ PPP_CODE_CONFIGURE_REQ
Configure-Request.
error_t pppSendAtCommand(NetInterface *interface, const char_t *data)
Send AT command.
bool_t pppCheckPassword(NetInterface *interface, const char_t *password)
Password verification.
error_t pppClose(NetInterface *interface)
Close a PPP connection.
uint8_t frame[PPP_MAX_FRAME_SIZE]
Incoming PPP frame.
bool_t ipv6Rejected
IPv6 protocol is not support by the peer.
@ PPP_CODE_ECHO_REP
Echo-Reply.
void pppGetDefaultSettings(PppSettings *settings)
Initialize settings with default values.
char_t peerName[PPP_MAX_USERNAME_LEN+1]
Peer's name.
error_t(* PppRandCallback)(uint8_t *data, size_t length)
Random data generation callback function.
PapFsm papFsm
PAP finite state machine.
@ PPP_PHASE_AUTHENTICATE
Authentication phase.
systime_t timeout
Timeout for blocking operations.
PppCode
Code field values.
PppConfig localConfig
Local configuration options.
PppPhase pppPhase
PPP phase.
bool_t authProtocolRejected
@ PPP_PHASE_DEAD
Link dead.
@ PPP_CODE_CONFIGURE_NAK
Configure-Nak.
PppFsm ipv6cpFsm
IPV6CP finite state machine.
@ PPP_PROTOCOL_IPV6
Internet Protocol version 6.
uint16_t pppCalcFcs(const uint8_t *data, size_t length)
FCS calculation.
@ PPP_PROTOCOL_IPV6CP
IPv6 Control Protocol.
__packed_struct _PppPacket
LCP/NCP packet header.
bool_t primaryDnsRejected
bool_t(* PppAuthCallback)(NetInterface *interface, const char_t *username)
PPP authentication callback function.
@ PPP_CODE_TERMINATE_ACK
Terminate-Ack.
bool_t magicNumberRejected
uint8_t txBuffer[PPP_TX_BUFFER_SIZE]
Transmit buffer.
@ PPP_CODE_DISCARD_REQ
Discard-Request.
uint32_t systime_t
System time.
error_t pppSendFrame(NetInterface *interface, NetBuffer *buffer, size_t offset, uint16_t protocol)
Send a PPP frame.
ChapFsm chapFsm
CHAP finite state machine.
PppAuthProtocol
PPP authentication protocols.
@ PPP_PROTOCOL_LCP
Link Control Protocol.
@ PPP_CODE_ECHO_REQ
Echo-Request.
@ PPP_PROTOCOL_IPCP
IP Control Protocol.
@ PPP_AUTH_PROTOCOL_CHAP_MD5
size_t pppParseFrameHeader(const uint8_t *frame, size_t length, uint16_t *protocol)
Parse PPP frame header.
PppFsm lcpFsm
LCP finite state machine.
PPP configuration options.
PppConfig peerConfig
Peer configuration options.
error_t pppSetAuthInfo(NetInterface *interface, const char_t *username, const char_t *password)
Set PPP authentication information.
uint8_t identifier
Identifier used to match requests and replies.
#define PPP_MAX_FRAME_SIZE
uint_t failureCounter
Failure counter.
NetInterface * interface
Underlying network interface.
#define PPP_MAX_PASSWORD_LEN
error_t pppInit(PppContext *context, const PppSettings *settings)
PPP initialization.
uint16_t pppCalcFcsEx(const NetBuffer *buffer, size_t offset, size_t length)
Calculate FCS over a multi-part buffer.
error_t pppConnect(NetInterface *interface)
Establish a PPP connection.
@ PPP_PHASE_TERMINATE
Link termination phase.
@ PPP_PROTOCOL_IP
Internet Protocol.
char_t password[PPP_MAX_PASSWORD_LEN+1]
Password.
PppRandCallback randCallback
Random data generation callback function.
uint_t restartCounter
Restart counter.
@ PPP_PROTOCOL_LQR
Link Quality Report.
PAP (Password Authentication Protocol)
@ PPP_CODE_TERMINATE_REQ
Terminate-Request.
PppFsm ipcpFsm
IPCP finite state machine.
typedef __packed_struct
Configure-Request, Configure-Ack, Configure-Nak and Configure-Reject packets.
error_t pppReceiveAtCommand(NetInterface *interface, char_t *data, size_t size)
Wait for an incoming AT command.
CHAP finite state machine.
@ PPP_PROTOCOL_PAP
Password Authentication Protocol.
@ PPP_PHASE_ESTABLISH
Link establishment phase.
#define PPP_MAX_USERNAME_LEN