PPP, SERVER: added PPPoS server support

New function: ppp_listen(), listen for an incoming PPP connection.
This commit is contained in:
Sylvain Rochet
2015-02-28 22:41:18 +01:00
parent 89771de6d0
commit 371bc91d73
9 changed files with 166 additions and 1 deletions

View File

@@ -2049,7 +2049,9 @@
#endif
/**
* PPP_SERVER==1: Enable PPP server support (waiting for incoming PPP session). CURRENTLY NOT SUPPORTED! DO NOT SET!
* PPP_SERVER==1: Enable PPP server support (waiting for incoming PPP session).
*
* Currently only supported for PPPoS.
*/
#ifndef PPP_SERVER
#define PPP_SERVER 0

View File

@@ -92,6 +92,11 @@ struct pppapi_msg_msg {
struct {
u16_t holdoff;
} open;
#if PPP_SERVER
struct {
struct ppp_addrs *addrs;
} listen;
#endif /* PPP_SERVER */
struct {
u8_t nocarrier;
} close;
@@ -127,6 +132,9 @@ ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_add
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOL2TP_SUPPORT */
err_t pppapi_open(ppp_pcb *pcb, u16_t holdoff);
#if PPP_SERVER
err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
#endif /* PPP_SERVER */
err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
err_t pppapi_free(ppp_pcb *pcb);
err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);

View File

@@ -463,6 +463,21 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
*/
err_t ppp_open(ppp_pcb *pcb, u16_t holdoff);
#if PPP_SERVER
/*
* Listen for an incoming PPP connection.
*
* This can only be called if PPP is in the dead phase.
*
* Local and remote interface IP addresses, as well as DNS are
* provided through a previously filled struct ppp_addrs.
*
* If this port connects to a modem, the modem connection must be
* established before calling this.
*/
err_t ppp_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
#endif /* PPP_SERVER */
/*
* Initiate the end of a PPP connection.
* Any outstanding packets in the queues are dropped.

View File

@@ -143,6 +143,10 @@
struct link_callbacks {
/* Start a connection (e.g. Initiate discovery phase) */
err_t (*connect) (ppp_pcb *pcb, void *ctx);
#if PPP_SERVER
/* Listen for an incoming connection (Passive mode) */
err_t (*listen) (ppp_pcb *pcb, void *ctx, struct ppp_addrs *addrs);
#endif /* PPP_SERVER */
/* End a connection (i.e. initiate disconnect phase) */
void (*disconnect) (ppp_pcb *pcb, void *ctx);
/* Free lower protocol control block */