xref: /freebsd/share/man/man4/ng_deflate.4 (revision cbb3ec25236ba72f91cbdf23f8b78b9d1af0cedf)
1.\"
2.\" Author: Alexander Motin <mav@alkar.net>
3.\"
4.\" Copyright (c) 2006, Alexander Motin <mav@alkar.net>
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice unmodified, this list of conditions, and the following
12.\"    disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd December 23, 2006
30.Dt NG_DEFLATE 4
31.Os
32.Sh NAME
33.Nm ng_deflate
34.Nd Deflate PPP compression (RFC 1979) netgraph node type
35.Sh SYNOPSIS
36.In sys/types.h
37.In netgraph/ng_deflate.h
38.Sh DESCRIPTION
39The
40.Nm deflate
41node type implements the Deflate sub-protocols of the Compression Control
42Protocol (CCP).
43.Pp
44The node has two hooks,
45.Va comp
46for compression and
47.Va decomp
48for decompression.
49Only one of them can be connected at the same time, specifying node's
50operation mode.
51Typically that hooks would be connected to the
52.Xr ng_ppp 4
53node type hook of the same name.
54Corresponding
55.Xr ng_ppp 4
56node hook must be switched to
57.Dv NG_PPP_DECOMPRESS_FULL
58mode to permit sending uncompressed frames.
59.Sh HOOKS
60This node type supports the following hooks:
61.Pp
62.Bl -tag -compact -width ".Va decomp"
63.It Va comp
64Connection to
65.Xr ng_ppp 4
66.Va comp
67hook.
68Incoming frames are compressed (if possible) and sent back out the same hook.
69.It Va decomp
70Connection to
71.Xr ng_ppp 4
72.Va decomp
73hook.
74Incoming frames are decompressed (if they are compressed), and sent
75back out the same hook.
76.El
77.Pp
78Only one hook can be connected at the same time, specifying node's
79operation mode.
80.Sh CONTROL MESSAGES
81This node type supports the generic control messages, plus the following:
82.Bl -tag -width foo
83.It Dv NGM_DEFLATE_CONFIG Pq Ic config
84This command resets and configures the node for a session
85(i.e., for compression or decompression).
86This command takes a
87.Vt "struct ng_deflate_config"
88as an argument:
89.Bd -literal -offset 0n
90struct ng_deflate_config {
91	u_char	enable;			/* node enabled */
92	u_char	windowBits;		/* log2(Window size) */
93};
94.Ed
95The
96.Fa enabled
97field enables traffic flow through the node.
98The
99.Fa windowBits
100specify compression windows size as negotiated by the
101Compression Control Protocol (CCP) in PPP.
102.It Dv NGM_DEFLATE_RESETREQ Pq Ic resetreq
103This message contains no arguments, and is bi-directional.
104If an error is detected during decompression, this message is sent by the
105node to the originator of the
106.Dv NGM_DEFLATE_CONFIG
107message that initiated the session.
108The receiver should respond by sending a PPP CCP Reset-Request to the peer.
109.Pp
110This message may also be received by this node type when a CCP Reset-Request
111or Reset-Ack is received by the local PPP entity.
112The node will respond by flushing its compression state so the sides
113can resynchronize.
114.It Dv NGM_DEFLATE_GET_STATS Pq Ic getstats
115This control message obtains statistics for a given hook.
116The statistics are returned in
117.Vt "struct ng_deflate_stats" :
118.Bd -literal
119struct ng_deflate_stats {
120	uint64_t	FramesPlain;
121	uint64_t	FramesComp;
122	uint64_t	FramesUncomp;
123	uint64_t	InOctets;
124	uint64_t	OutOctets;
125	uint64_t	Errors;
126};
127.Ed
128.It Dv NGM_DEFLATE_CLR_STATS Pq Ic clrstats
129This control message clears statistics for a given hook.
130.It Dv NGM_DEFLATE_GETCLR_STATS Pq Ic getclrstats
131This control message obtains and clears statistics for a given hook.
132.El
133.Sh SHUTDOWN
134This node shuts down upon receipt of a
135.Dv NGM_SHUTDOWN
136control message, or when hook have been disconnected.
137.Sh SEE ALSO
138.Xr netgraph 4 ,
139.Xr ng_ppp 4 ,
140.Xr ngctl 8
141.Rs
142.%A J. Woods
143.%T "PPP Deflate Protocol"
144.%O RFC 1979
145.Re
146.Rs
147.%A W. Simpson
148.%T "The Point-to-Point Protocol (PPP)"
149.%O RFC 1661
150.Re
151.Sh AUTHORS
152.An Alexander Motin Aq Mt mav@alkar.net
153.Sh BUGS
154Due to nature of netgraph PPP implementation there are possible race conditions
155between data packet and ResetAck CCP packet in case of packet loss.
156As result,
157packet loss can produce bigger performance degradation than supposed by protocol.
158