Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 5:3f93dd1d4cb3 1 /*****************************************************************************
sam_grove 5:3f93dd1d4cb3 2 * ppp_oe.h - PPP Over Ethernet implementation for lwIP.
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc.
sam_grove 5:3f93dd1d4cb3 5 *
sam_grove 5:3f93dd1d4cb3 6 * The authors hereby grant permission to use, copy, modify, distribute,
sam_grove 5:3f93dd1d4cb3 7 * and license this software and its documentation for any purpose, provided
sam_grove 5:3f93dd1d4cb3 8 * that existing copyright notices are retained in all copies and that this
sam_grove 5:3f93dd1d4cb3 9 * notice and the following disclaimer are included verbatim in any
sam_grove 5:3f93dd1d4cb3 10 * distributions. No written agreement, license, or royalty fee is required
sam_grove 5:3f93dd1d4cb3 11 * for any of the authorized uses.
sam_grove 5:3f93dd1d4cb3 12 *
sam_grove 5:3f93dd1d4cb3 13 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
sam_grove 5:3f93dd1d4cb3 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
sam_grove 5:3f93dd1d4cb3 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
sam_grove 5:3f93dd1d4cb3 16 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
sam_grove 5:3f93dd1d4cb3 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
sam_grove 5:3f93dd1d4cb3 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
sam_grove 5:3f93dd1d4cb3 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
sam_grove 5:3f93dd1d4cb3 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
sam_grove 5:3f93dd1d4cb3 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
sam_grove 5:3f93dd1d4cb3 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 23 *
sam_grove 5:3f93dd1d4cb3 24 ******************************************************************************
sam_grove 5:3f93dd1d4cb3 25 * REVISION HISTORY
sam_grove 5:3f93dd1d4cb3 26 *
sam_grove 5:3f93dd1d4cb3 27 * 06-01-01 Marc Boucher <marc@mbsi.ca>
sam_grove 5:3f93dd1d4cb3 28 * Ported to lwIP.
sam_grove 5:3f93dd1d4cb3 29 *****************************************************************************/
sam_grove 5:3f93dd1d4cb3 30
sam_grove 5:3f93dd1d4cb3 31
sam_grove 5:3f93dd1d4cb3 32
sam_grove 5:3f93dd1d4cb3 33 /* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */
sam_grove 5:3f93dd1d4cb3 34
sam_grove 5:3f93dd1d4cb3 35 /*-
sam_grove 5:3f93dd1d4cb3 36 * Copyright (c) 2002 The NetBSD Foundation, Inc.
sam_grove 5:3f93dd1d4cb3 37 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 38 *
sam_grove 5:3f93dd1d4cb3 39 * This code is derived from software contributed to The NetBSD Foundation
sam_grove 5:3f93dd1d4cb3 40 * by Martin Husemann <martin@NetBSD.org>.
sam_grove 5:3f93dd1d4cb3 41 *
sam_grove 5:3f93dd1d4cb3 42 * Redistribution and use in source and binary forms, with or without
sam_grove 5:3f93dd1d4cb3 43 * modification, are permitted provided that the following conditions
sam_grove 5:3f93dd1d4cb3 44 * are met:
sam_grove 5:3f93dd1d4cb3 45 * 1. Redistributions of source code must retain the above copyright
sam_grove 5:3f93dd1d4cb3 46 * notice, this list of conditions and the following disclaimer.
sam_grove 5:3f93dd1d4cb3 47 * 2. Redistributions in binary form must reproduce the above copyright
sam_grove 5:3f93dd1d4cb3 48 * notice, this list of conditions and the following disclaimer in the
sam_grove 5:3f93dd1d4cb3 49 * documentation and/or other materials provided with the distribution.
sam_grove 5:3f93dd1d4cb3 50 * 3. All advertising materials mentioning features or use of this software
sam_grove 5:3f93dd1d4cb3 51 * must display the following acknowledgement:
sam_grove 5:3f93dd1d4cb3 52 * This product includes software developed by the NetBSD
sam_grove 5:3f93dd1d4cb3 53 * Foundation, Inc. and its contributors.
sam_grove 5:3f93dd1d4cb3 54 * 4. Neither the name of The NetBSD Foundation nor the names of its
sam_grove 5:3f93dd1d4cb3 55 * contributors may be used to endorse or promote products derived
sam_grove 5:3f93dd1d4cb3 56 * from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 57 *
sam_grove 5:3f93dd1d4cb3 58 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
sam_grove 5:3f93dd1d4cb3 59 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
sam_grove 5:3f93dd1d4cb3 60 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
sam_grove 5:3f93dd1d4cb3 61 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
sam_grove 5:3f93dd1d4cb3 62 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
sam_grove 5:3f93dd1d4cb3 63 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
sam_grove 5:3f93dd1d4cb3 64 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
sam_grove 5:3f93dd1d4cb3 65 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
sam_grove 5:3f93dd1d4cb3 66 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
sam_grove 5:3f93dd1d4cb3 67 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sam_grove 5:3f93dd1d4cb3 68 * POSSIBILITY OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 69 */
sam_grove 5:3f93dd1d4cb3 70 #ifndef PPP_OE_H
sam_grove 5:3f93dd1d4cb3 71 #define PPP_OE_H
sam_grove 5:3f93dd1d4cb3 72
sam_grove 5:3f93dd1d4cb3 73 #include "lwip/opt.h"
sam_grove 5:3f93dd1d4cb3 74
sam_grove 5:3f93dd1d4cb3 75 #if PPPOE_SUPPORT > 0
sam_grove 5:3f93dd1d4cb3 76
sam_grove 5:3f93dd1d4cb3 77 #include "netif/etharp.h"
sam_grove 5:3f93dd1d4cb3 78
sam_grove 5:3f93dd1d4cb3 79 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 80 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 81 #endif
sam_grove 5:3f93dd1d4cb3 82 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 83 struct pppoehdr {
sam_grove 5:3f93dd1d4cb3 84 PACK_STRUCT_FIELD(u8_t vertype);
sam_grove 5:3f93dd1d4cb3 85 PACK_STRUCT_FIELD(u8_t code);
sam_grove 5:3f93dd1d4cb3 86 PACK_STRUCT_FIELD(u16_t session);
sam_grove 5:3f93dd1d4cb3 87 PACK_STRUCT_FIELD(u16_t plen);
sam_grove 5:3f93dd1d4cb3 88 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 89 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 90 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 91 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 92 #endif
sam_grove 5:3f93dd1d4cb3 93
sam_grove 5:3f93dd1d4cb3 94 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 95 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 96 #endif
sam_grove 5:3f93dd1d4cb3 97 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 98 struct pppoetag {
sam_grove 5:3f93dd1d4cb3 99 PACK_STRUCT_FIELD(u16_t tag);
sam_grove 5:3f93dd1d4cb3 100 PACK_STRUCT_FIELD(u16_t len);
sam_grove 5:3f93dd1d4cb3 101 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 102 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 103 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 104 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 105 #endif
sam_grove 5:3f93dd1d4cb3 106
sam_grove 5:3f93dd1d4cb3 107
sam_grove 5:3f93dd1d4cb3 108 #define PPPOE_STATE_INITIAL 0
sam_grove 5:3f93dd1d4cb3 109 #define PPPOE_STATE_PADI_SENT 1
sam_grove 5:3f93dd1d4cb3 110 #define PPPOE_STATE_PADR_SENT 2
sam_grove 5:3f93dd1d4cb3 111 #define PPPOE_STATE_SESSION 3
sam_grove 5:3f93dd1d4cb3 112 #define PPPOE_STATE_CLOSING 4
sam_grove 5:3f93dd1d4cb3 113 /* passive */
sam_grove 5:3f93dd1d4cb3 114 #define PPPOE_STATE_PADO_SENT 1
sam_grove 5:3f93dd1d4cb3 115
sam_grove 5:3f93dd1d4cb3 116 #define PPPOE_HEADERLEN sizeof(struct pppoehdr)
sam_grove 5:3f93dd1d4cb3 117 #define PPPOE_VERTYPE 0x11 /* VER=1, TYPE = 1 */
sam_grove 5:3f93dd1d4cb3 118
sam_grove 5:3f93dd1d4cb3 119 #define PPPOE_TAG_EOL 0x0000 /* end of list */
sam_grove 5:3f93dd1d4cb3 120 #define PPPOE_TAG_SNAME 0x0101 /* service name */
sam_grove 5:3f93dd1d4cb3 121 #define PPPOE_TAG_ACNAME 0x0102 /* access concentrator name */
sam_grove 5:3f93dd1d4cb3 122 #define PPPOE_TAG_HUNIQUE 0x0103 /* host unique */
sam_grove 5:3f93dd1d4cb3 123 #define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */
sam_grove 5:3f93dd1d4cb3 124 #define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */
sam_grove 5:3f93dd1d4cb3 125 #define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */
sam_grove 5:3f93dd1d4cb3 126 #define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */
sam_grove 5:3f93dd1d4cb3 127 #define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */
sam_grove 5:3f93dd1d4cb3 128 #define PPPOE_TAG_GENERIC_ERR 0x0203 /* gerneric error */
sam_grove 5:3f93dd1d4cb3 129
sam_grove 5:3f93dd1d4cb3 130 #define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */
sam_grove 5:3f93dd1d4cb3 131 #define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer */
sam_grove 5:3f93dd1d4cb3 132 #define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */
sam_grove 5:3f93dd1d4cb3 133 #define PPPOE_CODE_PADS 0x65 /* Active Discovery Session confirmation */
sam_grove 5:3f93dd1d4cb3 134 #define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */
sam_grove 5:3f93dd1d4cb3 135
sam_grove 5:3f93dd1d4cb3 136 #ifndef ETHERMTU
sam_grove 5:3f93dd1d4cb3 137 #define ETHERMTU 1500
sam_grove 5:3f93dd1d4cb3 138 #endif
sam_grove 5:3f93dd1d4cb3 139
sam_grove 5:3f93dd1d4cb3 140 /* two byte PPP protocol discriminator, then IP data */
sam_grove 5:3f93dd1d4cb3 141 #define PPPOE_MAXMTU (ETHERMTU-PPPOE_HEADERLEN-2)
sam_grove 5:3f93dd1d4cb3 142
sam_grove 5:3f93dd1d4cb3 143 #ifndef PPPOE_MAX_AC_COOKIE_LEN
sam_grove 5:3f93dd1d4cb3 144 #define PPPOE_MAX_AC_COOKIE_LEN 64
sam_grove 5:3f93dd1d4cb3 145 #endif
sam_grove 5:3f93dd1d4cb3 146
sam_grove 5:3f93dd1d4cb3 147 struct pppoe_softc {
sam_grove 5:3f93dd1d4cb3 148 struct pppoe_softc *next;
sam_grove 5:3f93dd1d4cb3 149 struct netif *sc_ethif; /* ethernet interface we are using */
sam_grove 5:3f93dd1d4cb3 150 int sc_pd; /* ppp unit number */
sam_grove 5:3f93dd1d4cb3 151 void (*sc_linkStatusCB)(int pd, int up);
sam_grove 5:3f93dd1d4cb3 152
sam_grove 5:3f93dd1d4cb3 153 int sc_state; /* discovery phase or session connected */
sam_grove 5:3f93dd1d4cb3 154 struct eth_addr sc_dest; /* hardware address of concentrator */
sam_grove 5:3f93dd1d4cb3 155 u16_t sc_session; /* PPPoE session id */
sam_grove 5:3f93dd1d4cb3 156
sam_grove 5:3f93dd1d4cb3 157 #ifdef PPPOE_TODO
sam_grove 5:3f93dd1d4cb3 158 char *sc_service_name; /* if != NULL: requested name of service */
sam_grove 5:3f93dd1d4cb3 159 char *sc_concentrator_name; /* if != NULL: requested concentrator id */
sam_grove 5:3f93dd1d4cb3 160 #endif /* PPPOE_TODO */
sam_grove 5:3f93dd1d4cb3 161 u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
sam_grove 5:3f93dd1d4cb3 162 size_t sc_ac_cookie_len; /* length of cookie data */
sam_grove 5:3f93dd1d4cb3 163 #ifdef PPPOE_SERVER
sam_grove 5:3f93dd1d4cb3 164 u8_t *sc_hunique; /* content of host unique we must echo back */
sam_grove 5:3f93dd1d4cb3 165 size_t sc_hunique_len; /* length of host unique */
sam_grove 5:3f93dd1d4cb3 166 #endif
sam_grove 5:3f93dd1d4cb3 167 int sc_padi_retried; /* number of PADI retries already done */
sam_grove 5:3f93dd1d4cb3 168 int sc_padr_retried; /* number of PADR retries already done */
sam_grove 5:3f93dd1d4cb3 169 };
sam_grove 5:3f93dd1d4cb3 170
sam_grove 5:3f93dd1d4cb3 171
sam_grove 5:3f93dd1d4cb3 172 #define pppoe_init() /* compatibility define, no initialization needed */
sam_grove 5:3f93dd1d4cb3 173
sam_grove 5:3f93dd1d4cb3 174 err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr);
sam_grove 5:3f93dd1d4cb3 175 err_t pppoe_destroy(struct netif *ifp);
sam_grove 5:3f93dd1d4cb3 176
sam_grove 5:3f93dd1d4cb3 177 int pppoe_connect(struct pppoe_softc *sc);
sam_grove 5:3f93dd1d4cb3 178 void pppoe_disconnect(struct pppoe_softc *sc);
sam_grove 5:3f93dd1d4cb3 179
sam_grove 5:3f93dd1d4cb3 180 void pppoe_disc_input(struct netif *netif, struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 181 void pppoe_data_input(struct netif *netif, struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 182
sam_grove 5:3f93dd1d4cb3 183 err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb);
sam_grove 5:3f93dd1d4cb3 184
sam_grove 5:3f93dd1d4cb3 185 /** used in ppp.c */
sam_grove 5:3f93dd1d4cb3 186 #define PPPOE_HDRLEN (sizeof(struct eth_hdr) + PPPOE_HEADERLEN)
sam_grove 5:3f93dd1d4cb3 187
sam_grove 5:3f93dd1d4cb3 188 #endif /* PPPOE_SUPPORT */
sam_grove 5:3f93dd1d4cb3 189
sam_grove 5:3f93dd1d4cb3 190 #endif /* PPP_OE_H */