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 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
sam_grove 5:3f93dd1d4cb3 3 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 4 *
sam_grove 5:3f93dd1d4cb3 5 * Redistribution and use in source and binary forms, with or without modification,
sam_grove 5:3f93dd1d4cb3 6 * are permitted provided that the following conditions are met:
sam_grove 5:3f93dd1d4cb3 7 *
sam_grove 5:3f93dd1d4cb3 8 * 1. Redistributions of source code must retain the above copyright notice,
sam_grove 5:3f93dd1d4cb3 9 * this list of conditions and the following disclaimer.
sam_grove 5:3f93dd1d4cb3 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
sam_grove 5:3f93dd1d4cb3 11 * this list of conditions and the following disclaimer in the documentation
sam_grove 5:3f93dd1d4cb3 12 * and/or other materials provided with the distribution.
sam_grove 5:3f93dd1d4cb3 13 * 3. The name of the author may not be used to endorse or promote products
sam_grove 5:3f93dd1d4cb3 14 * derived from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 15 *
sam_grove 5:3f93dd1d4cb3 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
sam_grove 5:3f93dd1d4cb3 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
sam_grove 5:3f93dd1d4cb3 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
sam_grove 5:3f93dd1d4cb3 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
sam_grove 5:3f93dd1d4cb3 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
sam_grove 5:3f93dd1d4cb3 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
sam_grove 5:3f93dd1d4cb3 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
sam_grove 5:3f93dd1d4cb3 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sam_grove 5:3f93dd1d4cb3 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
sam_grove 5:3f93dd1d4cb3 25 * OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 26 *
sam_grove 5:3f93dd1d4cb3 27 * This file is part of the lwIP TCP/IP stack.
sam_grove 5:3f93dd1d4cb3 28 *
sam_grove 5:3f93dd1d4cb3 29 * Author: Adam Dunkels <adam@sics.se>
sam_grove 5:3f93dd1d4cb3 30 *
sam_grove 5:3f93dd1d4cb3 31 */
sam_grove 5:3f93dd1d4cb3 32
sam_grove 5:3f93dd1d4cb3 33 #ifndef __LWIP_PBUF_H__
sam_grove 5:3f93dd1d4cb3 34 #define __LWIP_PBUF_H__
sam_grove 5:3f93dd1d4cb3 35
sam_grove 5:3f93dd1d4cb3 36 #include "lwip/opt.h"
sam_grove 5:3f93dd1d4cb3 37 #include "lwip/err.h"
sam_grove 5:3f93dd1d4cb3 38
sam_grove 5:3f93dd1d4cb3 39 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 40 extern "C" {
sam_grove 5:3f93dd1d4cb3 41 #endif
sam_grove 5:3f93dd1d4cb3 42
sam_grove 5:3f93dd1d4cb3 43 /** Currently, the pbuf_custom code is only needed for one specific configuration
sam_grove 5:3f93dd1d4cb3 44 * of IP_FRAG */
sam_grove 5:3f93dd1d4cb3 45 #define LWIP_SUPPORT_CUSTOM_PBUF (IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF)
sam_grove 5:3f93dd1d4cb3 46
sam_grove 5:3f93dd1d4cb3 47 #define PBUF_TRANSPORT_HLEN 20
sam_grove 5:3f93dd1d4cb3 48 #define PBUF_IP_HLEN 20
sam_grove 5:3f93dd1d4cb3 49
sam_grove 5:3f93dd1d4cb3 50 typedef enum {
sam_grove 5:3f93dd1d4cb3 51 PBUF_TRANSPORT,
sam_grove 5:3f93dd1d4cb3 52 PBUF_IP,
sam_grove 5:3f93dd1d4cb3 53 PBUF_LINK,
sam_grove 5:3f93dd1d4cb3 54 PBUF_RAW
sam_grove 5:3f93dd1d4cb3 55 } pbuf_layer;
sam_grove 5:3f93dd1d4cb3 56
sam_grove 5:3f93dd1d4cb3 57 typedef enum {
sam_grove 5:3f93dd1d4cb3 58 PBUF_RAM, /* pbuf data is stored in RAM */
sam_grove 5:3f93dd1d4cb3 59 PBUF_ROM, /* pbuf data is stored in ROM */
sam_grove 5:3f93dd1d4cb3 60 PBUF_REF, /* pbuf comes from the pbuf pool */
sam_grove 5:3f93dd1d4cb3 61 PBUF_POOL /* pbuf payload refers to RAM */
sam_grove 5:3f93dd1d4cb3 62 } pbuf_type;
sam_grove 5:3f93dd1d4cb3 63
sam_grove 5:3f93dd1d4cb3 64
sam_grove 5:3f93dd1d4cb3 65 /** indicates this packet's data should be immediately passed to the application */
sam_grove 5:3f93dd1d4cb3 66 #define PBUF_FLAG_PUSH 0x01U
sam_grove 5:3f93dd1d4cb3 67 /** indicates this is a custom pbuf: pbuf_free and pbuf_header handle such a
sam_grove 5:3f93dd1d4cb3 68 a pbuf differently */
sam_grove 5:3f93dd1d4cb3 69 #define PBUF_FLAG_IS_CUSTOM 0x02U
sam_grove 5:3f93dd1d4cb3 70 /** indicates this pbuf is UDP multicast to be looped back */
sam_grove 5:3f93dd1d4cb3 71 #define PBUF_FLAG_MCASTLOOP 0x04U
sam_grove 5:3f93dd1d4cb3 72
sam_grove 5:3f93dd1d4cb3 73 struct pbuf {
sam_grove 5:3f93dd1d4cb3 74 /** next pbuf in singly linked pbuf chain */
sam_grove 5:3f93dd1d4cb3 75 struct pbuf *next;
sam_grove 5:3f93dd1d4cb3 76
sam_grove 5:3f93dd1d4cb3 77 /** pointer to the actual data in the buffer */
sam_grove 5:3f93dd1d4cb3 78 void *payload;
sam_grove 5:3f93dd1d4cb3 79
sam_grove 5:3f93dd1d4cb3 80 /**
sam_grove 5:3f93dd1d4cb3 81 * total length of this buffer and all next buffers in chain
sam_grove 5:3f93dd1d4cb3 82 * belonging to the same packet.
sam_grove 5:3f93dd1d4cb3 83 *
sam_grove 5:3f93dd1d4cb3 84 * For non-queue packet chains this is the invariant:
sam_grove 5:3f93dd1d4cb3 85 * p->tot_len == p->len + (p->next? p->next->tot_len: 0)
sam_grove 5:3f93dd1d4cb3 86 */
sam_grove 5:3f93dd1d4cb3 87 u16_t tot_len;
sam_grove 5:3f93dd1d4cb3 88
sam_grove 5:3f93dd1d4cb3 89 /** length of this buffer */
sam_grove 5:3f93dd1d4cb3 90 u16_t len;
sam_grove 5:3f93dd1d4cb3 91
sam_grove 5:3f93dd1d4cb3 92 /** pbuf_type as u8_t instead of enum to save space */
sam_grove 5:3f93dd1d4cb3 93 u8_t /*pbuf_type*/ type;
sam_grove 5:3f93dd1d4cb3 94
sam_grove 5:3f93dd1d4cb3 95 /** misc flags */
sam_grove 5:3f93dd1d4cb3 96 u8_t flags;
sam_grove 5:3f93dd1d4cb3 97
sam_grove 5:3f93dd1d4cb3 98 /**
sam_grove 5:3f93dd1d4cb3 99 * the reference count always equals the number of pointers
sam_grove 5:3f93dd1d4cb3 100 * that refer to this pbuf. This can be pointers from an application,
sam_grove 5:3f93dd1d4cb3 101 * the stack itself, or pbuf->next pointers from a chain.
sam_grove 5:3f93dd1d4cb3 102 */
sam_grove 5:3f93dd1d4cb3 103 u16_t ref;
sam_grove 5:3f93dd1d4cb3 104 };
sam_grove 5:3f93dd1d4cb3 105
sam_grove 5:3f93dd1d4cb3 106 #if LWIP_SUPPORT_CUSTOM_PBUF
sam_grove 5:3f93dd1d4cb3 107 /** Prototype for a function to free a custom pbuf */
sam_grove 5:3f93dd1d4cb3 108 typedef void (*pbuf_free_custom_fn)(struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 109
sam_grove 5:3f93dd1d4cb3 110 /** A custom pbuf: like a pbuf, but following a function pointer to free it. */
sam_grove 5:3f93dd1d4cb3 111 struct pbuf_custom {
sam_grove 5:3f93dd1d4cb3 112 /** The actual pbuf */
sam_grove 5:3f93dd1d4cb3 113 struct pbuf pbuf;
sam_grove 5:3f93dd1d4cb3 114 /** This function is called when pbuf_free deallocates this pbuf(_custom) */
sam_grove 5:3f93dd1d4cb3 115 pbuf_free_custom_fn custom_free_function;
sam_grove 5:3f93dd1d4cb3 116 };
sam_grove 5:3f93dd1d4cb3 117 #endif /* LWIP_SUPPORT_CUSTOM_PBUF */
sam_grove 5:3f93dd1d4cb3 118
sam_grove 5:3f93dd1d4cb3 119 /* Initializes the pbuf module. This call is empty for now, but may not be in future. */
sam_grove 5:3f93dd1d4cb3 120 #define pbuf_init()
sam_grove 5:3f93dd1d4cb3 121
sam_grove 5:3f93dd1d4cb3 122 struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type);
sam_grove 5:3f93dd1d4cb3 123 #if LWIP_SUPPORT_CUSTOM_PBUF
sam_grove 5:3f93dd1d4cb3 124 struct pbuf *pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type,
sam_grove 5:3f93dd1d4cb3 125 struct pbuf_custom *p, void *payload_mem,
sam_grove 5:3f93dd1d4cb3 126 u16_t payload_mem_len);
sam_grove 5:3f93dd1d4cb3 127 #endif /* LWIP_SUPPORT_CUSTOM_PBUF */
sam_grove 5:3f93dd1d4cb3 128 void pbuf_realloc(struct pbuf *p, u16_t size);
sam_grove 5:3f93dd1d4cb3 129 u8_t pbuf_header(struct pbuf *p, s16_t header_size);
sam_grove 5:3f93dd1d4cb3 130 void pbuf_ref(struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 131 u8_t pbuf_free(struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 132 u8_t pbuf_clen(struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 133 void pbuf_cat(struct pbuf *head, struct pbuf *tail);
sam_grove 5:3f93dd1d4cb3 134 void pbuf_chain(struct pbuf *head, struct pbuf *tail);
sam_grove 5:3f93dd1d4cb3 135 struct pbuf *pbuf_dechain(struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 136 err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from);
sam_grove 5:3f93dd1d4cb3 137 u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
sam_grove 5:3f93dd1d4cb3 138 err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len);
sam_grove 5:3f93dd1d4cb3 139 struct pbuf *pbuf_coalesce(struct pbuf *p, pbuf_layer layer);
sam_grove 5:3f93dd1d4cb3 140 #if LWIP_CHECKSUM_ON_COPY
sam_grove 5:3f93dd1d4cb3 141 err_t pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr,
sam_grove 5:3f93dd1d4cb3 142 u16_t len, u16_t *chksum);
sam_grove 5:3f93dd1d4cb3 143 #endif /* LWIP_CHECKSUM_ON_COPY */
sam_grove 5:3f93dd1d4cb3 144
sam_grove 5:3f93dd1d4cb3 145 u8_t pbuf_get_at(struct pbuf* p, u16_t offset);
sam_grove 5:3f93dd1d4cb3 146 u16_t pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n);
sam_grove 5:3f93dd1d4cb3 147 u16_t pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset);
sam_grove 5:3f93dd1d4cb3 148 u16_t pbuf_strstr(struct pbuf* p, const char* substr);
sam_grove 5:3f93dd1d4cb3 149
sam_grove 5:3f93dd1d4cb3 150 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 151 }
sam_grove 5:3f93dd1d4cb3 152 #endif
sam_grove 5:3f93dd1d4cb3 153
sam_grove 5:3f93dd1d4cb3 154 #endif /* __LWIP_PBUF_H__ */