Deleted Added
full compact
ng_async.c (87599) ng_async.c (90227)
1
2/*
3 * ng_async.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
1
2/*
3 * ng_async.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_async.c 87599 2001-12-10 08:09:49Z obrien $
39 * $FreeBSD: head/sys/netgraph/ng_async.c 90227 2002-02-05 02:00:56Z dillon $
40 * $Whistle: ng_async.c,v 1.17 1999/11/01 09:24:51 julian Exp $
41 */
42
43/*
44 * This node type implements a PPP style sync <-> async converter.
45 * See RFC 1661 for details of how asynchronous encoding works.
46 */
47

--- 419 unchanged lines hidden (view full) ---

467 getmicrotime(&time);
468 if (time.tv_sec >= sc->lasttime + 1) {
469 sc->abuf[alen++] = PPP_FLAG;
470 sc->lasttime = time.tv_sec;
471 }
472
473 /* Add packet payload */
474 while (m != NULL) {
40 * $Whistle: ng_async.c,v 1.17 1999/11/01 09:24:51 julian Exp $
41 */
42
43/*
44 * This node type implements a PPP style sync <-> async converter.
45 * See RFC 1661 for details of how asynchronous encoding works.
46 */
47

--- 419 unchanged lines hidden (view full) ---

467 getmicrotime(&time);
468 if (time.tv_sec >= sc->lasttime + 1) {
469 sc->abuf[alen++] = PPP_FLAG;
470 sc->lasttime = time.tv_sec;
471 }
472
473 /* Add packet payload */
474 while (m != NULL) {
475 struct mbuf *n;
476
477 while (m->m_len > 0) {
478 ADD_BYTE(*mtod(m, u_char *));
479 m->m_data++;
480 m->m_len--;
481 }
475 while (m->m_len > 0) {
476 ADD_BYTE(*mtod(m, u_char *));
477 m->m_data++;
478 m->m_len--;
479 }
482 MFREE(m, n);
483 m = n;
480 m = m_free(m);
484 }
485
486 /* Add checksum and final sync flag */
487 fcs0 = fcs;
488 ADD_BYTE(~fcs0 & 0xff);
489 ADD_BYTE(~fcs0 >> 8);
490 sc->abuf[alen++] = PPP_FLAG;
491

--- 100 unchanged lines hidden (view full) ---

592 sc->stats.asyncOverflows++;
593 sc->amode = MODE_HUNT;
594 sc->slen = 0;
595 } else {
596 sc->sbuf[sc->slen++] = ch;
597 sc->fcs = PPP_FCS(sc->fcs, ch);
598 }
599 }
481 }
482
483 /* Add checksum and final sync flag */
484 fcs0 = fcs;
485 ADD_BYTE(~fcs0 & 0xff);
486 ADD_BYTE(~fcs0 >> 8);
487 sc->abuf[alen++] = PPP_FLAG;
488

--- 100 unchanged lines hidden (view full) ---

589 sc->stats.asyncOverflows++;
590 sc->amode = MODE_HUNT;
591 sc->slen = 0;
592 } else {
593 sc->sbuf[sc->slen++] = ch;
594 sc->fcs = PPP_FCS(sc->fcs, ch);
595 }
596 }
600 MFREE(m, n);
601 m = n;
597 m = m_free(m);
602 }
603 if (item)
604 NG_FREE_ITEM(item);
605 return (0);
606}
607
608/*
609 * CRC table

--- 37 unchanged lines hidden ---
598 }
599 if (item)
600 NG_FREE_ITEM(item);
601 return (0);
602}
603
604/*
605 * CRC table

--- 37 unchanged lines hidden ---