Lines Matching +full:no +full:- +full:wp
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
5 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
61 memset(async->cfg.EscMap, '\0', sizeof async->cfg.EscMap); in async_Init()
67 async->mode = MODE_HUNT; in async_Setup()
68 async->length = 0; in async_Setup()
69 async->my_accmap = async->his_accmap = 0xffffffff; in async_Setup()
75 async->my_accmap = mymap; in async_SetLinkParams()
76 async->his_accmap = hismap | mymap; in async_SetLinkParams()
85 u_char *wp; in async_Encode() local
87 wp = *cp; in async_Encode()
88 if ((c < 0x20 && (proto == PROTO_LCP || (async->his_accmap & (1 << c)))) in async_Encode()
90 *wp++ = HDLC_ESC; in async_Encode()
93 if (async->cfg.EscMap[32] && async->cfg.EscMap[c >> 3] & (1 << (c & 7))) { in async_Encode()
94 *wp++ = HDLC_ESC; in async_Encode()
97 *wp++ = c; in async_Encode()
98 *cp = wp; in async_Encode()
107 struct mbuf *wp; in async_LayerPush() local
118 cp = p->async.xbuff; in async_LayerPush()
119 ep = cp + HDLCSIZE - 10; in async_LayerPush()
120 wp = bp; in async_LayerPush()
122 while (wp) { in async_LayerPush()
123 sp = MBUF_CTOP(wp); in async_LayerPush()
124 for (cnt = wp->m_len; cnt > 0; cnt--) { in async_LayerPush()
125 async_Encode(&p->async, &cp, *sp++, *proto); in async_LayerPush()
131 wp = wp->m_next; in async_LayerPush()
135 cnt = cp - p->async.xbuff; in async_LayerPush()
138 memcpy(MBUF_CTOP(bp), p->async.xbuff, cnt); in async_LayerPush()
139 bp->priv = cnt - oldcnt; in async_LayerPush()
150 if ((async->mode & MODE_HUNT) && c != HDLC_SYN) in async_Decode()
155 async->mode &= ~MODE_HUNT; in async_Decode()
156 if (async->length) { /* packet is ready. */ in async_Decode()
157 bp = m_get(async->length, MB_ASYNCIN); in async_Decode()
158 mbuf_Write(bp, async->hbuff, async->length); in async_Decode()
159 async->length = 0; in async_Decode()
164 if (!(async->mode & MODE_ESC)) { in async_Decode()
165 async->mode |= MODE_ESC; in async_Decode()
170 if (async->length >= HDLCSIZE) { in async_Decode()
173 async->length); in async_Decode()
174 async->length = 0; in async_Decode()
175 async->mode = MODE_HUNT; in async_Decode()
178 if (async->mode & MODE_ESC) { in async_Decode()
180 async->mode &= ~MODE_ESC; in async_Decode()
182 async->hbuff[async->length++] = c; in async_Decode()
207 for (cnt = bp->m_len; cnt; cnt--) { in async_LayerPull()
208 *last = async_Decode(&p->async, *ch++); in async_LayerPull()
210 last = &(*last)->m_nextpkt; in async_LayerPull()