STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
ppp.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * ppp.h - Network Point to Point Protocol header file.
3 *
4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
5 * portions Copyright (c) 1997 Global Election Systems Inc.
6 *
7 * The authors hereby grant permission to use, copy, modify, distribute,
8 * and license this software and its documentation for any purpose, provided
9 * that existing copyright notices are retained in all copies and that this
10 * notice and the following disclaimer are included verbatim in any
11 * distributions. No written agreement, license, or royalty fee is required
12 * for any of the authorized uses.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 ******************************************************************************
26 * REVISION HISTORY
27 *
28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
29 * Ported to lwIP.
30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
31 * Original derived from BSD codes.
32 *****************************************************************************/
33 
34 #include "lwip/opt.h"
35 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
36 
37 #ifndef PPP_H
38 #define PPP_H
39 
40 #include "lwip/def.h"
41 #include "lwip/stats.h"
42 #include "lwip/mem.h"
43 #include "lwip/netif.h"
44 #include "lwip/sys.h"
45 #include "lwip/sio.h"
46 #include "lwip/lwip_timers.h"
47 #if PPP_IPV6_SUPPORT
48 #include "lwip/ip6_addr.h"
49 #endif /* PPP_IPV6_SUPPORT */
50 
51 /* Disable non-working or rarely used PPP feature, so rarely that we don't want to bloat opt.h with them */
52 #ifndef PPP_OPTIONS
53 #define PPP_OPTIONS 0
54 #endif
55 
56 #ifndef PPP_NOTIFY
57 #define PPP_NOTIFY 0
58 #endif
59 
60 #ifndef PPP_REMOTENAME
61 #define PPP_REMOTENAME 0
62 #endif
63 
64 #ifndef PPP_IDLETIMELIMIT
65 #define PPP_IDLETIMELIMIT 0
66 #endif
67 
68 #ifndef PPP_LCP_ADAPTIVE
69 #define PPP_LCP_ADAPTIVE 0
70 #endif
71 
72 #ifndef PPP_MAXCONNECT
73 #define PPP_MAXCONNECT 0
74 #endif
75 
76 #ifndef PPP_ALLOWED_ADDRS
77 #define PPP_ALLOWED_ADDRS 0
78 #endif
79 
80 #ifndef PPP_PROTOCOLNAME
81 #define PPP_PROTOCOLNAME 0
82 #endif
83 
84 #ifndef PPP_STATS_SUPPORT
85 #define PPP_STATS_SUPPORT 0
86 #endif
87 
88 #ifndef DEFLATE_SUPPORT
89 #define DEFLATE_SUPPORT 0
90 #endif
91 
92 #ifndef BSDCOMPRESS_SUPPORT
93 #define BSDCOMPRESS_SUPPORT 0
94 #endif
95 
96 #ifndef PREDICTOR_SUPPORT
97 #define PREDICTOR_SUPPORT 0
98 #endif
99 
100 /*************************
101 *** PUBLIC DEFINITIONS ***
102 *************************/
103 
104 /*
105  * The basic PPP frame.
106  */
107 #define PPP_HDRLEN 4 /* octets for standard ppp header */
108 #define PPP_FCSLEN 2 /* octets for FCS */
109 
110 /*
111  * Values for phase.
112  */
113 #define PPP_PHASE_DEAD 0
114 #define PPP_PHASE_INITIALIZE 1
115 #define PPP_PHASE_SERIALCONN 2
116 #define PPP_PHASE_DORMANT 3
117 #define PPP_PHASE_ESTABLISH 4
118 #define PPP_PHASE_AUTHENTICATE 5
119 #define PPP_PHASE_CALLBACK 6
120 #define PPP_PHASE_NETWORK 7
121 #define PPP_PHASE_RUNNING 8
122 #define PPP_PHASE_TERMINATE 9
123 #define PPP_PHASE_DISCONNECT 10
124 #define PPP_PHASE_HOLDOFF 11
125 #define PPP_PHASE_MASTER 12
126 
127 /* Error codes. */
128 #define PPPERR_NONE 0 /* No error. */
129 #define PPPERR_PARAM 1 /* Invalid parameter. */
130 #define PPPERR_OPEN 2 /* Unable to open PPP session. */
131 #define PPPERR_DEVICE 3 /* Invalid I/O device for PPP. */
132 #define PPPERR_ALLOC 4 /* Unable to allocate resources. */
133 #define PPPERR_USER 5 /* User interrupt. */
134 #define PPPERR_CONNECT 6 /* Connection lost. */
135 #define PPPERR_AUTHFAIL 7 /* Failed authentication challenge. */
136 #define PPPERR_PROTOCOL 8 /* Failed to meet protocol. */
137 #define PPPERR_PEERDEAD 9 /* Connection timeout */
138 #define PPPERR_IDLETIMEOUT 10 /* Idle Timeout */
139 #define PPPERR_CONNECTTIME 11 /* Max connect time reached */
140 #define PPPERR_LOOPBACK 12 /* Loopback detected */
141 
142 /* Whether auth support is enabled at all */
143 #define PPP_AUTH_SUPPORT (PAP_SUPPORT || CHAP_SUPPORT || EAP_SUPPORT)
144 
145 /************************
146 *** PUBLIC DATA TYPES ***
147 ************************/
148 
149 /*
150  * Other headers require ppp_pcb definition for prototypes, but ppp_pcb
151  * require some structure definition from other headers as well, we are
152  * fixing the dependency loop here by declaring the ppp_pcb type then
153  * by including headers containing necessary struct definition for ppp_pcb
154  */
155 typedef struct ppp_pcb_s ppp_pcb;
156 
157 /* Type definitions for BSD code. */
158 #ifndef __u_char_defined
159 typedef unsigned long u_long;
160 typedef unsigned int u_int;
161 typedef unsigned short u_short;
162 typedef unsigned char u_char;
163 #endif
164 
165 #include "fsm.h"
166 #include "lcp.h"
167 #if CCP_SUPPORT
168 #include "ccp.h"
169 #endif /* CCP_SUPPORT */
170 #if MPPE_SUPPORT
171 #include "mppe.h"
172 #endif /* MPPE_SUPPORT */
173 #if PPP_IPV4_SUPPORT
174 #include "ipcp.h"
175 #endif /* PPP_IPV4_SUPPORT */
176 #if PPP_IPV6_SUPPORT
177 #include "ipv6cp.h"
178 #endif /* PPP_IPV6_SUPPORT */
179 #if PAP_SUPPORT
180 #include "upap.h"
181 #endif /* PAP_SUPPORT */
182 #if CHAP_SUPPORT
183 #include "chap-new.h"
184 #endif /* CHAP_SUPPORT */
185 #if EAP_SUPPORT
186 #include "eap.h"
187 #endif /* EAP_SUPPORT */
188 #if VJ_SUPPORT
189 #include "vj.h"
190 #endif /* VJ_SUPPORT */
191 
192 /* Link status callback function prototype */
193 typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb, int err_code, void *ctx);
194 
195 /*
196  * PPP configuration.
197  */
198 typedef struct ppp_settings_s {
199 
200 #if PPP_SERVER && PPP_AUTH_SUPPORT
201  unsigned int auth_required :1; /* Peer is required to authenticate */
202  unsigned int null_login :1; /* Username of "" and a password of "" are acceptable */
203 #endif /* PPP_SERVER && PPP_AUTH_SUPPORT */
204 #if PPP_REMOTENAME
205  unsigned int explicit_remote :1; /* remote_name specified with remotename opt */
206 #endif /* PPP_REMOTENAME */
207 #if PAP_SUPPORT
208  unsigned int refuse_pap :1; /* Don't proceed auth. with PAP */
209 #endif /* PAP_SUPPORT */
210 #if CHAP_SUPPORT
211  unsigned int refuse_chap :1; /* Don't proceed auth. with CHAP */
212 #endif /* CHAP_SUPPORT */
213 #if MSCHAP_SUPPORT
214  unsigned int refuse_mschap :1; /* Don't proceed auth. with MS-CHAP */
215  unsigned int refuse_mschap_v2 :1; /* Don't proceed auth. with MS-CHAPv2 */
216 #endif /* MSCHAP_SUPPORT */
217 #if EAP_SUPPORT
218  unsigned int refuse_eap :1; /* Don't proceed auth. with EAP */
219 #endif /* EAP_SUPPORT */
220 #if LWIP_DNS
221  unsigned int usepeerdns :1; /* Ask peer for DNS adds */
222 #endif /* LWIP_DNS */
223  unsigned int persist :1; /* Persist mode, always try to open the connection */
224 #if PRINTPKT_SUPPORT
225  unsigned int hide_password :1; /* Hide password in dumped packets */
226 #endif /* PRINTPKT_SUPPORT */
227  unsigned int noremoteip :1; /* Let him have no IP address */
228  unsigned int lax_recv :1; /* accept control chars in asyncmap */
229  unsigned int noendpoint :1; /* don't send/accept endpoint discriminator */
230 #if PPP_LCP_ADAPTIVE
231  unsigned int lcp_echo_adaptive :1; /* request echo only if the link was idle */
232 #endif /* PPP_LCP_ADAPTIVE */
233 #if MPPE_SUPPORT
234  unsigned int require_mppe :1; /* Require MPPE (Microsoft Point to Point Encryption) */
235  unsigned int refuse_mppe_40 :1; /* Allow MPPE 40-bit mode? */
236  unsigned int refuse_mppe_128 :1; /* Allow MPPE 128-bit mode? */
237  unsigned int refuse_mppe_stateful :1; /* Allow MPPE stateful mode? */
238 #endif /* MPPE_SUPPORT */
239 
240  u16_t listen_time; /* time to listen first (ms), waiting for peer to send LCP packet */
241 
242 #if PPP_IDLETIMELIMIT
243  u16_t idle_time_limit; /* Disconnect if idle for this many seconds */
244 #endif /* PPP_IDLETIMELIMIT */
245 #if PPP_MAXCONNECT
246  u32_t maxconnect; /* Maximum connect time (seconds) */
247 #endif /* PPP_MAXCONNECT */
248 
249 #if PPP_AUTH_SUPPORT
250  /* auth data */
251  const char *user; /* Username for PAP */
252  const char *passwd; /* Password for PAP, secret for CHAP */
253 #if PPP_REMOTENAME
254  char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
255 #endif /* PPP_REMOTENAME */
256 
257 #if PAP_SUPPORT
258  u8_t pap_timeout_time; /* Timeout (seconds) for auth-req retrans. */
259  u8_t pap_max_transmits; /* Number of auth-reqs sent */
260 #if PPP_SERVER
261  u8_t pap_req_timeout; /* Time to wait for auth-req from peer */
262 #endif /* PPP_SERVER */
263 #endif /* PAP_SUPPPORT */
264 
265 #if CHAP_SUPPORT
266  u8_t chap_timeout_time; /* Timeout (seconds) for retransmitting req */
267  u8_t chap_max_transmits; /* max # times to send challenge */
268 #if PPP_SERVER
269  u8_t chap_rechallenge_time; /* Time to wait for auth-req from peer */
270 #endif /* PPP_SERVER */
271 #endif /* CHAP_SUPPPORT */
272 
273 #if EAP_SUPPORT
274  u8_t eap_req_time; /* Time to wait (for retransmit/fail) */
275  u8_t eap_allow_req; /* Max Requests allowed */
276 #if PPP_SERVER
277  u8_t eap_timeout_time; /* Time to wait (for retransmit/fail) */
278  u8_t eap_max_transmits; /* Max Requests allowed */
279 #endif /* PPP_SERVER */
280 #endif /* EAP_SUPPORT */
281 
282 #endif /* PPP_AUTH_SUPPORT */
283 
284  u8_t fsm_timeout_time; /* Timeout time in seconds */
285  u8_t fsm_max_conf_req_transmits; /* Maximum Configure-Request transmissions */
286  u8_t fsm_max_term_transmits; /* Maximum Terminate-Request transmissions */
287  u8_t fsm_max_nak_loops; /* Maximum number of nak loops tolerated */
288 
289  u8_t lcp_loopbackfail; /* Number of times we receive our magic number from the peer
290  before deciding the link is looped-back. */
291  u8_t lcp_echo_interval; /* Interval between LCP echo-requests */
292  u8_t lcp_echo_fails; /* Tolerance to unanswered echo-requests */
293 
294 } ppp_settings;
295 
296 #if PPP_SERVER
297 struct ppp_addrs {
298 #if PPP_IPV4_SUPPORT
299  ip4_addr_t our_ipaddr, his_ipaddr, netmask;
300 #if LWIP_DNS
301  ip4_addr_t dns1, dns2;
302 #endif /* LWIP_DNS */
303 #endif /* PPP_IPV4_SUPPORT */
304 #if PPP_IPV6_SUPPORT
305  ip6_addr_t our6_ipaddr, his6_ipaddr;
306 #endif /* PPP_IPV6_SUPPORT */
307 };
308 #endif /* PPP_SERVER */
309 
310 /*
311  * PPP interface control block.
312  */
313 struct ppp_pcb_s {
314  /* -- below are data that will NOT be cleared between two sessions */
315  ppp_settings settings;
316  const struct link_callbacks *link_cb;
317  void *link_ctx_cb;
318  void (*link_status_cb)(ppp_pcb *pcb, int err_code, void *ctx); /* Status change callback */
319 #if PPP_NOTIFY_PHASE
320  void (*notify_phase_cb)(ppp_pcb *pcb, u8_t phase, void *ctx); /* Notify phase callback */
321 #endif /* PPP_NOTIFY_PHASE */
322  void *ctx_cb; /* Callbacks optional pointer */
323  struct netif *netif; /* PPP interface */
324 
325  /* -- below are data that will be cleared between two sessions */
326 
327  /*
328  * phase must be the first member of cleared members, because it is used to know
329  * which part must not be cleared.
330  */
331  u8_t phase; /* where the link is at */
332  u8_t err_code; /* Code indicating why interface is down. */
333 
334  /* flags */
335 #if PPP_IPV4_SUPPORT
336  unsigned int ipcp_is_open :1; /* haven't called np_finished() */
337  unsigned int ipcp_is_up :1; /* have called ipcp_up() */
338  unsigned int if4_up :1; /* True when the IPv4 interface is up. */
339 #if 0 /* UNUSED - PROXY ARP */
340  unsigned int proxy_arp_set :1; /* Have created proxy arp entry */
341 #endif /* UNUSED - PROXY ARP */
342 #endif /* PPP_IPV4_SUPPORT */
343 #if PPP_IPV6_SUPPORT
344  unsigned int ipv6cp_is_up :1; /* have called ip6cp_up() */
345  unsigned int if6_up :1; /* True when the IPv6 interface is up. */
346 #endif /* PPP_IPV6_SUPPORT */
347  unsigned int lcp_echo_timer_running :1; /* set if a timer is running */
348 #if VJ_SUPPORT
349  unsigned int vj_enabled :1; /* Flag indicating VJ compression enabled. */
350 #endif /* VJ_SUPPORT */
351 #if CCP_SUPPORT
352  unsigned int ccp_all_rejected :1; /* we rejected all peer's options */
353 #endif /* CCP_SUPPORT */
354 #if MPPE_SUPPORT
355  unsigned int mppe_keys_set :1; /* Have the MPPE keys been set? */
356 #endif /* MPPE_SUPPORT */
357 
358 #if PPP_AUTH_SUPPORT
359  /* auth data */
360 #if PPP_SERVER && defined(HAVE_MULTILINK)
361  char peer_authname[MAXNAMELEN + 1]; /* The name by which the peer authenticated itself to us. */
362 #endif /* PPP_SERVER && defined(HAVE_MULTILINK) */
363  u16_t auth_pending; /* Records which authentication operations haven't completed yet. */
364  u16_t auth_done; /* Records which authentication operations have been completed. */
365 
366 #if PAP_SUPPORT
367  upap_state upap; /* PAP data */
368 #endif /* PAP_SUPPORT */
369 
370 #if CHAP_SUPPORT
371  chap_client_state chap_client; /* CHAP client data */
372 #if PPP_SERVER
373  chap_server_state chap_server; /* CHAP server data */
374 #endif /* PPP_SERVER */
375 #endif /* CHAP_SUPPORT */
376 
377 #if EAP_SUPPORT
378  eap_state eap; /* EAP data */
379 #endif /* EAP_SUPPORT */
380 #endif /* PPP_AUTH_SUPPORT */
381 
382  fsm lcp_fsm; /* LCP fsm structure */
383  lcp_options lcp_wantoptions; /* Options that we want to request */
384  lcp_options lcp_gotoptions; /* Options that peer ack'd */
385  lcp_options lcp_allowoptions; /* Options we allow peer to request */
386  lcp_options lcp_hisoptions; /* Options that we ack'd */
387  u16_t peer_mru; /* currently negotiated peer MRU */
388  u8_t lcp_echos_pending; /* Number of outstanding echo msgs */
389  u8_t lcp_echo_number; /* ID number of next echo frame */
390 
391  u8_t num_np_open; /* Number of network protocols which we have opened. */
392  u8_t num_np_up; /* Number of network protocols which have come up. */
393 
394 #if VJ_SUPPORT
395  struct vjcompress vj_comp; /* Van Jacobson compression header. */
396 #endif /* VJ_SUPPORT */
397 
398 #if CCP_SUPPORT
399  fsm ccp_fsm; /* CCP fsm structure */
400  ccp_options ccp_wantoptions; /* what to request the peer to use */
401  ccp_options ccp_gotoptions; /* what the peer agreed to do */
402  ccp_options ccp_allowoptions; /* what we'll agree to do */
403  ccp_options ccp_hisoptions; /* what we agreed to do */
404  u8_t ccp_localstate; /* Local state (mainly for handling reset-reqs and reset-acks). */
405  u8_t ccp_receive_method; /* Method chosen on receive path */
406  u8_t ccp_transmit_method; /* Method chosen on transmit path */
407 #if MPPE_SUPPORT
408  ppp_mppe_state mppe_comp; /* MPPE "compressor" structure */
409  ppp_mppe_state mppe_decomp; /* MPPE "decompressor" structure */
410 #endif /* MPPE_SUPPORT */
411 #endif /* CCP_SUPPORT */
412 
413 #if PPP_IPV4_SUPPORT
414  fsm ipcp_fsm; /* IPCP fsm structure */
415  ipcp_options ipcp_wantoptions; /* Options that we want to request */
416  ipcp_options ipcp_gotoptions; /* Options that peer ack'd */
417  ipcp_options ipcp_allowoptions; /* Options we allow peer to request */
418  ipcp_options ipcp_hisoptions; /* Options that we ack'd */
419 #endif /* PPP_IPV4_SUPPORT */
420 
421 #if PPP_IPV6_SUPPORT
422  fsm ipv6cp_fsm; /* IPV6CP fsm structure */
423  ipv6cp_options ipv6cp_wantoptions; /* Options that we want to request */
424  ipv6cp_options ipv6cp_gotoptions; /* Options that peer ack'd */
425  ipv6cp_options ipv6cp_allowoptions; /* Options we allow peer to request */
426  ipv6cp_options ipv6cp_hisoptions; /* Options that we ack'd */
427 #endif /* PPP_IPV6_SUPPORT */
428 };
429 
430 /************************
431  *** PUBLIC FUNCTIONS ***
432  ************************/
433 
434 /*
435  * Set auth helper, optional, you can either fill ppp_pcb->settings.
436  *
437  * Warning: Using PPPAUTHTYPE_ANY might have security consequences.
438  * RFC 1994 says:
439  *
440  * In practice, within or associated with each PPP server, there is a
441  * database which associates "user" names with authentication
442  * information ("secrets"). It is not anticipated that a particular
443  * named user would be authenticated by multiple methods. This would
444  * make the user vulnerable to attacks which negotiate the least secure
445  * method from among a set (such as PAP rather than CHAP). If the same
446  * secret was used, PAP would reveal the secret to be used later with
447  * CHAP.
448  *
449  * Instead, for each user name there should be an indication of exactly
450  * one method used to authenticate that user name. If a user needs to
451  * make use of different authentication methods under different
452  * circumstances, then distinct user names SHOULD be employed, each of
453  * which identifies exactly one authentication method.
454  *
455  */
456 #define PPPAUTHTYPE_NONE 0x00
457 #define PPPAUTHTYPE_PAP 0x01
458 #define PPPAUTHTYPE_CHAP 0x02
459 #define PPPAUTHTYPE_MSCHAP 0x04
460 #define PPPAUTHTYPE_MSCHAP_V2 0x08
461 #define PPPAUTHTYPE_EAP 0x10
462 #define PPPAUTHTYPE_ANY 0xff
463 void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
464 
465 /*
466  * Set a PPP interface as the default network interface
467  * (used to output all packets for which no specific route is found).
468  */
469 #define ppp_set_default(ppp) netif_set_default(ppp->netif)
470 
471 #if PPP_NOTIFY_PHASE
472 /*
473  * Set a PPP notify phase callback.
474  *
475  * This can be used for example to set a LED pattern depending on the
476  * current phase of the PPP session.
477  */
478 typedef void (*ppp_notify_phase_cb_fn)(ppp_pcb *pcb, u8_t phase, void *ctx);
479 void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
480 #endif /* PPP_NOTIFY_PHASE */
481 
482 /*
483  * Initiate a PPP connection.
484  *
485  * This can only be called if PPP is in the dead phase.
486  *
487  * Holdoff is the time to wait (in seconds) before initiating
488  * the connection.
489  *
490  * If this port connects to a modem, the modem connection must be
491  * established before calling this.
492  */
493 err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff);
494 
495 #if PPP_SERVER
496 /*
497  * Listen for an incoming PPP connection.
498  *
499  * This can only be called if PPP is in the dead phase.
500  *
501  * Local and remote interface IP addresses, as well as DNS are
502  * provided through a previously filled struct ppp_addrs.
503  *
504  * If this port connects to a modem, the modem connection must be
505  * established before calling this.
506  */
507 err_t ppp_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
508 #endif /* PPP_SERVER */
509 
510 /*
511  * Initiate the end of a PPP connection.
512  * Any outstanding packets in the queues are dropped.
513  *
514  * Setting nocarrier to 1 close the PPP connection without initiating the
515  * shutdown procedure. Always using nocarrier = 0 is still recommended,
516  * this is going to take a little longer time if your link is down, but
517  * is a safer choice for the PPP state machine.
518  *
519  * Return 0 on success, an error code on failure.
520  */
521 err_t ppp_close(ppp_pcb *pcb, u8_t nocarrier);
522 
523 /*
524  * Release the control block.
525  *
526  * This can only be called if PPP is in the dead phase.
527  *
528  * You must use ppp_close() before if you wish to terminate
529  * an established PPP session.
530  *
531  * Return 0 on success, an error code on failure.
532  */
533 err_t ppp_free(ppp_pcb *pcb);
534 
535 /*
536  * PPP IOCTL commands.
537  *
538  * Get the up status - 0 for down, non-zero for up. The argument must
539  * point to an int.
540  */
541 #define PPPCTLG_UPSTATUS 0
542 
543 /*
544  * Get the PPP error code. The argument must point to an int.
545  * Returns a PPPERR_* value.
546  */
547 #define PPPCTLG_ERRCODE 1
548 
549 /*
550  * Get the fd associated with a PPP over serial
551  */
552 #define PPPCTLG_FD 2
553 
554 /*
555  * Get and set parameters for the given connection.
556  * Return 0 on success, an error code on failure.
557  */
558 err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
559 
560 /* Get the PPP netif interface */
561 #define ppp_netif(ppp) (ppp->netif)
562 
563 /* Set an lwIP-style status-callback for the selected PPP device */
564 #define ppp_set_netif_statuscallback(ppp, status_cb) \
565  netif_set_status_callback(ppp->netif, status_cb);
566 
567 /* Set an lwIP-style link-callback for the selected PPP device */
568 #define ppp_set_netif_linkcallback(ppp, link_cb) \
569  netif_set_link_callback(ppp->netif, link_cb);
570 
571 #endif /* PPP_H */
572 
573 #endif /* PPP_SUPPORT */
574 
unsigned long u32_t
Definition: cc.h:42
s8_t err_t
Definition: err.h:47
Definition: netif.h:182
unsigned char u8_t
Definition: cc.h:38
unsigned short u16_t
Definition: cc.h:40