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 2
00016 #define RSBAC_NET_TEMP_OLD_VERSION 1
00017 #define RSBAC_NET_TEMP_KEY 0x815affe
00018 #define RSBAC_NET_TEMP_NAME "nettemp"
00019
00020 typedef __u32 rsbac_net_temp_id_t;
00021
00022 #define RSBAC_NET_MAX_ADDRESS_LEN 128
00023 #define RSBAC_NET_TEMP_NAMELEN 16
00024
00025 #define RSBAC_NET_MAX_PORT 65535
00026
00027 #define RSBAC_NET_NR_INET_ADDR 25
00028 #define RSBAC_NET_NR_PORTS 10
00029
00030 struct rsbac_net_temp_port_range_t {
00031 __u16 min;
00032 __u16 max;
00033 };
00034
00035 struct rsbac_net_temp_inet_addr_t {
00036 __u32 addr[RSBAC_NET_NR_INET_ADDR];
00037 __u8 valid_bits[RSBAC_NET_NR_INET_ADDR];
00038 __u8 nr_addr;
00039 };
00040
00041 struct rsbac_net_temp_other_addr_t {
00042 char addr[RSBAC_NET_MAX_ADDRESS_LEN];
00043 __u8 valid_len;
00044 };
00045
00046 struct rsbac_net_temp_ports_t {
00047 struct rsbac_net_temp_port_range_t ports[RSBAC_NET_NR_PORTS];
00048 __u8 nr_ports;
00049 };
00050
00051 union rsbac_net_temp_addr_t {
00052 struct rsbac_net_temp_inet_addr_t inet;
00053 struct rsbac_net_temp_other_addr_t other;
00054 };
00055
00056 struct rsbac_net_temp_data_t {
00057
00058 union rsbac_net_temp_addr_t address;
00059 __u8 address_family;
00060 __u8 type;
00061 __u8 protocol;
00062 rsbac_netdev_id_t netdev;
00063 struct rsbac_net_temp_ports_t ports;
00064 char name[RSBAC_NET_TEMP_NAMELEN];
00065 };
00066
00067 struct rsbac_net_temp_old_data_t {
00068
00069 char address[RSBAC_NET_MAX_ADDRESS_LEN];
00070 __u8 address_family;
00071 __u8 valid_len;
00072 __u8 type;
00073 __u8 protocol;
00074 rsbac_netdev_id_t netdev;
00075 __u16 min_port;
00076 __u16 max_port;
00077 char name[RSBAC_NET_TEMP_NAMELEN];
00078 };
00079
00080 #define RSBAC_NET_TEMP_LNET_ID 100101
00081 #define RSBAC_NET_TEMP_LNET_ADDRESS "127.0.0.0"
00082 #define RSBAC_NET_TEMP_LAN_ID 100102
00083 #define RSBAC_NET_TEMP_LAN_ADDRESS "192.168.0.0"
00084 #define RSBAC_NET_TEMP_AUTO_ID 100105
00085 #define RSBAC_NET_TEMP_AUTO_ADDRESS "0.0.0.0"
00086 #define RSBAC_NET_TEMP_INET_ID 100110
00087 #define RSBAC_NET_TEMP_ALL_ID ((rsbac_net_temp_id_t) -1)
00088
00089
00090
00091 struct rsbac_net_description_t {
00092 __u8 address_family;
00093 void *address;
00094 __u8 address_len;
00095 __u8 type;
00096 __u8 protocol;
00097 rsbac_netdev_id_t netdev;
00098 __u16 port;
00099 };
00100
00101 enum rsbac_net_temp_syscall_t {
00102 NTS_new_template,
00103 NTS_copy_template,
00104 NTS_delete_template,
00105 NTS_check_id,
00106 NTS_get_address,
00107 NTS_get_address_family,
00108 NTS_get_type,
00109 NTS_get_protocol,
00110 NTS_get_netdev,
00111 NTS_get_ports,
00112 NTS_get_name,
00113 NTS_set_address,
00114 NTS_set_address_family,
00115 NTS_set_type,
00116 NTS_set_protocol,
00117 NTS_set_netdev,
00118 NTS_set_ports,
00119 NTS_set_name,
00120 NTS_none
00121 };
00122
00123 union rsbac_net_temp_syscall_data_t {
00124 rsbac_net_temp_id_t id;
00125 union rsbac_net_temp_addr_t address;
00126 __u8 address_family;
00127 __u8 type;
00128 __u8 protocol;
00129 rsbac_netdev_id_t netdev;
00130 struct rsbac_net_temp_ports_t ports;
00131 char name[RSBAC_NET_TEMP_NAMELEN];
00132 };
00133
00134
00135
00136
00137
00138 #ifndef NIPQUAD
00139 #define NIPQUAD(addr) \
00140 ((unsigned char *)&addr)[0], \
00141 ((unsigned char *)&addr)[1], \
00142 ((unsigned char *)&addr)[2], \
00143 ((unsigned char *)&addr)[3]
00144
00145 #define HIPQUAD(addr) \
00146 ((unsigned char *)&addr)[3], \
00147 ((unsigned char *)&addr)[2], \
00148 ((unsigned char *)&addr)[1], \
00149 ((unsigned char *)&addr)[0]
00150 #endif
00151
00152 #endif