xref: /freebsd/share/man/man4/ng_vjc.4 (revision ae83180158c4c937f170e31eff311b18c0286a93)
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_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
37.\"
38.Dd January 19, 1999
39.Dt NG_VJC 4
40.Os
41.Sh NAME
42.Nm ng_vjc
43.Nd Van Jacobson compression netgraph node type
44.Sh SYNOPSIS
45.In net/slcompress.h
46.In netgraph/ng_vjc.h
47.Sh DESCRIPTION
48The
49.Nm vjc
50node type performs Van Jacobson compression, which is used
51over PPP, SLIP, and other point-to-point IP connections to
52compress TCP packet headers.  The
53.Dv ip
54hook represents the uncompressed side of the node, while the
55.Dv vjcomp ,
56.Dv vjuncomp ,
57and
58.Dv vjip
59hooks represent the compressed side of the node.  Packets received on the
60.Dv ip
61will be compressed or passed through as appropriate.  Packets received
62on the other three hooks will be uncompressed as appropriate.
63This node also supports
64.Dq always pass through
65mode in either direction.
66.Pp
67Van Jacobson compression only applies to TCP packets.
68Only
69.Dq normal
70(i.e., common case) TCP packets are actually compressed.
71These are output on the
72.Dv vjcomp
73hook.  Other TCP packets are run through the state machine but not
74compressed; these appear on the
75.Dv vjuncomp
76hook.
77Other non-TCP IP packets are forwarded unchanged to
78.Dv vjip .
79.Pp
80When connecting to a
81.Xr ng_ppp 4
82node, the
83.Dv ip ,
84.Dv vjuncomp ,
85.Dv vjcomp ,
86and
87.Dv vjip
88hooks should be connected to the
89.Xr ng_ppp 4
90node's
91.Dv vjc_ip ,
92.Dv vjc_vjcomp ,
93.Dv vjc_vjuncomp ,
94and
95.Dv vjc_ip
96hooks, respectively.
97.Sh HOOKS
98This node type supports the following hooks:
99.Pp
100.Bl -tag -width foobarbazi
101.It Dv ip
102Upstream (uncompressed) IP packets.
103.It Dv vjcomp
104Downstream compressed TCP packets.
105.It Dv vjuncomp
106Downstream uncompressed TCP packets.
107.It Dv vjip
108Downstream uncompressed IP packets.
109.El
110.Sh CONTROL MESSAGES
111This node type supports the generic control messages, plus the following:
112.Bl -tag -width foo
113.It Dv NGM_VJC_SET_CONFIG
114This command resets the compression state and configures it according
115to the supplied
116.Dv "struct ngm_vjc_config"
117argument.  This structure contains the following fields:
118.Bd -literal -offset 4n
119struct ngm_vjc_config {
120  u_char   enableComp;    /* Enable compression */
121  u_char   enableDecomp;  /* Enable decompression */
122  u_char   maxChannel;    /* Number of outgoing channels - 1 */
123  u_char   compressCID;   /* OK to compress outgoing CID's */
124};
125.Ed
126.Pp
127When
128.Dv enableComp
129is set to zero, all packets received on the
130.Dv ip
131hook are forwarded unchanged out the
132.Dv vjip
133hook.  Similarly, when
134.Dv enableDecomp
135is set to zero, all packets received on the
136.Dv vjip
137hook are forwarded unchanged out the
138.Dv ip
139hook, and packets are not accepted on the
140.Dv vjcomp
141and
142.Dv vjuncomp
143hooks.
144When a node is first created,
145both compression and decompression are disabled and the node is
146therefore operating in bi-directional
147.Dq pass through
148mode.
149.Pp
150When enabling compression,
151.Dv maxChannel
152should be set to the number of outgoing compression channels minus one,
153and is a value between 3 and 15, inclusive.  The
154.Dv compressCID
155field indicates whether it is OK to compress the CID header field for
156outgoing compressed TCP packets.  This value should be zero unless
157either (a) it is not possible for an outgoing frame to be lost, or
158(b) lost frames can be reliably detected and immediately
159reported to the peer's decompression engine (see
160.Dv NGM_VJC_RECV_ERROR
161below).
162.It Dv NGM_VJC_GET_STATE
163This command returns the node's current state described by the
164.Dv "struct slcompress"
165structure, which is defined in
166.Pa net/slcompress.h .
167.It Dv NGM_VJC_CLR_STATS
168Clears the node statistics counters.  Statistics are also cleared whenever the
169.Dv enableComp
170or
171.Dv enableDecomp
172fields are changed from zero to one by a
173.Dv NGM_VJC_SET_CONFIG
174control message.
175.It Dv NGM_VJC_RECV_ERROR
176When the peer has CID header field compression enabled,
177this message must be sent to the local
178.Nm vjc
179node immediately
180after detecting that a received frame has been lost, due to a bad
181checksum or for any other reason.  Failing to do this can result
182in corrupted TCP stream data.
183.El
184.Sh SHUTDOWN
185This node shuts down upon receipt of a
186.Dv NGM_SHUTDOWN
187control message, or when all hooks have been disconnected.
188.Sh BUGS
189Because the initialization routine in the kernel implementation of
190Van Jacobson compression initializes both compression and decompression
191at once, this node does not allow compression and decompression to
192be enabled in separate operations.  In order to enable one when
193the other is already enabled, first both must be disabled, then
194both enabled.  This of course resets the node state.  This restriction
195may be lifted in a later version.
196.Pp
197When built as a loadable kernel module, this module includes the file
198.Pa net/slcompress.c .
199Although loading the module should fail if
200.Pa net/slcompress.c
201already exists in the kernel, currently it does not, and the duplicate
202copies of the file do not interfere.
203However, this may change in the future.
204.Sh SEE ALSO
205.Xr netgraph 4 ,
206.Xr ng_iface 4 ,
207.Xr ng_ppp 4 ,
208.Xr ngctl 8
209.Rs
210.%A V. Jacobson
211.%T "Compressing TCP/IP Headers"
212.%O RFC 1144
213.Re
214.Rs
215.%A G. McGregor
216.%T "The PPP Internet Control Protocol (IPCP)"
217.%O RFC 1332
218.Re
219.Sh HISTORY
220The
221.Nm
222node type was implemented in
223.Fx 4.0 .
224.Sh AUTHORS
225.An Archie Cobbs Aq archie@FreeBSD.org
226