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