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 * $FreeBSD$ 19 * 20 * TODO: 21 */ 22 23 /* 24 * Definition for Async HDLC 25 */ 26 #define HDLC_SYN 0x7e /* SYNC character */ 27 #define HDLC_ESC 0x7d /* Escape character */ 28 #define HDLC_XOR 0x20 /* Modifier value */ 29 30 #define HDLC_ADDR 0xff 31 #define HDLC_UI 0x03 32 /* 33 * Definition for HDLC Frame Check Sequence 34 */ 35 #define INITFCS 0xffff /* Initial value for FCS computation */ 36 #define GOODFCS 0xf0b8 /* Good FCS value */ 37 38 #define DEF_MRU 1500 39 #define MAX_MRU M_MAXLEN 40 #define MIN_MRU 296 41 42 #define DEF_MTU 0 /* whatever peer says */ 43 #define MAX_MTU M_MAXLEN 44 #define MIN_MTU 296 45 46 struct physical; 47 struct link; 48 struct lcp; 49 struct bundle; 50 struct mbuf; 51 struct cmdargs; 52 53 struct hdlc { 54 struct pppTimer ReportTimer; 55 56 struct { 57 int badfcs; 58 int badaddr; 59 int badcommand; 60 int unknownproto; 61 } laststats, stats; 62 63 struct { 64 struct lcp *owner; /* parent LCP */ 65 struct pppTimer timer; /* When to send */ 66 int method; /* bit-mask for LQM_* from lqr.h */ 67 68 u_int32_t OutPackets; /* Packets sent by me */ 69 u_int32_t OutOctets; /* Octets sent by me */ 70 u_int32_t SaveInPackets; /* Packets received from peer */ 71 u_int32_t SaveInDiscards; /* Discards */ 72 u_int32_t SaveInErrors; /* Errors */ 73 u_int32_t SaveInOctets; /* Octets received from peer */ 74 75 struct { 76 u_int32_t OutLQRs; /* LQRs sent by me */ 77 u_int32_t SaveInLQRs; /* LQRs received from peer */ 78 struct lqrdata peer; /* Last LQR from peer */ 79 int peer_timeout; /* peers max lqr timeout */ 80 int resent; /* Resent last packet `resent' times */ 81 } lqr; 82 83 struct { 84 u_int32_t seq_sent; /* last echo sent */ 85 u_int32_t seq_recv; /* last echo received */ 86 } echo; 87 } lqm; 88 }; 89 90 91 extern void hdlc_Init(struct hdlc *, struct lcp *); 92 extern void hdlc_StartTimer(struct hdlc *); 93 extern void hdlc_StopTimer(struct hdlc *); 94 extern int hdlc_ReportStatus(struct cmdargs const *); 95 extern const char *hdlc_Protocol2Nam(u_short); 96 extern void hdlc_DecodePacket(struct bundle *, u_short, struct mbuf *, 97 struct link *); 98 99 extern u_short hdlc_Fcs(u_char *, size_t); 100 extern int hdlc_Detect(u_char const **, int, int); 101 extern int hdlc_WrapperOctets(struct lcp *, u_short); 102 103 extern struct layer hdlclayer; 104