xref: /freebsd/share/man/man4/ng_async.4 (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
14cf49a43SJulian Elischer.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
24cf49a43SJulian Elischer.\" All rights reserved.
34cf49a43SJulian Elischer.\"
44cf49a43SJulian Elischer.\" Subject to the following obligations and disclaimer of warranty, use and
54cf49a43SJulian Elischer.\" redistribution of this software, in source or object code forms, with or
64cf49a43SJulian Elischer.\" without modifications are expressly permitted by Whistle Communications;
74cf49a43SJulian Elischer.\" provided, however, that:
84cf49a43SJulian Elischer.\" 1. Any and all reproductions of the source or object code must include the
94cf49a43SJulian Elischer.\"    copyright notice above and the following disclaimer of warranties; and
104cf49a43SJulian Elischer.\" 2. No rights are granted, in any manner or form, to use Whistle
114cf49a43SJulian Elischer.\"    Communications, Inc. trademarks, including the mark "WHISTLE
124cf49a43SJulian Elischer.\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
134cf49a43SJulian Elischer.\"    such appears in the above copyright notice or in the software.
144cf49a43SJulian Elischer.\"
154cf49a43SJulian Elischer.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
164cf49a43SJulian Elischer.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
174cf49a43SJulian Elischer.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
184cf49a43SJulian Elischer.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
194cf49a43SJulian Elischer.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
204cf49a43SJulian Elischer.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
214cf49a43SJulian Elischer.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
224cf49a43SJulian Elischer.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
234cf49a43SJulian Elischer.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
244cf49a43SJulian Elischer.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
254cf49a43SJulian Elischer.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
264cf49a43SJulian Elischer.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
274cf49a43SJulian Elischer.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
284cf49a43SJulian Elischer.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
294cf49a43SJulian Elischer.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
304cf49a43SJulian Elischer.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
314cf49a43SJulian Elischer.\" OF SUCH DAMAGE.
324cf49a43SJulian Elischer.\"
334cf49a43SJulian Elischer.\" Author: Archie Cobbs <archie@whistle.com>
344cf49a43SJulian Elischer.\"
354cf49a43SJulian Elischer.\" $FreeBSD$
364cf49a43SJulian Elischer.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
374cf49a43SJulian Elischer.\"
384cf49a43SJulian Elischer.Dd January 19, 1999
394cf49a43SJulian Elischer.Dt NG_ASYNC 8
404cf49a43SJulian Elischer.Os FreeBSD 3
414cf49a43SJulian Elischer.Sh NAME
424cf49a43SJulian Elischer.Nm ng_async
434cf49a43SJulian Elischer.Nd asynchronous framing netgraph node type
444cf49a43SJulian Elischer.Sh SYNOPSIS
454cf49a43SJulian Elischer.Fd #include <netgraph/ng_async.h>
464cf49a43SJulian Elischer.Sh DESCRIPTION
474cf49a43SJulian ElischerThe
484cf49a43SJulian Elischer.Nm async
494cf49a43SJulian Elischernode type performs conversion between synchronous frames and
504cf49a43SJulian Elischerasynchronous frames, as defined for the PPP protocol in RFC 1662.
514cf49a43SJulian ElischerAsynchronous framing uses flag bytes and octet-stuffing
524cf49a43SJulian Elischerto simulate a frame oriented connection over an octet-oriented
534cf49a43SJulian Elischerasynchronous line.
544cf49a43SJulian Elischer.Pp
554cf49a43SJulian ElischerThe node trasmits and receives asynchronous data on the
564cf49a43SJulian Elischer.Dv async
574cf49a43SJulian Elischerhook.  Incoming data mbuf boundaries are ignored, while
584cf49a43SJulian Elischeroutgoing data is sent as a complete frame at a time.
594cf49a43SJulian Elischer.Pp
604cf49a43SJulian ElischerThere are two synchronous hooks,
614cf49a43SJulian Elischer.Dv sync
624cf49a43SJulian Elischerand
634cf49a43SJulian Elischer.Dv sync2 .
644cf49a43SJulian ElischerFor both hooks, received packets are encoded as asynchronous frames
654cf49a43SJulian Elischerand sent out on
664cf49a43SJulian Elischer.Dv async .
674cf49a43SJulian ElischerHook
684cf49a43SJulian Elischer.Dv sync2
694cf49a43SJulian Elischerdiffers from
704cf49a43SJulian Elischer.Dv sync
714cf49a43SJulian Elischeronly in that any configured address and control field compression
724cf49a43SJulian Elischerand/or control character escaping is disabled when the frame is encoded.
734cf49a43SJulian ElischerThis is useful for transmitting PPP LCP packets, which are always sent
744cf49a43SJulian Elischerthis way.
754cf49a43SJulian Elischer.Pp
764cf49a43SJulian ElischerThis node supports ``flag sharing'' for packets transmitted on
774cf49a43SJulian Elischer.Dv async .
784cf49a43SJulian ElischerThis is an optimization where the trailing flag byte
794cf49a43SJulian Elischerof one frame is shared with the opening flag byte of the next.
804cf49a43SJulian ElischerFlag sharing between frames is disabled after one second of transmit
814cf49a43SJulian Elischeridle time.
824cf49a43SJulian Elischer.Sh HOOKS
834cf49a43SJulian ElischerThis node type supports the following hooks:
844cf49a43SJulian Elischer.Pp
854cf49a43SJulian Elischer.Bl -tag -width foobar
864cf49a43SJulian Elischer.It Dv async
874cf49a43SJulian ElischerAsynchronous connection.
884cf49a43SJulian ElischerTypically this hook would be connected to a
894cf49a43SJulian Elischer.Xr ng_tty 8
904cf49a43SJulian Elischernode, which handles transmission of serial data over a tty device.
914cf49a43SJulian Elischer.It Dv sync
924cf49a43SJulian ElischerSynchronous connection. This hook sends and receives synchronous frames.
934cf49a43SJulian ElischerFor PPP, these frames contain no address, control, or checksum fields;
944cf49a43SJulian Elischereach frame begins with the PPP protocol number. Typically this hook would
954cf49a43SJulian Elischerbe connected to the
964cf49a43SJulian Elischer.Dv downstream
974cf49a43SJulian Elischerhook of a
984cf49a43SJulian Elischer.Xr ng_ppp 8
994cf49a43SJulian Elischertype node.
1004cf49a43SJulian Elischer.El
1014cf49a43SJulian Elischer.Sh CONTROL MESSAGES
1024cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following:
1034cf49a43SJulian Elischer.Bl -tag -width foo
1044cf49a43SJulian Elischer.It Dv NGM_ASYNC_CMD_GET_STATS
1054cf49a43SJulian ElischerThis command returns a
1064cf49a43SJulian Elischer.Dv "struct ng_async_stat"
1074cf49a43SJulian Elischercontaining node statistics for packet, octet, and error counts.
1084cf49a43SJulian Elischer.It Dv NGM_ASYNC_CMD_CLR_STATS
1094cf49a43SJulian ElischerClears the node statistics.
1104cf49a43SJulian Elischer.It Dv NGM_ASYNC_CMD_SET_CONFIG
1114cf49a43SJulian ElischerSets the node configuration, which is described by a
1124cf49a43SJulian Elischer.Dv "struct ng_async_cfg" :
1134cf49a43SJulian Elischer.Bd -literal -offset 4n
1144cf49a43SJulian Elischerstruct ng_async_cfg {
1154cf49a43SJulian Elischer  u_char    enabled;  /* Turn encoding on/off */
1164cf49a43SJulian Elischer  u_char    acfcomp;  /* Address/control field comp. */
1174cf49a43SJulian Elischer  u_int16_t amru;     /* Max receive async frame len */
1184cf49a43SJulian Elischer  u_int16_t smru;     /* Max receive sync frame len */
1194cf49a43SJulian Elischer  u_int32_t accm;     /* ACCM encoding */
1204cf49a43SJulian Elischer};
1214cf49a43SJulian Elischer.Ed
1224cf49a43SJulian Elischer.Pp
1234cf49a43SJulian ElischerThe
1244cf49a43SJulian Elischer.Dv enabled
1254cf49a43SJulian Elischerfield enables or disables all encoding/decoding functions (default disabled).
1264cf49a43SJulian ElischerWhen disabled, the node operates in simple ``pass through'' mode.  Setting
1274cf49a43SJulian Elischer.Dv acfcomp
1284cf49a43SJulian Elischerenables address and control field compression on transmission (for packets
1294cf49a43SJulian Elischerreceived on the
1304cf49a43SJulian Elischer.Dv sync
1314cf49a43SJulian Elischerhook only; default off).
1324cf49a43SJulian Elischer.Dv amru
1334cf49a43SJulian Elischerand
1344cf49a43SJulian Elischer.Dv smru
1354cf49a43SJulian Elischerare the asynchronous and synchronous MRU (maximum receive unit) values,
1364cf49a43SJulian Elischerrespectively. These both default to 1600; note that the async MRU
1374cf49a43SJulian Elischerapplies to the incoming frame length after asynchronous decoding.
1384cf49a43SJulian ElischerFinally,
1394cf49a43SJulian Elischer.Dv accm
1404cf49a43SJulian Elischeris the asynchronous character control map, which controls the escaping
1414cf49a43SJulian Elischerof characters 0x00 thorough 0x1f (default 0xffffffff).
1424cf49a43SJulian Elischer.It Dv NGM_ASYNC_CMD_GET_CONFIG
1434cf49a43SJulian ElischerThis command returns the current configuration structure.
1444cf49a43SJulian Elischer.El
1454cf49a43SJulian Elischer.Sh SHUTDOWN
1464cf49a43SJulian ElischerThis node shuts down upon receipt of a
1474cf49a43SJulian Elischer.Dv NGM_SHUTDOWN
1484cf49a43SJulian Elischercontrol message, or when all hooks have been disconnected.
1494cf49a43SJulian Elischer.Sh SEE ALSO
1504cf49a43SJulian Elischer.Xr netgraph 4 ,
1514cf49a43SJulian Elischer.Xr ng_ppp 8 ,
1524cf49a43SJulian Elischer.Xr ng_tty 8 ,
1534cf49a43SJulian Elischer.Xr ngctl 8 .
1544cf49a43SJulian Elischer.Rs
1554cf49a43SJulian Elischer.%A W. Simpson
1564cf49a43SJulian Elischer.%T "PPP in HDLC-link Framing"
1574cf49a43SJulian Elischer.%O RFC 1662
1584cf49a43SJulian Elischer.Re
1594cf49a43SJulian Elischer.Sh AUTHOR
1604cf49a43SJulian ElischerArchie Cobbs <archie@whistle.com>
161