/daten/src/linux-2.4.27-rsbac-v1.2.3/include/rsbac/network_types.h

Go to the documentation of this file.
00001 /************************************* */ 00002 /* Rule Set Based Access Control */ 00003 /* Author and (c) 1999-2001: */ 00004 /* Amon Ott <ao@rsbac.org> */ 00005 /* Network access control data structs */ 00006 /* Last modified: 30/Oct/2001 */ 00007 /************************************* */ 00008 00009 #ifndef __RSBAC_NETWORK_TYPES_H 00010 #define __RSBAC_NETWORK_TYPES_H 00011 00012 #define RSBAC_NET_ANY 0 00013 #define RSBAC_NET_UNKNOWN 0 00014 00015 #define RSBAC_NET_TEMP_VERSION 1 00016 #define RSBAC_NET_TEMP_KEY 0x815affe 00017 #define RSBAC_NET_TEMP_NAME "nettemp" 00018 00019 typedef __u32 rsbac_net_temp_id_t; 00020 00021 #define RSBAC_NET_MAX_ADDRESS_LEN 128 00022 #define RSBAC_NET_TEMP_NAMELEN 16 00023 00024 struct rsbac_net_temp_data_t 00025 { 00026 /* must be first for alignment */ 00027 char address[RSBAC_NET_MAX_ADDRESS_LEN]; 00028 __u8 address_family; 00029 __u8 valid_len; /* Bytes for AF_UNIX, Bits for all others */ 00030 __u8 type; 00031 __u8 protocol; 00032 rsbac_netdev_id_t netdev; 00033 __u16 min_port; /* for those address families that support them */ 00034 __u16 max_port; 00035 char name[RSBAC_NET_TEMP_NAMELEN]; 00036 }; 00037 00038 /* default template */ 00039 #define RSBAC_NET_TEMP_DEFAULT_DATA \ 00040 { \ 00041 "", /* address (not used, because len=0) */ \ 00042 AF_MAX, /* impossible family */ \ 00043 0, /* valid_len (match any) */ \ 00044 RSBAC_NET_ANY, /* type (not used) */ \ 00045 RSBAC_NET_ANY, /* protocol (not used) */ \ 00046 "", /* netdev (not used) */ \ 00047 0, /* min_port (not used) */ \ 00048 0, /* max_port (not used) */ \ 00049 "DEFAULT" /* name */ \ 00050 } 00051 00052 /* template to match all UNIX objects */ 00053 #define RSBAC_NET_TEMP_UNIX_ID 100010 00054 #define RSBAC_NET_TEMP_UNIX_DATA \ 00055 { \ 00056 "", /* address (not used, because len=0) */ \ 00057 AF_UNIX, /* family */ \ 00058 0, /* valid_len (match any) */ \ 00059 0, /* type (not used) */ \ 00060 0, /* protocol (not used) */ \ 00061 "", /* netdev (not used) */ \ 00062 0, /* min_port (not used) */ \ 00063 0, /* max_port (not used) */ \ 00064 "AF_UNIX" /* name */ \ 00065 } 00066 00067 /* template to match all INET (IPv4) objects in the localnet */ 00068 #define RSBAC_NET_TEMP_LNET_ID 100101 00069 #define RSBAC_NET_TEMP_LNET_ADDRESS "127.0.0.0" 00070 #define RSBAC_NET_TEMP_LNET_DATA \ 00071 { \ 00072 "", /* address filled in init code - do not enter dot-notation here! */ \ 00073 AF_INET, /* family */ \ 00074 8, /* valid_len */ \ 00075 RSBAC_NET_ANY, /* type */ \ 00076 RSBAC_NET_ANY, /* protocol */ \ 00077 "", /* netdev (any) */ \ 00078 0, /* min_port */ \ 00079 65535, /* max_port */ \ 00080 "localnet" /* name */ \ 00081 } 00082 00083 /* template to match all INET (IPv4) objects in the internal LAN */ 00084 #define RSBAC_NET_TEMP_LAN_ID 100102 00085 #define RSBAC_NET_TEMP_LAN_ADDRESS "192.168.0.0" 00086 #define RSBAC_NET_TEMP_LAN_DATA \ 00087 { \ 00088 "", /* address filled in init code - do not enter dot-notation here! */ \ 00089 AF_INET, /* family */ \ 00090 16, /* valid_len */ \ 00091 RSBAC_NET_ANY, /* type */ \ 00092 RSBAC_NET_ANY, /* protocol */ \ 00093 "", /* netdev (any) */ \ 00094 0, /* min_port */ \ 00095 65535, /* max_port */ \ 00096 "Internal LAN" /* name */ \ 00097 } 00098 00099 /* template to match all INET (IPv4) objects with 0.0.0.0 address */ 00100 /* (bind to all addresses / let system select address) */ 00101 #define RSBAC_NET_TEMP_AUTO_ID 100105 00102 #define RSBAC_NET_TEMP_AUTO_ADDRESS "0.0.0.0" 00103 #define RSBAC_NET_TEMP_AUTO_DATA \ 00104 { \ 00105 "", /* address filled in init code - do not enter dot-notation here! */ \ 00106 AF_INET, /* family */ \ 00107 32, /* valid_len */ \ 00108 RSBAC_NET_ANY, /* type */ \ 00109 RSBAC_NET_ANY, /* protocol */ \ 00110 "", /* netdev (any) */ \ 00111 0, /* min_port */ \ 00112 65535, /* max_port */ \ 00113 "Auto-IPv4" /* name */ \ 00114 } 00115 00116 /* template to match all INET (IPv4) objects */ 00117 #define RSBAC_NET_TEMP_INET_ID 100110 00118 #define RSBAC_NET_TEMP_INET_DATA \ 00119 { \ 00120 "", /* address (not used, because len=0) */ \ 00121 AF_INET, /* family */ \ 00122 0, /* valid_len (match any) */ \ 00123 RSBAC_NET_ANY, /* type */ \ 00124 RSBAC_NET_ANY, /* protocol */ \ 00125 "", /* netdev (any) */ \ 00126 0, /* min_port */ \ 00127 65535, /* max_port */ \ 00128 "AF_INET" /* name */ \ 00129 } 00130 00131 /* template to match all objects */ 00132 #define RSBAC_NET_TEMP_ALL_ID ((rsbac_net_temp_id_t) -1) 00133 #define RSBAC_NET_TEMP_ALL_DATA \ 00134 { \ 00135 "", /* address (not used, no family) */ \ 00136 RSBAC_NET_ANY, /* family */ \ 00137 0, /* valid_len (match any) */ \ 00138 RSBAC_NET_ANY, /* type */ \ 00139 RSBAC_NET_ANY, /* protocol */ \ 00140 "", /* netdev (any) */ \ 00141 0, /* min_port */ \ 00142 65535, /* max_port */ \ 00143 "ALL" /* name */ \ 00144 } 00145 00146 struct rsbac_net_description_t 00147 { 00148 __u8 address_family; 00149 void * address; 00150 __u8 address_len; 00151 __u8 type; 00152 __u8 protocol; 00153 rsbac_netdev_id_t netdev; 00154 __u16 port; 00155 }; 00156 00157 enum rsbac_net_temp_syscall_t 00158 { 00159 NTS_new_template, 00160 NTS_copy_template, 00161 NTS_delete_template, 00162 NTS_check_id, 00163 NTS_get_address, 00164 NTS_get_address_family, 00165 NTS_get_valid_len, 00166 NTS_get_type, 00167 NTS_get_protocol, 00168 NTS_get_netdev, 00169 NTS_get_min_port, 00170 NTS_get_max_port, 00171 NTS_get_name, 00172 NTS_set_address, 00173 NTS_set_address_family, 00174 NTS_set_valid_len, 00175 NTS_set_type, 00176 NTS_set_protocol, 00177 NTS_set_netdev, 00178 NTS_set_min_port, 00179 NTS_set_max_port, 00180 NTS_set_name, 00181 NTS_none 00182 }; 00183 00184 union rsbac_net_temp_syscall_data_t 00185 { 00186 rsbac_net_temp_id_t id; 00187 char address[RSBAC_NET_MAX_ADDRESS_LEN]; 00188 __u8 address_family; 00189 __u8 valid_len; /* Bytes for AF_UNIX, Bits for all others */ 00190 __u8 type; 00191 __u8 protocol; 00192 rsbac_netdev_id_t netdev; 00193 __u16 min_port; /* for those address families that support them */ 00194 __u16 max_port; 00195 char name[RSBAC_NET_TEMP_NAMELEN]; 00196 }; 00197 00198 /* 00199 * Display an IP address in readable format. 00200 */ 00201 00202 #ifndef NIPQUAD 00203 #define NIPQUAD(addr) \ 00204 ((unsigned char *)&addr)[0], \ 00205 ((unsigned char *)&addr)[1], \ 00206 ((unsigned char *)&addr)[2], \ 00207 ((unsigned char *)&addr)[3] 00208 00209 #define HIPQUAD(addr) \ 00210 ((unsigned char *)&addr)[3], \ 00211 ((unsigned char *)&addr)[2], \ 00212 ((unsigned char *)&addr)[1], \ 00213 ((unsigned char *)&addr)[0] 00214 #endif 00215 00216 #endif

Generated on Tue Aug 31 10:05:22 2004 for RSBAC by doxygen 1.3.8