xref: /freebsd/share/man/man4/ng_async.4 (revision c60bda17f2a9ed4a8c1ef6483ee7b8f207de7129)
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.\"
33eddc45e7SJeroen Ruigrok van der Werven.\" Author: Archie Cobbs <archie@FreeBSD.org>
344cf49a43SJulian Elischer.\"
354cf49a43SJulian Elischer.\" $FreeBSD$
364cf49a43SJulian Elischer.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
374cf49a43SJulian Elischer.\"
38*c60bda17SJoel Dahl.Dd November 13, 2012
39bec35b9aSArchie Cobbs.Dt NG_ASYNC 4
403d45e180SRuslan Ermilov.Os
414cf49a43SJulian Elischer.Sh NAME
424cf49a43SJulian Elischer.Nm ng_async
434cf49a43SJulian Elischer.Nd asynchronous framing netgraph node type
444cf49a43SJulian Elischer.Sh SYNOPSIS
45fbad9e2dSRuslan Ermilov.In sys/types.h
4632eef9aeSRuslan Ermilov.In netgraph/ng_async.h
474cf49a43SJulian Elischer.Sh DESCRIPTION
484cf49a43SJulian ElischerThe
494cf49a43SJulian Elischer.Nm async
504cf49a43SJulian Elischernode type performs conversion between synchronous frames and
514cf49a43SJulian Elischerasynchronous frames, as defined for the PPP protocol in RFC 1662.
524cf49a43SJulian ElischerAsynchronous framing uses flag bytes and octet-stuffing
534cf49a43SJulian Elischerto simulate a frame oriented connection over an octet-oriented
54db8cd7ceSArchie Cobbsasynchronous serial line.
554cf49a43SJulian Elischer.Pp
567f9d26bdSMike PritchardThe node transmits and receives asynchronous data on the
574cf49a43SJulian Elischer.Dv async
585203edcdSRuslan Ermilovhook.
595203edcdSRuslan ErmilovMbuf boundaries of incoming data are ignored.
60db8cd7ceSArchie CobbsOnce a complete packet has been received, it is decoded and
61db8cd7ceSArchie Cobbsstripped of all framing bytes, and transmitted out the
624cf49a43SJulian Elischer.Dv sync
63debfa518SArchie Cobbshook as a single frame.
64db8cd7ceSArchie Cobbs.Pp
65db8cd7ceSArchie CobbsSynchronous frames are transmitted and received on the
66db8cd7ceSArchie Cobbs.Dv sync
67db8cd7ceSArchie Cobbshook.
68db8cd7ceSArchie CobbsPackets received on this hook are encoded as asynchronous frames
694cf49a43SJulian Elischerand sent out on
704cf49a43SJulian Elischer.Dv async .
71debfa518SArchie CobbsReceived packets should start with the address and control fields,
72debfa518SArchie Cobbsor the PPP protocol field if address and control field compression
735203edcdSRuslan Ermilovis employed, and contain no checksum field.
745203edcdSRuslan ErmilovIf the first four bytes are
75debfa518SArchie Cobbs.Dv "0xff 0x03 0xc0 0x21"
76debfa518SArchie Cobbs(an LCP protocol frame) then complete control character escaping
77debfa518SArchie Cobbsis enabled for that frame (in PPP, LCP packets are always sent with
78debfa518SArchie Cobbsno address and control field compression and all control characters
79debfa518SArchie Cobbsescaped).
804cf49a43SJulian Elischer.Pp
8151291597SJulian ElischerThis node supports
8251291597SJulian Elischer.Dq flag sharing
8351291597SJulian Elischerfor packets transmitted on
844cf49a43SJulian Elischer.Dv async .
854cf49a43SJulian ElischerThis is an optimization where the trailing flag byte
864cf49a43SJulian Elischerof one frame is shared with the opening flag byte of the next.
874cf49a43SJulian ElischerFlag sharing between frames is disabled after one second of transmit
884cf49a43SJulian Elischeridle time.
894cf49a43SJulian Elischer.Sh HOOKS
904cf49a43SJulian ElischerThis node type supports the following hooks:
91*c60bda17SJoel Dahl.Bl -tag -width ".Va async"
92*c60bda17SJoel Dahl.It Va async
934cf49a43SJulian ElischerAsynchronous connection.
944cf49a43SJulian ElischerTypically this hook would be connected to a
95bec35b9aSArchie Cobbs.Xr ng_tty 4
964cf49a43SJulian Elischernode, which handles transmission of serial data over a tty device.
97*c60bda17SJoel Dahl.It Va sync
985203edcdSRuslan ErmilovSynchronous connection.
995203edcdSRuslan ErmilovThis hook sends and receives synchronous frames.
100debfa518SArchie CobbsFor PPP, these frames should contain address, control, and protocol fields,
101debfa518SArchie Cobbsbut no checksum field.
102debfa518SArchie CobbsTypically this hook would be connected to an individual link hook of a
103bec35b9aSArchie Cobbs.Xr ng_ppp 4
1044cf49a43SJulian Elischertype node.
1054cf49a43SJulian Elischer.El
1064cf49a43SJulian Elischer.Sh CONTROL MESSAGES
1074cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following:
1084cf49a43SJulian Elischer.Bl -tag -width foo
109*c60bda17SJoel Dahl.It Dv NGM_ASYNC_CMD_SET_CONFIG Pq Ic setconfig
1104cf49a43SJulian ElischerSets the node configuration, which is described by a
1114cf49a43SJulian Elischer.Dv "struct ng_async_cfg" :
1124cf49a43SJulian Elischer.Bd -literal -offset 4n
1134cf49a43SJulian Elischerstruct ng_async_cfg {
1144cf49a43SJulian Elischer	u_char    enabled;  /* Turn encoding on/off */
115*c60bda17SJoel Dahl	uint16_t  amru;     /* Max receive async frame length */
116*c60bda17SJoel Dahl	uint16_t  smru;     /* Max receive sync frame length */
1176b99842aSEd Schouten	uint32_t  accm;     /* ACCM encoding */
1184cf49a43SJulian Elischer};
1194cf49a43SJulian Elischer.Ed
1204cf49a43SJulian ElischerThe
1214cf49a43SJulian Elischer.Dv enabled
1224cf49a43SJulian Elischerfield enables or disables all encoding/decoding functions (default disabled).
12351291597SJulian ElischerWhen disabled, the node operates in simple
12451291597SJulian Elischer.Dq pass through
12551291597SJulian Elischermode.
126debfa518SArchie CobbsThe
1274cf49a43SJulian Elischer.Dv amru
1284cf49a43SJulian Elischerand
1294cf49a43SJulian Elischer.Dv smru
130debfa518SArchie Cobbsfields are the asynchronous and synchronous MRU (maximum receive unit) values,
1315203edcdSRuslan Ermilovrespectively.
1325203edcdSRuslan ErmilovThese both default to 1600; note that the async MRU
1334cf49a43SJulian Elischerapplies to the incoming frame length after asynchronous decoding.
134debfa518SArchie CobbsThe
1354cf49a43SJulian Elischer.Dv accm
136debfa518SArchie Cobbsfield is the asynchronous character control map, which controls the escaping
1374cf49a43SJulian Elischerof characters 0x00 thorough 0x1f (default 0xffffffff).
138*c60bda17SJoel Dahl.It Dv NGM_ASYNC_CMD_GET_CONFIG Pq Ic getconfig
1394cf49a43SJulian ElischerThis command returns the current configuration structure.
140*c60bda17SJoel Dahl.It Dv NGM_ASYNC_CMD_GET_STATS Pq Ic getstats
141*c60bda17SJoel DahlThis command returns a
142*c60bda17SJoel Dahl.Dv "struct ng_async_stat"
143*c60bda17SJoel Dahlcontaining node statistics for packet, octet, and error counts.
144*c60bda17SJoel Dahl.It Dv NGM_ASYNC_CMD_CLR_STATS Pq Ic clrstats
145*c60bda17SJoel DahlClears the node statistics.
146*c60bda17SJoel Dahl.Pp
1474cf49a43SJulian Elischer.El
1484cf49a43SJulian Elischer.Sh SHUTDOWN
1494cf49a43SJulian ElischerThis node shuts down upon receipt of a
1504cf49a43SJulian Elischer.Dv NGM_SHUTDOWN
1514cf49a43SJulian Elischercontrol message, or when all hooks have been disconnected.
1524cf49a43SJulian Elischer.Sh SEE ALSO
1534cf49a43SJulian Elischer.Xr netgraph 4 ,
154bec35b9aSArchie Cobbs.Xr ng_ppp 4 ,
155bec35b9aSArchie Cobbs.Xr ng_tty 4 ,
156bec35b9aSArchie Cobbs.Xr ngctl 8
1574cf49a43SJulian Elischer.Rs
1584cf49a43SJulian Elischer.%A W. Simpson
1594cf49a43SJulian Elischer.%T "PPP in HDLC-link Framing"
1604cf49a43SJulian Elischer.%O RFC 1662
1614cf49a43SJulian Elischer.Re
162debfa518SArchie Cobbs.Rs
163debfa518SArchie Cobbs.%A W. Simpson
164debfa518SArchie Cobbs.%T "The Point-to-Point Protocol (PPP)"
165debfa518SArchie Cobbs.%O RFC 1661
166debfa518SArchie Cobbs.Re
16751291597SJulian Elischer.Sh HISTORY
16851291597SJulian ElischerThe
16951291597SJulian Elischer.Nm
17051291597SJulian Elischernode type was implemented in
17151291597SJulian Elischer.Fx 4.0 .
17251291597SJulian Elischer.Sh AUTHORS
173eddc45e7SJeroen Ruigrok van der Werven.An Archie Cobbs Aq archie@FreeBSD.org
174