Geiger counter http://geigermaps.jp/Create/Tutorials/mbed_geiger/ja

Dependencies:   mbed

Committer:
okini3939
Date:
Fri Apr 15 16:51:30 2011 +0000
Revision:
0:5b2e60110d9b

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:5b2e60110d9b 1 /*****************************************************************************
okini3939 0:5b2e60110d9b 2 * pap.h - PPP Password Authentication Protocol header file.
okini3939 0:5b2e60110d9b 3 *
okini3939 0:5b2e60110d9b 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
okini3939 0:5b2e60110d9b 5 * portions Copyright (c) 1997 Global Election Systems Inc.
okini3939 0:5b2e60110d9b 6 *
okini3939 0:5b2e60110d9b 7 * The authors hereby grant permission to use, copy, modify, distribute,
okini3939 0:5b2e60110d9b 8 * and license this software and its documentation for any purpose, provided
okini3939 0:5b2e60110d9b 9 * that existing copyright notices are retained in all copies and that this
okini3939 0:5b2e60110d9b 10 * notice and the following disclaimer are included verbatim in any
okini3939 0:5b2e60110d9b 11 * distributions. No written agreement, license, or royalty fee is required
okini3939 0:5b2e60110d9b 12 * for any of the authorized uses.
okini3939 0:5b2e60110d9b 13 *
okini3939 0:5b2e60110d9b 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
okini3939 0:5b2e60110d9b 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
okini3939 0:5b2e60110d9b 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
okini3939 0:5b2e60110d9b 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
okini3939 0:5b2e60110d9b 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
okini3939 0:5b2e60110d9b 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
okini3939 0:5b2e60110d9b 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
okini3939 0:5b2e60110d9b 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
okini3939 0:5b2e60110d9b 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
okini3939 0:5b2e60110d9b 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
okini3939 0:5b2e60110d9b 24 *
okini3939 0:5b2e60110d9b 25 ******************************************************************************
okini3939 0:5b2e60110d9b 26 * REVISION HISTORY
okini3939 0:5b2e60110d9b 27 *
okini3939 0:5b2e60110d9b 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
okini3939 0:5b2e60110d9b 29 * Ported to lwIP.
okini3939 0:5b2e60110d9b 30 * 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
okini3939 0:5b2e60110d9b 31 * Original derived from BSD codes.
okini3939 0:5b2e60110d9b 32 *****************************************************************************/
okini3939 0:5b2e60110d9b 33 /*
okini3939 0:5b2e60110d9b 34 * upap.h - User/Password Authentication Protocol definitions.
okini3939 0:5b2e60110d9b 35 *
okini3939 0:5b2e60110d9b 36 * Copyright (c) 1989 Carnegie Mellon University.
okini3939 0:5b2e60110d9b 37 * All rights reserved.
okini3939 0:5b2e60110d9b 38 *
okini3939 0:5b2e60110d9b 39 * Redistribution and use in source and binary forms are permitted
okini3939 0:5b2e60110d9b 40 * provided that the above copyright notice and this paragraph are
okini3939 0:5b2e60110d9b 41 * duplicated in all such forms and that any documentation,
okini3939 0:5b2e60110d9b 42 * advertising materials, and other materials related to such
okini3939 0:5b2e60110d9b 43 * distribution and use acknowledge that the software was developed
okini3939 0:5b2e60110d9b 44 * by Carnegie Mellon University. The name of the
okini3939 0:5b2e60110d9b 45 * University may not be used to endorse or promote products derived
okini3939 0:5b2e60110d9b 46 * from this software without specific prior written permission.
okini3939 0:5b2e60110d9b 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
okini3939 0:5b2e60110d9b 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
okini3939 0:5b2e60110d9b 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
okini3939 0:5b2e60110d9b 50 */
okini3939 0:5b2e60110d9b 51
okini3939 0:5b2e60110d9b 52 #ifndef PAP_H
okini3939 0:5b2e60110d9b 53 #define PAP_H
okini3939 0:5b2e60110d9b 54
okini3939 0:5b2e60110d9b 55 #if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
okini3939 0:5b2e60110d9b 56
okini3939 0:5b2e60110d9b 57 /*
okini3939 0:5b2e60110d9b 58 * Packet header = Code, id, length.
okini3939 0:5b2e60110d9b 59 */
okini3939 0:5b2e60110d9b 60 #define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
okini3939 0:5b2e60110d9b 61
okini3939 0:5b2e60110d9b 62
okini3939 0:5b2e60110d9b 63 /*
okini3939 0:5b2e60110d9b 64 * UPAP codes.
okini3939 0:5b2e60110d9b 65 */
okini3939 0:5b2e60110d9b 66 #define UPAP_AUTHREQ 1 /* Authenticate-Request */
okini3939 0:5b2e60110d9b 67 #define UPAP_AUTHACK 2 /* Authenticate-Ack */
okini3939 0:5b2e60110d9b 68 #define UPAP_AUTHNAK 3 /* Authenticate-Nak */
okini3939 0:5b2e60110d9b 69
okini3939 0:5b2e60110d9b 70 /*
okini3939 0:5b2e60110d9b 71 * Each interface is described by upap structure.
okini3939 0:5b2e60110d9b 72 */
okini3939 0:5b2e60110d9b 73 typedef struct upap_state {
okini3939 0:5b2e60110d9b 74 int us_unit; /* Interface unit number */
okini3939 0:5b2e60110d9b 75 const char *us_user; /* User */
okini3939 0:5b2e60110d9b 76 int us_userlen; /* User length */
okini3939 0:5b2e60110d9b 77 const char *us_passwd; /* Password */
okini3939 0:5b2e60110d9b 78 int us_passwdlen; /* Password length */
okini3939 0:5b2e60110d9b 79 int us_clientstate; /* Client state */
okini3939 0:5b2e60110d9b 80 int us_serverstate; /* Server state */
okini3939 0:5b2e60110d9b 81 u_char us_id; /* Current id */
okini3939 0:5b2e60110d9b 82 int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
okini3939 0:5b2e60110d9b 83 int us_transmits; /* Number of auth-reqs sent */
okini3939 0:5b2e60110d9b 84 int us_maxtransmits; /* Maximum number of auth-reqs to send */
okini3939 0:5b2e60110d9b 85 int us_reqtimeout; /* Time to wait for auth-req from peer */
okini3939 0:5b2e60110d9b 86 } upap_state;
okini3939 0:5b2e60110d9b 87
okini3939 0:5b2e60110d9b 88 /*
okini3939 0:5b2e60110d9b 89 * Client states.
okini3939 0:5b2e60110d9b 90 */
okini3939 0:5b2e60110d9b 91 #define UPAPCS_INITIAL 0 /* Connection down */
okini3939 0:5b2e60110d9b 92 #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
okini3939 0:5b2e60110d9b 93 #define UPAPCS_PENDING 2 /* Connection down, have requested auth */
okini3939 0:5b2e60110d9b 94 #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
okini3939 0:5b2e60110d9b 95 #define UPAPCS_OPEN 4 /* We've received an Ack */
okini3939 0:5b2e60110d9b 96 #define UPAPCS_BADAUTH 5 /* We've received a Nak */
okini3939 0:5b2e60110d9b 97
okini3939 0:5b2e60110d9b 98 /*
okini3939 0:5b2e60110d9b 99 * Server states.
okini3939 0:5b2e60110d9b 100 */
okini3939 0:5b2e60110d9b 101 #define UPAPSS_INITIAL 0 /* Connection down */
okini3939 0:5b2e60110d9b 102 #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
okini3939 0:5b2e60110d9b 103 #define UPAPSS_PENDING 2 /* Connection down, have requested auth */
okini3939 0:5b2e60110d9b 104 #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
okini3939 0:5b2e60110d9b 105 #define UPAPSS_OPEN 4 /* We've sent an Ack */
okini3939 0:5b2e60110d9b 106 #define UPAPSS_BADAUTH 5 /* We've sent a Nak */
okini3939 0:5b2e60110d9b 107
okini3939 0:5b2e60110d9b 108
okini3939 0:5b2e60110d9b 109 extern upap_state upap[];
okini3939 0:5b2e60110d9b 110
okini3939 0:5b2e60110d9b 111 void upap_authwithpeer (int, char *, char *);
okini3939 0:5b2e60110d9b 112 void upap_authpeer (int);
okini3939 0:5b2e60110d9b 113
okini3939 0:5b2e60110d9b 114 extern struct protent pap_protent;
okini3939 0:5b2e60110d9b 115
okini3939 0:5b2e60110d9b 116 #endif /* PAP_SUPPORT */
okini3939 0:5b2e60110d9b 117
okini3939 0:5b2e60110d9b 118 #endif /* PAP_H */