| 1 |
%module capi |
| 2 |
%{ |
| 3 |
#include <netlink/route/rtnl.h> |
| 4 |
#include <netlink/route/link.h> |
| 5 |
#include <netlink/route/link/vlan.h> |
| 6 |
#include <netlink/route/link/macvlan.h> |
| 7 |
#include <netlink/route/link/vxlan.h> |
| 8 |
#include <netlink/route/link/bridge.h> |
| 9 |
#include <netlink/route/link/inet.h> |
| 10 |
|
| 11 |
#include <netlink/route/tc.h> |
| 12 |
#include <netlink/route/qdisc.h> |
| 13 |
#include <netlink/route/class.h> |
| 14 |
#include <netlink/route/classifier.h> |
| 15 |
|
| 16 |
#include <netlink/route/qdisc/htb.h> |
| 17 |
|
| 18 |
#include <netlink/route/addr.h> |
| 19 |
%} |
| 20 |
|
| 21 |
%include <stdint.i> |
| 22 |
%include <cstring.i> |
| 23 |
|
| 24 |
%inline %{ |
| 25 |
struct nl_object *link2obj(struct rtnl_link *link) |
| 26 |
{ |
| 27 |
return OBJ_CAST(link); |
| 28 |
} |
| 29 |
|
| 30 |
struct rtnl_link *obj2link(struct nl_object *obj) |
| 31 |
{ |
| 32 |
return (struct rtnl_link *) obj; |
| 33 |
} |
| 34 |
|
| 35 |
struct rtnl_link *get_from_kernel(struct nl_sock *sk, int ifindex, const char *name) |
| 36 |
{ |
| 37 |
struct rtnl_link *link; |
| 38 |
if (rtnl_link_get_kernel(sk, ifindex, name, &link) < 0) |
| 39 |
return NULL; |
| 40 |
return link; |
| 41 |
} |
| 42 |
|
| 43 |
uint32_t inet_get_conf(struct rtnl_link *link, const unsigned int id) |
| 44 |
{ |
| 45 |
uint32_t result; |
| 46 |
|
| 47 |
if (rtnl_link_inet_get_conf(link, id, &result) < 0) |
| 48 |
return 0; |
| 49 |
|
| 50 |
return result; |
| 51 |
} |
| 52 |
%}; |
| 53 |
|
| 54 |
extern struct nl_object *link2obj(struct rtnl_link *); |
| 55 |
extern struct rtnl_link *obj2link(struct nl_object *); |
| 56 |
|
| 57 |
/* <netlink/route/rtnl.h> */ |
| 58 |
|
| 59 |
%cstring_output_maxsize(char *buf, size_t len) |
| 60 |
extern char * rtnl_scope2str(int, char *buf, size_t len); |
| 61 |
extern int rtnl_str2scope(const char *); |
| 62 |
|
| 63 |
/* <netlink/route/link.h> */ |
| 64 |
|
| 65 |
extern struct rtnl_link *rtnl_link_alloc(void); |
| 66 |
|
| 67 |
extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int); |
| 68 |
extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); |
| 69 |
|
| 70 |
extern int rtnl_link_build_add_request(struct rtnl_link *, int, struct nl_msg **); |
| 71 |
extern int rtnl_link_add(struct nl_sock *, struct rtnl_link *, int); |
| 72 |
extern int rtnl_link_build_change_request(struct rtnl_link *, struct rtnl_link *, int, struct nl_msg **); |
| 73 |
extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *, struct rtnl_link *, int); |
| 74 |
|
| 75 |
extern int rtnl_link_build_delete_request(const struct rtnl_link *, struct nl_msg **); |
| 76 |
extern int rtnl_link_delete(struct nl_sock *, const struct rtnl_link *); |
| 77 |
extern int rtnl_link_build_get_request(int, const char *, struct nl_msg **); |
| 78 |
|
| 79 |
extern char *rtnl_link_stat2str(int, char *, size_t); |
| 80 |
extern int rtnl_link_str2stat(const char *); |
| 81 |
|
| 82 |
%cstring_output_maxsize(char *buf, size_t len) |
| 83 |
extern char *rtnl_link_flags2str(int, char *buf, size_t len); |
| 84 |
extern int rtnl_link_str2flags(const char *); |
| 85 |
|
| 86 |
%cstring_output_maxsize(char *buf, size_t len) |
| 87 |
extern char *rtnl_link_operstate2str(uint8_t, char *buf, size_t len); |
| 88 |
extern int rtnl_link_str2operstate(const char *); |
| 89 |
|
| 90 |
%cstring_output_maxsize(char *buf, size_t len) |
| 91 |
extern char *rtnl_link_mode2str(uint8_t, char *buf, size_t len); |
| 92 |
extern int rtnl_link_str2mode(const char *); |
| 93 |
|
| 94 |
extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *); |
| 95 |
extern char *rtnl_link_get_qdisc(struct rtnl_link *); |
| 96 |
|
| 97 |
extern void rtnl_link_set_name(struct rtnl_link *, const char *); |
| 98 |
extern char *rtnl_link_get_name(struct rtnl_link *); |
| 99 |
|
| 100 |
extern void rtnl_link_set_flags(struct rtnl_link *, unsigned int); |
| 101 |
extern void rtnl_link_unset_flags(struct rtnl_link *, unsigned int); |
| 102 |
extern unsigned int rtnl_link_get_flags(struct rtnl_link *); |
| 103 |
|
| 104 |
extern void rtnl_link_set_mtu(struct rtnl_link *, unsigned int); |
| 105 |
extern unsigned int rtnl_link_get_mtu(struct rtnl_link *); |
| 106 |
|
| 107 |
extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int); |
| 108 |
extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *); |
| 109 |
|
| 110 |
extern void rtnl_link_set_ifindex(struct rtnl_link *, int); |
| 111 |
extern int rtnl_link_get_ifindex(struct rtnl_link *); |
| 112 |
|
| 113 |
extern void rtnl_link_set_family(struct rtnl_link *, int); |
| 114 |
extern int rtnl_link_get_family(struct rtnl_link *); |
| 115 |
|
| 116 |
extern void rtnl_link_set_arptype(struct rtnl_link *, unsigned int); |
| 117 |
extern unsigned int rtnl_link_get_arptype(struct rtnl_link *); |
| 118 |
|
| 119 |
extern void rtnl_link_set_addr(struct rtnl_link *, struct nl_addr *); |
| 120 |
extern struct nl_addr *rtnl_link_get_addr(struct rtnl_link *); |
| 121 |
|
| 122 |
extern void rtnl_link_set_broadcast(struct rtnl_link *, struct nl_addr *); |
| 123 |
extern struct nl_addr *rtnl_link_get_broadcast(struct rtnl_link *); |
| 124 |
|
| 125 |
extern void rtnl_link_set_link(struct rtnl_link *, int); |
| 126 |
extern int rtnl_link_get_link(struct rtnl_link *); |
| 127 |
|
| 128 |
extern void rtnl_link_set_master(struct rtnl_link *, int); |
| 129 |
extern int rtnl_link_get_master(struct rtnl_link *); |
| 130 |
|
| 131 |
extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t); |
| 132 |
extern uint8_t rtnl_link_get_operstate(struct rtnl_link *); |
| 133 |
|
| 134 |
extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t); |
| 135 |
extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *); |
| 136 |
|
| 137 |
extern const char *rtnl_link_get_ifalias(struct rtnl_link *); |
| 138 |
extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); |
| 139 |
|
| 140 |
extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *); |
| 141 |
|
| 142 |
extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int); |
| 143 |
extern int rtnl_link_set_stat(struct rtnl_link *, const unsigned int, const uint64_t); |
| 144 |
|
| 145 |
extern int rtnl_link_set_type(struct rtnl_link *, const char *); |
| 146 |
extern char *rtnl_link_get_type(struct rtnl_link *); |
| 147 |
|
| 148 |
extern int rtnl_link_enslave(struct nl_sock * sock, struct rtnl_link * master, struct rtnl_link * slave); |
| 149 |
extern int rtnl_link_release(struct nl_sock * sock, struct rtnl_link * slave); |
| 150 |
|
| 151 |
/* <netlink/route/link/vlan.h> */ |
| 152 |
|
| 153 |
struct vlan_map |
| 154 |
{ |
| 155 |
uint32_t vm_from; |
| 156 |
uint32_t vm_to; |
| 157 |
}; |
| 158 |
|
| 159 |
#define VLAN_PRIO_MAX 7 |
| 160 |
|
| 161 |
%cstring_output_maxsize(char *buf, size_t len) |
| 162 |
extern char *rtnl_link_vlan_flags2str(int, char *buf, size_t len); |
| 163 |
extern int rtnl_link_vlan_str2flags(const char *); |
| 164 |
|
| 165 |
extern int rtnl_link_vlan_set_id(struct rtnl_link *, int); |
| 166 |
extern int rtnl_link_vlan_get_id(struct rtnl_link *); |
| 167 |
|
| 168 |
extern int rtnl_link_vlan_set_flags(struct rtnl_link *, unsigned int); |
| 169 |
extern int rtnl_link_vlan_unset_flags(struct rtnl_link *, unsigned int); |
| 170 |
extern unsigned int rtnl_link_vlan_get_flags(struct rtnl_link *); |
| 171 |
|
| 172 |
extern int rtnl_link_vlan_set_ingress_map(struct rtnl_link *, int, uint32_t); |
| 173 |
extern uint32_t *rtnl_link_vlan_get_ingress_map(struct rtnl_link *); |
| 174 |
|
| 175 |
extern int rtnl_link_vlan_set_egress_map(struct rtnl_link *, uint32_t, int); |
| 176 |
extern struct vlan_map *rtnl_link_vlan_get_egress_map(struct rtnl_link *, int *); |
| 177 |
|
| 178 |
/* <netlink/route/link/macvlan.h> */ |
| 179 |
|
| 180 |
%cstring_output_maxsize(char *buf, size_t len) |
| 181 |
extern struct rtnl_link *rtnl_link_macvlan_alloc(void); |
| 182 |
extern int rtnl_link_is_macvlan(struct rtnl_link *); |
| 183 |
extern char * rtnl_link_macvlan_mode2str(int, char *, size_t); |
| 184 |
extern int rtnl_link_macvlan_str2mode(const char *); |
| 185 |
extern char * rtnl_link_macvlan_flags2str(int, char *, size_t); |
| 186 |
extern int rtnl_link_macvlan_str2flags(const char *); |
| 187 |
extern int rtnl_link_macvlan_set_mode(struct rtnl_link *, uint32_t); |
| 188 |
extern uint32_t rtnl_link_macvlan_get_mode(struct rtnl_link *); |
| 189 |
extern int rtnl_link_macvlan_set_flags(struct rtnl_link *, uint16_t); |
| 190 |
extern int rtnl_link_macvlan_unset_flags(struct rtnl_link *, uint16_t); |
| 191 |
extern uint16_t rtnl_link_macvlan_get_flags(struct rtnl_link *); |
| 192 |
|
| 193 |
/* <netlink/route/link/vxlan.h> */ |
| 194 |
|
| 195 |
#define VXLAN_ID_MAX 16777215 |
| 196 |
|
| 197 |
extern struct rtnl_link *rtnl_link_vxlan_alloc(void); |
| 198 |
|
| 199 |
extern int rtnl_link_is_vxlan(struct rtnl_link *); |
| 200 |
|
| 201 |
extern int rtnl_link_vxlan_set_id(struct rtnl_link *, uint32_t); |
| 202 |
extern int rtnl_link_vxlan_get_id(struct rtnl_link *, uint32_t *); |
| 203 |
|
| 204 |
extern int rtnl_link_vxlan_set_group(struct rtnl_link *, struct nl_addr *); |
| 205 |
extern int rtnl_link_vxlan_get_group(struct rtnl_link *, struct nl_addr **); |
| 206 |
|
| 207 |
extern int rtnl_link_vxlan_set_link(struct rtnl_link *, uint32_t); |
| 208 |
extern int rtnl_link_vxlan_get_link(struct rtnl_link *, uint32_t *); |
| 209 |
|
| 210 |
extern int rtnl_link_vxlan_set_local(struct rtnl_link *, struct nl_addr *); |
| 211 |
extern int rtnl_link_vxlan_get_local(struct rtnl_link *, struct nl_addr **); |
| 212 |
|
| 213 |
extern int rtnl_link_vxlan_set_ttl(struct rtnl_link *, uint8_t); |
| 214 |
extern int rtnl_link_vxlan_get_ttl(struct rtnl_link *); |
| 215 |
|
| 216 |
extern int rtnl_link_vxlan_set_tos(struct rtnl_link *, uint8_t); |
| 217 |
extern int rtnl_link_vxlan_get_tos(struct rtnl_link *); |
| 218 |
|
| 219 |
extern int rtnl_link_vxlan_set_learning(struct rtnl_link *, uint8_t); |
| 220 |
extern int rtnl_link_vxlan_get_learning(struct rtnl_link *); |
| 221 |
extern int rtnl_link_vxlan_enable_learning(struct rtnl_link *); |
| 222 |
extern int rtnl_link_vxlan_disable_learning(struct rtnl_link *); |
| 223 |
|
| 224 |
extern int rtnl_link_vxlan_set_ageing(struct rtnl_link *, uint32_t); |
| 225 |
extern int rtnl_link_vxlan_get_ageing(struct rtnl_link *, uint32_t *); |
| 226 |
|
| 227 |
extern int rtnl_link_vxlan_set_limit(struct rtnl_link *, uint32_t); |
| 228 |
extern int rtnl_link_vxlan_get_limit(struct rtnl_link *, uint32_t *); |
| 229 |
|
| 230 |
extern int rtnl_link_vxlan_set_port_range(struct rtnl_link *, |
| 231 |
struct ifla_vxlan_port_range *); |
| 232 |
extern int rtnl_link_vxlan_get_port_range(struct rtnl_link *, |
| 233 |
struct ifla_vxlan_port_range *); |
| 234 |
|
| 235 |
extern int rtnl_link_vxlan_set_proxy(struct rtnl_link *, uint8_t); |
| 236 |
extern int rtnl_link_vxlan_get_proxy(struct rtnl_link *); |
| 237 |
extern int rtnl_link_vxlan_enable_proxy(struct rtnl_link *); |
| 238 |
extern int rtnl_link_vxlan_disable_proxy(struct rtnl_link *); |
| 239 |
|
| 240 |
extern int rtnl_link_vxlan_set_rsc(struct rtnl_link *, uint8_t); |
| 241 |
extern int rtnl_link_vxlan_get_rsc(struct rtnl_link *); |
| 242 |
extern int rtnl_link_vxlan_enable_rsc(struct rtnl_link *); |
| 243 |
extern int rtnl_link_vxlan_disable_rsc(struct rtnl_link *); |
| 244 |
|
| 245 |
extern int rtnl_link_vxlan_set_l2miss(struct rtnl_link *, uint8_t); |
| 246 |
extern int rtnl_link_vxlan_get_l2miss(struct rtnl_link *); |
| 247 |
extern int rtnl_link_vxlan_enable_l2miss(struct rtnl_link *); |
| 248 |
extern int rtnl_link_vxlan_disable_l2miss(struct rtnl_link *); |
| 249 |
|
| 250 |
extern int rtnl_link_vxlan_set_l3miss(struct rtnl_link *, uint8_t); |
| 251 |
extern int rtnl_link_vxlan_get_l3miss(struct rtnl_link *); |
| 252 |
extern int rtnl_link_vxlan_enable_l3miss(struct rtnl_link *); |
| 253 |
extern int rtnl_link_vxlan_disable_l3miss(struct rtnl_link *); |
| 254 |
|
| 255 |
/* <netlink/route/link/bridge.h> */ |
| 256 |
|
| 257 |
enum rtnl_link_bridge_flags { |
| 258 |
RTNL_BRIDGE_HAIRPIN_MODE = 0x0001, |
| 259 |
RTNL_BRIDGE_BPDU_GUARD = 0x0002, |
| 260 |
RTNL_BRIDGE_ROOT_BLOCK = 0x0004, |
| 261 |
RTNL_BRIDGE_FAST_LEAVE = 0x0008, |
| 262 |
}; |
| 263 |
|
| 264 |
extern int rtnl_link_is_bridge(struct rtnl_link *); |
| 265 |
extern int rtnl_link_bridge_has_ext_info(struct rtnl_link *); |
| 266 |
|
| 267 |
extern int rtnl_link_bridge_set_port_state(struct rtnl_link *, uint8_t ); |
| 268 |
extern int rtnl_link_bridge_get_port_state(struct rtnl_link *); |
| 269 |
|
| 270 |
extern int rtnl_link_bridge_set_priority(struct rtnl_link *, uint16_t); |
| 271 |
extern int rtnl_link_bridge_get_priority(struct rtnl_link *); |
| 272 |
|
| 273 |
extern int rtnl_link_bridge_set_cost(struct rtnl_link *, uint32_t); |
| 274 |
extern int rtnl_link_bridge_get_cost(struct rtnl_link *, uint32_t *); |
| 275 |
|
| 276 |
extern int rtnl_link_bridge_unset_flags(struct rtnl_link *, unsigned int); |
| 277 |
extern int rtnl_link_bridge_set_flags(struct rtnl_link *, unsigned int); |
| 278 |
extern int rtnl_link_bridge_get_flags(struct rtnl_link *); |
| 279 |
|
| 280 |
extern char * rtnl_link_bridge_flags2str(int, char *, size_t); |
| 281 |
extern int rtnl_link_bridge_str2flags(const char *); |
| 282 |
|
| 283 |
/* <netlink/route/link/inet.h> */ |
| 284 |
%cstring_output_maxsize(char *buf, size_t len) |
| 285 |
extern const char *rtnl_link_inet_devconf2str(int, char *buf, size_t len); |
| 286 |
extern unsigned int rtnl_link_inet_str2devconf(const char *); |
| 287 |
|
| 288 |
extern int rtnl_link_inet_set_conf(struct rtnl_link *, const unsigned int, uint32_t); |
| 289 |
|
| 290 |
/* <netlink/route/tc.h> */ |
| 291 |
|
| 292 |
%inline %{ |
| 293 |
uint32_t tc_str2handle(const char *name) |
| 294 |
{ |
| 295 |
uint32_t result; |
| 296 |
|
| 297 |
if (rtnl_tc_str2handle(name, &result) < 0) |
| 298 |
return 0; |
| 299 |
|
| 300 |
return result; |
| 301 |
} |
| 302 |
%}; |
| 303 |
|
| 304 |
extern void rtnl_tc_set_ifindex(struct rtnl_tc *, int); |
| 305 |
extern int rtnl_tc_get_ifindex(struct rtnl_tc *); |
| 306 |
extern void rtnl_tc_set_link(struct rtnl_tc *, struct rtnl_link *); |
| 307 |
extern struct rtnl_link *rtnl_tc_get_link(struct rtnl_tc *); |
| 308 |
extern void rtnl_tc_set_mtu(struct rtnl_tc *, uint32_t); |
| 309 |
extern uint32_t rtnl_tc_get_mtu(struct rtnl_tc *); |
| 310 |
extern void rtnl_tc_set_mpu(struct rtnl_tc *, uint32_t); |
| 311 |
extern uint32_t rtnl_tc_get_mpu(struct rtnl_tc *); |
| 312 |
extern void rtnl_tc_set_overhead(struct rtnl_tc *, uint32_t); |
| 313 |
extern uint32_t rtnl_tc_get_overhead(struct rtnl_tc *); |
| 314 |
extern void rtnl_tc_set_linktype(struct rtnl_tc *, uint32_t); |
| 315 |
extern uint32_t rtnl_tc_get_linktype(struct rtnl_tc *); |
| 316 |
extern void rtnl_tc_set_handle(struct rtnl_tc *, uint32_t); |
| 317 |
extern uint32_t rtnl_tc_get_handle(struct rtnl_tc *); |
| 318 |
extern void rtnl_tc_set_parent(struct rtnl_tc *, uint32_t); |
| 319 |
extern uint32_t rtnl_tc_get_parent(struct rtnl_tc *); |
| 320 |
extern int rtnl_tc_set_kind(struct rtnl_tc *, const char *); |
| 321 |
extern char * rtnl_tc_get_kind(struct rtnl_tc *); |
| 322 |
extern uint64_t rtnl_tc_get_stat(struct rtnl_tc *, enum rtnl_tc_stat); |
| 323 |
|
| 324 |
extern int rtnl_tc_calc_txtime(int, int); |
| 325 |
extern int rtnl_tc_calc_bufsize(int, int); |
| 326 |
extern int rtnl_tc_calc_cell_log(int); |
| 327 |
|
| 328 |
extern int rtnl_tc_read_classid_file(void); |
| 329 |
%cstring_output_maxsize(char *buf, size_t len) |
| 330 |
extern char * rtnl_tc_handle2str(uint32_t, char *buf, size_t len); |
| 331 |
extern int rtnl_classid_generate(const char *, uint32_t *, uint32_t); |
| 332 |
|
| 333 |
/* <netlink/route/qdisc.h> */ |
| 334 |
|
| 335 |
%inline %{ |
| 336 |
struct nl_object *qdisc2obj(struct rtnl_qdisc *qdisc) |
| 337 |
{ |
| 338 |
return OBJ_CAST(qdisc); |
| 339 |
} |
| 340 |
|
| 341 |
struct rtnl_qdisc *obj2qdisc(struct nl_object *obj) |
| 342 |
{ |
| 343 |
return (struct rtnl_qdisc *) obj; |
| 344 |
} |
| 345 |
|
| 346 |
struct nl_object *class2obj(struct rtnl_class *cl) |
| 347 |
{ |
| 348 |
return OBJ_CAST(cl); |
| 349 |
} |
| 350 |
|
| 351 |
struct rtnl_class *obj2class(struct nl_object *obj) |
| 352 |
{ |
| 353 |
return (struct rtnl_class *) obj; |
| 354 |
} |
| 355 |
|
| 356 |
struct nl_object *cls2obj(struct rtnl_cls *cls) |
| 357 |
{ |
| 358 |
return OBJ_CAST(cls); |
| 359 |
} |
| 360 |
|
| 361 |
struct rtnl_cls *obj2cls(struct nl_object *obj) |
| 362 |
{ |
| 363 |
return (struct rtnl_cls *) obj; |
| 364 |
} |
| 365 |
|
| 366 |
struct rtnl_tc *obj2tc(struct nl_object *obj) |
| 367 |
{ |
| 368 |
return TC_CAST(obj); |
| 369 |
} |
| 370 |
%}; |
| 371 |
extern struct rtnl_qdisc * |
| 372 |
rtnl_qdisc_alloc(void); |
| 373 |
|
| 374 |
extern struct rtnl_qdisc * |
| 375 |
rtnl_qdisc_get(struct nl_cache *, int, uint32_t); |
| 376 |
|
| 377 |
extern struct rtnl_qdisc * |
| 378 |
rtnl_qdisc_get_by_parent(struct nl_cache *, int, uint32_t); |
| 379 |
|
| 380 |
extern int rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int, |
| 381 |
struct nl_msg **); |
| 382 |
extern int rtnl_qdisc_add(struct nl_sock *, struct rtnl_qdisc *, int); |
| 383 |
|
| 384 |
extern int rtnl_qdisc_build_update_request(struct rtnl_qdisc *, |
| 385 |
struct rtnl_qdisc *, |
| 386 |
int, struct nl_msg **); |
| 387 |
|
| 388 |
extern int rtnl_qdisc_update(struct nl_sock *, struct rtnl_qdisc *, |
| 389 |
struct rtnl_qdisc *, int); |
| 390 |
|
| 391 |
extern int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *, |
| 392 |
struct nl_msg **); |
| 393 |
extern int rtnl_qdisc_delete(struct nl_sock *, struct rtnl_qdisc *); |
| 394 |
|
| 395 |
/* <netlink/route/classifier.h> */ |
| 396 |
|
| 397 |
extern struct rtnl_cls *rtnl_cls_alloc(void); |
| 398 |
extern void rtnl_cls_put(struct rtnl_cls *); |
| 399 |
|
| 400 |
extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int); |
| 401 |
|
| 402 |
extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *, |
| 403 |
int); |
| 404 |
|
| 405 |
extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t); |
| 406 |
extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *); |
| 407 |
|
| 408 |
extern void rtnl_cls_set_protocol(struct rtnl_cls *, uint16_t); |
| 409 |
extern uint16_t rtnl_cls_get_protocol(struct rtnl_cls *); |
| 410 |
|
| 411 |
/* <netlink/route/qdisc/htb.h> */ |
| 412 |
|
| 413 |
extern uint32_t rtnl_htb_get_rate2quantum(struct rtnl_qdisc *); |
| 414 |
extern int rtnl_htb_set_rate2quantum(struct rtnl_qdisc *, uint32_t); |
| 415 |
extern uint32_t rtnl_htb_get_defcls(struct rtnl_qdisc *); |
| 416 |
extern int rtnl_htb_set_defcls(struct rtnl_qdisc *, uint32_t); |
| 417 |
|
| 418 |
extern uint32_t rtnl_htb_get_prio(struct rtnl_class *); |
| 419 |
extern int rtnl_htb_set_prio(struct rtnl_class *, uint32_t); |
| 420 |
extern uint32_t rtnl_htb_get_rate(struct rtnl_class *); |
| 421 |
extern int rtnl_htb_set_rate(struct rtnl_class *, uint32_t); |
| 422 |
extern uint32_t rtnl_htb_get_ceil(struct rtnl_class *); |
| 423 |
extern int rtnl_htb_set_ceil(struct rtnl_class *, uint32_t); |
| 424 |
extern uint32_t rtnl_htb_get_rbuffer(struct rtnl_class *); |
| 425 |
extern int rtnl_htb_set_rbuffer(struct rtnl_class *, uint32_t); |
| 426 |
extern uint32_t rtnl_htb_get_cbuffer(struct rtnl_class *); |
| 427 |
extern int rtnl_htb_set_cbuffer(struct rtnl_class *, uint32_t); |
| 428 |
extern uint32_t rtnl_htb_get_quantum(struct rtnl_class *); |
| 429 |
extern int rtnl_htb_set_quantum(struct rtnl_class *, uint32_t); |
| 430 |
extern int rtnl_htb_get_level(struct rtnl_class *); |
| 431 |
|
| 432 |
/* <netlink/route/addr.h> */ |
| 433 |
|
| 434 |
%inline %{ |
| 435 |
struct nl_object *addr2obj(struct rtnl_addr *addr) |
| 436 |
{ |
| 437 |
return OBJ_CAST(addr); |
| 438 |
} |
| 439 |
|
| 440 |
struct rtnl_addr *obj2addr(struct nl_object *obj) |
| 441 |
{ |
| 442 |
return (struct rtnl_addr *) obj; |
| 443 |
} |
| 444 |
%}; |
| 445 |
|
| 446 |
extern struct rtnl_addr *rtnl_addr_alloc(void); |
| 447 |
|
| 448 |
extern struct rtnl_addr * |
| 449 |
rtnl_addr_get(struct nl_cache *, int, struct nl_addr *); |
| 450 |
|
| 451 |
extern int rtnl_addr_build_add_request(struct rtnl_addr *, int, |
| 452 |
struct nl_msg **); |
| 453 |
extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int); |
| 454 |
|
| 455 |
extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int, |
| 456 |
struct nl_msg **); |
| 457 |
extern int rtnl_addr_delete(struct nl_sock *, |
| 458 |
struct rtnl_addr *, int); |
| 459 |
|
| 460 |
%cstring_output_maxsize(char *buf, size_t len) |
| 461 |
extern char * rtnl_addr_flags2str(int, char *buf, size_t len); |
| 462 |
extern int rtnl_addr_str2flags(const char *); |
| 463 |
|
| 464 |
extern int rtnl_addr_set_label(struct rtnl_addr *, const char *); |
| 465 |
extern char * rtnl_addr_get_label(struct rtnl_addr *); |
| 466 |
|
| 467 |
extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int); |
| 468 |
extern int rtnl_addr_get_ifindex(struct rtnl_addr *); |
| 469 |
|
| 470 |
extern void rtnl_addr_set_link(struct rtnl_addr *, struct rtnl_link *); |
| 471 |
extern struct rtnl_link * |
| 472 |
rtnl_addr_get_link(struct rtnl_addr *); |
| 473 |
extern void rtnl_addr_set_family(struct rtnl_addr *, int); |
| 474 |
extern int rtnl_addr_get_family(struct rtnl_addr *); |
| 475 |
|
| 476 |
extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int); |
| 477 |
extern int rtnl_addr_get_prefixlen(struct rtnl_addr *); |
| 478 |
|
| 479 |
extern void rtnl_addr_set_scope(struct rtnl_addr *, int); |
| 480 |
extern int rtnl_addr_get_scope(struct rtnl_addr *); |
| 481 |
|
| 482 |
extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int); |
| 483 |
extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int); |
| 484 |
extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *); |
| 485 |
|
| 486 |
extern int rtnl_addr_set_local(struct rtnl_addr *, |
| 487 |
struct nl_addr *); |
| 488 |
extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *); |
| 489 |
|
| 490 |
extern int rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *); |
| 491 |
extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *); |
| 492 |
|
| 493 |
extern int rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *); |
| 494 |
extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *); |
| 495 |
|
| 496 |
extern int rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *); |
| 497 |
extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *); |
| 498 |
|
| 499 |
extern int rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *); |
| 500 |
extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *); |
| 501 |
|
| 502 |
extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *); |
| 503 |
extern void rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t); |
| 504 |
extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *); |
| 505 |
extern void rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t); |
| 506 |
extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *); |
| 507 |
extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *); |