00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <netlink-local.h>
00013 #include <netlink-tc.h>
00014 #include <netlink/netlink.h>
00015 #include <netlink/utils.h>
00016 #include <netlink/route/tc.h>
00017 #include <netlink/route/classifier.h>
00018 #include <netlink/route/classifier-modules.h>
00019 #include <netlink/route/cls/police.h>
00020
00021
00022
00023
00024
00025
00026 static struct trans_tbl police_types[] = {
00027 __ADD(TC_POLICE_UNSPEC,unspec)
00028 __ADD(TC_POLICE_OK,ok)
00029 __ADD(TC_POLICE_RECLASSIFY,reclassify)
00030 __ADD(TC_POLICE_SHOT,shot)
00031 #ifdef TC_POLICE_PIPE
00032 __ADD(TC_POLICE_PIPE,pipe)
00033 #endif
00034 };
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 char * nl_police2str(int type, char *buf, size_t len)
00048 {
00049 return __type2str(type, buf, len, police_types,
00050 ARRAY_SIZE(police_types));
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 int nl_str2police(const char *name)
00063 {
00064 return __str2type(name, police_types, ARRAY_SIZE(police_types));
00065 }
00066
00067