1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   Point-to-Point Protocol (PPP)                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
26 /*                                                                        */
27 /*    nx_ppp.h                                            PORTABLE C      */
28 /*                                                           6.3.0        */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Yuxin Zhou, Microsoft Corporation                                   */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the NetX Point-to-Point Protocol (PPP)            */
36 /*    component, including all data types and external references.        */
37 /*    It is assumed that nx_api.h and nx_port.h have already been         */
38 /*    included.                                                           */
39 /*                                                                        */
40 /*  RELEASE HISTORY                                                       */
41 /*                                                                        */
42 /*    DATE              NAME                      DESCRIPTION             */
43 /*                                                                        */
44 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
45 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
46 /*                                            resulting in version 6.1    */
47 /*  11-09-2020     Yuxin Zhou               Modified comment(s),          */
48 /*                                            improved packet length      */
49 /*                                            verification,               */
50 /*                                            resulting in version 6.1.2  */
51 /*  10-15-2021     Yuxin Zhou               Modified comment(s), included */
52 /*                                            necessary header file,      */
53 /*                                            resulting in version 6.1.9  */
54 /*  10-31-2023     Wenhui Xie               Modified comment(s), and      */
55 /*                                            supported processing        */
56 /*                                            compressed data,            */
57 /*                                            resulting in version 6.3.0  */
58 /*                                                                        */
59 /**************************************************************************/
60 
61 #ifndef NX_PPP_H
62 #define NX_PPP_H
63 
64 /* Determine if a C++ compiler is being used.  If so, ensure that standard
65    C is used to process the API information.  */
66 
67 #ifdef   __cplusplus
68 
69 /* Yes, C++ compiler is present.  Use standard C.  */
70 extern   "C" {
71 
72 #endif
73 
74 #include "nx_api.h"
75 
76 /* Define the PPP ID.  */
77 
78 #define NX_PPP_ID                                           0x50505020UL
79 
80 #define NX_PPP_SERIAL_BUFFER_ALERT_THRESHOLD                NX_PPP_SERIAL_BUFFER_SIZE/4
81 
82 /* Defined, support for transmitting PPP over Ethernet.  */
83 /*
84 #define NX_PPP_PPPOE_ENABLE
85 */
86 
87 /* If defined, this removes logic for compiling PPP transmit and receive statistics.
88 #define NX_PPP_DISABLE_INFO
89 */
90 
91 /* If defined, this enables PPP event logging.
92 #define NX_PPP_DEBUG_LOG_ENABLE
93 */
94 
95 /* If defined, this enables data saved to the PPP log to be printed out (printf).
96 #define NX_PPP_DEBUG_LOG_PRINT_ENABLE
97 */
98 
99 /* If defined, this disables CHAP authentication.
100 #define NX_PPP_DISABLE_CHAP
101 */
102 
103 /* If defined, this disables PAP authentication.
104 #define NX_PPP_DISABLE_PAP
105 */
106 
107 /* If defined, the primary DNS address request option is not set in NAKed list.
108 #define NX_PPP_DNS_OPTION_DISABLE
109 */
110 
111 /* Define how many times the PPP should try to request DNS address from the Peer. This
112    will have no effect if NX_PPP_DNS_OPTION_DISABLE is defined. */
113 #ifndef NX_PPP_DNS_ADDRESS_MAX_RETRIES
114 #define NX_PPP_DNS_ADDRESS_MAX_RETRIES                      2
115 #endif
116 
117 /* Define the thread time slice.  */
118 #ifndef NX_PPP_THREAD_TIME_SLICE
119 #define NX_PPP_THREAD_TIME_SLICE                            TX_NO_TIME_SLICE
120 #endif
121 
122 /* Set the link transfer size. */
123 #ifndef NX_PPP_MRU
124 #ifdef NX_PPP_PPPOE_ENABLE
125 #define NX_PPP_MRU                                          1480        /* Minimum value!  */
126 #else /* !NX_PPP_PPPOE_ENABLE  */
127 #define NX_PPP_MRU                                          1500        /* Minimum value!  */
128 #endif /* NX_PPP_PPPOE_ENABLE  */
129 #endif /* NX_PPP_MRU  */
130 
131 /* Minimum MRU to accept in  MRU parsed from received LCP configuration request. */
132 #ifndef NX_PPP_MINIMUM_MRU
133 #ifdef NX_PPP_PPPOE_ENABLE
134 #define NX_PPP_MINIMUM_MRU                                  1480
135 #else /* !NX_PPP_PPPOE_ENABLE  */
136 #define NX_PPP_MINIMUM_MRU                                  1500
137 #endif /* NX_PPP_PPPOE_ENABLE  */
138 #endif /* NX_PPP_MINIMUM_MRU  */
139 
140 /* Size of the receive character buffer. */
141 #ifndef NX_PPP_SERIAL_BUFFER_SIZE
142 #define NX_PPP_SERIAL_BUFFER_SIZE                           NX_PPP_MRU*2
143 #endif
144 
145 
146 /* User name buffer size for PAP login.  */
147 #ifndef NX_PPP_NAME_SIZE
148 #define NX_PPP_NAME_SIZE                                    32
149 #endif
150 
151 /* Password buffer size for PAP login.  */
152 #ifndef NX_PPP_PASSWORD_SIZE
153 #define NX_PPP_PASSWORD_SIZE                                32
154 #endif
155 
156 /* Buffer size of the random value to process the CHAP challenge name */
157 #ifndef NX_PPP_VALUE_SIZE
158 #define NX_PPP_VALUE_SIZE                                   32
159 #endif
160 
161 /* Buffer size of the hash value to process the CHAP challenge name */
162 #ifndef NX_PPP_HASHED_VALUE_SIZE
163 #define NX_PPP_HASHED_VALUE_SIZE                            16
164 #endif
165 
166 
167 /* The time period in timer ticks at which the PPP timer function executes and wakes up the PPP processing thread
168    to check for PPP events. */
169 #ifndef NX_PPP_BASE_TIMEOUT
170 #define NX_PPP_BASE_TIMEOUT                                 (NX_IP_PERIODIC_RATE * 1)        /* 1 second  */
171 #endif
172 
173 /* The time out in timer ticks on allocating packets for processing PPP data into IP packets either receiving or sending. */
174 #ifndef NX_PPP_TIMEOUT
175 #define NX_PPP_TIMEOUT                                      (NX_IP_PERIODIC_RATE * 4)       /* 4 seconds  */
176 #endif
177 
178 /* Number of times the PPP task times out waiting for another byte in the serial buffer. On reaching
179    this value, the PPP instance releases the packet and allocates a fresh packet for a new message.  */
180 #ifndef NX_PPP_RECEIVE_TIMEOUTS
181 #define NX_PPP_RECEIVE_TIMEOUTS                             4
182 #endif
183 
184 /* Timeout in seconds on the PPP task to receive a response to PPP protocol request.  */
185 #ifndef NX_PPP_PROTOCOL_TIMEOUT
186 #define NX_PPP_PROTOCOL_TIMEOUT                             4                            /* 4 seconds.  */
187 #endif
188 
189 /* Size of debug entry, this is also the wrap around index for debug output to overwrite oldest data. */
190 #ifndef NX_PPP_DEBUG_LOG_SIZE
191 #define NX_PPP_DEBUG_LOG_SIZE                               50
192 #endif
193 
194 /* Maximum amount of data to add to debug output from received packet. */
195 #ifndef NX_PPP_DEBUG_FRAME_SIZE
196 #define NX_PPP_DEBUG_FRAME_SIZE                             50
197 #endif
198 
199 /* Size of the NAK list. Not in use. */
200 #ifndef NX_PPP_OPTION_MESSAGE_LENGTH
201 #define NX_PPP_OPTION_MESSAGE_LENGTH                        64
202 #endif
203 
204 /* Number of instances the PPP instance resends another LCP configure request message without a response.
205    When this number is reached, the PPP instance aborts the PPP handshake, and the link status is down. */
206 #ifndef NX_PPP_MAX_LCP_PROTOCOL_RETRIES
207 #define NX_PPP_MAX_LCP_PROTOCOL_RETRIES                     20
208 #endif
209 
210 /* Number of instances the PPP instance resends another PAP authentication request message without a response.
211    When this number is reached, the PPP instance aborts the PPP handshake, and the link status is down. */
212 #ifndef NX_PPP_MAX_PAP_PROTOCOL_RETRIES
213 #define NX_PPP_MAX_PAP_PROTOCOL_RETRIES                     20
214 #endif
215 
216 /* Number of instances the PPP instance resends another CHAP challenge message without a response.
217    When this number is reached, the PPP instance aborts the PPP handshake, and the link status is down. */
218 #ifndef NX_PPP_MAX_CHAP_PROTOCOL_RETRIES
219 #define NX_PPP_MAX_CHAP_PROTOCOL_RETRIES                    20
220 #endif
221 
222 /* Number of instances the PPP instance times out before the IPCP part of the PPP handshake.
223    When this number is reached, the PPP instance aborts and the link is down. */
224 #ifndef NX_PPP_MAX_IPCP_PROTOCOL_RETRIES
225 #define NX_PPP_MAX_IPCP_PROTOCOL_RETRIES                    20
226 #endif
227 
228 /* Define the packet header.  */
229 #ifdef NX_PPP_PPPOE_ENABLE
230 #ifndef NX_PPP_PACKET
231 #define NX_PPP_PACKET                                       22  /* Ethernet Header(14) + (PPPoE Header(6) + 2), keep four-byte alignment for Ethernet.  */
232 #endif /* NX_PPP_PACKET  */
233 #else /* !NX_PPP_PPPOE_ENABLE  */
234 #define NX_PPP_PACKET                                       0
235 #endif /* NX_PPP_PPPOE_ENABLE  */
236 
237 /* Define the minimum PPP packet payload, the PPP commands (LCP, PAP, CHAP, IPCP) should be in one packet.  */
238 
239 #ifndef NX_PPP_MIN_PACKET_PAYLOAD
240 #define NX_PPP_MIN_PACKET_PAYLOAD                           (NX_PPP_PACKET + 128)
241 #endif
242 
243 /* Define PPP protocol types.  */
244 
245 #define NX_PPP_LCP_PROTOCOL                                 0xC021
246 #define NX_PPP_IPCP_PROTOCOL                                0x8021
247 #define NX_PPP_PAP_PROTOCOL                                 0xC023
248 #define NX_PPP_CHAP_PROTOCOL                                0xC223
249 #define NX_PPP_DATA                                         0x0021
250 
251 
252 /* Define PPP LCP codes and action.   */
253 
254 #define NX_PPP_LCP_CONFIGURE_REQUEST                        1
255 #define NX_PPP_LCP_CONFIGURE_ACK                            2
256 #define NX_PPP_LCP_CONFIGURE_NAK                            3
257 #define NX_PPP_LCP_CONFIGURE_REJECT                         4
258 #define NX_PPP_LCP_TERMINATE_REQUEST                        5
259 #define NX_PPP_LCP_TERMINATE_ACK                            6
260 #define NX_PPP_LCP_CODE_REJECT                              7
261 #define NX_PPP_LCP_PROTOCOL_REJECT                          8
262 #define NX_PPP_LCP_ECHO_REQUEST                             9
263 #define NX_PPP_LCP_ECHO_REPLY                               10
264 #define NX_PPP_LCP_DISCARD_REQUEST                          11
265 #define NX_PPP_LCP_TIMEOUT                                  99
266 
267 
268 /* Define PPP PAP codes and action.  */
269 
270 #define NX_PPP_PAP_AUTHENTICATE_REQUEST                     1
271 #define NX_PPP_PAP_AUTHENTICATE_ACK                         2
272 #define NX_PPP_PAP_AUTHENTICATE_NAK                         3
273 #define NX_PPP_PAP_AUTHENTICATE_TIMEOUT                     99
274 
275 
276 /* Define PPP CHAP codes and action.  */
277 
278 #define NX_PPP_CHAP_CHALLENGE_REQUEST                       1
279 #define NX_PPP_CHAP_CHALLENGE_RESPONSE                      2
280 #define NX_PPP_CHAP_CHALLENGE_SUCCESS                       3
281 #define NX_PPP_CHAP_CHALLENGE_FAILURE                       4
282 #define NX_PPP_CHAP_CHALLENGE_TIMEOUT                       99
283 
284 
285 /* Define PPP IPCP codes and action.   */
286 
287 #define NX_PPP_IPCP_CONFIGURE_REQUEST                       1
288 #define NX_PPP_IPCP_CONFIGURE_ACK                           2
289 #define NX_PPP_IPCP_CONFIGURE_NAK                           3
290 #define NX_PPP_IPCP_CONFIGURE_REJECT                        4
291 #define NX_PPP_IPCP_TERMINATE_REQUEST                       5
292 #define NX_PPP_IPCP_TERMINATE_ACK                           6
293 #define NX_PPP_IPCP_TIMEOUT                                 99
294 
295 
296 /* Define API return codes.  */
297 
298 #define NX_PPP_FAILURE                                      0xb0
299 #define NX_PPP_BUFFER_FULL                                  0xb1
300 #define NX_PPP_BAD_PACKET                                   0xb3
301 #define NX_PPP_ERROR                                        0xb4
302 #define NX_PPP_NOT_ESTABLISHED                              0xb5
303 #define NX_PPP_INVALID_PARAMETER                            0xb6
304 #define NX_PPP_ADDRESS_NOT_ESTABLISHED                      0xb7
305 #define NX_PPP_ALREADY_STOPPED                              0xb8
306 #define NX_PPP_ALREADY_STARTED                              0xb9
307 
308 /* Define PPP state machine states.  */
309 
310 #define NX_PPP_STOPPED                                      0
311 #define NX_PPP_STARTED                                      1
312 #define NX_PPP_ESTABLISHED                                  2
313 
314 
315 /* Define LCP state machine states.  */
316 
317 #define NX_PPP_LCP_INITIAL_STATE                            0
318 #define NX_PPP_LCP_START_STATE                              1
319 #define NX_PPP_LCP_CONFIGURE_REQUEST_SENT_STATE             2
320 #define NX_PPP_LCP_CONFIGURE_REQUEST_ACKED_STATE            3
321 #define NX_PPP_LCP_PEER_CONFIGURE_REQUEST_ACKED_STATE       4
322 #define NX_PPP_LCP_STOPPING_STATE                           5
323 #define NX_PPP_LCP_STOPPED_STATE                            6
324 #define NX_PPP_LCP_FAILED_STATE                             7
325 #define NX_PPP_LCP_COMPLETED_STATE                          8
326 
327 
328 /* Define PAP state machine states.  */
329 
330 #define NX_PPP_PAP_INITIAL_STATE                            0
331 #define NX_PPP_PAP_START_STATE                              1
332 #define NX_PPP_PAP_AUTHENTICATE_REQUEST_SENT_STATE          2
333 #define NX_PPP_PAP_AUTHENTICATE_REQUEST_WAIT_STATE          3
334 #define NX_PPP_PAP_FAILED_STATE                             4
335 #define NX_PPP_PAP_COMPLETED_STATE                          5
336 
337 
338 /* Define CHAP state machine states.  */
339 
340 #define NX_PPP_CHAP_INITIAL_STATE                           0
341 #define NX_PPP_CHAP_START_STATE                             1
342 #define NX_PPP_CHAP_CHALLENGE_REQUEST_SENT_STATE            2
343 #define NX_PPP_CHAP_CHALLENGE_REQUEST_SENT_BOTH_STATE       3
344 #define NX_PPP_CHAP_CHALLENGE_REQUEST_WAIT_STATE            4
345 #define NX_PPP_CHAP_CHALLENGE_REQUEST_SENT_RESPONDED_STATE  5
346 #define NX_PPP_CHAP_CHALLENGE_RESPONSE_WAIT_STATE           6
347 #define NX_PPP_CHAP_COMPLETED_NEW_STATE                     8
348 #define NX_PPP_CHAP_COMPLETED_NEW_SENT_STATE                9
349 #define NX_PPP_CHAP_CHALLENGE_FAILED_STATE                  10
350 #define NX_PPP_CHAP_COMPLETED_STATE                         11
351 
352 
353 /* Define IPCP state machine states.  */
354 
355 #define NX_PPP_IPCP_INITIAL_STATE                           0
356 #define NX_PPP_IPCP_START_STATE                             1
357 #define NX_PPP_IPCP_CONFIGURE_REQUEST_SENT_STATE            2
358 #define NX_PPP_IPCP_CONFIGURE_REQUEST_ACKED_STATE           3
359 #define NX_PPP_IPCP_PEER_CONFIGURE_REQUEST_ACKED_STATE      4
360 #define NX_PPP_IPCP_STOPPING_STATE                          5
361 #define NX_PPP_IPCP_STOPPED_STATE                           6
362 #define NX_PPP_IPCP_FAILED_STATE                            7
363 #define NX_PPP_IPCP_COMPLETED_STATE                         8
364 
365 
366 /* Define event flags for PPP thread control.  */
367 
368 #define NX_PPP_EVENT_START                                  0x01
369 #define NX_PPP_EVENT_STOP                                   0x02
370 #define NX_PPP_EVENT_PACKET_RECEIVE                         0x04
371 #define NX_PPP_EVENT_RAW_STRING_SEND                        0x08
372 #define NX_PPP_EVENT_IP_PACKET_SEND                         0x10
373 #define NX_PPP_EVENT_CHAP_CHALLENGE                         0x20
374 #define NX_PPP_EVENT_TIMEOUT                                0x40
375 #define NX_PPP_EVENT_PPPOE_PACKET_RECEIVE                   0x80
376 
377 
378 /* Define PPP status return values.  */
379 
380 #define NX_PPP_STATUS_LCP_IN_PROGRESS                       0
381 #define NX_PPP_STATUS_LCP_FAILED                            1
382 #define NX_PPP_STATUS_PAP_IN_PROGRESS                       2
383 #define NX_PPP_STATUS_PAP_FAILED                            3
384 #define NX_PPP_STATUS_CHAP_IN_PROGRESS                      4
385 #define NX_PPP_STATUS_CHAP_FAILED                           5
386 #define NX_PPP_STATUS_IPCP_IN_PROGRESS                      6
387 #define NX_PPP_STATUS_IPCP_FAILED                           7
388 #define NX_PPP_STATUS_ESTABLISHED                           8
389 
390 /* Define NAKed list options */
391 #define NX_PPP_IP_COMPRESSION_OPTION                        0x02
392 #define NX_PPP_IP_ADDRESS_OPTION                            0x03
393 #define NX_PPP_DNS_SERVER_OPTION                            0x81
394 #define NX_PPP_DNS_SECONDARY_SERVER_OPTION                  0x83
395 
396 /* Define the mark for the last octet of protocol field */
397 /* RFC 1661 https://www.rfc-editor.org/rfc/rfc1661#section-6.5:
398    The presence of a binary "1" as the LSB marks the last octet of the Protocol field. */
399 #define NX_PPP_PROTOCOL_LSB_MARK                            0x01
400 
401 
402 /* Define optional debug log.  This is used to capture the PPP traffic for debug
403    purposes.  */
404 
405 typedef struct NX_PPP_DEBUG_ENTRY_STRUCT
406 {
407 
408     ULONG           nx_ppp_debug_entry_time_stamp;
409     UCHAR           nx_ppp_debug_ppp_state;
410     UCHAR           nx_ppp_debug_lcp_state;
411     UCHAR           nx_ppp_debug_pap_state;
412     UCHAR           nx_ppp_debug_chap_state;
413     UCHAR           nx_ppp_debug_ipcp_state;
414     UCHAR           nx_ppp_debug_authenticated;
415     UCHAR           nx_ppp_debug_frame_type;
416     ULONG           nx_ppp_debug_packet_length;
417     UCHAR           nx_ppp_debug_frame[NX_PPP_DEBUG_FRAME_SIZE];
418 } NX_PPP_DEBUG_ENTRY;
419 
420 
421 
422 /* Define the main PPP data structure.  */
423 
424 typedef struct NX_PPP_STRUCT
425 {
426 
427     ULONG           nx_ppp_id;
428     CHAR            *nx_ppp_name;
429     NX_IP           *nx_ppp_ip_ptr;
430     NX_INTERFACE    *nx_ppp_interface_ptr;
431     UINT            nx_ppp_interface_index;
432     NX_PACKET_POOL  *nx_ppp_packet_pool_ptr;
433     UCHAR           nx_ppp_transmit_id;
434     UCHAR           nx_ppp_receive_id;
435     UCHAR           nx_ppp_lcp_echo_reply_id;
436     UCHAR           nx_ppp_reserved;
437     ULONG           nx_ppp_mru;
438     UINT            nx_ppp_server;
439     UINT            nx_ppp_state;
440     UINT            nx_ppp_lcp_state;
441     UINT            nx_ppp_pap_state;
442     UINT            nx_ppp_chap_state;
443     UINT            nx_ppp_ipcp_state;
444     UINT            nx_ppp_authenticated;
445     UINT            nx_ppp_generate_authentication_protocol;
446     UINT            nx_ppp_verify_authentication_protocol;
447     USHORT          nx_ppp_pap_enabled;
448     USHORT          nx_ppp_chap_enabled;
449     CHAR            nx_ppp_chap_challenger_name[NX_PPP_NAME_SIZE + 1];
450     CHAR            nx_ppp_chap_random_value[NX_PPP_VALUE_SIZE + 1];
451     UCHAR           nx_ppp_ipcp_local_ip[4];
452     UCHAR           nx_ppp_ipcp_peer_ip[4];
453     ULONG           nx_ppp_primary_dns_address;
454     ULONG           nx_ppp_secondary_dns_address;
455     UINT            nx_ppp_dns_address_retries;
456     UINT            nx_ppp_secondary_dns_address_retries;
457     ULONG           nx_ppp_timeout;
458     ULONG           nx_ppp_receive_timeouts;
459     ULONG           nx_ppp_protocol_retry_counter;
460 #ifndef NX_PPP_DISABLE_INFO
461     ULONG           nx_ppp_packet_allocate_timeouts;
462     ULONG           nx_ppp_frame_timeouts;
463     ULONG           nx_ppp_internal_errors;
464     ULONG           nx_ppp_frame_crc_errors;
465     ULONG           nx_ppp_packet_overflow;
466     ULONG           nx_ppp_bytes_received;
467     ULONG           nx_ppp_bytes_sent;
468     ULONG           nx_ppp_bytes_dropped;
469     ULONG           nx_ppp_bytes_invalid;
470     ULONG           nx_ppp_total_frames_received;
471     ULONG           nx_ppp_lcp_frames_received;
472     ULONG           nx_ppp_lcp_frames_sent;
473     ULONG           nx_ppp_lcp_configure_requests_sent;
474     ULONG           nx_ppp_lcp_configure_requests_received;
475     ULONG           nx_ppp_lcp_configure_acks_sent;
476     ULONG           nx_ppp_lcp_configure_acks_received;
477     ULONG           nx_ppp_lcp_configure_naks_sent;
478     ULONG           nx_ppp_lcp_configure_naks_received;
479     ULONG           nx_ppp_lcp_configure_rejects_sent;
480     ULONG           nx_ppp_lcp_configure_rejects_received;
481     ULONG           nx_ppp_lcp_terminate_requests_sent;
482     ULONG           nx_ppp_lcp_terminate_requests_received;
483     ULONG           nx_ppp_lcp_terminate_acks_sent;
484     ULONG           nx_ppp_lcp_terminate_acks_received;
485     ULONG           nx_ppp_lcp_code_rejects_sent;
486     ULONG           nx_ppp_lcp_code_rejects_received;
487     ULONG           nx_ppp_lcp_protocol_rejects_sent;
488     ULONG           nx_ppp_lcp_protocol_rejects_received;
489     ULONG           nx_ppp_lcp_echo_requests_sent;
490     ULONG           nx_ppp_lcp_echo_replies_received;
491     ULONG           nx_ppp_lcp_echo_requests_received;
492     ULONG           nx_ppp_lcp_echo_requests_dropped;
493     ULONG           nx_ppp_lcp_echo_replies_sent;
494     ULONG           nx_ppp_lcp_discard_requests_sent;
495     ULONG           nx_ppp_lcp_discard_requests_received;
496     ULONG           nx_ppp_lcp_unknown_requests_received;
497     ULONG           nx_ppp_lcp_state_machine_unhandled_requests;
498     ULONG           nx_ppp_lcp_state_machine_timeouts;
499 #ifndef NX_PPP_DISABLE_PAP
500     ULONG           nx_ppp_pap_frames_received;
501     ULONG           nx_ppp_pap_frames_sent;
502     ULONG           nx_ppp_pap_authenticate_requests_sent;
503     ULONG           nx_ppp_pap_authenticate_requests_received;
504     ULONG           nx_ppp_pap_authenticate_acks_sent;
505     ULONG           nx_ppp_pap_authenticate_acks_received;
506     ULONG           nx_ppp_pap_authenticate_naks_sent;
507     ULONG           nx_ppp_pap_authenticate_naks_received;
508     ULONG           nx_ppp_pap_unknown_requests_received;
509     ULONG           nx_ppp_pap_state_machine_unhandled_requests;
510     ULONG           nx_ppp_pap_state_machine_timeouts;
511 #endif
512 #ifndef NX_PPP_DISABLE_CHAP
513     ULONG           nx_ppp_chap_frames_received;
514     ULONG           nx_ppp_chap_frames_sent;
515     ULONG           nx_ppp_chap_challenge_requests_sent;
516     ULONG           nx_ppp_chap_challenge_requests_received;
517     ULONG           nx_ppp_chap_challenge_responses_sent;
518     ULONG           nx_ppp_chap_challenge_responses_received;
519     ULONG           nx_ppp_chap_challenge_successes_sent;
520     ULONG           nx_ppp_chap_challenge_successes_received;
521     ULONG           nx_ppp_chap_challenge_failures_sent;
522     ULONG           nx_ppp_chap_challenge_failures_received;
523     ULONG           nx_ppp_chap_unknown_requests_received;
524     ULONG           nx_ppp_chap_state_machine_unhandled_requests;
525     ULONG           nx_ppp_chap_state_machine_timeouts;
526 #endif
527     ULONG           nx_ppp_ipcp_frames_received;
528     ULONG           nx_ppp_ipcp_frames_sent;
529     ULONG           nx_ppp_ipcp_configure_requests_sent;
530     ULONG           nx_ppp_ipcp_configure_requests_received;
531     ULONG           nx_ppp_ipcp_configure_acks_sent;
532     ULONG           nx_ppp_ipcp_configure_acks_received;
533     ULONG           nx_ppp_ipcp_configure_naks_sent;
534     ULONG           nx_ppp_ipcp_configure_naks_received;
535     ULONG           nx_ppp_ipcp_configure_rejects_sent;
536     ULONG           nx_ppp_ipcp_configure_rejects_received;
537     ULONG           nx_ppp_ipcp_terminate_requests_sent;
538     ULONG           nx_ppp_ipcp_terminate_requests_received;
539     ULONG           nx_ppp_ipcp_terminate_acks_sent;
540     ULONG           nx_ppp_ipcp_terminate_acks_received;
541     ULONG           nx_ppp_ipcp_unknown_requests_received;
542     ULONG           nx_ppp_ipcp_state_machine_unhandled_requests;
543     ULONG           nx_ppp_ipcp_state_machine_timeouts;
544     ULONG           nx_ppp_ip_frames_received;
545     ULONG           nx_ppp_ip_frames_sent;
546     ULONG           nx_ppp_receive_frames_dropped;
547     ULONG           nx_ppp_transmit_frames_dropped;
548     ULONG           nx_ppp_invalid_frame_id;
549 #endif
550 
551     void            (*nx_ppp_byte_send)(UCHAR byte);
552 
553 #ifdef NX_PPP_PPPOE_ENABLE
554     void            (*nx_ppp_packet_send)(NX_PACKET *packet_ptr);
555 #endif /* NX_PPP_PPPOE_ENABLE  */
556 
557     void            (*nx_ppp_non_ppp_packet_handler)(NX_PACKET *packet_ptr);
558     void            (*nx_ppp_nak_authentication_notify)(void);
559 
560     void            (*nx_ppp_link_up_callback)(struct NX_PPP_STRUCT *ppp_ptr);
561     void            (*nx_ppp_link_down_callback)(struct NX_PPP_STRUCT *ppp_ptr);
562 
563     UINT            (*nx_ppp_pap_verify_login)(CHAR *name, CHAR *password);
564     UINT            (*nx_ppp_pap_generate_login)(CHAR *name, CHAR *password);
565 
566     UINT            (*nx_ppp_chap_get_challenge_values)(CHAR *rand_value, CHAR *id, CHAR *name);
567     UINT            (*nx_ppp_chap_get_responder_values)(CHAR *sys, CHAR *name, CHAR *secret);
568     UINT            (*nx_ppp_chap_get_verification_values)(CHAR *sys, CHAR *name, CHAR *secret);
569     TX_EVENT_FLAGS_GROUP
570                     nx_ppp_event;
571     TX_TIMER        nx_ppp_timer;
572 
573     UCHAR           nx_ppp_serial_buffer[NX_PPP_SERIAL_BUFFER_SIZE];
574     USHORT          nx_ppp_serial_buffer_write_index;
575     USHORT          nx_ppp_serial_buffer_read_index;
576     USHORT          nx_ppp_serial_buffer_byte_count;
577 
578     NX_PACKET       *nx_ppp_receive_partial_packet;
579     ULONG           nx_ppp_receive_buffer_size;
580     UCHAR           *nx_ppp_receive_buffer_ptr;
581 
582     NX_PACKET       *nx_ppp_head_packet;
583 
584 #ifdef NX_PPP_PPPOE_ENABLE
585 
586     /* Define the deferred packet processing queue for driver packet.  */
587     NX_PACKET       *nx_ppp_deferred_received_packet_head,
588                     *nx_ppp_deferred_received_packet_tail;
589 #endif /* NX_PPP_PPPOE_ENABLE  */
590 
591     NX_PACKET       *nx_ppp_raw_packet_queue_head;
592     NX_PACKET       *nx_ppp_raw_packet_queue_tail;
593     ULONG           nx_ppp_raw_packet_queue_count;
594 
595     NX_PACKET       *nx_ppp_ip_packet_queue_head;
596     NX_PACKET       *nx_ppp_ip_packet_queue_tail;
597     ULONG           nx_ppp_ip_packet_queue_count;
598 
599     TX_THREAD       nx_ppp_thread;
600     struct NX_PPP_STRUCT
601                     *nx_ppp_created_next,
602                     *nx_ppp_created_previous;
603 
604     UCHAR           nx_ppp_naked_list[NX_PPP_OPTION_MESSAGE_LENGTH];
605     UCHAR           nx_ppp_peer_naked_list[NX_PPP_OPTION_MESSAGE_LENGTH];
606     UCHAR           nx_ppp_rejected_list[NX_PPP_OPTION_MESSAGE_LENGTH];
607 
608 #ifdef NX_PPP_DEBUG_LOG_ENABLE
609     NX_PPP_DEBUG_ENTRY
610                     nx_ppp_debug_log[NX_PPP_DEBUG_LOG_SIZE];
611     UINT            nx_ppp_debug_log_oldest_index;
612 #endif
613 
614 } NX_PPP;
615 
616 
617 #ifndef NX_PPP_SOURCE_CODE
618 
619 /* Application caller is present, perform API mapping.  */
620 
621 /* Determine if error checking is desired.  If so, map API functions
622    to the appropriate error checking front-ends.  Otherwise, map API
623    functions to the core functions that actually perform the work.
624    Note: error checking is enabled by default.  */
625 
626 #ifdef NX_DISABLE_ERROR_CHECKING
627 
628 /* Services without error checking.  */
629 
630 #define nx_ppp_byte_receive                 _nx_ppp_byte_receive
631 #define nx_ppp_chap_challenge               _nx_ppp_chap_challenge
632 #define nx_ppp_chap_enable                  _nx_ppp_chap_enable
633 #define nx_ppp_create                       _nx_ppp_create
634 #define nx_ppp_delete                       _nx_ppp_delete
635 #define nx_ppp_dns_address_get              _nx_ppp_dns_address_get
636 #define nx_ppp_dns_address_set              _nx_ppp_dns_address_set
637 #define nx_ppp_secondary_dns_address_get    _nx_ppp_secondary_dns_address_get
638 #define nx_ppp_secondary_dns_address_set    _nx_ppp_secondary_dns_address_set
639 #define nx_ppp_driver                       _nx_ppp_driver
640 #define nx_ppp_interface_index_get          _nx_ppp_interface_index_get
641 #define nx_ppp_ip_address_assign            _nx_ppp_ip_address_assign
642 #define nx_ppp_link_down_notify             _nx_ppp_link_down_notify
643 #define nx_ppp_link_up_notify               _nx_ppp_link_up_notify
644 #define nx_ppp_nak_authentication_notify    _nx_ppp_nak_authentication_notify
645 #define nx_ppp_pap_enable                   _nx_ppp_pap_enable
646 #define nx_ppp_raw_string_send              _nx_ppp_raw_string_send
647 #define nx_ppp_start                        _nx_ppp_start
648 #define nx_ppp_stop                         _nx_ppp_stop
649 #define nx_ppp_restart                      _nx_ppp_restart
650 #define nx_ppp_status_get                   _nx_ppp_status_get
651 #define nx_ppp_ping_request                 _nx_ppp_ping_request
652 #ifdef NX_PPP_PPPOE_ENABLE
653 #define nx_ppp_packet_receive               _nx_ppp_packet_receive
654 #define nx_ppp_packet_send_set              _nx_ppp_packet_send_set
655 #endif /* NX_PPP_PPPOE_ENABLE  */
656 
657 #else
658 
659 /* Services with error checking.  */
660 
661 #define nx_ppp_byte_receive                 _nxe_ppp_byte_receive
662 #define nx_ppp_chap_challenge               _nxe_ppp_chap_challenge
663 #define nx_ppp_chap_enable                  _nxe_ppp_chap_enable
664 #define nx_ppp_create                       _nxe_ppp_create
665 #define nx_ppp_delete                       _nxe_ppp_delete
666 #define nx_ppp_dns_address_get              _nxe_ppp_dns_address_get
667 #define nx_ppp_dns_address_set              _nxe_ppp_dns_address_set
668 #define nx_ppp_secondary_dns_address_get    _nxe_ppp_secondary_dns_address_get
669 #define nx_ppp_secondary_dns_address_set    _nxe_ppp_secondary_dns_address_set
670 #define nx_ppp_driver                       _nx_ppp_driver
671 #define nx_ppp_interface_index_get          _nxe_ppp_interface_index_get
672 #define nx_ppp_ip_address_assign            _nxe_ppp_ip_address_assign
673 #define nx_ppp_link_down_notify             _nxe_ppp_link_down_notify
674 #define nx_ppp_link_up_notify               _nxe_ppp_link_up_notify
675 #define nx_ppp_nak_authentication_notify    _nxe_ppp_nak_authentication_notify
676 #define nx_ppp_pap_enable                   _nxe_ppp_pap_enable
677 #define nx_ppp_raw_string_send              _nxe_ppp_raw_string_send
678 #define nx_ppp_start                        _nxe_ppp_start
679 #define nx_ppp_stop                         _nxe_ppp_stop
680 #define nx_ppp_restart                      _nxe_ppp_restart
681 #define nx_ppp_status_get                   _nxe_ppp_status_get
682 #define nx_ppp_ping_request                 _nxe_ppp_ping_request
683 #ifdef NX_PPP_PPPOE_ENABLE
684 #define nx_ppp_packet_receive               _nxe_ppp_packet_receive
685 #define nx_ppp_packet_send_set              _nxe_ppp_packet_send_set
686 #endif /* NX_PPP_PPPOE_ENABLE  */
687 
688 #endif /* NX_DISABLE_ERROR_CHECKING */
689 
690 /* Define the prototypes accessible to the application software.  */
691 
692 UINT    nx_ppp_byte_receive(NX_PPP *ppp_ptr, UCHAR byte);
693 UINT    nx_ppp_chap_challenge(NX_PPP *ppp_ptr);
694 UINT    nx_ppp_chap_enable(NX_PPP *ppp_ptr,
695                UINT (*get_challenge_values)(CHAR *rand_value, CHAR *id, CHAR *name),
696                UINT (*get_responder_values)(CHAR *system, CHAR *name, CHAR *secret),
697                UINT (*get_verification_values)(CHAR *system, CHAR *name, CHAR *secret));
698 UINT    nx_ppp_create(NX_PPP *ppp_ptr, CHAR *name, NX_IP *ip_ptr,
699                VOID *stack_memory_ptr, ULONG stack_size, UINT thread_priority,
700                NX_PACKET_POOL *pool_ptr,
701                void (*ppp_non_ppp_packet_handler)(NX_PACKET *packet_ptr),
702                void (*ppp_byte_send)(UCHAR byte));
703 UINT    nx_ppp_delete(NX_PPP *ppp_ptr);
704 UINT    nx_ppp_dns_address_get(NX_PPP *ppp_ptr, ULONG *dns_address_ptr);
705 UINT    nx_ppp_dns_address_set(NX_PPP *ppp_ptr, ULONG dns_address);
706 UINT    nx_ppp_secondary_dns_address_get(NX_PPP *ppp_ptr, ULONG *secondary_dns_address_ptr);
707 UINT    nx_ppp_secondary_dns_address_set(NX_PPP *ppp_ptr, ULONG secondary_dns_address);
708 void    nx_ppp_driver(NX_IP_DRIVER *driver_req_ptr);
709 UINT    nx_ppp_interface_index_get(NX_PPP *ppp_ptr, UINT *index_ptr);
710 UINT    nx_ppp_ip_address_assign(NX_PPP *ppp_ptr, ULONG local_ip_address, ULONG peer_ip_address);
711 UINT    nx_ppp_link_down_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_down_callback)(NX_PPP *ppp_ptr));
712 UINT    nx_ppp_link_up_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_up_callback)(NX_PPP *ppp_ptr));
713 UINT    nx_ppp_nak_authentication_notify(NX_PPP *ppp_ptr, void (*nak_authentication_notify)(void));
714 UINT    nx_ppp_pap_enable(NX_PPP *ppp_ptr, UINT (*generate_login)(CHAR *name, CHAR *password), UINT (*verify_login)(CHAR *name, CHAR *password));
715 UINT    nx_ppp_raw_string_send(NX_PPP *ppp_ptr, CHAR *string_ptr);
716 UINT    nx_ppp_start(NX_PPP *ppp_ptr);
717 UINT    nx_ppp_stop(NX_PPP *ppp_ptr);
718 UINT    nx_ppp_restart(NX_PPP *ppp_ptr);
719 UINT    nx_ppp_status_get(NX_PPP *ppp_ptr, UINT *status_ptr);
720 UINT    nx_ppp_ping_request(NX_PPP *ppp_ptr, CHAR *data_ptr, ULONG data_size,  ULONG wait_option);
721 #ifdef NX_PPP_PPPOE_ENABLE
722 UINT    nx_ppp_packet_receive(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
723 UINT    nx_ppp_packet_send_set(NX_PPP *ppp_ptr, void (*nx_ppp_packet_send)(NX_PACKET *packet_ptr));
724 #endif /* NX_PPP_PPPOE_ENABLE  */
725 
726 #else /* NX_PPP_SOURCE_CODE  */
727 
728 UINT    _nxe_ppp_byte_receive(NX_PPP *ppp_ptr, UCHAR byte);
729 UINT    _nx_ppp_byte_receive(NX_PPP *ppp_ptr, UCHAR byte);
730 UINT    _nxe_ppp_chap_challenge(NX_PPP *ppp_ptr);
731 UINT    _nx_ppp_chap_challenge(NX_PPP *ppp_ptr);
732 UINT    _nxe_ppp_chap_enable(NX_PPP *ppp_ptr,
733                UINT (*get_challenge_values)(CHAR *rand_value, CHAR *id, CHAR *name),
734                UINT (*get_responder_values)(CHAR *system, CHAR *name, CHAR *secret),
735                UINT (*get_verification_values)(CHAR *system, CHAR *name, CHAR *secret));
736 UINT    _nx_ppp_chap_enable(NX_PPP *ppp_ptr,
737                UINT (*get_challenge_values)(CHAR *rand_value, CHAR *id, CHAR *name),
738                UINT (*get_responder_values)(CHAR *system, CHAR *name, CHAR *secret),
739                UINT (*get_verification_values)(CHAR *system, CHAR *name, CHAR *secret));
740 UINT    _nxe_ppp_create(NX_PPP *ppp_ptr, CHAR *name, NX_IP *ip_ptr,
741                VOID *stack_memory_ptr, ULONG stack_size, UINT thread_priority,
742                NX_PACKET_POOL *pool_ptr,
743                void (*ppp_non_ppp_packet_handler)(NX_PACKET *packet_ptr),
744                void (*ppp_byte_send)(UCHAR byte));
745 UINT    _nx_ppp_create(NX_PPP *ppp_ptr, CHAR *name, NX_IP *ip_ptr,
746                VOID *stack_memory_ptr, ULONG stack_size, UINT thread_priority,
747                NX_PACKET_POOL *pool_ptr,
748                void (*ppp_non_ppp_packet_handler)(NX_PACKET *packet_ptr),
749                void (*ppp_byte_send)(UCHAR byte));
750 UINT    _nxe_ppp_delete(NX_PPP *ppp_ptr);
751 UINT    _nx_ppp_delete(NX_PPP *ppp_ptr);
752 UINT    _nxe_ppp_dns_address_get(NX_PPP *ppp_ptr, ULONG *dns_address_ptr);
753 UINT    _nx_ppp_dns_address_get(NX_PPP *ppp_ptr, ULONG *dns_address_ptr);
754 UINT    _nxe_ppp_dns_address_set(NX_PPP *ppp_ptr, ULONG dns_address);
755 UINT    _nx_ppp_dns_address_set(NX_PPP *ppp_ptr, ULONG dns_address);
756 UINT    _nxe_ppp_secondary_dns_address_get(NX_PPP *ppp_ptr, ULONG *secondary_dns_address_ptr);
757 UINT    _nx_ppp_secondary_dns_address_get(NX_PPP *ppp_ptr, ULONG *secondary_dns_address_ptr);
758 UINT    _nxe_ppp_secondary_dns_address_set(NX_PPP *ppp_ptr, ULONG secondary_dns_address);
759 UINT    _nx_ppp_secondary_dns_address_set(NX_PPP *ppp_ptr, ULONG secondary_dns_address);
760 UINT    _nxe_ppp_interface_index_get(NX_PPP *ppp_ptr, UINT *index_ptr);
761 UINT    _nx_ppp_interface_index_get(NX_PPP *ppp_ptr, UINT *index_ptr);
762 UINT    _nxe_ppp_ip_address_assign(NX_PPP *ppp_ptr, ULONG local_ip_address, ULONG peer_ip_address);
763 UINT    _nx_ppp_ip_address_assign(NX_PPP *ppp_ptr, ULONG local_ip_address, ULONG peer_ip_address);
764 UINT    _nxe_ppp_link_down_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_down_callback)(NX_PPP *ppp_ptr));
765 UINT    _nx_ppp_link_down_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_down_callback)(NX_PPP *ppp_ptr));
766 UINT    _nxe_ppp_link_up_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_up_callback)(NX_PPP *ppp_ptr));
767 UINT    _nx_ppp_link_up_notify(NX_PPP *ppp_ptr, VOID (*ppp_link_up_callback)(NX_PPP *ppp_ptr));
768 UINT    _nxe_ppp_nak_authentication_notify(NX_PPP *ppp_ptr, void (*nak_authentication_notify)(void));
769 UINT    _nx_ppp_nak_authentication_notify(NX_PPP *ppp_ptr, void (*nak_authentication_notify)(void));
770 UINT    _nxe_ppp_pap_enable(NX_PPP *ppp_ptr, UINT (*generate_login)(CHAR *name, CHAR *password), UINT (*verify_login)(CHAR *name, CHAR *password));
771 UINT    _nx_ppp_pap_enable(NX_PPP *ppp_ptr, UINT (*generate_login)(CHAR *name, CHAR *password), UINT (*verify_login)(CHAR *name, CHAR *password));
772 UINT    _nxe_ppp_raw_string_send(NX_PPP *ppp_ptr, CHAR *string_ptr);
773 UINT    _nx_ppp_raw_string_send(NX_PPP *ppp_ptr, CHAR *string_ptr);
774 UINT    _nxe_ppp_start(NX_PPP *ppp_ptr);
775 UINT    _nx_ppp_start(NX_PPP *ppp_ptr);
776 UINT    _nxe_ppp_stop(NX_PPP *ppp_ptr);
777 UINT    _nx_ppp_stop(NX_PPP *ppp_ptr);
778 UINT    _nxe_ppp_restart(NX_PPP *ppp_ptr);
779 UINT    _nx_ppp_restart(NX_PPP *ppp_ptr);
780 UINT    _nxe_ppp_status_get(NX_PPP *ppp_ptr, UINT *status_ptr);
781 UINT    _nx_ppp_status_get(NX_PPP *ppp_ptr, UINT *status_ptr);
782 UINT    _nxe_ppp_ping_request(NX_PPP *ppp_ptr, CHAR *data_ptr, ULONG data_size,  ULONG wait_option);
783 UINT    _nx_ppp_ping_request(NX_PPP *ppp_ptr, CHAR *data_ptr, ULONG data_size,  ULONG wait_option);
784 #ifdef NX_PPP_PPPOE_ENABLE
785 UINT    _nxe_ppp_packet_receive(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
786 UINT    _nx_ppp_packet_receive(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
787 UINT    _nxe_ppp_packet_send_set(NX_PPP *ppp_ptr, VOID (*nx_ppp_packet_send)(NX_PACKET *packet_ptr));
788 UINT    _nx_ppp_packet_send_set(NX_PPP *ppp_ptr, VOID (*nx_ppp_packet_send)(NX_PACKET *packet_ptr));
789 #endif /* NX_PPP_PPPOE_ENABLE  */
790 
791 /* Define internal PPP services. */
792 void    _nx_ppp_thread_entry(ULONG ppp_addr);
793 void    _nx_ppp_driver(NX_IP_DRIVER *driver_req_ptr);
794 void    _nx_ppp_receive_packet_get(NX_PPP *ppp_ptr, NX_PACKET **return_packet_ptr);
795 void    _nx_ppp_receive_packet_process(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
796 void    _nx_ppp_timeout(NX_PPP *ppp_ptr);
797 void    _nx_ppp_timer_entry(ULONG id);
798 void    _nx_ppp_netx_packet_transfer(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
799 void    _nx_ppp_process_deferred_raw_string_send(NX_PPP *ppp_ptr);
800 void    _nx_ppp_process_deferred_ip_packet_send(NX_PPP *ppp_ptr);
801 void    _nx_ppp_lcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
802 void    _nx_ppp_lcp_code_reject(NX_PPP *ppp_ptr, UCHAR *lcp_ptr);
803 void    _nx_ppp_lcp_configure_reply_send(NX_PPP *ppp_ptr, UINT configure_status, UCHAR *lcp_ptr, UCHAR *naked_list, UCHAR *rejected_list);
804 void    _nx_ppp_lcp_configure_request_send(NX_PPP *ppp_ptr);
805 UINT    _nx_ppp_lcp_configuration_retrieve(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list, UINT *configure_status);
806 void    _nx_ppp_lcp_nak_configure_list(NX_PPP *ppp_ptr, UCHAR *naked_list);
807 void    _nx_ppp_lcp_terminate_ack_send(NX_PPP *ppp_ptr);
808 void    _nx_ppp_lcp_terminate_request_send(NX_PPP *ppp_ptr);
809 void    _nx_ppp_pap_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
810 void    _nx_ppp_pap_authentication_request(NX_PPP *ppp_ptr);
811 UINT    _nx_ppp_pap_login_valid(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
812 void    _nx_ppp_pap_authentication_ack(NX_PPP *ppp_ptr);
813 void    _nx_ppp_pap_authentication_nak(NX_PPP *ppp_ptr);
814 void    _nx_ppp_chap_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
815 void    _nx_ppp_chap_challenge_send(NX_PPP *ppp_ptr);
816 void    _nx_ppp_chap_challenge_respond(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
817 UINT    _nx_ppp_chap_challenge_validate(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
818 void    _nx_ppp_ipcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
819 UINT    _nx_ppp_ipcp_configure_check(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list, UCHAR *good_data);
820 void    _nx_ppp_ipcp_configure_request_send(NX_PPP *ppp_ptr, UCHAR *negotiate_list);
821 void    _nx_ppp_ipcp_response_extract(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
822 void    _nx_ppp_ipcp_response_send(NX_PPP *ppp_ptr, UCHAR type, UCHAR *data, UCHAR length, NX_PACKET *cfg_packet_ptr);
823 void    _nx_ppp_ipcp_terminate_send(NX_PPP *ppp_ptr);
824 void    _nx_ppp_ipcp_terminate_ack_send(NX_PPP *ppp_ptr);
825 void    _nx_ppp_packet_transmit(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
826 UINT    _nx_ppp_check_crc(NX_PACKET *packet_ptr);
827 UINT    _nx_ppp_crc_append(NX_PACKET *packet_ptr, UCHAR crc[2]);
828 void    _nx_ppp_debug_log_capture(NX_PPP *ppp_ptr, UCHAR packet_type, NX_PACKET *packet_ptr);
829 void    _nx_ppp_debug_log_capture_protocol(NX_PPP *ppp_ptr);
830 void    _nx_ppp_hash_generator(unsigned char *hvalue,  unsigned char id, unsigned char *secret,  unsigned char *rand_value, UINT length);
831 void    _nx_ppp_lcp_ping_reply(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
832 void    _nx_ppp_lcp_ping_process_echo_reply(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr);
833 
834 #endif /* NX_PPP_SOURCE_CODE */
835 
836 /* Determine if a C++ compiler is being used.  If so, complete the standard
837    C conditional started above.  */
838 #ifdef   __cplusplus
839         }
840 #endif
841 
842 #endif /* NX_PPP_H */
843