]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/ip_state.h
f27f94cb15c3877e8e79fe46eac498d77c17f563
   2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 
   4  * @APPLE_LICENSE_HEADER_START@ 
   6  * The contents of this file constitute Original Code as defined in and 
   7  * are subject to the Apple Public Source License Version 1.1 (the 
   8  * "License").  You may not use this file except in compliance with the 
   9  * License.  Please obtain a copy of the License at 
  10  * http://www.apple.com/publicsource and read it before using this file. 
  12  * This Original Code and all software distributed under the License are 
  13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
  16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the 
  17  * License for the specific language governing rights and limitations 
  20  * @APPLE_LICENSE_HEADER_END@ 
  23  * Copyright (C) 1995-1997 by Darren Reed. 
  25  * Redistribution and use in source and binary forms are permitted 
  26  * provided that this notice is preserved and due credit is given 
  27  * to the original author and the contributors. 
  29  * @(#)ip_state.h       1.3 1/12/96 (C) 1995 Darren Reed 
  31 #ifndef __IP_STATE_H__ 
  32 #define __IP_STATE_H__ 
  34 #define IPSTATE_SIZE    257 
  35 #define IPSTATE_MAX     2048    /* Maximum number of states held */ 
  37 #define PAIRS(s1,d1,s2,d2)      ((((s1) == (s2)) && ((d1) == (d2))) ||\ 
  38                                  (((s1) == (d2)) && ((d1) == (s2)))) 
  39 #define IPPAIR(s1,d1,s2,d2)     PAIRS((s1).s_addr, (d1).s_addr, \ 
  40                                       (s2).s_addr, (d2).s_addr) 
  43 typedef struct udpstate 
{ 
  48 typedef struct icmpstate 
{ 
  54 typedef struct tcpstate 
{ 
  64 typedef struct ipstate 
{ 
  65         struct  ipstate 
*is_next
; 
  72         struct  in_addr is_src
; 
  73         struct  in_addr is_dst
; 
  89 #define is_icmp is_ps.is_ics 
  90 #define is_tcp  is_ps.is_ts 
  91 #define is_udp  is_ps.is_us 
  92 #define is_seq  is_tcp.ts_seq 
  93 #define is_ack  is_tcp.ts_ack 
  94 #define is_dwin is_tcp.ts_dwin 
  95 #define is_swin is_tcp.ts_swin 
  96 #define is_sport        is_tcp.ts_sport 
  97 #define is_dport        is_tcp.ts_dport 
  98 #define is_state        is_tcp.ts_state 
 100 #define TH_OPENING      (TH_SYN|TH_ACK) 
 103 typedef struct  ipslog  
{ 
 106         struct  in_addr isl_src
; 
 107         struct  in_addr isl_dst
; 
 112                 u_short isl_filler
[2]; 
 113                 u_short isl_ports
[2]; 
 118 #define isl_sport       isl_ps.isl_ports[0] 
 119 #define isl_dport       isl_ps.isl_ports[1] 
 120 #define isl_itype       isl_ps.isl_icmp 
 123 #define ISL_EXPIRE      0xffff 
 124 #define ISL_FLUSH       0xfffe 
 127 typedef struct  ips_stat 
{ 
 140         ipstate_t 
**iss_table
; 
 144 extern  u_long  fr_tcpidletimeout
; 
 145 extern  u_long  fr_tcpclosewait
; 
 146 extern  u_long  fr_tcplastack
; 
 147 extern  u_long  fr_tcptimeout
; 
 148 extern  u_long  fr_tcpclosed
; 
 149 extern  u_long  fr_udptimeout
; 
 150 extern  u_long  fr_icmptimeout
; 
 151 extern  int     fr_tcpstate 
__P((ipstate_t 
*, fr_info_t 
*, ip_t 
*, tcphdr_t 
*)); 
 152 extern  int     fr_addstate 
__P((ip_t 
*, fr_info_t 
*, u_int
)); 
 153 extern  int     fr_checkstate 
__P((ip_t 
*, fr_info_t 
*)); 
 154 extern  void    fr_timeoutstate 
__P((void)); 
 155 extern  void    fr_tcp_age 
__P((u_long 
*, u_char 
*, ip_t 
*, fr_info_t 
*, int)); 
 156 extern  void    fr_stateunload 
__P((void)); 
 157 extern  void    ipstate_log 
__P((struct ipstate 
*, u_short
)); 
 158 #if defined(__NetBSD__) || defined(__OpenBSD__) 
 159 extern  int     fr_state_ioctl 
__P((caddr_t
, u_long
, int)); 
 161 extern  int     fr_state_ioctl 
__P((caddr_t
, int, int)); 
 164 #endif /* __IP_STATE_H__ */