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