PPP, Documentation: add PPP server(listener) documentation

Now that creating a PPP listener session is a bit less obvious than
before (but much versatile!), add documentation about the most common
way to setup a PPP listener.
This commit is contained in:
Sylvain Rochet 2016-06-26 20:32:28 +02:00
parent 3d684cda23
commit 6fb074874b

View File

@ -171,6 +171,7 @@ static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
* to do a much better signaling here ;-) * to do a much better signaling here ;-)
*/ */
ppp_connect(pcb, 30); ppp_connect(pcb, 30);
/* OR ppp_listen(pcb); */
} }
@ -272,8 +273,8 @@ ppp_set_default(ppp);
/* /*
* Initiate PPP connection * Initiate PPP client connection
* ======================= * ==============================
*/ */
/* /*
@ -284,6 +285,42 @@ u16_t holdoff = 0;
ppp_connect(ppp, holdoff); ppp_connect(ppp, holdoff);
/*
* Initiate PPP server listener
* ============================
*/
/*
* Basic PPP server configuration. Can only be set if PPP session is in the
* dead state (i.e. disconnected). We don't need to provide thread-safe
* equivalents through PPPAPI because those helpers are only changing
* structure members.
*/
ip4_addr_t addr;
/* Set our address */
IP4_ADDR(&addr, 192,168,0,1);
ppp_set_ipcp_ouraddr(ppp, &addr);
/* Set peer(his) address */
IP4_ADDR(&addr, 192,168,0,2);
ppp_set_ipcp_hisaddr(ppp, &addr);
/* Set primary DNS server */
IP4_ADDR(&addr, 192,168,10,20);
ppp_set_ipcp_dnsaddr(ppp, 0, &addr);
/* Set secondary DNS server */
IP4_ADDR(&addr, 192,168,10,21);
ppp_set_ipcp_dnsaddr(ppp, 1, &addr);
/*
* Initiate PPP listener (i.e. wait for an incoming connection), can only
* be called if PPP session is in the dead state (i.e. disconnected).
*/
ppp_listen(ppp);
/* /*
* Closing PPP connection * Closing PPP connection
* ====================== * ======================