mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 06:35:57 +00:00
PPP: introduce ppp_set_passive and ppp_set_silent
There is two passive modes for PPPoS, passive more, for which we will try to connect and then listen silently, and silent mode, for which we will listen silently from the beginning. Introduce ppp_set_passive and ppp_set_silent so the mode can be chosen before connecting/listening.
This commit is contained in:
parent
b97c4d96e2
commit
e7069d6e82
11
doc/ppp.txt
11
doc/ppp.txt
|
@ -326,6 +326,17 @@ ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password");
|
||||||
/* Require peer to authenticate */
|
/* Require peer to authenticate */
|
||||||
ppp_set_auth_required(ppp, 1);
|
ppp_set_auth_required(ppp, 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only for PPPoS, the PPP session should be up and waiting for input.
|
||||||
|
*
|
||||||
|
* Note: for PPPoS, ppp_connect() and ppp_listen() are actually the same thing.
|
||||||
|
* The listen call is meant for future support of PPPoE and PPPoL2TP server
|
||||||
|
* mode, where we will need to negotiate the incoming PPPoE session or L2TP
|
||||||
|
* session before initiating PPP itself. We need this call because there is
|
||||||
|
* two passive modes for PPPoS, ppp_set_passive and ppp_set_silent.
|
||||||
|
*/
|
||||||
|
ppp_set_silent(pppos, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate PPP listener (i.e. wait for an incoming connection), can only
|
* 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).
|
* be called if PPP session is in the dead state (i.e. disconnected).
|
||||||
|
|
|
@ -509,6 +509,20 @@ void ppp_set_mppe(ppp_pcb *pcb, u8_t flags);
|
||||||
*/
|
*/
|
||||||
#define ppp_set_listen_time(ppp, intval) (ppp->settings.listen_time = intval)
|
#define ppp_set_listen_time(ppp, intval) (ppp->settings.listen_time = intval)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enables the "passive" option in the LCP. With this option, we will attempt
|
||||||
|
* to initiate a connection; if no reply is received from the peer, we will
|
||||||
|
* then just wait passively for a valid LCP packet from the peer.
|
||||||
|
*/
|
||||||
|
#define ppp_set_passive(ppp, boolval) (ppp->lcp_wantoptions.passive = boolval)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* With this option, we will not transmit LCP packets to initiate a connection
|
||||||
|
* until a valid LCP packet is received from the peer. This is what we usually
|
||||||
|
* call the server mode.
|
||||||
|
*/
|
||||||
|
#define ppp_set_silent(ppp, boolval) (ppp->lcp_wantoptions.silent = boolval)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a PPP interface as the default network interface
|
* Set a PPP interface as the default network interface
|
||||||
* (used to output all packets for which no specific route is found).
|
* (used to output all packets for which no specific route is found).
|
||||||
|
|
|
@ -288,18 +288,12 @@ err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
|
||||||
* established before calling this.
|
* established before calling this.
|
||||||
*/
|
*/
|
||||||
err_t ppp_listen(ppp_pcb *pcb) {
|
err_t ppp_listen(ppp_pcb *pcb) {
|
||||||
lcp_options *lcp_wo;
|
|
||||||
|
|
||||||
if (pcb->phase != PPP_PHASE_DEAD) {
|
if (pcb->phase != PPP_PHASE_DEAD) {
|
||||||
return ERR_ALREADY;
|
return ERR_ALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
PPPDEBUG(LOG_DEBUG, ("ppp_listen[%d]\n", pcb->netif->num));
|
PPPDEBUG(LOG_DEBUG, ("ppp_listen[%d]\n", pcb->netif->num));
|
||||||
|
|
||||||
/* Wait passively */
|
|
||||||
lcp_wo = &pcb->lcp_wantoptions;
|
|
||||||
lcp_wo->silent = 1;
|
|
||||||
|
|
||||||
if (pcb->link_cb->listen) {
|
if (pcb->link_cb->listen) {
|
||||||
return pcb->link_cb->listen(pcb, pcb->link_ctx_cb);
|
return pcb->link_cb->listen(pcb, pcb->link_ctx_cb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user