Nut/OS  5.0.5
API Reference
if_ppp.h
Go to the documentation of this file.
00001 #ifndef _NETINET_IF_PPP_H_
00002 #define _NETINET_IF_PPP_H_
00003 
00004 /*
00005  * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00024  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  *
00035  * -
00036  * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
00037  *
00038  * Redistribution and use in source and binary forms, with or without
00039  * modification, are permitted provided that the following conditions
00040  * are met:
00041  *
00042  * 1. Redistributions of source code must retain the above copyright
00043  *    notice, this list of conditions and the following disclaimer.
00044  * 2. Redistributions in binary form must reproduce the above copyright
00045  *    notice, this list of conditions and the following disclaimer in the
00046  *    documentation and/or other materials provided with the distribution.
00047  * 3. Neither the name of the copyright holders nor the names of
00048  *    contributors may be used to endorse or promote products derived
00049  *    from this software without specific prior written permission.
00050  *
00051  * THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS
00052  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00053  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00054  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
00055  * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00056  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00057  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00058  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00059  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00060  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00061  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00062  * SUCH DAMAGE.
00063  *
00064  * For additional information see http://www.calldirect.com.au/
00065  * -
00066  *
00067  * Portions are
00068  * Copyright (c) 1989 by Carnegie Mellon University.
00069  * All rights reserved.
00070  *
00071  * Redistribution and use in source and binary forms are permitted
00072  * provided that the above copyright notice and this paragraph are
00073  * duplicated in all such forms and that any documentation,
00074  * advertising materials, and other materials related to such
00075  * distribution and use acknowledge that the software was developed
00076  * by Carnegie Mellon University.  The name of the
00077  * University may not be used to endorse or promote products derived
00078  * from this software without specific prior written permission.
00079  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00080  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00081  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00082  */
00083 
00084 /*
00085  * $Log$
00086  * Revision 1.4  2008/08/11 07:00:22  haraldkipp
00087  * BSD types replaced by stdint types (feature request #1282721).
00088  *
00089  * Revision 1.3  2004/01/30 11:38:25  haraldkipp
00090  * Handle magic number rejects
00091  *
00092  * Revision 1.2  2003/08/14 15:05:18  haraldkipp
00093  * Caller will do ID increment
00094  *
00095  * Revision 1.1.1.1  2003/05/09 14:41:14  haraldkipp
00096  * Initial using 3.2.1
00097  *
00098  * Revision 1.2  2003/05/06 18:46:33  harald
00099  * Cleanup
00100  *
00101  * Revision 1.1  2003/03/31 14:57:20  harald
00102  * *** empty log message ***
00103  *
00104  */
00105 
00106 #include <sys/types.h>
00107 #include <net/if_var.h>
00108 
00115 #define MAX_NAK_LOOPS   10
00116 #define MIN_LCPMRU     128
00117 
00118 #define PPP_MRU     1500
00119 
00120 
00121 /*
00122  * Protocol field values.
00123  */
00124 #define PPP_IP          0x0021  /* Internet Protocol */
00125 #define PPP_AT          0x0029  /* AppleTalk Protocol */
00126 #define PPP_IPX         0x002b  /* IPX protocol */
00127 #define PPP_VJC_COMP    0x002d  /* VJ compressed TCP */
00128 #define PPP_VJC_UNCOMP  0x002f  /* VJ uncompressed TCP */
00129 #define PPP_IPV6        0x0057  /* Internet Protocol Version 6 */
00130 #define PPP_COMP        0x00fd  /* compressed packet */
00131 #define PPP_IPCP        0x8021  /* IP Control Protocol */
00132 #define PPP_ATCP        0x8029  /* AppleTalk Control Protocol */
00133 #define PPP_IPXCP       0x802b  /* IPX Control Protocol */
00134 #define PPP_IPV6CP      0x8057  /* IPv6 Control Protocol */
00135 #define PPP_CCP         0x80fd  /* Compression Control Protocol */
00136 #define PPP_LCP         0xc021  /* Link Control Protocol */
00137 #define PPP_PAP         0xc023  /* Password Authentication Protocol */
00138 #define PPP_LQR         0xc025  /* Link Quality Report protocol */
00139 #define PPP_CHAP        0xc223  /* Cryptographic Handshake Auth. Protocol */
00140 #define PPP_CBCP        0xc029  /* Callback Control Protocol */
00141 
00142 
00143 /*
00144  * LCP options.
00145  */
00146 #define LCP_MRU           1     
00147 #define LCP_ASYNCMAP      2     
00148 #define LCP_AUTHTYPE      3     
00149 #define LCP_QUALITY       4     
00150 #define LCP_MAGICNUMBER   5     
00151 #define LCP_PCOMPRESSION  7     
00152 #define LCP_ACCOMPRESSION 8     
00154 /*
00155  * IPCP Options.
00156  */
00157 #define IPCP_ADDRS        1       /* IP Addresses */
00158 #define IPCP_COMPRESSTYPE 2       /* Compression Type */
00159 #define IPCP_ADDR         3       /* IP Address */
00160 
00161 #define IPCP_MS_DNS1      129     /* Primary DNS value */
00162 #define IPCP_MS_WINS1     130     /* Primary WINS value */
00163 #define IPCP_MS_DNS2      131     /* Secondary DNS value */
00164 #define IPCP_MS_WINS2     132     /* Secondary WINS value */
00165 
00170 typedef struct ppp_header {
00171     uint8_t address;        
00172     uint8_t control;        
00173     uint16_t prot_type;     
00174 } PPPHDR;
00175 
00176 typedef struct xcphdr {
00179     uint8_t  xch_code;
00180 
00183     uint8_t  xch_id;
00184 
00187     uint16_t xch_len;
00188 } XCPHDR;
00189 
00190 
00191 extern void NutLcpInput(NUTDEVICE * dev, NETBUF * nb);
00192 extern int NutLcpOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
00193 extern void LcpTxConfReq(NUTDEVICE *dev, uint8_t id, uint8_t rejected);
00194 extern void LcpTxProtRej(NUTDEVICE *dev, uint16_t protocol, NETBUF *nb);
00195 
00196 extern void NutPapInput(NUTDEVICE * dev, NETBUF * nb);
00197 extern int NutPapOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
00198 extern void PapTxAuthReq(NUTDEVICE *dev, uint8_t id);
00199 
00200 extern void NutIpcpInput(NUTDEVICE * dev, NETBUF * nb);
00201 extern int NutIpcpOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
00202 extern void IpcpTxConfReq(NUTDEVICE *dev, uint8_t id);
00203 
00204 #endif
00205