async.c (46686) | async.c (47061) |
---|---|
1/* 2 * PPP Async HDLC Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP Async HDLC Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $Id: async.c,v 1.18 1999/04/11 08:51:04 brian Exp $ | 20 * $Id: async.c,v 1.19 1999/05/08 11:06:03 brian Exp $ |
21 * 22 */ 23#include <sys/types.h> 24 25#include <string.h> 26#include <termios.h> 27 28#include "layer.h" --- 84 unchanged lines hidden (view full) --- 113 wp = wp->next; 114 } 115 *cp++ = HDLC_SYN; 116 117 cnt = cp - p->async.xbuff; 118 mbuf_Free(bp); 119 bp = mbuf_Alloc(cnt, MB_ASYNC); 120 memcpy(MBUF_CTOP(bp), p->async.xbuff, cnt); | 21 * 22 */ 23#include <sys/types.h> 24 25#include <string.h> 26#include <termios.h> 27 28#include "layer.h" --- 84 unchanged lines hidden (view full) --- 113 wp = wp->next; 114 } 115 *cp++ = HDLC_SYN; 116 117 cnt = cp - p->async.xbuff; 118 mbuf_Free(bp); 119 bp = mbuf_Alloc(cnt, MB_ASYNC); 120 memcpy(MBUF_CTOP(bp), p->async.xbuff, cnt); |
121 log_DumpBp(LogASYNC, "Write", bp); |
|
121 | 122 |
122 log_DumpBp(LogASYNC, "WriteModem", bp); | |
123 return bp; 124} 125 126static struct mbuf * 127async_Decode(struct async *async, u_char c) 128{ 129 struct mbuf *bp; 130 --- 46 unchanged lines hidden (view full) --- 177 178 if (!p) { 179 log_Printf(LogERROR, "Can't Pull an async packet from a logical link\n"); 180 return bp; 181 } 182 183 last = &nbp; 184 | 123 return bp; 124} 125 126static struct mbuf * 127async_Decode(struct async *async, u_char c) 128{ 129 struct mbuf *bp; 130 --- 46 unchanged lines hidden (view full) --- 177 178 if (!p) { 179 log_Printf(LogERROR, "Can't Pull an async packet from a logical link\n"); 180 return bp; 181 } 182 183 last = &nbp; 184 |
185 log_DumpBp(LogASYNC, "Read", bp); |
|
185 while (bp) { 186 ch = MBUF_CTOP(bp); 187 for (cnt = bp->cnt; cnt; cnt--) { 188 *last = async_Decode(&p->async, *ch++); 189 if (*last != NULL) 190 last = &(*last)->pnext; 191 } 192 bp = mbuf_FreeSeg(bp); 193 } 194 195 return nbp; 196} 197 198struct layer asynclayer = 199 { LAYER_ASYNC, "async", async_LayerPush, async_LayerPull }; | 186 while (bp) { 187 ch = MBUF_CTOP(bp); 188 for (cnt = bp->cnt; cnt; cnt--) { 189 *last = async_Decode(&p->async, *ch++); 190 if (*last != NULL) 191 last = &(*last)->pnext; 192 } 193 bp = mbuf_FreeSeg(bp); 194 } 195 196 return nbp; 197} 198 199struct layer asynclayer = 200 { LAYER_ASYNC, "async", async_LayerPush, async_LayerPull }; |