xref: /freebsd/usr.sbin/ppp/hdlc.h (revision e627b39baccd1ec9129690167cf5e6d860509655)
1 /*
2  *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3  *
4  *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5  *
6  * Redistribution and use in source and binary forms are permitted
7  * provided that the above copyright notice and this paragraph are
8  * duplicated in all such forms and that any documentation,
9  * advertising materials, and other materials related to such
10  * distribution and use acknowledge that the software was developed
11  * by the Internet Initiative Japan.  The name of the
12  * IIJ may not be used to endorse or promote products derived
13  * from this software without specific prior written permission.
14  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * $Id: hdlc.h,v 1.3 1996/01/11 17:48:48 phk Exp $
19  *
20  *	TODO:
21  */
22 
23 #ifndef _HDLC_H_
24 #define _HDLC_H_
25 
26 /*
27  *  Definition for Async HDLC
28  */
29 #define HDLC_SYN 0x7e	/* SYNC character */
30 #define HDLC_ESC 0x7d	/* Escape character */
31 #define HDLC_XOR 0x20	/* Modifier value */
32 
33 #define	HDLC_ADDR 0xff
34 #define	HDLC_UI	  0x03
35 /*
36  *  Definition for HDLC Frame Check Sequence
37  */
38 #define INITFCS 0xffff	/* Initial value for FCS computation */
39 #define GOODFCS 0xf0b8	/* Good FCS value */
40 
41 #define	DEF_MRU		1500
42 #define	MAX_MRU		2000
43 #define	MIN_MRU		296
44 
45 /*
46  *  Output priority
47  */
48 /* PRI_NORMAL and PRI_FAST have meaning only on the IP queue.
49  * All IP frames have the same priority once they are compressed.
50  * IP frames stay on the IP queue till they can be sent on the
51  * link. They are compressed at that time.
52 */
53 #define	PRI_NORMAL	0	/* Normal priority */
54 #define	PRI_FAST	1	/* Fast (interractive) */
55 #define	PRI_LINK	1	/* Urgent (LQR packets) */
56 
57 unsigned char EscMap[33];
58 
59 void HdlcInit __P((void));
60 void HdlcErrorCheck __P((void));
61 void HdlcInput __P((struct mbuf *bp));
62 void HdlcOutput __P((int pri, u_short proto, struct mbuf *bp));
63 void AsyncOutput __P((int pri, struct mbuf *bp, int proto));
64 u_short HdlcFcs __P((u_short, u_char *, int));
65 void DecodePacket __P((u_short, struct mbuf *));
66 #endif
67