Deleted Added
full compact
tcpflags.c (145519) tcpflags.c (153881)
1/* $FreeBSD: head/contrib/ipfilter/lib/tcpflags.c 145519 2005-04-25 18:20:15Z darrenr $ */
1/* $FreeBSD: head/contrib/ipfilter/lib/tcpflags.c 153881 2005-12-30 11:52:26Z guido $ */
2
3/*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
2
3/*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * Id: tcpflags.c,v 1.3 2002/11/02 07:18:01 darrenr Exp
8 * $Id: tcpflags.c,v 1.3 2002/11/02 07:18:01 darrenr Exp $
9 */
10
11#include "ipf.h"
12
13
14/*
15 * ECN is a new addition to TCP - RFC 2481
16 */
17#ifndef TH_ECN
18# define TH_ECN 0x40
19#endif
20#ifndef TH_CWR
21# define TH_CWR 0x80
22#endif
23
24extern char flagset[];
25extern u_char flags[];
26
27
28u_char tcpflags(flgs)
29char *flgs;
30{
31 u_char tcpf = 0;
32 char *s, *t;
33
34 for (s = flgs; *s; s++) {
35 if (*s == 'W')
36 tcpf |= TH_CWR;
37 else {
38 if (!(t = strchr(flagset, *s))) {
39 return 0;
40 }
41 tcpf |= flags[t - flagset];
42 }
43 }
44 return tcpf;
45}
9 */
10
11#include "ipf.h"
12
13
14/*
15 * ECN is a new addition to TCP - RFC 2481
16 */
17#ifndef TH_ECN
18# define TH_ECN 0x40
19#endif
20#ifndef TH_CWR
21# define TH_CWR 0x80
22#endif
23
24extern char flagset[];
25extern u_char flags[];
26
27
28u_char tcpflags(flgs)
29char *flgs;
30{
31 u_char tcpf = 0;
32 char *s, *t;
33
34 for (s = flgs; *s; s++) {
35 if (*s == 'W')
36 tcpf |= TH_CWR;
37 else {
38 if (!(t = strchr(flagset, *s))) {
39 return 0;
40 }
41 tcpf |= flags[t - flagset];
42 }
43 }
44 return tcpf;
45}