hdlc.h revision 28679
16059Samurai/* 26059Samurai * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 36059Samurai * 46059Samurai * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 56059Samurai * 66059Samurai * Redistribution and use in source and binary forms are permitted 76059Samurai * provided that the above copyright notice and this paragraph are 86059Samurai * duplicated in all such forms and that any documentation, 96059Samurai * advertising materials, and other materials related to such 106059Samurai * distribution and use acknowledge that the software was developed 116059Samurai * by the Internet Initiative Japan. The name of the 126059Samurai * IIJ may not be used to endorse or promote products derived 136059Samurai * from this software without specific prior written permission. 146059Samurai * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 156059Samurai * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 166059Samurai * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 176059Samurai * 1828679Sbrian * $Id: hdlc.h,v 1.9 1997/06/09 03:27:22 brian Exp $ 196059Samurai * 206059Samurai * TODO: 216059Samurai */ 226059Samurai 236059Samurai#ifndef _HDLC_H_ 246059Samurai#define _HDLC_H_ 256059Samurai 266059Samurai/* 276059Samurai * Definition for Async HDLC 286059Samurai */ 2928679Sbrian#define HDLC_SYN 0x7e /* SYNC character */ 3028679Sbrian#define HDLC_ESC 0x7d /* Escape character */ 3128679Sbrian#define HDLC_XOR 0x20 /* Modifier value */ 326059Samurai 336059Samurai#define HDLC_ADDR 0xff 346059Samurai#define HDLC_UI 0x03 356059Samurai/* 366059Samurai * Definition for HDLC Frame Check Sequence 376059Samurai */ 3828679Sbrian#define INITFCS 0xffff /* Initial value for FCS computation */ 3928679Sbrian#define GOODFCS 0xf0b8 /* Good FCS value */ 406059Samurai 416059Samurai#define DEF_MRU 1500 4226341Sbrian#define MAX_MRU 2048 436059Samurai#define MIN_MRU 296 446059Samurai 4526326Sbrian#define DEF_MTU 0 /* whatever peer says */ 4626341Sbrian#define MAX_MTU 2048 4726326Sbrian#define MIN_MTU 296 4826326Sbrian 496059Samurai/* 506059Samurai * Output priority 516059Samurai */ 5213733Sdfr/* PRI_NORMAL and PRI_FAST have meaning only on the IP queue. 5313733Sdfr * All IP frames have the same priority once they are compressed. 5413733Sdfr * IP frames stay on the IP queue till they can be sent on the 5513733Sdfr * link. They are compressed at that time. 5613733Sdfr*/ 576059Samurai#define PRI_NORMAL 0 /* Normal priority */ 5813733Sdfr#define PRI_FAST 1 /* Fast (interractive) */ 5913733Sdfr#define PRI_LINK 1 /* Urgent (LQR packets) */ 606059Samurai 6128679Sbrianextern u_char EscMap[33]; 626059Samurai 6326516Sbrianvoid HdlcInit(void); 6426516Sbrianvoid HdlcErrorCheck(void); 6528679Sbrianvoid HdlcInput(struct mbuf * bp); 6628679Sbrianvoid HdlcOutput(int pri, u_short proto, struct mbuf * bp); 6728679Sbrianvoid AsyncOutput(int pri, struct mbuf * bp, int proto); 6826516Sbrianu_short HdlcFcs(u_short, u_char *, int); 6926516Sbrianvoid DecodePacket(u_short, struct mbuf *); 7028679Sbrian 716059Samurai#endif 72