00001
00002
00003
00004
00005
00006
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 #define RSBAC_NET_MAX_PORT 65535
00025
00026 struct rsbac_net_temp_data_t
00027 {
00028
00029 char address[RSBAC_NET_MAX_ADDRESS_LEN];
00030 __u8 address_family;
00031 __u8 valid_len;
00032 __u8 type;
00033 __u8 protocol;
00034 rsbac_netdev_id_t netdev;
00035 __u16 min_port;
00036 __u16 max_port;
00037 char name[RSBAC_NET_TEMP_NAMELEN];
00038 };
00039
00040
00041 #define RSBAC_NET_TEMP_DEFAULT_DATA \
00042 { \
00043 "", \
00044 AF_MAX, \
00045 0, \
00046 RSBAC_NET_ANY, \
00047 RSBAC_NET_ANY, \
00048 "", \
00049 0, \
00050 0, \
00051 "DEFAULT" \
00052 }
00053
00054
00055 #define RSBAC_NET_TEMP_UNIX_ID 100010
00056 #define RSBAC_NET_TEMP_UNIX_DATA \
00057 { \
00058 "", \
00059 AF_UNIX, \
00060 0, \
00061 0, \
00062 0, \
00063 "", \
00064 0, \
00065 0, \
00066 "AF_UNIX" \
00067 }
00068
00069
00070 #define RSBAC_NET_TEMP_LNET_ID 100101
00071 #define RSBAC_NET_TEMP_LNET_ADDRESS "127.0.0.0"
00072 #define RSBAC_NET_TEMP_LNET_DATA \
00073 { \
00074 "", \
00075 AF_INET, \
00076 8, \
00077 RSBAC_NET_ANY, \
00078 RSBAC_NET_ANY, \
00079 "", \
00080 0, \
00081 65535, \
00082 "localnet" \
00083 }
00084
00085
00086 #define RSBAC_NET_TEMP_LAN_ID 100102
00087 #define RSBAC_NET_TEMP_LAN_ADDRESS "192.168.0.0"
00088 #define RSBAC_NET_TEMP_LAN_DATA \
00089 { \
00090 "", \
00091 AF_INET, \
00092 16, \
00093 RSBAC_NET_ANY, \
00094 RSBAC_NET_ANY, \
00095 "", \
00096 0, \
00097 65535, \
00098 "Internal LAN" \
00099 }
00100
00101
00102
00103 #define RSBAC_NET_TEMP_AUTO_ID 100105
00104 #define RSBAC_NET_TEMP_AUTO_ADDRESS "0.0.0.0"
00105 #define RSBAC_NET_TEMP_AUTO_DATA \
00106 { \
00107 "", \
00108 AF_INET, \
00109 32, \
00110 RSBAC_NET_ANY, \
00111 RSBAC_NET_ANY, \
00112 "", \
00113 0, \
00114 65535, \
00115 "Auto-IPv4" \
00116 }
00117
00118
00119 #define RSBAC_NET_TEMP_INET_ID 100110
00120 #define RSBAC_NET_TEMP_INET_DATA \
00121 { \
00122 "", \
00123 AF_INET, \
00124 0, \
00125 RSBAC_NET_ANY, \
00126 RSBAC_NET_ANY, \
00127 "", \
00128 0, \
00129 65535, \
00130 "AF_INET" \
00131 }
00132
00133
00134 #define RSBAC_NET_TEMP_ALL_ID ((rsbac_net_temp_id_t) -1)
00135 #define RSBAC_NET_TEMP_ALL_DATA \
00136 { \
00137 "", \
00138 RSBAC_NET_ANY, \
00139 0, \
00140 RSBAC_NET_ANY, \
00141 RSBAC_NET_ANY, \
00142 "", \
00143 0, \
00144 65535, \
00145 "ALL" \
00146 }
00147
00148 struct rsbac_net_description_t
00149 {
00150 __u8 address_family;
00151 void * address;
00152 __u8 address_len;
00153 __u8 type;
00154 __u8 protocol;
00155 rsbac_netdev_id_t netdev;
00156 __u16 port;
00157 };
00158
00159 enum rsbac_net_temp_syscall_t
00160 {
00161 NTS_new_template,
00162 NTS_copy_template,
00163 NTS_delete_template,
00164 NTS_check_id,
00165 NTS_get_address,
00166 NTS_get_address_family,
00167 NTS_get_valid_len,
00168 NTS_get_type,
00169 NTS_get_protocol,
00170 NTS_get_netdev,
00171 NTS_get_min_port,
00172 NTS_get_max_port,
00173 NTS_get_name,
00174 NTS_set_address,
00175 NTS_set_address_family,
00176 NTS_set_valid_len,
00177 NTS_set_type,
00178 NTS_set_protocol,
00179 NTS_set_netdev,
00180 NTS_set_min_port,
00181 NTS_set_max_port,
00182 NTS_set_name,
00183 NTS_none
00184 };
00185
00186 union rsbac_net_temp_syscall_data_t
00187 {
00188 rsbac_net_temp_id_t id;
00189 char address[RSBAC_NET_MAX_ADDRESS_LEN];
00190 __u8 address_family;
00191 __u8 valid_len;
00192 __u8 type;
00193 __u8 protocol;
00194 rsbac_netdev_id_t netdev;
00195 __u16 min_port;
00196 __u16 max_port;
00197 char name[RSBAC_NET_TEMP_NAMELEN];
00198 };
00199
00200
00201
00202
00203
00204 #ifndef NIPQUAD
00205 #define NIPQUAD(addr) \
00206 ((unsigned char *)&addr)[0], \
00207 ((unsigned char *)&addr)[1], \
00208 ((unsigned char *)&addr)[2], \
00209 ((unsigned char *)&addr)[3]
00210
00211 #define HIPQUAD(addr) \
00212 ((unsigned char *)&addr)[3], \
00213 ((unsigned char *)&addr)[2], \
00214 ((unsigned char *)&addr)[1], \
00215 ((unsigned char *)&addr)[0]
00216 #endif
00217
00218 #endif