#include <rsbac/types.h>#include <rsbac/getname.h>#include <rsbac/net_getname.h>#include <rsbac/helpers.h>#include <rsbac/error.h>#include <linux/socket.h>#include <string.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | proto_desc_t |
Defines | |
| #define | NR_PROTO 18 |
Functions | |
| char * | rsbac_get_net_temp_syscall_name (char *name, enum rsbac_net_temp_syscall_t value) |
| enum rsbac_net_temp_syscall_t | rsbac_get_net_temp_syscall_nr (const char *name) |
| char * | rsbac_get_net_family_name (char *name, u_int value) |
| int | rsbac_get_net_family_nr (const char *name) |
| char * | rsbac_get_net_protocol_name (char *name, u_int value) |
| int | rsbac_get_net_protocol_nr (const char *name) |
| char * | rsbac_get_net_type_name (char *name, u_int value) |
| int | rsbac_get_net_type_nr (const char *name) |
Variables | |
| static char | net_temp_syscall_list [NTS_none+1][19] |
| static char | net_family_list [AF_MAX+1][19] |
| static struct proto_desc_t | net_protocol_list [NR_PROTO] |
| static char | rsbac_net_type_list [RSBAC_NET_TYPE_MAX+1][19] |
| #define NR_PROTO 18 |
Definition at line 90 of file net_getname.c.
Referenced by rsbac_get_net_protocol_name(), and rsbac_get_net_protocol_nr().
| char* rsbac_get_net_family_name | ( | char * | name, | |
| u_int | value | |||
| ) |
Definition at line 168 of file net_getname.c.
References AF_MAX, net_family_list, and NULL.
Referenced by get_target_name().
00169 { 00170 if (!name) 00171 return (NULL); 00172 if (value > AF_MAX) 00173 strcpy(name, "ERROR!"); 00174 else 00175 strcpy(name, net_family_list[value]); 00176 return (name); 00177 };
| int rsbac_get_net_family_nr | ( | const char * | name | ) |
Definition at line 180 of file net_getname.c.
References AF_MAX, and net_family_list.
00181 { 00182 int i; 00183 00184 if (!name) 00185 return (AF_MAX); 00186 for (i = 0; i < AF_MAX; i++) { 00187 if (!strcmp(name, net_family_list[i])) { 00188 return (i); 00189 } 00190 } 00191 return (AF_MAX); 00192 };
| char* rsbac_get_net_protocol_name | ( | char * | name, | |
| u_int | value | |||
| ) |
Definition at line 200 of file net_getname.c.
References net_protocol_list, proto_desc_t::nr, NR_PROTO, NULL, and RSBAC_NET_PROTO_MAX.
Referenced by get_target_name().
00201 { 00202 int i; 00203 00204 if (!name) 00205 return (NULL); 00206 if (value >= RSBAC_NET_PROTO_MAX) 00207 strcpy(name, "ERROR!"); 00208 else { 00209 for (i = 0; i < NR_PROTO; i++) { 00210 if (net_protocol_list[i].nr == value) { 00211 strcpy(name, net_protocol_list[i].name); 00212 return name; 00213 } 00214 } 00215 sprintf(name, "%u", value); 00216 } 00217 return (name); 00218 };
| int rsbac_get_net_protocol_nr | ( | const char * | name | ) |
Definition at line 221 of file net_getname.c.
References net_protocol_list, proto_desc_t::nr, NR_PROTO, and RSBAC_NET_PROTO_MAX.
00222 { 00223 int i; 00224 00225 if (!name) 00226 return (RSBAC_NET_PROTO_MAX); 00227 for (i = 0; i < NR_PROTO; i++) { 00228 if (!strcmp(name, net_protocol_list[i].name)) { 00229 return (net_protocol_list[i].nr); 00230 } 00231 } 00232 return (RSBAC_NET_PROTO_MAX); 00233 };
| char* rsbac_get_net_temp_syscall_name | ( | char * | name, | |
| enum rsbac_net_temp_syscall_t | value | |||
| ) |
Definition at line 134 of file net_getname.c.
References net_temp_syscall_list, NTS_none, and NULL.
00136 { 00137 if (!name) 00138 return (NULL); 00139 if (value > NTS_none) 00140 strcpy(name, "ERROR!"); 00141 else 00142 strcpy(name, net_temp_syscall_list[value]); 00143 return (name); 00144 };
| enum rsbac_net_temp_syscall_t rsbac_get_net_temp_syscall_nr | ( | const char * | name | ) |
Definition at line 147 of file net_getname.c.
References net_temp_syscall_list, and NTS_none.
00149 { 00150 enum rsbac_net_temp_syscall_t i; 00151 00152 if (!name) 00153 return (NTS_none); 00154 for (i = 0; i < NTS_none; i++) { 00155 if (!strcmp(name, net_temp_syscall_list[i])) { 00156 return (i); 00157 } 00158 } 00159 return (NTS_none); 00160 };
| char* rsbac_get_net_type_name | ( | char * | name, | |
| u_int | value | |||
| ) |
Definition at line 241 of file net_getname.c.
References NULL, rsbac_net_type_list, and RSBAC_NET_TYPE_MAX.
Referenced by get_attribute_value_name(), and get_target_name().
00242 { 00243 if (!name) 00244 return (NULL); 00245 if (value > RSBAC_NET_TYPE_MAX) 00246 strcpy(name, "ERROR!"); 00247 else 00248 strcpy(name, rsbac_net_type_list[value]); 00249 return (name); 00250 };
| int rsbac_get_net_type_nr | ( | const char * | name | ) |
Definition at line 253 of file net_getname.c.
References rsbac_net_type_list, and RSBAC_NET_TYPE_MAX.
00254 { 00255 int i; 00256 00257 if (!name) 00258 return (RSBAC_NET_TYPE_MAX); 00259 for (i = 0; i < RSBAC_NET_TYPE_MAX; i++) { 00260 if (!strcmp(name, rsbac_net_type_list[i])) { 00261 return (i); 00262 } 00263 } 00264 return (RSBAC_NET_TYPE_MAX); 00265 };
char net_family_list[AF_MAX+1][19] [static] |
Definition at line 50 of file net_getname.c.
Referenced by rsbac_get_net_family_name(), and rsbac_get_net_family_nr().
struct proto_desc_t net_protocol_list[NR_PROTO] [static] |
Initial value:
{
{"ANY", 0},
{"ICMP", 1},
{"IGMP", 2},
{"IPIP", 4},
{"TCP", 6},
{"EGP", 8},
{"PUP", 12},
{"UDP", 17},
{"IDP", 22},
{"RSVP", 46},
{"GRE", 47},
{"IPV6", 41},
{"PIM", 103},
{"ESP", 50},
{"AH", 51},
{"COMP", 108},
{"RAW", 255},
{"MAX", RSBAC_NET_PROTO_MAX}
}
Definition at line 92 of file net_getname.c.
Referenced by rsbac_get_net_protocol_name(), and rsbac_get_net_protocol_nr().
char net_temp_syscall_list[NTS_none+1][19] [static] |
Initial value:
{
"new_template",
"copy_template",
"delete_template",
"check_id",
"get_address",
"get_address_family",
"get_type",
"get_protocol",
"get_netdev",
"get_ports",
"get_name",
"set_address",
"set_address_family",
"set_type",
"set_protocol",
"set_netdev",
"set_ports",
"set_name",
"none"
}
Definition at line 28 of file net_getname.c.
Referenced by rsbac_get_net_temp_syscall_name(), and rsbac_get_net_temp_syscall_nr().
char rsbac_net_type_list[RSBAC_NET_TYPE_MAX+1][19] [static] |
Initial value:
{
"ANY",
"STREAM",
"DGRAM",
"RAW",
"RDM",
"SEQPACKET",
"(undefined)",
"(undefined)",
"(undefined)",
"(undefined)",
"PACKET",
"MAX"
}
Definition at line 113 of file net_getname.c.
Referenced by rsbac_get_net_type_name(), and rsbac_get_net_type_nr().
1.5.1