PPP: Moved PPPoS from ppp.c to pppos.c

Started removing from PPP core most of low level protocol PPPoS
handling to separate files, using the new low level PPP callbacks.
This commit is contained in:
Sylvain Rochet
2015-02-15 22:12:39 +01:00
parent 09b4485870
commit 9c15ffbb74
6 changed files with 843 additions and 760 deletions

View File

@@ -467,18 +467,6 @@ struct ppp_pcb_s {
*** PUBLIC FUNCTIONS ***
************************/
#if PPPOS_SUPPORT
/*
* Create a new PPP connection using the given serial I/O device.
*
* If this port connects to a modem, the modem connection must be
* established before calling this.
*
* Return 0 on success, an error code on failure.
*/
ppp_pcb *ppp_over_serial_create(struct netif *pppif, sio_fd_t fd, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOS_SUPPORT */
/*
* Set auth helper, optional, you can either fill ppp_pcb->settings.
*
@@ -566,13 +554,6 @@ int ppp_free(ppp_pcb *pcb);
*/
int ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg);
#if PPPOS_SUPPORT
/*
* PPP over Serial: this is the input function to be called for received data.
*/
void pppos_input(ppp_pcb *pcb, u_char* data, int len);
#endif /* PPPOS_SUPPORT */
/* Get the PPP netif interface */
#define ppp_netif(ppp) (ppp->netif)

View File

@@ -146,19 +146,6 @@
#define PPP_EAP 0xc227 /* Extensible Authentication Protocol */
#endif /* EAP_SUPPORT */
/*
* Values for FCS calculations.
*/
#define PPP_INITFCS 0xffff /* Initial FCS value */
#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
#if PPP_FCS_TABLE
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
#else
u16_t ppp_get_fcs(u8_t byte);
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ ppp_get_fcs(((fcs) ^ (c)) & 0xff))
#endif
/*
* What to do with network protocol (NP) packets.
*/

View File

@@ -0,0 +1,50 @@
/**
* @file
* Network Point to Point Protocol over Serial header file.
*
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/
#include "lwip/opt.h"
#if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef PPPOS_H
#define PPPOS_H
#include "ppp.h"
/* Create a new PPPoS session. */
ppp_pcb *ppp_over_serial_create(struct netif *pppif, sio_fd_t fd,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
/* PPP over Serial: this is the input function to be called for received data. */
void pppos_input(ppp_pcb *pcb, u_char* data, int len);
#endif /* PPPOS_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */