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_API_MSG_H__
sam_grove 5:3f93dd1d4cb3 33 #define __LWIP_API_MSG_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_NETCONN /* don't build if not configured for use in lwipopts.h */
sam_grove 5:3f93dd1d4cb3 38
sam_grove 5:3f93dd1d4cb3 39 #include <stddef.h> /* for size_t */
sam_grove 5:3f93dd1d4cb3 40
sam_grove 5:3f93dd1d4cb3 41 #include "lwip/ip_addr.h"
sam_grove 5:3f93dd1d4cb3 42 #include "lwip/err.h"
sam_grove 5:3f93dd1d4cb3 43 #include "lwip/sys.h"
sam_grove 5:3f93dd1d4cb3 44 #include "lwip/igmp.h"
sam_grove 5:3f93dd1d4cb3 45 #include "lwip/api.h"
sam_grove 5:3f93dd1d4cb3 46
sam_grove 5:3f93dd1d4cb3 47 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 48 extern "C" {
sam_grove 5:3f93dd1d4cb3 49 #endif
sam_grove 5:3f93dd1d4cb3 50
sam_grove 5:3f93dd1d4cb3 51 /* For the netconn API, these values are use as a bitmask! */
sam_grove 5:3f93dd1d4cb3 52 #define NETCONN_SHUT_RD 1
sam_grove 5:3f93dd1d4cb3 53 #define NETCONN_SHUT_WR 2
sam_grove 5:3f93dd1d4cb3 54 #define NETCONN_SHUT_RDWR (NETCONN_SHUT_RD | NETCONN_SHUT_WR)
sam_grove 5:3f93dd1d4cb3 55
sam_grove 5:3f93dd1d4cb3 56 /* IP addresses and port numbers are expected to be in
sam_grove 5:3f93dd1d4cb3 57 * the same byte order as in the corresponding pcb.
sam_grove 5:3f93dd1d4cb3 58 */
sam_grove 5:3f93dd1d4cb3 59 /** This struct includes everything that is necessary to execute a function
sam_grove 5:3f93dd1d4cb3 60 for a netconn in another thread context (mainly used to process netconns
sam_grove 5:3f93dd1d4cb3 61 in the tcpip_thread context to be thread safe). */
sam_grove 5:3f93dd1d4cb3 62 struct api_msg_msg {
sam_grove 5:3f93dd1d4cb3 63 /** The netconn which to process - always needed: it includes the semaphore
sam_grove 5:3f93dd1d4cb3 64 which is used to block the application thread until the function finished. */
sam_grove 5:3f93dd1d4cb3 65 struct netconn *conn;
sam_grove 5:3f93dd1d4cb3 66 /** The return value of the function executed in tcpip_thread. */
sam_grove 5:3f93dd1d4cb3 67 err_t err;
sam_grove 5:3f93dd1d4cb3 68 /** Depending on the executed function, one of these union members is used */
sam_grove 5:3f93dd1d4cb3 69 union {
sam_grove 5:3f93dd1d4cb3 70 /** used for do_send */
sam_grove 5:3f93dd1d4cb3 71 struct netbuf *b;
sam_grove 5:3f93dd1d4cb3 72 /** used for do_newconn */
sam_grove 5:3f93dd1d4cb3 73 struct {
sam_grove 5:3f93dd1d4cb3 74 u8_t proto;
sam_grove 5:3f93dd1d4cb3 75 } n;
sam_grove 5:3f93dd1d4cb3 76 /** used for do_bind and do_connect */
sam_grove 5:3f93dd1d4cb3 77 struct {
sam_grove 5:3f93dd1d4cb3 78 ip_addr_t *ipaddr;
sam_grove 5:3f93dd1d4cb3 79 u16_t port;
sam_grove 5:3f93dd1d4cb3 80 } bc;
sam_grove 5:3f93dd1d4cb3 81 /** used for do_getaddr */
sam_grove 5:3f93dd1d4cb3 82 struct {
sam_grove 5:3f93dd1d4cb3 83 ip_addr_t *ipaddr;
sam_grove 5:3f93dd1d4cb3 84 u16_t *port;
sam_grove 5:3f93dd1d4cb3 85 u8_t local;
sam_grove 5:3f93dd1d4cb3 86 } ad;
sam_grove 5:3f93dd1d4cb3 87 /** used for do_write */
sam_grove 5:3f93dd1d4cb3 88 struct {
sam_grove 5:3f93dd1d4cb3 89 const void *dataptr;
sam_grove 5:3f93dd1d4cb3 90 size_t len;
sam_grove 5:3f93dd1d4cb3 91 u8_t apiflags;
sam_grove 5:3f93dd1d4cb3 92 } w;
sam_grove 5:3f93dd1d4cb3 93 /** used for do_recv */
sam_grove 5:3f93dd1d4cb3 94 struct {
sam_grove 5:3f93dd1d4cb3 95 u32_t len;
sam_grove 5:3f93dd1d4cb3 96 } r;
sam_grove 5:3f93dd1d4cb3 97 /** used for do_close (/shutdown) */
sam_grove 5:3f93dd1d4cb3 98 struct {
sam_grove 5:3f93dd1d4cb3 99 u8_t shut;
sam_grove 5:3f93dd1d4cb3 100 } sd;
sam_grove 5:3f93dd1d4cb3 101 #if LWIP_IGMP
sam_grove 5:3f93dd1d4cb3 102 /** used for do_join_leave_group */
sam_grove 5:3f93dd1d4cb3 103 struct {
sam_grove 5:3f93dd1d4cb3 104 ip_addr_t *multiaddr;
sam_grove 5:3f93dd1d4cb3 105 ip_addr_t *netif_addr;
sam_grove 5:3f93dd1d4cb3 106 enum netconn_igmp join_or_leave;
sam_grove 5:3f93dd1d4cb3 107 } jl;
sam_grove 5:3f93dd1d4cb3 108 #endif /* LWIP_IGMP */
sam_grove 5:3f93dd1d4cb3 109 #if TCP_LISTEN_BACKLOG
sam_grove 5:3f93dd1d4cb3 110 struct {
sam_grove 5:3f93dd1d4cb3 111 u8_t backlog;
sam_grove 5:3f93dd1d4cb3 112 } lb;
sam_grove 5:3f93dd1d4cb3 113 #endif /* TCP_LISTEN_BACKLOG */
sam_grove 5:3f93dd1d4cb3 114 } msg;
sam_grove 5:3f93dd1d4cb3 115 };
sam_grove 5:3f93dd1d4cb3 116
sam_grove 5:3f93dd1d4cb3 117 /** This struct contains a function to execute in another thread context and
sam_grove 5:3f93dd1d4cb3 118 a struct api_msg_msg that serves as an argument for this function.
sam_grove 5:3f93dd1d4cb3 119 This is passed to tcpip_apimsg to execute functions in tcpip_thread context. */
sam_grove 5:3f93dd1d4cb3 120 struct api_msg {
sam_grove 5:3f93dd1d4cb3 121 /** function to execute in tcpip_thread context */
sam_grove 5:3f93dd1d4cb3 122 void (* function)(struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 123 /** arguments for this function */
sam_grove 5:3f93dd1d4cb3 124 struct api_msg_msg msg;
sam_grove 5:3f93dd1d4cb3 125 };
sam_grove 5:3f93dd1d4cb3 126
sam_grove 5:3f93dd1d4cb3 127 #if LWIP_DNS
sam_grove 5:3f93dd1d4cb3 128 /** As do_gethostbyname requires more arguments but doesn't require a netconn,
sam_grove 5:3f93dd1d4cb3 129 it has its own struct (to avoid struct api_msg getting bigger than necessary).
sam_grove 5:3f93dd1d4cb3 130 do_gethostbyname must be called using tcpip_callback instead of tcpip_apimsg
sam_grove 5:3f93dd1d4cb3 131 (see netconn_gethostbyname). */
sam_grove 5:3f93dd1d4cb3 132 struct dns_api_msg {
sam_grove 5:3f93dd1d4cb3 133 /** Hostname to query or dotted IP address string */
sam_grove 5:3f93dd1d4cb3 134 const char *name;
sam_grove 5:3f93dd1d4cb3 135 /** Rhe resolved address is stored here */
sam_grove 5:3f93dd1d4cb3 136 ip_addr_t *addr;
sam_grove 5:3f93dd1d4cb3 137 /** This semaphore is posted when the name is resolved, the application thread
sam_grove 5:3f93dd1d4cb3 138 should wait on it. */
sam_grove 5:3f93dd1d4cb3 139 sys_sem_t *sem;
sam_grove 5:3f93dd1d4cb3 140 /** Errors are given back here */
sam_grove 5:3f93dd1d4cb3 141 err_t *err;
sam_grove 5:3f93dd1d4cb3 142 };
sam_grove 5:3f93dd1d4cb3 143 #endif /* LWIP_DNS */
sam_grove 5:3f93dd1d4cb3 144
sam_grove 5:3f93dd1d4cb3 145 void do_newconn ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 146 void do_delconn ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 147 void do_bind ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 148 void do_connect ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 149 void do_disconnect ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 150 void do_listen ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 151 void do_send ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 152 void do_recv ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 153 void do_write ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 154 void do_getaddr ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 155 void do_close ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 156 void do_shutdown ( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 157 #if LWIP_IGMP
sam_grove 5:3f93dd1d4cb3 158 void do_join_leave_group( struct api_msg_msg *msg);
sam_grove 5:3f93dd1d4cb3 159 #endif /* LWIP_IGMP */
sam_grove 5:3f93dd1d4cb3 160
sam_grove 5:3f93dd1d4cb3 161 #if LWIP_DNS
sam_grove 5:3f93dd1d4cb3 162 void do_gethostbyname(void *arg);
sam_grove 5:3f93dd1d4cb3 163 #endif /* LWIP_DNS */
sam_grove 5:3f93dd1d4cb3 164
sam_grove 5:3f93dd1d4cb3 165 struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
sam_grove 5:3f93dd1d4cb3 166 void netconn_free(struct netconn *conn);
sam_grove 5:3f93dd1d4cb3 167
sam_grove 5:3f93dd1d4cb3 168 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 169 }
sam_grove 5:3f93dd1d4cb3 170 #endif
sam_grove 5:3f93dd1d4cb3 171
sam_grove 5:3f93dd1d4cb3 172 #endif /* LWIP_NETCONN */
sam_grove 5:3f93dd1d4cb3 173
sam_grove 5:3f93dd1d4cb3 174 #endif /* __LWIP_API_MSG_H__ */