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 * chap.h - Network Challenge Handshake Authentication Protocol 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 * portions Copyright (c) 1998 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-12-03 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
sam_grove 5:3f93dd1d4cb3 31 * Original built from BSD network code.
sam_grove 5:3f93dd1d4cb3 32 ******************************************************************************/
sam_grove 5:3f93dd1d4cb3 33 /*
sam_grove 5:3f93dd1d4cb3 34 * chap.h - Challenge Handshake Authentication Protocol definitions.
sam_grove 5:3f93dd1d4cb3 35 *
sam_grove 5:3f93dd1d4cb3 36 * Copyright (c) 1993 The Australian National 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 the Australian National University. The name of the University
sam_grove 5:3f93dd1d4cb3 45 * may not be used to endorse or promote products derived from this
sam_grove 5:3f93dd1d4cb3 46 * 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 * Copyright (c) 1991 Gregory M. Christy
sam_grove 5:3f93dd1d4cb3 52 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 53 *
sam_grove 5:3f93dd1d4cb3 54 * Redistribution and use in source and binary forms are permitted
sam_grove 5:3f93dd1d4cb3 55 * provided that the above copyright notice and this paragraph are
sam_grove 5:3f93dd1d4cb3 56 * duplicated in all such forms and that any documentation,
sam_grove 5:3f93dd1d4cb3 57 * advertising materials, and other materials related to such
sam_grove 5:3f93dd1d4cb3 58 * distribution and use acknowledge that the software was developed
sam_grove 5:3f93dd1d4cb3 59 * by the author.
sam_grove 5:3f93dd1d4cb3 60 *
sam_grove 5:3f93dd1d4cb3 61 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
sam_grove 5:3f93dd1d4cb3 62 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
sam_grove 5:3f93dd1d4cb3 63 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
sam_grove 5:3f93dd1d4cb3 64 *
sam_grove 5:3f93dd1d4cb3 65 * $Id: chap.h,v 1.6 2010/01/24 13:19:34 goldsimon Exp $
sam_grove 5:3f93dd1d4cb3 66 */
sam_grove 5:3f93dd1d4cb3 67
sam_grove 5:3f93dd1d4cb3 68 #ifndef CHAP_H
sam_grove 5:3f93dd1d4cb3 69 #define CHAP_H
sam_grove 5:3f93dd1d4cb3 70
sam_grove 5:3f93dd1d4cb3 71 /* Code + ID + length */
sam_grove 5:3f93dd1d4cb3 72 #define CHAP_HEADERLEN 4
sam_grove 5:3f93dd1d4cb3 73
sam_grove 5:3f93dd1d4cb3 74 /*
sam_grove 5:3f93dd1d4cb3 75 * CHAP codes.
sam_grove 5:3f93dd1d4cb3 76 */
sam_grove 5:3f93dd1d4cb3 77
sam_grove 5:3f93dd1d4cb3 78 #define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */
sam_grove 5:3f93dd1d4cb3 79 #define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */
sam_grove 5:3f93dd1d4cb3 80 #define CHAP_MICROSOFT 0x80 /* use Microsoft-compatible alg. */
sam_grove 5:3f93dd1d4cb3 81 #define MS_CHAP_RESPONSE_LEN 49 /* Response length for MS-CHAP */
sam_grove 5:3f93dd1d4cb3 82
sam_grove 5:3f93dd1d4cb3 83 #define CHAP_CHALLENGE 1
sam_grove 5:3f93dd1d4cb3 84 #define CHAP_RESPONSE 2
sam_grove 5:3f93dd1d4cb3 85 #define CHAP_SUCCESS 3
sam_grove 5:3f93dd1d4cb3 86 #define CHAP_FAILURE 4
sam_grove 5:3f93dd1d4cb3 87
sam_grove 5:3f93dd1d4cb3 88 /*
sam_grove 5:3f93dd1d4cb3 89 * Challenge lengths (for challenges we send) and other limits.
sam_grove 5:3f93dd1d4cb3 90 */
sam_grove 5:3f93dd1d4cb3 91 #define MIN_CHALLENGE_LENGTH 32
sam_grove 5:3f93dd1d4cb3 92 #define MAX_CHALLENGE_LENGTH 64
sam_grove 5:3f93dd1d4cb3 93 #define MAX_RESPONSE_LENGTH 64 /* sufficient for MD5 or MS-CHAP */
sam_grove 5:3f93dd1d4cb3 94
sam_grove 5:3f93dd1d4cb3 95 /*
sam_grove 5:3f93dd1d4cb3 96 * Each interface is described by a chap structure.
sam_grove 5:3f93dd1d4cb3 97 */
sam_grove 5:3f93dd1d4cb3 98
sam_grove 5:3f93dd1d4cb3 99 typedef struct chap_state {
sam_grove 5:3f93dd1d4cb3 100 int unit; /* Interface unit number */
sam_grove 5:3f93dd1d4cb3 101 int clientstate; /* Client state */
sam_grove 5:3f93dd1d4cb3 102 int serverstate; /* Server state */
sam_grove 5:3f93dd1d4cb3 103 u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */
sam_grove 5:3f93dd1d4cb3 104 u_char chal_len; /* challenge length */
sam_grove 5:3f93dd1d4cb3 105 u_char chal_id; /* ID of last challenge */
sam_grove 5:3f93dd1d4cb3 106 u_char chal_type; /* hash algorithm for challenges */
sam_grove 5:3f93dd1d4cb3 107 u_char id; /* Current id */
sam_grove 5:3f93dd1d4cb3 108 char *chal_name; /* Our name to use with challenge */
sam_grove 5:3f93dd1d4cb3 109 int chal_interval; /* Time until we challenge peer again */
sam_grove 5:3f93dd1d4cb3 110 int timeouttime; /* Timeout time in seconds */
sam_grove 5:3f93dd1d4cb3 111 int max_transmits; /* Maximum # of challenge transmissions */
sam_grove 5:3f93dd1d4cb3 112 int chal_transmits; /* Number of transmissions of challenge */
sam_grove 5:3f93dd1d4cb3 113 int resp_transmits; /* Number of transmissions of response */
sam_grove 5:3f93dd1d4cb3 114 u_char response[MAX_RESPONSE_LENGTH]; /* Response to send */
sam_grove 5:3f93dd1d4cb3 115 u_char resp_length; /* length of response */
sam_grove 5:3f93dd1d4cb3 116 u_char resp_id; /* ID for response messages */
sam_grove 5:3f93dd1d4cb3 117 u_char resp_type; /* hash algorithm for responses */
sam_grove 5:3f93dd1d4cb3 118 char *resp_name; /* Our name to send with response */
sam_grove 5:3f93dd1d4cb3 119 } chap_state;
sam_grove 5:3f93dd1d4cb3 120
sam_grove 5:3f93dd1d4cb3 121
sam_grove 5:3f93dd1d4cb3 122 /*
sam_grove 5:3f93dd1d4cb3 123 * Client (peer) states.
sam_grove 5:3f93dd1d4cb3 124 */
sam_grove 5:3f93dd1d4cb3 125 #define CHAPCS_INITIAL 0 /* Lower layer down, not opened */
sam_grove 5:3f93dd1d4cb3 126 #define CHAPCS_CLOSED 1 /* Lower layer up, not opened */
sam_grove 5:3f93dd1d4cb3 127 #define CHAPCS_PENDING 2 /* Auth us to peer when lower up */
sam_grove 5:3f93dd1d4cb3 128 #define CHAPCS_LISTEN 3 /* Listening for a challenge */
sam_grove 5:3f93dd1d4cb3 129 #define CHAPCS_RESPONSE 4 /* Sent response, waiting for status */
sam_grove 5:3f93dd1d4cb3 130 #define CHAPCS_OPEN 5 /* We've received Success */
sam_grove 5:3f93dd1d4cb3 131
sam_grove 5:3f93dd1d4cb3 132 /*
sam_grove 5:3f93dd1d4cb3 133 * Server (authenticator) states.
sam_grove 5:3f93dd1d4cb3 134 */
sam_grove 5:3f93dd1d4cb3 135 #define CHAPSS_INITIAL 0 /* Lower layer down, not opened */
sam_grove 5:3f93dd1d4cb3 136 #define CHAPSS_CLOSED 1 /* Lower layer up, not opened */
sam_grove 5:3f93dd1d4cb3 137 #define CHAPSS_PENDING 2 /* Auth peer when lower up */
sam_grove 5:3f93dd1d4cb3 138 #define CHAPSS_INITIAL_CHAL 3 /* We've sent the first challenge */
sam_grove 5:3f93dd1d4cb3 139 #define CHAPSS_OPEN 4 /* We've sent a Success msg */
sam_grove 5:3f93dd1d4cb3 140 #define CHAPSS_RECHALLENGE 5 /* We've sent another challenge */
sam_grove 5:3f93dd1d4cb3 141 #define CHAPSS_BADAUTH 6 /* We've sent a Failure msg */
sam_grove 5:3f93dd1d4cb3 142
sam_grove 5:3f93dd1d4cb3 143 extern chap_state chap[];
sam_grove 5:3f93dd1d4cb3 144
sam_grove 5:3f93dd1d4cb3 145 void ChapAuthWithPeer (int, char *, u_char);
sam_grove 5:3f93dd1d4cb3 146 void ChapAuthPeer (int, char *, u_char);
sam_grove 5:3f93dd1d4cb3 147
sam_grove 5:3f93dd1d4cb3 148 extern struct protent chap_protent;
sam_grove 5:3f93dd1d4cb3 149
sam_grove 5:3f93dd1d4cb3 150 #endif /* CHAP_H */