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 #ifndef __LWIP_UDP_H__
sam_grove 5:3f93dd1d4cb3 33 #define __LWIP_UDP_H__
sam_grove 5:3f93dd1d4cb3 34
sam_grove 5:3f93dd1d4cb3 35 #include "lwip/opt.h"
sam_grove 5:3f93dd1d4cb3 36
sam_grove 5:3f93dd1d4cb3 37 #if LWIP_UDP /* don't build if not configured for use in lwipopts.h */
sam_grove 5:3f93dd1d4cb3 38
sam_grove 5:3f93dd1d4cb3 39 #include "lwip/pbuf.h"
sam_grove 5:3f93dd1d4cb3 40 #include "lwip/netif.h"
sam_grove 5:3f93dd1d4cb3 41 #include "lwip/ip_addr.h"
sam_grove 5:3f93dd1d4cb3 42 #include "lwip/ip.h"
sam_grove 5:3f93dd1d4cb3 43
sam_grove 5:3f93dd1d4cb3 44 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 45 extern "C" {
sam_grove 5:3f93dd1d4cb3 46 #endif
sam_grove 5:3f93dd1d4cb3 47
sam_grove 5:3f93dd1d4cb3 48 #define UDP_HLEN 8
sam_grove 5:3f93dd1d4cb3 49
sam_grove 5:3f93dd1d4cb3 50 /* Fields are (of course) in network byte order. */
sam_grove 5:3f93dd1d4cb3 51 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 52 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 53 #endif
sam_grove 5:3f93dd1d4cb3 54 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 55 struct udp_hdr {
sam_grove 5:3f93dd1d4cb3 56 PACK_STRUCT_FIELD(u16_t src);
sam_grove 5:3f93dd1d4cb3 57 PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */
sam_grove 5:3f93dd1d4cb3 58 PACK_STRUCT_FIELD(u16_t len);
sam_grove 5:3f93dd1d4cb3 59 PACK_STRUCT_FIELD(u16_t chksum);
sam_grove 5:3f93dd1d4cb3 60 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 61 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 62 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 63 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 64 #endif
sam_grove 5:3f93dd1d4cb3 65
sam_grove 5:3f93dd1d4cb3 66 #define UDP_FLAGS_NOCHKSUM 0x01U
sam_grove 5:3f93dd1d4cb3 67 #define UDP_FLAGS_UDPLITE 0x02U
sam_grove 5:3f93dd1d4cb3 68 #define UDP_FLAGS_CONNECTED 0x04U
sam_grove 5:3f93dd1d4cb3 69 #define UDP_FLAGS_MULTICAST_LOOP 0x08U
sam_grove 5:3f93dd1d4cb3 70
sam_grove 5:3f93dd1d4cb3 71 struct udp_pcb;
sam_grove 5:3f93dd1d4cb3 72
sam_grove 5:3f93dd1d4cb3 73 /** Function prototype for udp pcb receive callback functions
sam_grove 5:3f93dd1d4cb3 74 * addr and port are in same byte order as in the pcb
sam_grove 5:3f93dd1d4cb3 75 * The callback is responsible for freeing the pbuf
sam_grove 5:3f93dd1d4cb3 76 * if it's not used any more.
sam_grove 5:3f93dd1d4cb3 77 *
sam_grove 5:3f93dd1d4cb3 78 * ATTENTION: Be aware that 'addr' points into the pbuf 'p' so freeing this pbuf
sam_grove 5:3f93dd1d4cb3 79 * makes 'addr' invalid, too.
sam_grove 5:3f93dd1d4cb3 80 *
sam_grove 5:3f93dd1d4cb3 81 * @param arg user supplied argument (udp_pcb.recv_arg)
sam_grove 5:3f93dd1d4cb3 82 * @param pcb the udp_pcb which received data
sam_grove 5:3f93dd1d4cb3 83 * @param p the packet buffer that was received
sam_grove 5:3f93dd1d4cb3 84 * @param addr the remote IP address from which the packet was received
sam_grove 5:3f93dd1d4cb3 85 * @param port the remote port from which the packet was received
sam_grove 5:3f93dd1d4cb3 86 */
sam_grove 5:3f93dd1d4cb3 87 typedef void (*udp_recv_fn)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 88 ip_addr_t *addr, u16_t port);
sam_grove 5:3f93dd1d4cb3 89
sam_grove 5:3f93dd1d4cb3 90
sam_grove 5:3f93dd1d4cb3 91 struct udp_pcb {
sam_grove 5:3f93dd1d4cb3 92 /* Common members of all PCB types */
sam_grove 5:3f93dd1d4cb3 93 IP_PCB;
sam_grove 5:3f93dd1d4cb3 94
sam_grove 5:3f93dd1d4cb3 95 /* Protocol specific PCB members */
sam_grove 5:3f93dd1d4cb3 96
sam_grove 5:3f93dd1d4cb3 97 struct udp_pcb *next;
sam_grove 5:3f93dd1d4cb3 98
sam_grove 5:3f93dd1d4cb3 99 u8_t flags;
sam_grove 5:3f93dd1d4cb3 100 /** ports are in host byte order */
sam_grove 5:3f93dd1d4cb3 101 u16_t local_port, remote_port;
sam_grove 5:3f93dd1d4cb3 102
sam_grove 5:3f93dd1d4cb3 103 #if LWIP_IGMP
sam_grove 5:3f93dd1d4cb3 104 /** outgoing network interface for multicast packets */
sam_grove 5:3f93dd1d4cb3 105 ip_addr_t multicast_ip;
sam_grove 5:3f93dd1d4cb3 106 #endif /* LWIP_IGMP */
sam_grove 5:3f93dd1d4cb3 107
sam_grove 5:3f93dd1d4cb3 108 #if LWIP_UDPLITE
sam_grove 5:3f93dd1d4cb3 109 /** used for UDP_LITE only */
sam_grove 5:3f93dd1d4cb3 110 u16_t chksum_len_rx, chksum_len_tx;
sam_grove 5:3f93dd1d4cb3 111 #endif /* LWIP_UDPLITE */
sam_grove 5:3f93dd1d4cb3 112
sam_grove 5:3f93dd1d4cb3 113 /** receive callback function */
sam_grove 5:3f93dd1d4cb3 114 udp_recv_fn recv;
sam_grove 5:3f93dd1d4cb3 115 /** user-supplied argument for the recv callback */
sam_grove 5:3f93dd1d4cb3 116 void *recv_arg;
sam_grove 5:3f93dd1d4cb3 117 };
sam_grove 5:3f93dd1d4cb3 118 /* udp_pcbs export for exernal reference (e.g. SNMP agent) */
sam_grove 5:3f93dd1d4cb3 119 extern struct udp_pcb *udp_pcbs;
sam_grove 5:3f93dd1d4cb3 120
sam_grove 5:3f93dd1d4cb3 121 /* The following functions is the application layer interface to the
sam_grove 5:3f93dd1d4cb3 122 UDP code. */
sam_grove 5:3f93dd1d4cb3 123 struct udp_pcb * udp_new (void);
sam_grove 5:3f93dd1d4cb3 124 void udp_remove (struct udp_pcb *pcb);
sam_grove 5:3f93dd1d4cb3 125 err_t udp_bind (struct udp_pcb *pcb, ip_addr_t *ipaddr,
sam_grove 5:3f93dd1d4cb3 126 u16_t port);
sam_grove 5:3f93dd1d4cb3 127 err_t udp_connect (struct udp_pcb *pcb, ip_addr_t *ipaddr,
sam_grove 5:3f93dd1d4cb3 128 u16_t port);
sam_grove 5:3f93dd1d4cb3 129 void udp_disconnect (struct udp_pcb *pcb);
sam_grove 5:3f93dd1d4cb3 130 void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv,
sam_grove 5:3f93dd1d4cb3 131 void *recv_arg);
sam_grove 5:3f93dd1d4cb3 132 err_t udp_sendto_if (struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 133 ip_addr_t *dst_ip, u16_t dst_port,
sam_grove 5:3f93dd1d4cb3 134 struct netif *netif);
sam_grove 5:3f93dd1d4cb3 135 err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 136 ip_addr_t *dst_ip, u16_t dst_port);
sam_grove 5:3f93dd1d4cb3 137 err_t udp_send (struct udp_pcb *pcb, struct pbuf *p);
sam_grove 5:3f93dd1d4cb3 138
sam_grove 5:3f93dd1d4cb3 139 #if LWIP_CHECKSUM_ON_COPY
sam_grove 5:3f93dd1d4cb3 140 err_t udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 141 ip_addr_t *dst_ip, u16_t dst_port,
sam_grove 5:3f93dd1d4cb3 142 struct netif *netif, u8_t have_chksum,
sam_grove 5:3f93dd1d4cb3 143 u16_t chksum);
sam_grove 5:3f93dd1d4cb3 144 err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 145 ip_addr_t *dst_ip, u16_t dst_port,
sam_grove 5:3f93dd1d4cb3 146 u8_t have_chksum, u16_t chksum);
sam_grove 5:3f93dd1d4cb3 147 err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
sam_grove 5:3f93dd1d4cb3 148 u8_t have_chksum, u16_t chksum);
sam_grove 5:3f93dd1d4cb3 149 #endif /* LWIP_CHECKSUM_ON_COPY */
sam_grove 5:3f93dd1d4cb3 150
sam_grove 5:3f93dd1d4cb3 151 #define udp_flags(pcb) ((pcb)->flags)
sam_grove 5:3f93dd1d4cb3 152 #define udp_setflags(pcb, f) ((pcb)->flags = (f))
sam_grove 5:3f93dd1d4cb3 153
sam_grove 5:3f93dd1d4cb3 154 /* The following functions are the lower layer interface to UDP. */
sam_grove 5:3f93dd1d4cb3 155 void udp_input (struct pbuf *p, struct netif *inp);
sam_grove 5:3f93dd1d4cb3 156
sam_grove 5:3f93dd1d4cb3 157 #define udp_init() /* Compatibility define, not init needed. */
sam_grove 5:3f93dd1d4cb3 158
sam_grove 5:3f93dd1d4cb3 159 #if UDP_DEBUG
sam_grove 5:3f93dd1d4cb3 160 void udp_debug_print(struct udp_hdr *udphdr);
sam_grove 5:3f93dd1d4cb3 161 #else
sam_grove 5:3f93dd1d4cb3 162 #define udp_debug_print(udphdr)
sam_grove 5:3f93dd1d4cb3 163 #endif
sam_grove 5:3f93dd1d4cb3 164
sam_grove 5:3f93dd1d4cb3 165 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 166 }
sam_grove 5:3f93dd1d4cb3 167 #endif
sam_grove 5:3f93dd1d4cb3 168
sam_grove 5:3f93dd1d4cb3 169 #endif /* LWIP_UDP */
sam_grove 5:3f93dd1d4cb3 170
sam_grove 5:3f93dd1d4cb3 171 #endif /* __LWIP_UDP_H__ */