packet_parser.h

Go to the documentation of this file.
00001 /*
00002  ** Copyright(C) 2003-2006 - INL
00003  ** Written by Eric Leblond <regit@inl.fr>
00004  ** INL http://www.inl.fr/
00005  **
00006  ** $Id: packet_parser.h 4847 2008-06-13 14:48:31Z regit $
00007  **
00008  ** This program is free software; you can redistribute it and/or modify
00009  ** it under the terms of the GNU General Public License as published by
00010  ** the Free Software Foundation, version 3 of the License.
00011  **
00012  ** This program is distributed in the hope that it will be useful,
00013  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  ** GNU General Public License for more details.
00016  **
00017  ** You should have received a copy of the GNU General Public License
00018  ** along with this program; if not, write to the Free Software
00019  ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020  */
00021 
00029 #ifndef PACKET_PARSER_H
00030 #define PACKET_PARSER_H
00031 
00032 #include "ipv6.h"
00033 #include <sys/types.h>
00034 
00035 #ifdef TRACKING_WITH_PAYLOAD
00036 #  define PAYLOAD_SAMPLE 8
00037 #  define PAYLOAD6_SAMPLE PAYLOAD_SAMPLE
00038 #endif
00039 
00041 typedef enum {
00042         TCP_STATE_DROP = 0,     
00043         TCP_STATE_OPEN,         
00044         TCP_STATE_ESTABLISHED,  
00045         TCP_STATE_CLOSE,        
00046         TCP_STATE_UNKNOW        
00047 } tcp_state_t;
00048 
00053 typedef struct {
00054         /* Group informations about destination to make
00055          * ACL hash function faster. If you change this
00056          * structure, please also change hash_acl() and hash_connection() */
00057         struct in6_addr saddr;  
00058         struct in6_addr daddr;  
00059         u_int8_t protocol;      
00060         u_int8_t padding;       
00062         u_int16_t dest;         
00063         u_int16_t source;       
00065         u_int8_t type;          
00066         u_int8_t code;          
00069 #ifdef TRACKING_WITH_PAYLOAD
00070         char payload[PAYLOAD_SAMPLE];   
00071 #endif
00072 } tracking_t;
00073 
00074 unsigned int get_ip_headers(tracking_t * tracking,
00075                             const unsigned char *dgram,
00076                             unsigned int dgram_size);
00077 int get_udp_headers(tracking_t * tracking, const unsigned char *dgram,
00078                     unsigned int dgram_size);
00079 tcp_state_t get_tcp_headers(tracking_t * tracking,
00080                             const unsigned char *dgram,
00081                             unsigned int dgram_size);
00082 int get_icmp_headers(tracking_t * tracking, const unsigned char *dgram,
00083                      unsigned int dgram_size);
00084 int get_icmpv6_headers(tracking_t * tracking, const unsigned char *dgram,
00085                        unsigned int dgram_size);
00086 
00087 #endif

Generated on Sat Nov 22 04:00:37 2008 for NuFW by  doxygen 1.4.7