ppp_defs.h revision 11970
111970Speter/*	from Id: ppp_defs.h,v 1.7 1995/08/10 06:49:35 paulus Exp */
211970Speter/*	$Id$	*/
311967Speter
411967Speter/*
511967Speter * ppp_defs.h - PPP definitions.
611967Speter *
711967Speter * Copyright (c) 1994 The Australian National University.
811967Speter * All rights reserved.
911967Speter *
1011967Speter * Permission to use, copy, modify, and distribute this software and its
1111967Speter * documentation is hereby granted, provided that the above copyright
1211967Speter * notice appears in all copies.  This software is provided without any
1311967Speter * warranty, express or implied. The Australian National University
1411967Speter * makes no representations about the suitability of this software for
1511967Speter * any purpose.
1611967Speter *
1711967Speter * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
1811967Speter * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1911967Speter * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
2011967Speter * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
2111967Speter * OF SUCH DAMAGE.
2211967Speter *
2311967Speter * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
2411967Speter * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
2511967Speter * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
2611967Speter * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
2711967Speter * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
2811967Speter * OR MODIFICATIONS.
2911967Speter */
3011967Speter
3111967Speter#ifndef _PPP_DEFS_H_
3211967Speter#define _PPP_DEFS_H_
3311967Speter
3411967Speter/*
3511967Speter * The basic PPP frame.
3611967Speter */
3711967Speter#define PPP_HDRLEN	4	/* octets for standard ppp header */
3811967Speter#define PPP_FCSLEN	2	/* octets for FCS */
3911967Speter#define PPP_MRU		1500	/* default MRU = max length of info field */
4011967Speter
4111967Speter#define PPP_ADDRESS(p)	(((u_char *)(p))[0])
4211967Speter#define PPP_CONTROL(p)	(((u_char *)(p))[1])
4311967Speter#define PPP_PROTOCOL(p)	((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
4411967Speter
4511967Speter/*
4611967Speter * Significant octet values.
4711967Speter */
4811967Speter#define	PPP_ALLSTATIONS	0xff	/* All-Stations broadcast address */
4911967Speter#define	PPP_UI		0x03	/* Unnumbered Information */
5011967Speter#define	PPP_FLAG	0x7e	/* Flag Sequence */
5111967Speter#define	PPP_ESCAPE	0x7d	/* Asynchronous Control Escape */
5211967Speter#define	PPP_TRANS	0x20	/* Asynchronous transparency modifier */
5311967Speter
5411967Speter/*
5511967Speter * Protocol field values.
5611967Speter */
5711967Speter#define PPP_IP		0x21	/* Internet Protocol */
5811970Speter#define	PPP_XNS		0x25	/* Xerox NS */
5911970Speter#define PPP_IPX		0x2b	/* IPX Datagram (RFC1552) */
6011967Speter#define	PPP_VJC_COMP	0x2d	/* VJ compressed TCP */
6111967Speter#define	PPP_VJC_UNCOMP	0x2f	/* VJ uncompressed TCP */
6211967Speter#define PPP_COMP	0xfd	/* compressed packet */
6311967Speter#define PPP_IPCP	0x8021	/* IP Control Protocol */
6411970Speter#define PPP_IPXCP	0x802b	/* IPX Control Protocol (RFC1552) */
6511967Speter#define PPP_CCP		0x80fd	/* Compression Control Protocol */
6611967Speter#define PPP_LCP		0xc021	/* Link Control Protocol */
6711967Speter#define PPP_PAP		0xc023	/* Password Authentication Protocol */
6811967Speter#define PPP_LQR		0xc025	/* Link Quality Report protocol */
6911967Speter#define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
7011967Speter
7111967Speter/*
7211967Speter * Values for FCS calculations.
7311967Speter */
7411967Speter#define PPP_INITFCS	0xffff	/* Initial FCS value */
7511967Speter#define PPP_GOODFCS	0xf0b8	/* Good final FCS value */
7611967Speter#define PPP_FCS(fcs, c)	(((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
7711967Speter
7811967Speter/*
7911967Speter * A 32-bit unsigned integral type.
8011967Speter */
8111970Speter#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) && !defined(__FreeBSD__)
8211967Speter#ifdef	UINT32_T
8311967Spetertypedef UINT32_T	u_int32_t;
8411967Speter#else
8511967Spetertypedef unsigned int	u_int32_t;
8611967Speter#endif
8711967Speter#endif
8811967Speter
8911967Speter/*
9011967Speter * Extended asyncmap - allows any character to be escaped.
9111967Speter */
9211967Spetertypedef u_int32_t	ext_accm[8];
9311967Speter
9411967Speter/*
9511967Speter * What to do with network protocol (NP) packets.
9611967Speter */
9711967Speterenum NPmode {
9811967Speter    NPMODE_PASS,		/* pass the packet through */
9911967Speter    NPMODE_DROP,		/* silently drop the packet */
10011967Speter    NPMODE_ERROR,		/* return an error */
10111967Speter    NPMODE_QUEUE		/* save it up for later. */
10211967Speter};
10311967Speter
10411967Speter/*
10511967Speter * Statistics.
10611967Speter */
10711967Speterstruct pppstat	{
10811967Speter    u_int	ppp_ibytes;	/* bytes received */
10911967Speter    u_int	ppp_ipackets;	/* packets received */
11011967Speter    u_int	ppp_ierrors;	/* receive errors */
11111967Speter    u_int	ppp_obytes;	/* bytes sent */
11211967Speter    u_int	ppp_opackets;	/* packets sent */
11311967Speter    u_int	ppp_oerrors;	/* transmit errors */
11411967Speter};
11511967Speter
11611967Speterstruct vjstat {
11711967Speter    u_int	vjs_packets;	/* outbound packets */
11811967Speter    u_int	vjs_compressed;	/* outbound compressed packets */
11911967Speter    u_int	vjs_searches;	/* searches for connection state */
12011967Speter    u_int	vjs_misses;	/* times couldn't find conn. state */
12111967Speter    u_int	vjs_uncompressedin; /* inbound uncompressed packets */
12211967Speter    u_int	vjs_compressedin;   /* inbound compressed packets */
12311967Speter    u_int	vjs_errorin;	/* inbound unknown type packets */
12411967Speter    u_int	vjs_tossed;	/* inbound packets tossed because of error */
12511967Speter};
12611967Speter
12711967Speterstruct ppp_stats {
12811967Speter    struct pppstat	p;	/* basic PPP statistics */
12911967Speter    struct vjstat	vj;	/* VJ header compression statistics */
13011967Speter};
13111967Speter
13211967Speterstruct compstat {
13311967Speter    u_int	unc_bytes;	/* total uncompressed bytes */
13411967Speter    u_int	unc_packets;	/* total uncompressed packets */
13511967Speter    u_int	comp_bytes;	/* compressed bytes */
13611967Speter    u_int	comp_packets;	/* compressed packets */
13711967Speter    u_int	inc_bytes;	/* incompressible bytes */
13811967Speter    u_int	inc_packets;	/* incompressible packets */
13911967Speter    u_int	ratio;		/* recent compression ratio << 8 */
14011967Speter};
14111967Speter
14211967Speterstruct ppp_comp_stats {
14311967Speter    struct compstat	c;	/* packet compression statistics */
14411967Speter    struct compstat	d;	/* packet decompression statistics */
14511967Speter};
14611967Speter
14711967Speter/*
14811967Speter * The following structure records the time in seconds since
14911967Speter * the last NP packet was sent or received.
15011967Speter */
15111967Speterstruct ppp_idle {
15211967Speter    time_t xmit_idle;		/* time since last NP packet sent */
15311967Speter    time_t recv_idle;		/* time since last NP packet received */
15411967Speter};
15511967Speter
15611967Speter#ifndef __P
15711967Speter#ifdef __STDC__
15811967Speter#define __P(x)	x
15911967Speter#else
16011967Speter#define __P(x)	()
16111967Speter#endif
16211967Speter#endif
16311967Speter
16411967Speter#endif /* _PPP_DEFS_H_ */
165