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 * Definitions for tcp compression routines.
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * $Id: vj.h,v 1.7 2010/02/22 17:52:09 goldsimon Exp $
sam_grove 5:3f93dd1d4cb3 5 *
sam_grove 5:3f93dd1d4cb3 6 * Copyright (c) 1989 Regents of the University of California.
sam_grove 5:3f93dd1d4cb3 7 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 8 *
sam_grove 5:3f93dd1d4cb3 9 * Redistribution and use in source and binary forms are permitted
sam_grove 5:3f93dd1d4cb3 10 * provided that the above copyright notice and this paragraph are
sam_grove 5:3f93dd1d4cb3 11 * duplicated in all such forms and that any documentation,
sam_grove 5:3f93dd1d4cb3 12 * advertising materials, and other materials related to such
sam_grove 5:3f93dd1d4cb3 13 * distribution and use acknowledge that the software was developed
sam_grove 5:3f93dd1d4cb3 14 * by the University of California, Berkeley. The name of the
sam_grove 5:3f93dd1d4cb3 15 * University may not be used to endorse or promote products derived
sam_grove 5:3f93dd1d4cb3 16 * from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
sam_grove 5:3f93dd1d4cb3 18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
sam_grove 5:3f93dd1d4cb3 19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
sam_grove 5:3f93dd1d4cb3 20 *
sam_grove 5:3f93dd1d4cb3 21 * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
sam_grove 5:3f93dd1d4cb3 22 * - Initial distribution.
sam_grove 5:3f93dd1d4cb3 23 */
sam_grove 5:3f93dd1d4cb3 24
sam_grove 5:3f93dd1d4cb3 25 #ifndef VJ_H
sam_grove 5:3f93dd1d4cb3 26 #define VJ_H
sam_grove 5:3f93dd1d4cb3 27
sam_grove 5:3f93dd1d4cb3 28 #include "lwip/ip.h"
sam_grove 5:3f93dd1d4cb3 29 #include "lwip/tcp_impl.h"
sam_grove 5:3f93dd1d4cb3 30
sam_grove 5:3f93dd1d4cb3 31 #define MAX_SLOTS 16 /* must be > 2 and < 256 */
sam_grove 5:3f93dd1d4cb3 32 #define MAX_HDR 128
sam_grove 5:3f93dd1d4cb3 33
sam_grove 5:3f93dd1d4cb3 34 /*
sam_grove 5:3f93dd1d4cb3 35 * Compressed packet format:
sam_grove 5:3f93dd1d4cb3 36 *
sam_grove 5:3f93dd1d4cb3 37 * The first octet contains the packet type (top 3 bits), TCP
sam_grove 5:3f93dd1d4cb3 38 * 'push' bit, and flags that indicate which of the 4 TCP sequence
sam_grove 5:3f93dd1d4cb3 39 * numbers have changed (bottom 5 bits). The next octet is a
sam_grove 5:3f93dd1d4cb3 40 * conversation number that associates a saved IP/TCP header with
sam_grove 5:3f93dd1d4cb3 41 * the compressed packet. The next two octets are the TCP checksum
sam_grove 5:3f93dd1d4cb3 42 * from the original datagram. The next 0 to 15 octets are
sam_grove 5:3f93dd1d4cb3 43 * sequence number changes, one change per bit set in the header
sam_grove 5:3f93dd1d4cb3 44 * (there may be no changes and there are two special cases where
sam_grove 5:3f93dd1d4cb3 45 * the receiver implicitly knows what changed -- see below).
sam_grove 5:3f93dd1d4cb3 46 *
sam_grove 5:3f93dd1d4cb3 47 * There are 5 numbers which can change (they are always inserted
sam_grove 5:3f93dd1d4cb3 48 * in the following order): TCP urgent pointer, window,
sam_grove 5:3f93dd1d4cb3 49 * acknowlegement, sequence number and IP ID. (The urgent pointer
sam_grove 5:3f93dd1d4cb3 50 * is different from the others in that its value is sent, not the
sam_grove 5:3f93dd1d4cb3 51 * change in value.) Since typical use of SLIP links is biased
sam_grove 5:3f93dd1d4cb3 52 * toward small packets (see comments on MTU/MSS below), changes
sam_grove 5:3f93dd1d4cb3 53 * use a variable length coding with one octet for numbers in the
sam_grove 5:3f93dd1d4cb3 54 * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
sam_grove 5:3f93dd1d4cb3 55 * range 256 - 65535 or 0. (If the change in sequence number or
sam_grove 5:3f93dd1d4cb3 56 * ack is more than 65535, an uncompressed packet is sent.)
sam_grove 5:3f93dd1d4cb3 57 */
sam_grove 5:3f93dd1d4cb3 58
sam_grove 5:3f93dd1d4cb3 59 /*
sam_grove 5:3f93dd1d4cb3 60 * Packet types (must not conflict with IP protocol version)
sam_grove 5:3f93dd1d4cb3 61 *
sam_grove 5:3f93dd1d4cb3 62 * The top nibble of the first octet is the packet type. There are
sam_grove 5:3f93dd1d4cb3 63 * three possible types: IP (not proto TCP or tcp with one of the
sam_grove 5:3f93dd1d4cb3 64 * control flags set); uncompressed TCP (a normal IP/TCP packet but
sam_grove 5:3f93dd1d4cb3 65 * with the 8-bit protocol field replaced by an 8-bit connection id --
sam_grove 5:3f93dd1d4cb3 66 * this type of packet syncs the sender & receiver); and compressed
sam_grove 5:3f93dd1d4cb3 67 * TCP (described above).
sam_grove 5:3f93dd1d4cb3 68 *
sam_grove 5:3f93dd1d4cb3 69 * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
sam_grove 5:3f93dd1d4cb3 70 * is logically part of the 4-bit "changes" field that follows. Top
sam_grove 5:3f93dd1d4cb3 71 * three bits are actual packet type. For backward compatibility
sam_grove 5:3f93dd1d4cb3 72 * and in the interest of conserving bits, numbers are chosen so the
sam_grove 5:3f93dd1d4cb3 73 * IP protocol version number (4) which normally appears in this nibble
sam_grove 5:3f93dd1d4cb3 74 * means "IP packet".
sam_grove 5:3f93dd1d4cb3 75 */
sam_grove 5:3f93dd1d4cb3 76
sam_grove 5:3f93dd1d4cb3 77 /* packet types */
sam_grove 5:3f93dd1d4cb3 78 #define TYPE_IP 0x40
sam_grove 5:3f93dd1d4cb3 79 #define TYPE_UNCOMPRESSED_TCP 0x70
sam_grove 5:3f93dd1d4cb3 80 #define TYPE_COMPRESSED_TCP 0x80
sam_grove 5:3f93dd1d4cb3 81 #define TYPE_ERROR 0x00
sam_grove 5:3f93dd1d4cb3 82
sam_grove 5:3f93dd1d4cb3 83 /* Bits in first octet of compressed packet */
sam_grove 5:3f93dd1d4cb3 84 #define NEW_C 0x40 /* flag bits for what changed in a packet */
sam_grove 5:3f93dd1d4cb3 85 #define NEW_I 0x20
sam_grove 5:3f93dd1d4cb3 86 #define NEW_S 0x08
sam_grove 5:3f93dd1d4cb3 87 #define NEW_A 0x04
sam_grove 5:3f93dd1d4cb3 88 #define NEW_W 0x02
sam_grove 5:3f93dd1d4cb3 89 #define NEW_U 0x01
sam_grove 5:3f93dd1d4cb3 90
sam_grove 5:3f93dd1d4cb3 91 /* reserved, special-case values of above */
sam_grove 5:3f93dd1d4cb3 92 #define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
sam_grove 5:3f93dd1d4cb3 93 #define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
sam_grove 5:3f93dd1d4cb3 94 #define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
sam_grove 5:3f93dd1d4cb3 95
sam_grove 5:3f93dd1d4cb3 96 #define TCP_PUSH_BIT 0x10
sam_grove 5:3f93dd1d4cb3 97
sam_grove 5:3f93dd1d4cb3 98
sam_grove 5:3f93dd1d4cb3 99 /*
sam_grove 5:3f93dd1d4cb3 100 * "state" data for each active tcp conversation on the wire. This is
sam_grove 5:3f93dd1d4cb3 101 * basically a copy of the entire IP/TCP header from the last packet
sam_grove 5:3f93dd1d4cb3 102 * we saw from the conversation together with a small identifier
sam_grove 5:3f93dd1d4cb3 103 * the transmit & receive ends of the line use to locate saved header.
sam_grove 5:3f93dd1d4cb3 104 */
sam_grove 5:3f93dd1d4cb3 105 struct cstate {
sam_grove 5:3f93dd1d4cb3 106 struct cstate *cs_next; /* next most recently used state (xmit only) */
sam_grove 5:3f93dd1d4cb3 107 u_short cs_hlen; /* size of hdr (receive only) */
sam_grove 5:3f93dd1d4cb3 108 u_char cs_id; /* connection # associated with this state */
sam_grove 5:3f93dd1d4cb3 109 u_char cs_filler;
sam_grove 5:3f93dd1d4cb3 110 union {
sam_grove 5:3f93dd1d4cb3 111 char csu_hdr[MAX_HDR];
sam_grove 5:3f93dd1d4cb3 112 struct ip_hdr csu_ip; /* ip/tcp hdr from most recent packet */
sam_grove 5:3f93dd1d4cb3 113 } vjcs_u;
sam_grove 5:3f93dd1d4cb3 114 };
sam_grove 5:3f93dd1d4cb3 115 #define cs_ip vjcs_u.csu_ip
sam_grove 5:3f93dd1d4cb3 116 #define cs_hdr vjcs_u.csu_hdr
sam_grove 5:3f93dd1d4cb3 117
sam_grove 5:3f93dd1d4cb3 118
sam_grove 5:3f93dd1d4cb3 119 struct vjstat {
sam_grove 5:3f93dd1d4cb3 120 unsigned long vjs_packets; /* outbound packets */
sam_grove 5:3f93dd1d4cb3 121 unsigned long vjs_compressed; /* outbound compressed packets */
sam_grove 5:3f93dd1d4cb3 122 unsigned long vjs_searches; /* searches for connection state */
sam_grove 5:3f93dd1d4cb3 123 unsigned long vjs_misses; /* times couldn't find conn. state */
sam_grove 5:3f93dd1d4cb3 124 unsigned long vjs_uncompressedin; /* inbound uncompressed packets */
sam_grove 5:3f93dd1d4cb3 125 unsigned long vjs_compressedin; /* inbound compressed packets */
sam_grove 5:3f93dd1d4cb3 126 unsigned long vjs_errorin; /* inbound unknown type packets */
sam_grove 5:3f93dd1d4cb3 127 unsigned long vjs_tossed; /* inbound packets tossed because of error */
sam_grove 5:3f93dd1d4cb3 128 };
sam_grove 5:3f93dd1d4cb3 129
sam_grove 5:3f93dd1d4cb3 130 /*
sam_grove 5:3f93dd1d4cb3 131 * all the state data for one serial line (we need one of these per line).
sam_grove 5:3f93dd1d4cb3 132 */
sam_grove 5:3f93dd1d4cb3 133 struct vjcompress {
sam_grove 5:3f93dd1d4cb3 134 struct cstate *last_cs; /* most recently used tstate */
sam_grove 5:3f93dd1d4cb3 135 u_char last_recv; /* last rcvd conn. id */
sam_grove 5:3f93dd1d4cb3 136 u_char last_xmit; /* last sent conn. id */
sam_grove 5:3f93dd1d4cb3 137 u_short flags;
sam_grove 5:3f93dd1d4cb3 138 u_char maxSlotIndex;
sam_grove 5:3f93dd1d4cb3 139 u_char compressSlot; /* Flag indicating OK to compress slot ID. */
sam_grove 5:3f93dd1d4cb3 140 #if LINK_STATS
sam_grove 5:3f93dd1d4cb3 141 struct vjstat stats;
sam_grove 5:3f93dd1d4cb3 142 #endif
sam_grove 5:3f93dd1d4cb3 143 struct cstate tstate[MAX_SLOTS]; /* xmit connection states */
sam_grove 5:3f93dd1d4cb3 144 struct cstate rstate[MAX_SLOTS]; /* receive connection states */
sam_grove 5:3f93dd1d4cb3 145 };
sam_grove 5:3f93dd1d4cb3 146
sam_grove 5:3f93dd1d4cb3 147 /* flag values */
sam_grove 5:3f93dd1d4cb3 148 #define VJF_TOSS 1U /* tossing rcvd frames because of input err */
sam_grove 5:3f93dd1d4cb3 149
sam_grove 5:3f93dd1d4cb3 150 extern void vj_compress_init (struct vjcompress *comp);
sam_grove 5:3f93dd1d4cb3 151 extern u_int vj_compress_tcp (struct vjcompress *comp, struct pbuf *pb);
sam_grove 5:3f93dd1d4cb3 152 extern void vj_uncompress_err (struct vjcompress *comp);
sam_grove 5:3f93dd1d4cb3 153 extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
sam_grove 5:3f93dd1d4cb3 154 extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp);
sam_grove 5:3f93dd1d4cb3 155
sam_grove 5:3f93dd1d4cb3 156 #endif /* VJ_H */