pred.c (72025) | pred.c (78411) |
---|---|
1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * Ian Donaldson <iand@labtam.labtam.oz.au> 4 * Carsten Bormann <cabo@cs.tu-berlin.de> 5 * Dave Rand <dlr@bungi.com>/<dave_rand@novell.com> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 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 * | 1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * Ian Donaldson <iand@labtam.labtam.oz.au> 4 * Carsten Bormann <cabo@cs.tu-berlin.de> 5 * Dave Rand <dlr@bungi.com>/<dave_rand@novell.com> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 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 * $FreeBSD: head/usr.sbin/ppp/pred.c 72025 2001-02-04 22:53:11Z brian $ | 29 * $FreeBSD: head/usr.sbin/ppp/pred.c 78411 2001-06-18 15:00:22Z brian $ |
30 */ 31 32#include <sys/types.h> 33 34#include <stdlib.h> 35#include <string.h> 36#include <termios.h> 37 --- 96 unchanged lines hidden (view full) --- 134Pred1ResetInput(void *v) 135{ 136 struct pred1_state *state = (struct pred1_state *)v; 137 state->hash = 0; 138 memset(state->dict, '\0', sizeof state->dict); 139 log_Printf(LogCCP, "Predictor1: Input channel reset\n"); 140} 141 | 30 */ 31 32#include <sys/types.h> 33 34#include <stdlib.h> 35#include <string.h> 36#include <termios.h> 37 --- 96 unchanged lines hidden (view full) --- 134Pred1ResetInput(void *v) 135{ 136 struct pred1_state *state = (struct pred1_state *)v; 137 state->hash = 0; 138 memset(state->dict, '\0', sizeof state->dict); 139 log_Printf(LogCCP, "Predictor1: Input channel reset\n"); 140} 141 |
142static void | 142static int |
143Pred1ResetOutput(void *v) 144{ 145 struct pred1_state *state = (struct pred1_state *)v; 146 state->hash = 0; 147 memset(state->dict, '\0', sizeof state->dict); 148 log_Printf(LogCCP, "Predictor1: Output channel reset\n"); | 143Pred1ResetOutput(void *v) 144{ 145 struct pred1_state *state = (struct pred1_state *)v; 146 state->hash = 0; 147 memset(state->dict, '\0', sizeof state->dict); 148 log_Printf(LogCCP, "Predictor1: Output channel reset\n"); |
149 150 return 1; /* Ask FSM to ACK */ |
|
149} 150 151static void * 152Pred1InitInput(struct lcp_opt *o) 153{ 154 struct pred1_state *state; 155 state = (struct pred1_state *)malloc(sizeof(struct pred1_state)); 156 if (state != NULL) --- 142 unchanged lines hidden (view full) --- 299 300static void 301Pred1InitOptsOutput(struct lcp_opt *o, const struct ccp_config *cfg) 302{ 303 o->len = 2; 304} 305 306static int | 151} 152 153static void * 154Pred1InitInput(struct lcp_opt *o) 155{ 156 struct pred1_state *state; 157 state = (struct pred1_state *)malloc(sizeof(struct pred1_state)); 158 if (state != NULL) --- 142 unchanged lines hidden (view full) --- 301 302static void 303Pred1InitOptsOutput(struct lcp_opt *o, const struct ccp_config *cfg) 304{ 305 o->len = 2; 306} 307 308static int |
307Pred1SetOptsOutput(struct lcp_opt *o) | 309Pred1SetOptsOutput(struct lcp_opt *o, const struct ccp_config *cfg) |
308{ 309 if (o->len != 2) { 310 o->len = 2; 311 return MODE_NAK; 312 } 313 return MODE_ACK; 314} 315 316static int 317Pred1SetOptsInput(struct lcp_opt *o, const struct ccp_config *cfg) 318{ | 310{ 311 if (o->len != 2) { 312 o->len = 2; 313 return MODE_NAK; 314 } 315 return MODE_ACK; 316} 317 318static int 319Pred1SetOptsInput(struct lcp_opt *o, const struct ccp_config *cfg) 320{ |
319 return Pred1SetOptsOutput(o); | 321 if (o->len != 2) { 322 o->len = 2; 323 return MODE_NAK; 324 } 325 return MODE_ACK; |
320} 321 322const struct ccp_algorithm Pred1Algorithm = { 323 TY_PRED1, 324 CCP_NEG_PRED1, 325 Pred1DispOpts, | 326} 327 328const struct ccp_algorithm Pred1Algorithm = { 329 TY_PRED1, 330 CCP_NEG_PRED1, 331 Pred1DispOpts, |
326 ccp_IsUsable, | 332 ccp_DefaultUsable, 333 ccp_DefaultRequired, |
327 { 328 Pred1SetOptsInput, 329 Pred1InitInput, 330 Pred1Term, 331 Pred1ResetInput, 332 Pred1Input, 333 Pred1DictSetup 334 }, 335 { 336 Pred1InitOptsOutput, 337 Pred1SetOptsOutput, 338 Pred1InitOutput, 339 Pred1Term, 340 Pred1ResetOutput, 341 Pred1Output 342 }, 343}; | 334 { 335 Pred1SetOptsInput, 336 Pred1InitInput, 337 Pred1Term, 338 Pred1ResetInput, 339 Pred1Input, 340 Pred1DictSetup 341 }, 342 { 343 Pred1InitOptsOutput, 344 Pred1SetOptsOutput, 345 Pred1InitOutput, 346 Pred1Term, 347 Pred1ResetOutput, 348 Pred1Output 349 }, 350}; |