mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-03 21:32:08 +00:00
PPP, prepare new callbacks for low level protocols
New callbacks: write and netif_output
This commit is contained in:
parent
f8501478f6
commit
45bfccfddc
@ -349,6 +349,10 @@ typedef struct ppp_pcb_rx_s {
|
||||
/*
|
||||
* PPP interface control block.
|
||||
*/
|
||||
typedef void (*link_command_cb_fn)(void *pcb, u8_t command);
|
||||
typedef void (*link_write_cb_fn)(void *pcb, struct pbuf *p);
|
||||
typedef void (*link_netif_output_cb_fn)(void *pcb, struct pbuf *p, u_short protocol);
|
||||
|
||||
struct ppp_pcb_s {
|
||||
/* -- below are data that will NOT be cleared between two sessions */
|
||||
#if PPP_DEBUG
|
||||
@ -358,7 +362,9 @@ struct ppp_pcb_s {
|
||||
#if PPPOS_SUPPORT
|
||||
sio_fd_t fd; /* File device ID of port. */
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
void (*link_command_cb)(void *pcb, u8_t command);
|
||||
link_command_cb_fn link_command_cb;
|
||||
link_write_cb_fn link_write_cb;
|
||||
link_netif_output_cb_fn link_netif_output_cb;
|
||||
#if PPPOE_SUPPORT
|
||||
struct pppoe_softc *pppoe_sc;
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
|
@ -381,7 +381,7 @@ int ppp_init(void);
|
||||
ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||
|
||||
/* Set link callback function */
|
||||
#define ppp_link_set_callback(ppp, cb) (ppp->link_command_cb = cb)
|
||||
void ppp_link_set_callbacks(ppp_pcb *pcb, link_command_cb_fn command, link_write_cb_fn write, link_netif_output_cb_fn netif_output);
|
||||
|
||||
/* Initiate LCP open request */
|
||||
void ppp_start(ppp_pcb *pcb);
|
||||
|
@ -550,6 +550,12 @@ static void ppp_clear(ppp_pcb *pcb) {
|
||||
new_phase(pcb, PPP_PHASE_INITIALIZE);
|
||||
}
|
||||
|
||||
void ppp_link_set_callbacks(ppp_pcb *pcb, link_command_cb_fn command, link_write_cb_fn write, link_netif_output_cb_fn netif_output) {
|
||||
pcb->link_command_cb = command;
|
||||
pcb->link_write_cb = write;
|
||||
pcb->link_netif_output_cb = netif_output;
|
||||
}
|
||||
|
||||
static void ppp_do_open(void *arg) {
|
||||
ppp_pcb *pcb = (ppp_pcb*)arg;
|
||||
|
||||
|
@ -114,7 +114,7 @@ static char pppoe_error_tmp[PPPOE_ERRORSTRING_LEN];
|
||||
|
||||
|
||||
/* callback called from PPP core */
|
||||
static void pppoe_link_callback(void *pcb, u8_t command);
|
||||
static void pppoe_link_command_callback(void *pcb, u8_t command);
|
||||
|
||||
/* management routines */
|
||||
static err_t pppoe_destroy(struct pppoe_softc *sc);
|
||||
@ -173,12 +173,12 @@ pppoe_create(struct netif *pppif,
|
||||
pppoe_softc_list = sc;
|
||||
|
||||
ppp->pppoe_sc = sc;
|
||||
ppp_link_set_callback(ppp, pppoe_link_callback);
|
||||
ppp_link_set_callbacks(ppp, pppoe_link_command_callback, NULL, NULL);
|
||||
return ppp;
|
||||
}
|
||||
|
||||
/* Called by PPP core */
|
||||
static void pppoe_link_callback(void *pcb, u8_t command) {
|
||||
static void pppoe_link_command_callback(void *pcb, u8_t command) {
|
||||
struct pppoe_softc *sc = (struct pppoe_softc *)pcb;
|
||||
|
||||
switch(command) {
|
||||
|
@ -72,7 +72,7 @@
|
||||
#endif /* PPPOL2TP_AUTH_SUPPORT */
|
||||
|
||||
/* Prototypes for procedures local to this file. */
|
||||
static void pppol2tp_link_callback(void *pcb, u8_t command);
|
||||
static void pppol2tp_link_command_callback(void *pcb, u8_t command);
|
||||
static err_t pppol2tp_destroy(pppol2tp_pcb *l2tp); /* Destroy a L2TP control block */
|
||||
static err_t pppol2tp_connect(pppol2tp_pcb *l2tp); /* Be a LAC, connect to a LNS. */
|
||||
static void pppol2tp_disconnect(pppol2tp_pcb *l2tp); /* Disconnect */
|
||||
@ -130,12 +130,12 @@ ppp_pcb *pppol2tp_create(struct netif *pppif,
|
||||
#endif /* PPPOL2TP_AUTH_SUPPORT */
|
||||
|
||||
ppp->l2tp_pcb = l2tp;
|
||||
ppp_link_set_callback(ppp, pppol2tp_link_callback);
|
||||
ppp_link_set_callbacks(ppp, pppol2tp_link_command_callback, NULL, NULL);
|
||||
return ppp;
|
||||
}
|
||||
|
||||
/* Called by PPP core */
|
||||
static void pppol2tp_link_callback(void *pcb, u8_t command) {
|
||||
static void pppol2tp_link_command_callback(void *pcb, u8_t command) {
|
||||
pppol2tp_pcb *l2tp = (pppol2tp_pcb *)pcb;
|
||||
|
||||
switch(command) {
|
||||
|
Loading…
Reference in New Issue
Block a user