2 * netlink-types.h Netlink Types (Private)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_LOCAL_TYPES_H_
13 #define NETLINK_LOCAL_TYPES_H_
15 #include <netlink/list.h>
16 #include <netlink/route/link.h>
17 #include <netlink/route/qdisc.h>
18 #include <netlink/route/rtnl.h>
22 #define NL_SOCK_BUFSIZE_SET 1
23 #define NL_SOCK_PASSCRED 2
25 #define NL_MSG_CRED_PRESENT 1
32 nl_recvmsg_msg_cb_t cb_set[NL_CB_TYPE_MAX+1];
33 void * cb_args[NL_CB_TYPE_MAX+1];
35 nl_recvmsg_err_cb_t cb_err;
38 /** May be used to replace nl_recvmsgs with your own implementation
39 * in all internal calls to nl_recvmsgs. */
40 int (*cb_recvmsgs_ow)(struct nl_handle *,
43 /** Overwrite internal calls to nl_recv, must return the number of
44 * octets read and allocate a buffer for the received data. */
45 int (*cb_recv_ow)(struct nl_handle *,
50 /** Overwrites internal calls to nl_send, must send the netlink
52 int (*cb_send_ow)(struct nl_handle *,
58 struct sockaddr_nl h_local;
59 struct sockaddr_nl h_peer;
62 unsigned int h_seq_next;
63 unsigned int h_seq_expect;
70 struct nl_list_head c_items;
74 struct nl_cache_ops * c_ops;
77 struct nl_parser_param;
93 * Called whenever an update of the cache is required. Must send
94 * a request message to the kernel requesting a complete dump.
96 int (*co_request_update)(struct nl_cache *, struct nl_handle *);
99 * Called whenever a new object was allocated
101 void (*co_constructor)(struct nl_object *);
104 * Called whenever a object in the cache gets destroyed, must
105 * free the type specific memory allocations
107 void (*co_free_data)(struct nl_object *);
110 * Called whenever a message was received that needs to be parsed.
111 * Must parse the message and call the paser callback function
112 * (nl_parser_param) provided via the argument.
114 int (*co_msg_parser)(struct sockaddr_nl *, struct nlmsghdr *, void *);
117 * Called whenever a dump of a cache object is requested. Must
118 * dump the specified object to the specified file descriptor
120 int (*co_dump[NL_DUMP_MAX+1])(struct nl_object *,
121 struct nl_dump_params *);
124 * Must compare the two specified objects and return a non-zero
125 * value if they match.
127 int (*co_filter)(struct nl_object *, struct nl_object *);
130 struct nl_cache_ops *co_next;
131 struct nl_cache *co_major_cache;
132 struct nl_msgtype co_msgtypes[];
135 #define NLHDR_COMMON \
137 struct nl_cache_ops * ce_ops; \
138 struct nl_cache * ce_cache; \
139 struct nl_object * ce_dataref; \
140 struct nl_list_head ce_list; \
148 struct nl_parser_param
150 int (*pp_cb)(struct nl_object *, struct nl_parser_param *);
163 unsigned int a_maxsize;
167 unsigned char a_addr[0];
174 struct sockaddr_nl nm_src;
175 struct sockaddr_nl nm_dst;
176 struct ucred nm_creds;
177 struct nlmsghdr * nm_nlh;
182 uint64_t lm_mem_start;
184 uint64_t lm_base_addr;
190 #define IFQDISCSIZ 32
196 char l_name[IFNAMSIZ];
208 struct nl_addr *l_addr;
209 struct nl_addr *l_bcast;
210 char l_qdisc[IFQDISCSIZ];
211 struct rtnl_link_map l_map;
212 uint64_t l_stats[RTNL_LINK_STATS_MAX+1];
214 uint32_t l_flag_mask;
217 struct rtnl_ncacheinfo
219 uint32_t nci_confirmed; /**< Time since neighbour validty was last confirmed */
220 uint32_t nci_used; /**< Time since neighbour entry was last ued */
221 uint32_t nci_updated; /**< Time since last update */
222 uint32_t nci_refcnt; /**< Reference counter */
234 struct nl_addr *n_lladdr;
235 struct nl_addr *n_dst;
237 struct rtnl_ncacheinfo n_cacheinfo;
239 uint32_t n_state_mask;
240 uint32_t n_flag_mask;
244 struct rtnl_addr_cacheinfo
246 /* Preferred lifetime in seconds */
247 uint32_t aci_prefered;
249 /* Valid lifetime in seconds */
252 /* Timestamp of creation in 1/100s seince boottime */
255 /* Timestamp of last update in 1/100s since boottime */
269 struct nl_addr *a_peer;
270 struct nl_addr *a_local;
271 struct nl_addr *a_bcast;
272 struct nl_addr *a_anycast;
273 struct nl_addr *a_multicast;
275 struct rtnl_addr_cacheinfo a_cacheinfo;
277 char a_label[IFNAMSIZ];
279 uint32_t a_flag_mask;
285 uint8_t rtnh_flag_mask;
288 uint32_t rtnh_ifindex;
289 struct nl_addr * rtnh_gateway;
292 struct nl_list_head rtnh_list;
295 struct rtnl_rtcacheinfo
297 uint32_t rtci_clntref;
298 uint32_t rtci_last_use;
299 uint32_t rtci_expires;
320 struct nl_addr * rt_dst;
321 struct nl_addr * rt_src;
322 char rt_iif[IFNAMSIZ];
324 struct nl_addr * rt_gateway;
326 uint32_t rt_metrics[RTAX_MAX];
327 uint32_t rt_metrics_mask;
328 struct nl_addr * rt_pref_src;
329 struct nl_list_head rt_nexthops;
331 struct rtnl_rtcacheinfo rt_cacheinfo;
333 uint32_t rt_flag_mask;
350 char r_iif[IFNAMSIZ];
351 struct nl_addr *r_src;
352 struct nl_addr *r_dst;
353 struct nl_addr *r_srcmap;
358 struct rtnl_neightbl_parms
361 * Interface index of the device this parameter set is assigned
362 * to or 0 for the default set.
364 uint32_t ntp_ifindex;
367 * Number of references to this parameter set.
372 * Queue length for pending arp requests, i.e. the number of
373 * packets which are accepted from other layers while the
374 * neighbour address is still being resolved
376 uint32_t ntp_queue_len;
379 * Number of requests to send to the user level ARP daemon.
380 * Specify 0 to disable.
382 uint32_t ntp_app_probes;
385 * Maximum number of retries for unicast solicitation.
387 uint32_t ntp_ucast_probes;
390 * Maximum number of retries for multicast solicitation.
392 uint32_t ntp_mcast_probes;
395 * Base value in milliseconds to ompute reachable time, see RFC2461.
397 uint64_t ntp_base_reachable_time;
400 * Actual reachable time (read-only)
402 uint64_t ntp_reachable_time; /* secs */
405 * The time in milliseconds between retransmitted Neighbor
406 * Solicitation messages.
408 uint64_t ntp_retrans_time;
411 * Interval in milliseconds to check for stale neighbour
414 uint64_t ntp_gc_stale_time; /* secs */
417 * Delay in milliseconds for the first time probe if
418 * the neighbour is reachable.
420 uint64_t ntp_probe_delay; /* secs */
423 * Maximum delay in milliseconds of an answer to a neighbour
424 * solicitation message.
426 uint64_t ntp_anycast_delay;
429 * Minimum age in milliseconds before a neighbour entry
432 uint64_t ntp_locktime;
435 * Delay in milliseconds before answering to an ARP request
436 * for which a proxy ARP entry exists.
438 uint64_t ntp_proxy_delay;
441 * Queue length for the delayed proxy arp requests.
443 uint32_t ntp_proxy_qlen;
446 * Mask of available parameter attributes
451 #define NTBLNAMSIZ 32
461 char nt_name[NTBLNAMSIZ];
463 uint32_t nt_gc_thresh1;
464 uint32_t nt_gc_thresh2;
465 uint32_t nt_gc_thresh3;
466 uint64_t nt_gc_interval;
467 struct ndt_config nt_config;
468 struct rtnl_neightbl_parms nt_parms;
469 struct ndt_stats nt_stats;
505 #define NL_TCA_GENERIC(pre) \
507 uint32_t pre ##_family; \
508 uint32_t pre ##_ifindex; \
509 uint32_t pre ##_handle; \
510 uint32_t pre ##_parent; \
511 uint32_t pre ##_info; \
512 char pre ##_kind[TCKINDSIZ]; \
513 struct nl_data * pre ##_opts; \
514 uint64_t pre ##_stats[RTNL_TC_STATS_MAX+1]; \
515 struct nl_data * pre ##_xstats; \
516 void * pre ##_subdata; \
528 struct rtnl_qdisc_ops *q_ops;
534 struct rtnl_class_ops *c_ops;
542 struct rtnl_cls_ops *c_ops;
551 struct nl_data * cu_pcnt;
552 struct nl_data * cu_selector;
553 struct nl_data * cu_act;
554 struct nl_data * cu_police;
555 char cu_indev[IFNAMSIZ];
562 struct nl_data * cf_act;
563 struct nl_data * cf_police;
564 char cf_indev[IFNAMSIZ];
568 struct rtnl_dsmark_qdisc
570 uint16_t qdm_indices;
571 uint16_t qdm_default_index;
572 uint32_t qdm_set_tc_index;
576 struct rtnl_dsmark_class
592 uint8_t qp_priomap[TC_PRIO_MAX+1];
600 struct rtnl_ratespec qt_rate;
601 uint32_t qt_rate_bucket;
602 uint32_t qt_rate_txtime;
603 struct rtnl_ratespec qt_peakrate;
604 uint32_t qt_peakrate_bucket;
605 uint32_t qt_peakrate_txtime;
619 struct rtnl_netem_corr
623 uint32_t nmc_duplicate;
626 struct rtnl_netem_reo
628 uint32_t nmro_probability;
629 uint32_t nmro_correlation;
634 uint32_t qnm_latency;
638 uint32_t qnm_duplicate;
641 struct rtnl_netem_corr qnm_corr;
642 struct rtnl_netem_reo qnm_ro;
645 struct rtnl_htb_qdisc
647 uint32_t qh_rate2quantum;
652 struct rtnl_htb_class
656 struct rtnl_ratespec ch_rate;
657 struct rtnl_ratespec ch_ceil;
665 struct tc_cbq_lssopt cbq_lss;
666 struct tc_ratespec cbq_rate;
667 struct tc_cbq_wrropt cbq_wrr;
668 struct tc_cbq_ovl cbq_ovl;
669 struct tc_cbq_fopt cbq_fopt;
670 struct tc_cbq_police cbq_police;
681 uint8_t qr_scell_log;
687 struct nl_addr * lr_addr;
701 struct flnl_request * fr_req;
703 uint8_t fr_prefixlen;