xref: /freebsd/share/man/man4/ng_async.4 (revision 72143e89bb430c3b1406b399b810806904f6c882)
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.\"
35.\" $FreeBSD$
36.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
37.\"
38.Dd November 13, 2012
39.Dt NG_ASYNC 4
40.Os
41.Sh NAME
42.Nm ng_async
43.Nd asynchronous framing netgraph node type
44.Sh SYNOPSIS
45.In sys/types.h
46.In netgraph/ng_async.h
47.Sh DESCRIPTION
48The
49.Nm async
50node type performs conversion between synchronous frames and
51asynchronous frames, as defined for the PPP protocol in RFC 1662.
52Asynchronous framing uses flag bytes and octet-stuffing
53to simulate a frame oriented connection over an octet-oriented
54asynchronous serial line.
55.Pp
56The node transmits and receives asynchronous data on the
57.Dv async
58hook.
59Mbuf boundaries of incoming data are ignored.
60Once a complete packet has been received, it is decoded and
61stripped of all framing bytes, and transmitted out the
62.Dv sync
63hook as a single frame.
64.Pp
65Synchronous frames are transmitted and received on the
66.Dv sync
67hook.
68Packets received on this hook are encoded as asynchronous frames
69and sent out on
70.Dv async .
71Received packets should start with the address and control fields,
72or the PPP protocol field if address and control field compression
73is employed, and contain no checksum field.
74If the first four bytes are
75.Dv "0xff 0x03 0xc0 0x21"
76(an LCP protocol frame) then complete control character escaping
77is enabled for that frame (in PPP, LCP packets are always sent with
78no address and control field compression and all control characters
79escaped).
80.Pp
81This node supports
82.Dq flag sharing
83for packets transmitted on
84.Dv async .
85This is an optimization where the trailing flag byte
86of one frame is shared with the opening flag byte of the next.
87Flag sharing between frames is disabled after one second of transmit
88idle time.
89.Sh HOOKS
90This node type supports the following hooks:
91.Bl -tag -width ".Va async"
92.It Va async
93Asynchronous connection.
94Typically this hook would be connected to a
95.Xr ng_tty 4
96node, which handles transmission of serial data over a tty device.
97.It Va sync
98Synchronous connection.
99This hook sends and receives synchronous frames.
100For PPP, these frames should contain address, control, and protocol fields,
101but no checksum field.
102Typically this hook would be connected to an individual link hook of a
103.Xr ng_ppp 4
104type node.
105.El
106.Sh CONTROL MESSAGES
107This node type supports the generic control messages, plus the following:
108.Bl -tag -width foo
109.It Dv NGM_ASYNC_CMD_SET_CONFIG Pq Ic setconfig
110Sets the node configuration, which is described by a
111.Dv "struct ng_async_cfg" :
112.Bd -literal -offset 4n
113struct ng_async_cfg {
114	u_char    enabled;  /* Turn encoding on/off */
115	uint16_t  amru;     /* Max receive async frame length */
116	uint16_t  smru;     /* Max receive sync frame length */
117	uint32_t  accm;     /* ACCM encoding */
118};
119.Ed
120The
121.Dv enabled
122field enables or disables all encoding/decoding functions (default disabled).
123When disabled, the node operates in simple
124.Dq pass through
125mode.
126The
127.Dv amru
128and
129.Dv smru
130fields are the asynchronous and synchronous MRU (maximum receive unit) values,
131respectively.
132These both default to 1600; note that the async MRU
133applies to the incoming frame length after asynchronous decoding.
134The
135.Dv accm
136field is the asynchronous character control map, which controls the escaping
137of characters 0x00 thorough 0x1f (default 0xffffffff).
138.It Dv NGM_ASYNC_CMD_GET_CONFIG Pq Ic getconfig
139This command returns the current configuration structure.
140.It Dv NGM_ASYNC_CMD_GET_STATS Pq Ic getstats
141This command returns a
142.Dv "struct ng_async_stat"
143containing node statistics for packet, octet, and error counts.
144.It Dv NGM_ASYNC_CMD_CLR_STATS Pq Ic clrstats
145Clears the node statistics.
146.El
147.Sh SHUTDOWN
148This node shuts down upon receipt of a
149.Dv NGM_SHUTDOWN
150control message, or when all hooks have been disconnected.
151.Sh SEE ALSO
152.Xr netgraph 4 ,
153.Xr ng_ppp 4 ,
154.Xr ng_tty 4 ,
155.Xr ngctl 8
156.Rs
157.%A W. Simpson
158.%T "PPP in HDLC-link Framing"
159.%O RFC 1662
160.Re
161.Rs
162.%A W. Simpson
163.%T "The Point-to-Point Protocol (PPP)"
164.%O RFC 1661
165.Re
166.Sh HISTORY
167The
168.Nm
169node type was implemented in
170.Fx 4.0 .
171.Sh AUTHORS
172.An Archie Cobbs Aq Mt archie@FreeBSD.org
173