Sync usage with man page.
[netbsd-mini2440.git] / dist / ipf / lib / tcpflags.c
blob7e7f603637cacbd2cb7e08f9a537bbe9d0a88f44
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2001-2002 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: tcpflags.c,v 1.3.4.1 2006/06/16 17:21:17 darrenr Exp
9 */
11 #include "ipf.h"
15 * ECN is a new addition to TCP - RFC 2481
17 #ifndef TH_ECN
18 # define TH_ECN 0x40
19 #endif
20 #ifndef TH_CWR
21 # define TH_CWR 0x80
22 #endif
24 extern char flagset[];
25 extern u_char flags[];
28 u_char tcpflags(flgs)
29 char *flgs;
31 u_char tcpf = 0;
32 char *s, *t;
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;
41 tcpf |= flags[t - flagset];
44 return tcpf;