embedded IPsec source code documentation


types.h

Go to the documentation of this file.
00001 /*
00002  * embedded IPsec
00003  * Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without modification,
00007  * are permitted provided that the following conditions are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright notice,
00012  *    this list of conditions and the following disclaimer in the documentation
00013  *    and/or other materials provided with the distribution.
00014  * 3. The name of the author may not be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00020  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00022  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00023  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00025  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00026  * OF SUCH DAMAGE.
00027  *
00028  */
00029 
00043 #ifndef __IPSEC_TYPES_H__
00044 #define __IPSEC_TYPES_H__
00045 
00046 typedef unsigned   char    __u8;
00047 typedef signed     char    __s8;
00048 typedef unsigned   short   __u16;
00049 typedef signed     short   __s16;
00050 typedef unsigned   long    __u32;
00051 typedef signed     long    __s32;
00052 
00053 
00061 typedef enum ipsec_status_list {                                
00062         IPSEC_STATUS_SUCCESS                    =  0,           
00063         IPSEC_STATUS_NOT_IMPLEMENTED    = -1,           
00064         IPSEC_STATUS_FAILURE                    = -2,           
00065         IPSEC_STATUS_DATA_SIZE_ERROR    = -3,           
00066         IPSEC_STATUS_NO_SPACE_IN_SPD    = -4,           
00067         IPSEC_STATUS_NO_POLICY_FOUND    = -5,           
00068         IPSEC_STATUS_NO_SA_FOUND                = -6,           
00069         IPSEC_STATUS_BAD_PACKET                 = -7,           
00070         IPSEC_STATUS_BAD_PROTOCOL               = -8,           
00071         IPSEC_STATUS_BAD_KEY                    = -9,           
00072         IPSEC_STATUS_TTL_EXPIRED                = -10,          
00073         IPSEC_STATUS_NOT_INITIALIZED    = -100          
00074 } ipsec_status;
00075 
00076 
00077 typedef enum ipsec_audit_list {                                 
00078         IPSEC_AUDIT_SUCCESS                     =  0,           
00079         IPSEC_AUDIT_NOT_IMPLEMENTED     =  1,           
00080         IPSEC_AUDIT_FAILURE                             =  2,           
00081         IPSEC_AUDIT_APPLY                               =  3,           
00082         IPSEC_AUDIT_BYPASS                              =  4,           
00083         IPSEC_AUDIT_DISCARD                             =  5,           
00084         IPSEC_AUDIT_SPI_MISMATCH                =  6,           
00085         IPSEC_AUDIT_SEQ_MISMATCH                =  7,           
00086         IPSEC_AUDIT_POLICY_MISMATCH             =  8            
00087 } ipsec_audit;
00088 
00089 
00090 typedef enum ipsec_ip_protocol_list {                   
00091         IPSEC_PROTO_ICMP                                = 0x01,         
00092         IPSEC_PROTO_TCP                                 = 0x06,         
00093         IPSEC_PROTO_UDP                                 = 0x11,         
00094         IPSEC_PROTO_ESP                                 = 0x32,         
00095         IPSEC_PROTO_AH                                  = 0x33          
00096 } ipsec_ip_protocol;
00097 
00098 
00099 #pragma pack(1)
00100 #pragma bytealign
00101 
00102 typedef struct ipsec_ip_hdr_struct 
00103 {
00104   __u8  v_hl;                           
00105   __u8  tos;                            
00106   __u16 len;                            
00107   __u16 id;                                     
00108   __u16 offset;                         
00109   __u8  ttl;                            
00110   __u8  protocol;                       
00111   __u16 chksum;                         
00112   __u32 src;                            
00113   __u32 dest;                           
00114 } ipsec_ip_header;
00115 
00116 typedef struct ipsec_tcp_hdr_struct 
00117 {
00118   __u16 src;                            
00119   __u16 dest;                           
00120   __u32 seqno;                          
00121   __u32 ackno;                          
00122   __u16 offset_flags;           
00123   __u16 wnd;                            
00124   __u16 chksum;                         
00125   __u16 urgp;                           
00126 } ipsec_tcp_header;
00127 
00128 typedef struct ipsec_udp_hdr_struct 
00129 {
00130         __u16   src ;                   
00131         __u16   dest ;                  
00132         __u16   len ;                   
00133         __u16   chksum ;                
00134 } ipsec_udp_header ;
00135 
00136 
00137 
00138 #endif

Copyright 2003 by Christian Scheurer and Niklaus Schild