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-2008 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>
19 #include <netlink/route/route.h>
21 #define NL_SOCK_BUFSIZE_SET (1<<0)
22 #define NL_SOCK_PASSCRED (1<<1)
23 #define NL_OWN_PORT (1<<2)
24 #define NL_MSG_PEEK (1<<3)
25 #define NL_NO_AUTO_ACK (1<<4)
27 #define NL_MSG_CRED_PRESENT 1
35 nl_recvmsg_msg_cb_t cb_set[NL_CB_TYPE_MAX+1];
36 void * cb_args[NL_CB_TYPE_MAX+1];
38 nl_recvmsg_err_cb_t cb_err;
41 /** May be used to replace nl_recvmsgs with your own implementation
42 * in all internal calls to nl_recvmsgs. */
43 int (*cb_recvmsgs_ow)(struct nl_sock *,
46 /** Overwrite internal calls to nl_recv, must return the number of
47 * octets read and allocate a buffer for the received data. */
48 int (*cb_recv_ow)(struct nl_sock *,
53 /** Overwrites internal calls to nl_send, must send the netlink
55 int (*cb_send_ow)(struct nl_sock *,
63 struct sockaddr_nl s_local;
64 struct sockaddr_nl s_peer;
67 unsigned int s_seq_next;
68 unsigned int s_seq_expect;
75 struct nl_list_head c_items;
79 struct nl_cache_ops * c_ops;
84 struct nl_cache * ca_cache;
85 change_func_t ca_change;
86 void * ca_change_data;
94 struct nl_sock * cm_handle;
95 struct nl_cache_assoc * cm_assocs;
98 struct nl_parser_param;
100 #define LOOSE_COMPARISON 1
102 #define NL_OBJ_MARK 1
118 unsigned int a_maxsize;
129 struct sockaddr_nl nm_src;
130 struct sockaddr_nl nm_dst;
131 struct ucred nm_creds;
132 struct nlmsghdr * nm_nlh;
139 uint64_t lm_mem_start;
141 uint64_t lm_base_addr;
147 #define IFQDISCSIZ 32
153 char l_name[IFNAMSIZ];
165 struct nl_addr *l_addr;
166 struct nl_addr *l_bcast;
167 char l_qdisc[IFQDISCSIZ];
168 struct rtnl_link_map l_map;
169 uint64_t l_stats[RTNL_LINK_STATS_MAX+1];
170 uint32_t l_flag_mask;
174 struct rtnl_link_info_ops *l_info_ops;
178 struct rtnl_ncacheinfo
180 uint32_t nci_confirmed; /**< Time since neighbour validty was last confirmed */
181 uint32_t nci_used; /**< Time since neighbour entry was last ued */
182 uint32_t nci_updated; /**< Time since last update */
183 uint32_t nci_refcnt; /**< Reference counter */
195 struct nl_addr *n_lladdr;
196 struct nl_addr *n_dst;
198 struct rtnl_ncacheinfo n_cacheinfo;
199 uint32_t n_state_mask;
200 uint32_t n_flag_mask;
204 struct rtnl_addr_cacheinfo
206 /* Preferred lifetime in seconds */
207 uint32_t aci_prefered;
209 /* Valid lifetime in seconds */
212 /* Timestamp of creation in 1/100s seince boottime */
215 /* Timestamp of last update in 1/100s since boottime */
229 struct nl_addr *a_peer;
230 struct nl_addr *a_local;
231 struct nl_addr *a_bcast;
232 struct nl_addr *a_anycast;
233 struct nl_addr *a_multicast;
235 struct rtnl_addr_cacheinfo a_cacheinfo;
237 char a_label[IFNAMSIZ];
238 uint32_t a_flag_mask;
244 uint8_t rtnh_flag_mask;
247 uint32_t rtnh_ifindex;
248 struct nl_addr * rtnh_gateway;
249 uint32_t ce_mask; /* HACK to support attr macros */
250 struct nl_list_head rtnh_list;
251 uint32_t rtnh_realms;
267 struct nl_addr * rt_dst;
268 struct nl_addr * rt_src;
272 uint32_t rt_metrics[RTAX_MAX];
273 uint32_t rt_metrics_mask;
275 struct nl_addr * rt_pref_src;
276 struct nl_list_head rt_nexthops;
277 struct rtnl_rtcacheinfo rt_cacheinfo;
278 uint32_t rt_flag_mask;
294 char r_iif[IFNAMSIZ];
295 struct nl_addr *r_src;
296 struct nl_addr *r_dst;
297 struct nl_addr *r_srcmap;
300 struct rtnl_neightbl_parms
303 * Interface index of the device this parameter set is assigned
304 * to or 0 for the default set.
306 uint32_t ntp_ifindex;
309 * Number of references to this parameter set.
314 * Queue length for pending arp requests, i.e. the number of
315 * packets which are accepted from other layers while the
316 * neighbour address is still being resolved
318 uint32_t ntp_queue_len;
321 * Number of requests to send to the user level ARP daemon.
322 * Specify 0 to disable.
324 uint32_t ntp_app_probes;
327 * Maximum number of retries for unicast solicitation.
329 uint32_t ntp_ucast_probes;
332 * Maximum number of retries for multicast solicitation.
334 uint32_t ntp_mcast_probes;
337 * Base value in milliseconds to ompute reachable time, see RFC2461.
339 uint64_t ntp_base_reachable_time;
342 * Actual reachable time (read-only)
344 uint64_t ntp_reachable_time; /* secs */
347 * The time in milliseconds between retransmitted Neighbor
348 * Solicitation messages.
350 uint64_t ntp_retrans_time;
353 * Interval in milliseconds to check for stale neighbour
356 uint64_t ntp_gc_stale_time; /* secs */
359 * Delay in milliseconds for the first time probe if
360 * the neighbour is reachable.
362 uint64_t ntp_probe_delay; /* secs */
365 * Maximum delay in milliseconds of an answer to a neighbour
366 * solicitation message.
368 uint64_t ntp_anycast_delay;
371 * Minimum age in milliseconds before a neighbour entry
374 uint64_t ntp_locktime;
377 * Delay in milliseconds before answering to an ARP request
378 * for which a proxy ARP entry exists.
380 uint64_t ntp_proxy_delay;
383 * Queue length for the delayed proxy arp requests.
385 uint32_t ntp_proxy_qlen;
388 * Mask of available parameter attributes
393 #define NTBLNAMSIZ 32
403 char nt_name[NTBLNAMSIZ];
405 uint32_t nt_gc_thresh1;
406 uint32_t nt_gc_thresh2;
407 uint32_t nt_gc_thresh3;
408 uint64_t nt_gc_interval;
409 struct ndt_config nt_config;
410 struct rtnl_neightbl_parms nt_parms;
411 struct ndt_stats nt_stats;
446 #define NL_TCA_GENERIC(pre) \
448 uint32_t pre ##_family; \
449 uint32_t pre ##_ifindex; \
450 uint32_t pre ##_handle; \
451 uint32_t pre ##_parent; \
452 uint32_t pre ##_info; \
453 char pre ##_kind[TCKINDSIZ]; \
454 struct nl_data * pre ##_opts; \
455 uint64_t pre ##_stats[RTNL_TC_STATS_MAX+1]; \
456 struct nl_data * pre ##_xstats; \
457 struct nl_data * pre ##_subdata; \
468 struct rtnl_qdisc_ops *q_ops;
474 struct rtnl_class_ops *c_ops;
482 struct rtnl_cls_ops *c_ops;
491 struct nl_data * cu_pcnt;
492 struct nl_data * cu_selector;
493 struct nl_data * cu_act;
494 struct nl_data * cu_police;
495 char cu_indev[IFNAMSIZ];
501 struct rtnl_ematch_tree *cg_ematch;
508 struct nl_data * cf_act;
509 struct nl_data * cf_police;
510 char cf_indev[IFNAMSIZ];
520 struct nl_list_head e_childs;
521 struct nl_list_head e_list;
522 struct rtnl_ematch_ops *e_ops;
527 struct rtnl_ematch_tree
530 struct nl_list_head et_list;
534 struct rtnl_dsmark_qdisc
536 uint16_t qdm_indices;
537 uint16_t qdm_default_index;
538 uint32_t qdm_set_tc_index;
542 struct rtnl_dsmark_class
558 uint8_t qp_priomap[TC_PRIO_MAX+1];
566 struct rtnl_ratespec qt_rate;
567 uint32_t qt_rate_bucket;
568 uint32_t qt_rate_txtime;
569 struct rtnl_ratespec qt_peakrate;
570 uint32_t qt_peakrate_bucket;
571 uint32_t qt_peakrate_txtime;
585 struct rtnl_netem_corr
589 uint32_t nmc_duplicate;
592 struct rtnl_netem_reo
594 uint32_t nmro_probability;
595 uint32_t nmro_correlation;
598 struct rtnl_netem_crpt
600 uint32_t nmcr_probability;
601 uint32_t nmcr_correlation;
604 struct rtnl_netem_dist
612 uint32_t qnm_latency;
616 uint32_t qnm_duplicate;
619 struct rtnl_netem_corr qnm_corr;
620 struct rtnl_netem_reo qnm_ro;
621 struct rtnl_netem_crpt qnm_crpt;
622 struct rtnl_netem_dist qnm_dist;
625 struct rtnl_htb_qdisc
627 uint32_t qh_rate2quantum;
632 struct rtnl_htb_class
636 struct rtnl_ratespec ch_rate;
637 struct rtnl_ratespec ch_ceil;
648 struct tc_cbq_lssopt cbq_lss;
649 struct tc_ratespec cbq_rate;
650 struct tc_cbq_wrropt cbq_wrr;
651 struct tc_cbq_ovl cbq_ovl;
652 struct tc_cbq_fopt cbq_fopt;
653 struct tc_cbq_police cbq_police;
664 uint8_t qr_scell_log;
672 struct nl_addr * lr_addr;
684 struct flnl_request * fr_req;
686 uint8_t fr_prefixlen;
693 #define GENL_OP_HAS_POLICY 1
694 #define GENL_OP_HAS_DOIT 2
695 #define GENL_OP_HAS_DUMPIT 4
697 struct genl_family_op
702 struct nl_list_head o_list;
705 struct genl_family_grp {
706 struct genl_family *family; /* private */
707 struct nl_list_head list; /* private */
708 char name[GENL_NAMSIZ];
717 char gf_name[GENL_NAMSIZ];
722 struct nl_list_head gf_ops;
723 struct nl_list_head gf_mc_grps;
740 struct nl_addr * src;
741 struct nl_addr * dst;
742 union nfnl_ct_proto proto;
747 union nfnl_ct_protoinfo {
758 union nfnl_ct_protoinfo ct_protoinfo;
761 uint32_t ct_status_mask;
767 struct nfnl_ct_dir ct_orig;
768 struct nfnl_ct_dir ct_repl;
775 uint8_t log_copy_mode;
776 uint32_t log_copy_range;
777 uint32_t log_flush_timeout;
778 uint32_t log_alloc_size;
779 uint32_t log_queue_threshold;
781 uint32_t log_flag_mask;
784 struct nfnl_log_msg {
787 uint8_t log_msg_family;
788 uint8_t log_msg_hook;
789 uint16_t log_msg_hwproto;
790 uint32_t log_msg_mark;
791 struct timeval log_msg_timestamp;
792 uint32_t log_msg_indev;
793 uint32_t log_msg_outdev;
794 uint32_t log_msg_physindev;
795 uint32_t log_msg_physoutdev;
796 uint8_t log_msg_hwaddr[8];
797 int log_msg_hwaddr_len;
798 void * log_msg_payload;
799 int log_msg_payload_len;
800 char * log_msg_prefix;
801 uint32_t log_msg_uid;
802 uint32_t log_msg_gid;
803 uint32_t log_msg_seq;
804 uint32_t log_msg_seq_global;
810 uint16_t queue_group;
811 uint32_t queue_maxlen;
812 uint32_t queue_copy_range;
813 uint8_t queue_copy_mode;
816 struct nfnl_queue_msg {
819 uint16_t queue_msg_group;
820 uint8_t queue_msg_family;
821 uint8_t queue_msg_hook;
822 uint16_t queue_msg_hwproto;
823 uint32_t queue_msg_packetid;
824 uint32_t queue_msg_mark;
825 struct timeval queue_msg_timestamp;
826 uint32_t queue_msg_indev;
827 uint32_t queue_msg_outdev;
828 uint32_t queue_msg_physindev;
829 uint32_t queue_msg_physoutdev;
830 uint8_t queue_msg_hwaddr[8];
831 int queue_msg_hwaddr_len;
832 void * queue_msg_payload;
833 int queue_msg_payload_len;
834 uint32_t queue_msg_verdict;