simple tester example >>> osc destination & receive

Dependencies:   mbed

Fork of myOSC_test by Alvaro Cassinelli

Committer:
sfjmt
Date:
Tue Aug 06 10:12:56 2013 +0000
Revision:
2:44f1e5803762
Parent:
0:f76708a93fb3
revision_01

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 0:f76708a93fb3 1 /*****************************************************************************
mbedalvaro 0:f76708a93fb3 2 * lcp.h - Network Link Control Protocol header file.
mbedalvaro 0:f76708a93fb3 3 *
mbedalvaro 0:f76708a93fb3 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
mbedalvaro 0:f76708a93fb3 5 * portions Copyright (c) 1997 Global Election Systems Inc.
mbedalvaro 0:f76708a93fb3 6 *
mbedalvaro 0:f76708a93fb3 7 * The authors hereby grant permission to use, copy, modify, distribute,
mbedalvaro 0:f76708a93fb3 8 * and license this software and its documentation for any purpose, provided
mbedalvaro 0:f76708a93fb3 9 * that existing copyright notices are retained in all copies and that this
mbedalvaro 0:f76708a93fb3 10 * notice and the following disclaimer are included verbatim in any
mbedalvaro 0:f76708a93fb3 11 * distributions. No written agreement, license, or royalty fee is required
mbedalvaro 0:f76708a93fb3 12 * for any of the authorized uses.
mbedalvaro 0:f76708a93fb3 13 *
mbedalvaro 0:f76708a93fb3 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
mbedalvaro 0:f76708a93fb3 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
mbedalvaro 0:f76708a93fb3 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
mbedalvaro 0:f76708a93fb3 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mbedalvaro 0:f76708a93fb3 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
mbedalvaro 0:f76708a93fb3 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
mbedalvaro 0:f76708a93fb3 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
mbedalvaro 0:f76708a93fb3 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbedalvaro 0:f76708a93fb3 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
mbedalvaro 0:f76708a93fb3 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbedalvaro 0:f76708a93fb3 24 *
mbedalvaro 0:f76708a93fb3 25 ******************************************************************************
mbedalvaro 0:f76708a93fb3 26 * REVISION HISTORY
mbedalvaro 0:f76708a93fb3 27 *
mbedalvaro 0:f76708a93fb3 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
mbedalvaro 0:f76708a93fb3 29 * Ported to lwIP.
mbedalvaro 0:f76708a93fb3 30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
mbedalvaro 0:f76708a93fb3 31 * Original derived from BSD codes.
mbedalvaro 0:f76708a93fb3 32 *****************************************************************************/
mbedalvaro 0:f76708a93fb3 33 /*
mbedalvaro 0:f76708a93fb3 34 * lcp.h - Link Control Protocol definitions.
mbedalvaro 0:f76708a93fb3 35 *
mbedalvaro 0:f76708a93fb3 36 * Copyright (c) 1989 Carnegie Mellon University.
mbedalvaro 0:f76708a93fb3 37 * All rights reserved.
mbedalvaro 0:f76708a93fb3 38 *
mbedalvaro 0:f76708a93fb3 39 * Redistribution and use in source and binary forms are permitted
mbedalvaro 0:f76708a93fb3 40 * provided that the above copyright notice and this paragraph are
mbedalvaro 0:f76708a93fb3 41 * duplicated in all such forms and that any documentation,
mbedalvaro 0:f76708a93fb3 42 * advertising materials, and other materials related to such
mbedalvaro 0:f76708a93fb3 43 * distribution and use acknowledge that the software was developed
mbedalvaro 0:f76708a93fb3 44 * by Carnegie Mellon University. The name of the
mbedalvaro 0:f76708a93fb3 45 * University may not be used to endorse or promote products derived
mbedalvaro 0:f76708a93fb3 46 * from this software without specific prior written permission.
mbedalvaro 0:f76708a93fb3 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
mbedalvaro 0:f76708a93fb3 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
mbedalvaro 0:f76708a93fb3 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
mbedalvaro 0:f76708a93fb3 50 *
mbedalvaro 0:f76708a93fb3 51 * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
mbedalvaro 0:f76708a93fb3 52 */
mbedalvaro 0:f76708a93fb3 53
mbedalvaro 0:f76708a93fb3 54 #ifndef LCP_H
mbedalvaro 0:f76708a93fb3 55 #define LCP_H
mbedalvaro 0:f76708a93fb3 56 /*
mbedalvaro 0:f76708a93fb3 57 * Options.
mbedalvaro 0:f76708a93fb3 58 */
mbedalvaro 0:f76708a93fb3 59 #define CI_MRU 1 /* Maximum Receive Unit */
mbedalvaro 0:f76708a93fb3 60 #define CI_ASYNCMAP 2 /* Async Control Character Map */
mbedalvaro 0:f76708a93fb3 61 #define CI_AUTHTYPE 3 /* Authentication Type */
mbedalvaro 0:f76708a93fb3 62 #define CI_QUALITY 4 /* Quality Protocol */
mbedalvaro 0:f76708a93fb3 63 #define CI_MAGICNUMBER 5 /* Magic Number */
mbedalvaro 0:f76708a93fb3 64 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
mbedalvaro 0:f76708a93fb3 65 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
mbedalvaro 0:f76708a93fb3 66 #define CI_CALLBACK 13 /* callback */
mbedalvaro 0:f76708a93fb3 67 #define CI_MRRU 17 /* max reconstructed receive unit; multilink */
mbedalvaro 0:f76708a93fb3 68 #define CI_SSNHF 18 /* short sequence numbers for multilink */
mbedalvaro 0:f76708a93fb3 69 #define CI_EPDISC 19 /* endpoint discriminator */
mbedalvaro 0:f76708a93fb3 70
mbedalvaro 0:f76708a93fb3 71 /*
mbedalvaro 0:f76708a93fb3 72 * LCP-specific packet types (code numbers).
mbedalvaro 0:f76708a93fb3 73 */
mbedalvaro 0:f76708a93fb3 74 #define PROTREJ 8 /* Protocol Reject */
mbedalvaro 0:f76708a93fb3 75 #define ECHOREQ 9 /* Echo Request */
mbedalvaro 0:f76708a93fb3 76 #define ECHOREP 10 /* Echo Reply */
mbedalvaro 0:f76708a93fb3 77 #define DISCREQ 11 /* Discard Request */
mbedalvaro 0:f76708a93fb3 78 #define CBCP_OPT 6 /* Use callback control protocol */
mbedalvaro 0:f76708a93fb3 79
mbedalvaro 0:f76708a93fb3 80 /*
mbedalvaro 0:f76708a93fb3 81 * The state of options is described by an lcp_options structure.
mbedalvaro 0:f76708a93fb3 82 */
mbedalvaro 0:f76708a93fb3 83 typedef struct lcp_options {
mbedalvaro 0:f76708a93fb3 84 u_int passive : 1; /* Don't die if we don't get a response */
mbedalvaro 0:f76708a93fb3 85 u_int silent : 1; /* Wait for the other end to start first */
mbedalvaro 0:f76708a93fb3 86 u_int restart : 1; /* Restart vs. exit after close */
mbedalvaro 0:f76708a93fb3 87 u_int neg_mru : 1; /* Negotiate the MRU? */
mbedalvaro 0:f76708a93fb3 88 u_int neg_asyncmap : 1; /* Negotiate the async map? */
mbedalvaro 0:f76708a93fb3 89 u_int neg_upap : 1; /* Ask for UPAP authentication? */
mbedalvaro 0:f76708a93fb3 90 u_int neg_chap : 1; /* Ask for CHAP authentication? */
mbedalvaro 0:f76708a93fb3 91 u_int neg_magicnumber : 1; /* Ask for magic number? */
mbedalvaro 0:f76708a93fb3 92 u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
mbedalvaro 0:f76708a93fb3 93 u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
mbedalvaro 0:f76708a93fb3 94 u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
mbedalvaro 0:f76708a93fb3 95 u_int neg_cbcp : 1; /* Negotiate use of CBCP */
mbedalvaro 0:f76708a93fb3 96 #ifdef PPP_MULTILINK
mbedalvaro 0:f76708a93fb3 97 u_int neg_mrru : 1; /* Negotiate multilink MRRU */
mbedalvaro 0:f76708a93fb3 98 u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
mbedalvaro 0:f76708a93fb3 99 u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
mbedalvaro 0:f76708a93fb3 100 #endif
mbedalvaro 0:f76708a93fb3 101 u_short mru; /* Value of MRU */
mbedalvaro 0:f76708a93fb3 102 #ifdef PPP_MULTILINK
mbedalvaro 0:f76708a93fb3 103 u_short mrru; /* Value of MRRU, and multilink enable */
mbedalvaro 0:f76708a93fb3 104 #endif
mbedalvaro 0:f76708a93fb3 105 u_char chap_mdtype; /* which MD type (hashing algorithm) */
mbedalvaro 0:f76708a93fb3 106 u32_t asyncmap; /* Value of async map */
mbedalvaro 0:f76708a93fb3 107 u32_t magicnumber;
mbedalvaro 0:f76708a93fb3 108 int numloops; /* Number of loops during magic number neg. */
mbedalvaro 0:f76708a93fb3 109 u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
mbedalvaro 0:f76708a93fb3 110 #ifdef PPP_MULTILINK
mbedalvaro 0:f76708a93fb3 111 struct epdisc endpoint; /* endpoint discriminator */
mbedalvaro 0:f76708a93fb3 112 #endif
mbedalvaro 0:f76708a93fb3 113 } lcp_options;
mbedalvaro 0:f76708a93fb3 114
mbedalvaro 0:f76708a93fb3 115 /*
mbedalvaro 0:f76708a93fb3 116 * Values for phase from BSD pppd.h based on RFC 1661.
mbedalvaro 0:f76708a93fb3 117 */
mbedalvaro 0:f76708a93fb3 118 typedef enum {
mbedalvaro 0:f76708a93fb3 119 PHASE_DEAD = 0,
mbedalvaro 0:f76708a93fb3 120 PHASE_INITIALIZE,
mbedalvaro 0:f76708a93fb3 121 PHASE_ESTABLISH,
mbedalvaro 0:f76708a93fb3 122 PHASE_AUTHENTICATE,
mbedalvaro 0:f76708a93fb3 123 PHASE_CALLBACK,
mbedalvaro 0:f76708a93fb3 124 PHASE_NETWORK,
mbedalvaro 0:f76708a93fb3 125 PHASE_TERMINATE
mbedalvaro 0:f76708a93fb3 126 } LinkPhase;
mbedalvaro 0:f76708a93fb3 127
mbedalvaro 0:f76708a93fb3 128
mbedalvaro 0:f76708a93fb3 129
mbedalvaro 0:f76708a93fb3 130 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
mbedalvaro 0:f76708a93fb3 131 extern lcp_options lcp_wantoptions[];
mbedalvaro 0:f76708a93fb3 132 extern lcp_options lcp_gotoptions[];
mbedalvaro 0:f76708a93fb3 133 extern lcp_options lcp_allowoptions[];
mbedalvaro 0:f76708a93fb3 134 extern lcp_options lcp_hisoptions[];
mbedalvaro 0:f76708a93fb3 135 extern ext_accm xmit_accm[];
mbedalvaro 0:f76708a93fb3 136
mbedalvaro 0:f76708a93fb3 137
mbedalvaro 0:f76708a93fb3 138 void lcp_init (int);
mbedalvaro 0:f76708a93fb3 139 void lcp_open (int);
mbedalvaro 0:f76708a93fb3 140 void lcp_close (int, char *);
mbedalvaro 0:f76708a93fb3 141 void lcp_lowerup (int);
mbedalvaro 0:f76708a93fb3 142 void lcp_lowerdown(int);
mbedalvaro 0:f76708a93fb3 143 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
mbedalvaro 0:f76708a93fb3 144
mbedalvaro 0:f76708a93fb3 145 extern struct protent lcp_protent;
mbedalvaro 0:f76708a93fb3 146
mbedalvaro 0:f76708a93fb3 147 /* Default number of times we receive our magic number from the peer
mbedalvaro 0:f76708a93fb3 148 before deciding the link is looped-back. */
mbedalvaro 0:f76708a93fb3 149 #define DEFLOOPBACKFAIL 10
mbedalvaro 0:f76708a93fb3 150
mbedalvaro 0:f76708a93fb3 151 #endif /* LCP_H */