1.\" Copyright (c) 1996-1999 Whistle Communications, Inc. 2.\" All rights reserved. 3.\" 4.\" Subject to the following obligations and disclaimer of warranty, use and 5.\" redistribution of this software, in source or object code forms, with or 6.\" without modifications are expressly permitted by Whistle Communications; 7.\" provided, however, that: 8.\" 1. Any and all reproductions of the source or object code must include the 9.\" copyright notice above and the following disclaimer of warranties; and 10.\" 2. No rights are granted, in any manner or form, to use Whistle 11.\" Communications, Inc. trademarks, including the mark "WHISTLE 12.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as 13.\" such appears in the above copyright notice or in the software. 14.\" 15.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 16.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 17.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 18.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 19.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 20.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 21.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 22.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 23.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 24.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 25.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 26.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 27.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 31.\" OF SUCH DAMAGE. 32.\" 33.\" Author: Archie Cobbs <archie@FreeBSD.org> 34.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $ 35.\" 36.Dd November 13, 2012 37.Dt NG_ASYNC 4 38.Os 39.Sh NAME 40.Nm ng_async 41.Nd asynchronous framing netgraph node type 42.Sh SYNOPSIS 43.In sys/types.h 44.In netgraph/ng_async.h 45.Sh DESCRIPTION 46The 47.Nm async 48node type performs conversion between synchronous frames and 49asynchronous frames, as defined for the PPP protocol in RFC 1662. 50Asynchronous framing uses flag bytes and octet-stuffing 51to simulate a frame oriented connection over an octet-oriented 52asynchronous serial line. 53.Pp 54The node transmits and receives asynchronous data on the 55.Dv async 56hook. 57Mbuf boundaries of incoming data are ignored. 58Once a complete packet has been received, it is decoded and 59stripped of all framing bytes, and transmitted out the 60.Dv sync 61hook as a single frame. 62.Pp 63Synchronous frames are transmitted and received on the 64.Dv sync 65hook. 66Packets received on this hook are encoded as asynchronous frames 67and sent out on 68.Dv async . 69Received packets should start with the address and control fields, 70or the PPP protocol field if address and control field compression 71is employed, and contain no checksum field. 72If the first four bytes are 73.Dv "0xff 0x03 0xc0 0x21" 74(an LCP protocol frame) then complete control character escaping 75is enabled for that frame (in PPP, LCP packets are always sent with 76no address and control field compression and all control characters 77escaped). 78.Pp 79This node supports 80.Dq flag sharing 81for packets transmitted on 82.Dv async . 83This is an optimization where the trailing flag byte 84of one frame is shared with the opening flag byte of the next. 85Flag sharing between frames is disabled after one second of transmit 86idle time. 87.Sh HOOKS 88This node type supports the following hooks: 89.Bl -tag -width ".Va async" 90.It Va async 91Asynchronous connection. 92Typically this hook would be connected to a 93.Xr ng_tty 4 94node, which handles transmission of serial data over a tty device. 95.It Va sync 96Synchronous connection. 97This hook sends and receives synchronous frames. 98For PPP, these frames should contain address, control, and protocol fields, 99but no checksum field. 100Typically this hook would be connected to an individual link hook of a 101.Xr ng_ppp 4 102type node. 103.El 104.Sh CONTROL MESSAGES 105This node type supports the generic control messages, plus the following: 106.Bl -tag -width foo 107.It Dv NGM_ASYNC_CMD_SET_CONFIG Pq Ic setconfig 108Sets the node configuration, which is described by a 109.Dv "struct ng_async_cfg" : 110.Bd -literal -offset 4n 111struct ng_async_cfg { 112 u_char enabled; /* Turn encoding on/off */ 113 uint16_t amru; /* Max receive async frame length */ 114 uint16_t smru; /* Max receive sync frame length */ 115 uint32_t accm; /* ACCM encoding */ 116}; 117.Ed 118The 119.Dv enabled 120field enables or disables all encoding/decoding functions (default disabled). 121When disabled, the node operates in simple 122.Dq pass through 123mode. 124The 125.Dv amru 126and 127.Dv smru 128fields are the asynchronous and synchronous MRU (maximum receive unit) values, 129respectively. 130These both default to 1600; note that the async MRU 131applies to the incoming frame length after asynchronous decoding. 132The 133.Dv accm 134field is the asynchronous character control map, which controls the escaping 135of characters 0x00 thorough 0x1f (default 0xffffffff). 136.It Dv NGM_ASYNC_CMD_GET_CONFIG Pq Ic getconfig 137This command returns the current configuration structure. 138.It Dv NGM_ASYNC_CMD_GET_STATS Pq Ic getstats 139This command returns a 140.Dv "struct ng_async_stat" 141containing node statistics for packet, octet, and error counts. 142.It Dv NGM_ASYNC_CMD_CLR_STATS Pq Ic clrstats 143Clears the node statistics. 144.El 145.Sh SHUTDOWN 146This node shuts down upon receipt of a 147.Dv NGM_SHUTDOWN 148control message, or when all hooks have been disconnected. 149.Sh SEE ALSO 150.Xr netgraph 4 , 151.Xr ng_ppp 4 , 152.Xr ng_tty 4 , 153.Xr ngctl 8 154.Rs 155.%A W. Simpson 156.%T "PPP in HDLC-link Framing" 157.%O RFC 1662 158.Re 159.Rs 160.%A W. Simpson 161.%T "The Point-to-Point Protocol (PPP)" 162.%O RFC 1661 163.Re 164.Sh HISTORY 165The 166.Nm 167node type was implemented in 168.Fx 4.0 . 169.Sh AUTHORS 170.An Archie Cobbs Aq Mt archie@FreeBSD.org 171