40 #define PAP_SUPPORT ENABLED
41#elif (PAP_SUPPORT != ENABLED && PAP_SUPPORT != DISABLED)
42 #error PAP_SUPPORT parameter is not valid
46#ifndef PAP_RESTART_TIMER
47 #define PAP_RESTART_TIMER 3000
48#elif (PAP_RESTART_TIMER < 1000)
49 #error PAP_RESTART_TIMER parameter is not valid
53#ifndef PAP_MAX_REQUESTS
54 #define PAP_MAX_REQUESTS 5
55#elif (PAP_MAX_REQUESTS < 1)
56 #error PAP_MAX_REQUESTS parameter is not valid
71 PAP_STATE_0_INITIAL = 0,
72 PAP_STATE_1_STARTED = 1,
73 PAP_STATE_2_REQ_SENT = 2,
74 PAP_STATE_3_REQ_RCVD = 3,
75 PAP_STATE_4_ACK_SENT = 4,
76 PAP_STATE_5_ACK_RCVD = 5,
77 PAP_STATE_6_NAK_SENT = 6,
78 PAP_STATE_7_NAK_RCVD = 7
95#if defined(__CWCC__) || defined(_WIN32)
109 uint8_t peerIdLength;
143#if defined(__CWCC__) || defined(_WIN32)
165error_t papStartAuth(PppContext *context);
166error_t papAbortAuth(PppContext *context);
168void papTick(PppContext *context);
170void papProcessPacket(PppContext *context,
171 const PppPacket *packet,
size_t length);
173error_t papProcessAuthReq(PppContext *context,
174 const PapAuthReqPacket *authReqPacket,
size_t length);
176error_t papProcessAuthAck(PppContext *context,
177 const PapAuthAckPacket *authAckPacket,
size_t length);
179error_t papProcessAuthNak(PppContext *context,
180 const PapAuthNakPacket *authNakPacket,
size_t length);
182error_t papSendAuthReq(PppContext *context);
183error_t papSendAuthAck(PppContext *context, uint8_t identifier);
184error_t papSendAuthNak(PppContext *context, uint8_t identifier);
186bool_t papCheckPassword(PppContext *context,
const char_t *password);
error_t
Error codes.
Definition error.h:43
uint32_t systime_t
System time.
Definition os_port_none.h:90
PapCode
Code field values.
Definition pap.h:87
@ 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
PapState
PAP states.
Definition pap.h:70
typedef __packed_struct
Authenticate-Request packet.
Definition pap.h:105
PPP (Point-to-Point Protocol)
PAP finite state machine.
Definition pap.h:153
uint_t peerState
Peer state.
Definition pap.h:155
size_t passwordLen
Length of the password in bytes.
Definition pap.h:160
uint_t restartCounter
Restart counter.
Definition pap.h:157
systime_t timestamp
Timestamp to manage retransmissions.
Definition pap.h:158
const uint8_t * password
Peer's password.
Definition pap.h:159
uint_t localState
Local state.
Definition pap.h:154
uint8_t identifier
Identifier used to match requests and replies.
Definition pap.h:156