hdlc.h revision 26516
150476Speter/* 212821Sphk * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3278202Sngie * 4278202Sngie * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5298107Sgjb * 6298107Sgjb * Redistribution and use in source and binary forms are permitted 7124747Sru * provided that the above copyright notice and this paragraph are 8124747Sru * duplicated in all such forms and that any documentation, 9180595Sdwmalone * advertising materials, and other materials related to such 10124747Sru * distribution and use acknowledge that the software was developed 11124747Sru * by the Internet Initiative Japan. The name of the 12124747Sru * IIJ may not be used to endorse or promote products derived 13133265Smlaier * from this software without specific prior written permission. 14124747Sru * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15124747Sru * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16289467Scem * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17124747Sru * 18129456Sdwmalone * $Id: hdlc.h,v 1.8 1997/06/01 11:35:02 brian Exp $ 19124747Sru * 20230787Sbrueffer * TODO: 21175578Sattilio */ 22124747Sru 23124747Sru#ifndef _HDLC_H_ 24124747Sru#define _HDLC_H_ 25175578Sattilio 26124747Sru/* 27124747Sru * Definition for Async HDLC 28124747Sru */ 29129190Simp#define HDLC_SYN 0x7e /* SYNC character */ 30221231Sjhb#define HDLC_ESC 0x7d /* Escape character */ 31124747Sru#define HDLC_XOR 0x20 /* Modifier value */ 32198085Sjhb 33124747Sru#define HDLC_ADDR 0xff 34239512Sjhb#define HDLC_UI 0x03 35239515Sjhb/* 36124747Sru * Definition for HDLC Frame Check Sequence 37198134Sjhb */ 38115420Shmp#define INITFCS 0xffff /* Initial value for FCS computation */ 39124747Sru#define GOODFCS 0xf0b8 /* Good FCS value */ 4084458Sbde 41193833Sjhb#define DEF_MRU 1500 42124747Sru#define MAX_MRU 2048 43124747Sru#define MIN_MRU 296 44124747Sru 45299286Sjhb#define DEF_MTU 0 /* whatever peer says */ 46288271Scem#define MAX_MTU 2048 47300317Sjhb#define MIN_MTU 296 48193833Sjhb 49124747Sru/* 50124747Sru * Output priority 51298707Sjhb */ 52124747Sru/* PRI_NORMAL and PRI_FAST have meaning only on the IP queue. 53193833Sjhb * All IP frames have the same priority once they are compressed. 54112831Simp * IP frames stay on the IP queue till they can be sent on the 55124747Sru * link. They are compressed at that time. 56147359Simp*/ 5791722Smike#define PRI_NORMAL 0 /* Normal priority */ 58273788Sjkim#define PRI_FAST 1 /* Fast (interractive) */ 59124747Sru#define PRI_LINK 1 /* Urgent (LQR packets) */ 60336346Skevans 61124747Sruunsigned char EscMap[33]; 62162638Simp 63126689Sjkoshyvoid HdlcInit(void); 64124747Sruvoid HdlcErrorCheck(void); 65249268Sglebiusvoid HdlcInput(struct mbuf *bp); 66289667Scemvoid HdlcOutput(int pri, u_short proto, struct mbuf *bp); 67164408Scerivoid AsyncOutput(int pri, struct mbuf *bp, int proto); 68124747Sruu_short HdlcFcs(u_short, u_char *, int); 69124747Sruvoid DecodePacket(u_short, struct mbuf *); 70124747Sru#endif 71124747Sru