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 * fsm.h - Network Control Protocol Finite State Machine header file.
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
sam_grove 5:3f93dd1d4cb3 5 * Copyright (c) 1997 Global Election Systems Inc.
sam_grove 5:3f93dd1d4cb3 6 *
sam_grove 5:3f93dd1d4cb3 7 * The authors hereby grant permission to use, copy, modify, distribute,
sam_grove 5:3f93dd1d4cb3 8 * and license this software and its documentation for any purpose, provided
sam_grove 5:3f93dd1d4cb3 9 * that existing copyright notices are retained in all copies and that this
sam_grove 5:3f93dd1d4cb3 10 * notice and the following disclaimer are included verbatim in any
sam_grove 5:3f93dd1d4cb3 11 * distributions. No written agreement, license, or royalty fee is required
sam_grove 5:3f93dd1d4cb3 12 * for any of the authorized uses.
sam_grove 5:3f93dd1d4cb3 13 *
sam_grove 5:3f93dd1d4cb3 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
sam_grove 5:3f93dd1d4cb3 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
sam_grove 5:3f93dd1d4cb3 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
sam_grove 5:3f93dd1d4cb3 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
sam_grove 5:3f93dd1d4cb3 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
sam_grove 5:3f93dd1d4cb3 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
sam_grove 5:3f93dd1d4cb3 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
sam_grove 5:3f93dd1d4cb3 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
sam_grove 5:3f93dd1d4cb3 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
sam_grove 5:3f93dd1d4cb3 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 24 *
sam_grove 5:3f93dd1d4cb3 25 ******************************************************************************
sam_grove 5:3f93dd1d4cb3 26 * REVISION HISTORY
sam_grove 5:3f93dd1d4cb3 27 *
sam_grove 5:3f93dd1d4cb3 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
sam_grove 5:3f93dd1d4cb3 29 * Ported to lwIP.
sam_grove 5:3f93dd1d4cb3 30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
sam_grove 5:3f93dd1d4cb3 31 * Original based on BSD code.
sam_grove 5:3f93dd1d4cb3 32 *****************************************************************************/
sam_grove 5:3f93dd1d4cb3 33 /*
sam_grove 5:3f93dd1d4cb3 34 * fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
sam_grove 5:3f93dd1d4cb3 35 *
sam_grove 5:3f93dd1d4cb3 36 * Copyright (c) 1989 Carnegie Mellon University.
sam_grove 5:3f93dd1d4cb3 37 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 38 *
sam_grove 5:3f93dd1d4cb3 39 * Redistribution and use in source and binary forms are permitted
sam_grove 5:3f93dd1d4cb3 40 * provided that the above copyright notice and this paragraph are
sam_grove 5:3f93dd1d4cb3 41 * duplicated in all such forms and that any documentation,
sam_grove 5:3f93dd1d4cb3 42 * advertising materials, and other materials related to such
sam_grove 5:3f93dd1d4cb3 43 * distribution and use acknowledge that the software was developed
sam_grove 5:3f93dd1d4cb3 44 * by Carnegie Mellon University. The name of the
sam_grove 5:3f93dd1d4cb3 45 * University may not be used to endorse or promote products derived
sam_grove 5:3f93dd1d4cb3 46 * from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
sam_grove 5:3f93dd1d4cb3 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
sam_grove 5:3f93dd1d4cb3 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
sam_grove 5:3f93dd1d4cb3 50 *
sam_grove 5:3f93dd1d4cb3 51 * $Id: fsm.h,v 1.5 2009/12/31 17:08:08 goldsimon Exp $
sam_grove 5:3f93dd1d4cb3 52 */
sam_grove 5:3f93dd1d4cb3 53
sam_grove 5:3f93dd1d4cb3 54 #ifndef FSM_H
sam_grove 5:3f93dd1d4cb3 55 #define FSM_H
sam_grove 5:3f93dd1d4cb3 56
sam_grove 5:3f93dd1d4cb3 57 /*
sam_grove 5:3f93dd1d4cb3 58 * LCP Packet header = Code, id, length.
sam_grove 5:3f93dd1d4cb3 59 */
sam_grove 5:3f93dd1d4cb3 60 #define HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
sam_grove 5:3f93dd1d4cb3 61
sam_grove 5:3f93dd1d4cb3 62
sam_grove 5:3f93dd1d4cb3 63 /*
sam_grove 5:3f93dd1d4cb3 64 * CP (LCP, IPCP, etc.) codes.
sam_grove 5:3f93dd1d4cb3 65 */
sam_grove 5:3f93dd1d4cb3 66 #define CONFREQ 1 /* Configuration Request */
sam_grove 5:3f93dd1d4cb3 67 #define CONFACK 2 /* Configuration Ack */
sam_grove 5:3f93dd1d4cb3 68 #define CONFNAK 3 /* Configuration Nak */
sam_grove 5:3f93dd1d4cb3 69 #define CONFREJ 4 /* Configuration Reject */
sam_grove 5:3f93dd1d4cb3 70 #define TERMREQ 5 /* Termination Request */
sam_grove 5:3f93dd1d4cb3 71 #define TERMACK 6 /* Termination Ack */
sam_grove 5:3f93dd1d4cb3 72 #define CODEREJ 7 /* Code Reject */
sam_grove 5:3f93dd1d4cb3 73
sam_grove 5:3f93dd1d4cb3 74
sam_grove 5:3f93dd1d4cb3 75 /*
sam_grove 5:3f93dd1d4cb3 76 * Each FSM is described by an fsm structure and fsm callbacks.
sam_grove 5:3f93dd1d4cb3 77 */
sam_grove 5:3f93dd1d4cb3 78 typedef struct fsm {
sam_grove 5:3f93dd1d4cb3 79 int unit; /* Interface unit number */
sam_grove 5:3f93dd1d4cb3 80 u_short protocol; /* Data Link Layer Protocol field value */
sam_grove 5:3f93dd1d4cb3 81 int state; /* State */
sam_grove 5:3f93dd1d4cb3 82 int flags; /* Contains option bits */
sam_grove 5:3f93dd1d4cb3 83 u_char id; /* Current id */
sam_grove 5:3f93dd1d4cb3 84 u_char reqid; /* Current request id */
sam_grove 5:3f93dd1d4cb3 85 u_char seen_ack; /* Have received valid Ack/Nak/Rej to Req */
sam_grove 5:3f93dd1d4cb3 86 int timeouttime; /* Timeout time in milliseconds */
sam_grove 5:3f93dd1d4cb3 87 int maxconfreqtransmits; /* Maximum Configure-Request transmissions */
sam_grove 5:3f93dd1d4cb3 88 int retransmits; /* Number of retransmissions left */
sam_grove 5:3f93dd1d4cb3 89 int maxtermtransmits; /* Maximum Terminate-Request transmissions */
sam_grove 5:3f93dd1d4cb3 90 int nakloops; /* Number of nak loops since last ack */
sam_grove 5:3f93dd1d4cb3 91 int maxnakloops; /* Maximum number of nak loops tolerated */
sam_grove 5:3f93dd1d4cb3 92 struct fsm_callbacks* callbacks; /* Callback routines */
sam_grove 5:3f93dd1d4cb3 93 char* term_reason; /* Reason for closing protocol */
sam_grove 5:3f93dd1d4cb3 94 int term_reason_len; /* Length of term_reason */
sam_grove 5:3f93dd1d4cb3 95 } fsm;
sam_grove 5:3f93dd1d4cb3 96
sam_grove 5:3f93dd1d4cb3 97
sam_grove 5:3f93dd1d4cb3 98 typedef struct fsm_callbacks {
sam_grove 5:3f93dd1d4cb3 99 void (*resetci)(fsm*); /* Reset our Configuration Information */
sam_grove 5:3f93dd1d4cb3 100 int (*cilen)(fsm*); /* Length of our Configuration Information */
sam_grove 5:3f93dd1d4cb3 101 void (*addci)(fsm*, u_char*, int*); /* Add our Configuration Information */
sam_grove 5:3f93dd1d4cb3 102 int (*ackci)(fsm*, u_char*, int); /* ACK our Configuration Information */
sam_grove 5:3f93dd1d4cb3 103 int (*nakci)(fsm*, u_char*, int); /* NAK our Configuration Information */
sam_grove 5:3f93dd1d4cb3 104 int (*rejci)(fsm*, u_char*, int); /* Reject our Configuration Information */
sam_grove 5:3f93dd1d4cb3 105 int (*reqci)(fsm*, u_char*, int*, int); /* Request peer's Configuration Information */
sam_grove 5:3f93dd1d4cb3 106 void (*up)(fsm*); /* Called when fsm reaches LS_OPENED state */
sam_grove 5:3f93dd1d4cb3 107 void (*down)(fsm*); /* Called when fsm leaves LS_OPENED state */
sam_grove 5:3f93dd1d4cb3 108 void (*starting)(fsm*); /* Called when we want the lower layer */
sam_grove 5:3f93dd1d4cb3 109 void (*finished)(fsm*); /* Called when we don't want the lower layer */
sam_grove 5:3f93dd1d4cb3 110 void (*protreject)(int); /* Called when Protocol-Reject received */
sam_grove 5:3f93dd1d4cb3 111 void (*retransmit)(fsm*); /* Retransmission is necessary */
sam_grove 5:3f93dd1d4cb3 112 int (*extcode)(fsm*, int, u_char, u_char*, int); /* Called when unknown code received */
sam_grove 5:3f93dd1d4cb3 113 char *proto_name; /* String name for protocol (for messages) */
sam_grove 5:3f93dd1d4cb3 114 } fsm_callbacks;
sam_grove 5:3f93dd1d4cb3 115
sam_grove 5:3f93dd1d4cb3 116
sam_grove 5:3f93dd1d4cb3 117 /*
sam_grove 5:3f93dd1d4cb3 118 * Link states.
sam_grove 5:3f93dd1d4cb3 119 */
sam_grove 5:3f93dd1d4cb3 120 #define LS_INITIAL 0 /* Down, hasn't been opened */
sam_grove 5:3f93dd1d4cb3 121 #define LS_STARTING 1 /* Down, been opened */
sam_grove 5:3f93dd1d4cb3 122 #define LS_CLOSED 2 /* Up, hasn't been opened */
sam_grove 5:3f93dd1d4cb3 123 #define LS_STOPPED 3 /* Open, waiting for down event */
sam_grove 5:3f93dd1d4cb3 124 #define LS_CLOSING 4 /* Terminating the connection, not open */
sam_grove 5:3f93dd1d4cb3 125 #define LS_STOPPING 5 /* Terminating, but open */
sam_grove 5:3f93dd1d4cb3 126 #define LS_REQSENT 6 /* We've sent a Config Request */
sam_grove 5:3f93dd1d4cb3 127 #define LS_ACKRCVD 7 /* We've received a Config Ack */
sam_grove 5:3f93dd1d4cb3 128 #define LS_ACKSENT 8 /* We've sent a Config Ack */
sam_grove 5:3f93dd1d4cb3 129 #define LS_OPENED 9 /* Connection available */
sam_grove 5:3f93dd1d4cb3 130
sam_grove 5:3f93dd1d4cb3 131 /*
sam_grove 5:3f93dd1d4cb3 132 * Flags - indicate options controlling FSM operation
sam_grove 5:3f93dd1d4cb3 133 */
sam_grove 5:3f93dd1d4cb3 134 #define OPT_PASSIVE 1 /* Don't die if we don't get a response */
sam_grove 5:3f93dd1d4cb3 135 #define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */
sam_grove 5:3f93dd1d4cb3 136 #define OPT_SILENT 4 /* Wait for peer to speak first */
sam_grove 5:3f93dd1d4cb3 137
sam_grove 5:3f93dd1d4cb3 138
sam_grove 5:3f93dd1d4cb3 139 /*
sam_grove 5:3f93dd1d4cb3 140 * Prototypes
sam_grove 5:3f93dd1d4cb3 141 */
sam_grove 5:3f93dd1d4cb3 142 void fsm_init (fsm*);
sam_grove 5:3f93dd1d4cb3 143 void fsm_lowerup (fsm*);
sam_grove 5:3f93dd1d4cb3 144 void fsm_lowerdown (fsm*);
sam_grove 5:3f93dd1d4cb3 145 void fsm_open (fsm*);
sam_grove 5:3f93dd1d4cb3 146 void fsm_close (fsm*, char*);
sam_grove 5:3f93dd1d4cb3 147 void fsm_input (fsm*, u_char*, int);
sam_grove 5:3f93dd1d4cb3 148 void fsm_protreject (fsm*);
sam_grove 5:3f93dd1d4cb3 149 void fsm_sdata (fsm*, u_char, u_char, u_char*, int);
sam_grove 5:3f93dd1d4cb3 150
sam_grove 5:3f93dd1d4cb3 151
sam_grove 5:3f93dd1d4cb3 152 /*
sam_grove 5:3f93dd1d4cb3 153 * Variables
sam_grove 5:3f93dd1d4cb3 154 */
sam_grove 5:3f93dd1d4cb3 155 extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */
sam_grove 5:3f93dd1d4cb3 156
sam_grove 5:3f93dd1d4cb3 157 #endif /* FSM_H */