2 * netlink-private/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-2013 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>
20 #include <netlink-private/route/tc-api.h>
22 #define NL_SOCK_BUFSIZE_SET (1<<0)
23 #define NL_SOCK_PASSCRED (1<<1)
24 #define NL_OWN_PORT (1<<2)
25 #define NL_MSG_PEEK (1<<3)
26 #define NL_NO_AUTO_ACK (1<<4)
28 #define NL_MSG_CRED_PRESENT 1
37 nl_recvmsg_msg_cb_t cb_set[NL_CB_TYPE_MAX+1];
38 void * cb_args[NL_CB_TYPE_MAX+1];
40 nl_recvmsg_err_cb_t cb_err;
43 /** May be used to replace nl_recvmsgs with your own implementation
44 * in all internal calls to nl_recvmsgs. */
45 int (*cb_recvmsgs_ow)(struct nl_sock *,
48 /** Overwrite internal calls to nl_recv, must return the number of
49 * octets read and allocate a buffer for the received data. */
50 int (*cb_recv_ow)(struct nl_sock *,
55 /** Overwrites internal calls to nl_send, must send the netlink
57 int (*cb_send_ow)(struct nl_sock *,
65 struct sockaddr_nl s_local;
66 struct sockaddr_nl s_peer;
69 unsigned int s_seq_next;
70 unsigned int s_seq_expect;
78 struct nl_list_head c_items;
84 struct nl_hash_table * hashtable;
85 struct nl_cache_ops * c_ops;
90 struct nl_cache * ca_cache;
91 change_func_t ca_change;
92 void * ca_change_data;
100 struct nl_sock * cm_sock;
101 struct nl_sock * cm_sync_sock;
102 struct nl_cache_assoc * cm_assocs;
105 struct nl_parser_param;
107 #define LOOSE_COMPARISON 1
109 #define NL_OBJ_MARK 1
120 unsigned int a_maxsize;
131 struct sockaddr_nl nm_src;
132 struct sockaddr_nl nm_dst;
133 struct ucred nm_creds;
134 struct nlmsghdr * nm_nlh;
141 uint64_t lm_mem_start;
143 uint64_t lm_base_addr;
149 #define IFQDISCSIZ 32
155 char l_name[IFNAMSIZ];
166 struct nl_addr * l_addr;
167 struct nl_addr * l_bcast;
168 char l_qdisc[IFQDISCSIZ];
169 struct rtnl_link_map l_map;
170 uint64_t l_stats[RTNL_LINK_STATS_MAX+1];
171 uint32_t l_flag_mask;
177 struct rtnl_link_info_ops * l_info_ops;
178 void * l_af_data[AF_MAX];
181 uint32_t l_promiscuity;
182 uint32_t l_num_tx_queues;
183 uint32_t l_num_rx_queues;
187 struct rtnl_link_af_ops * l_af_ops;
190 struct rtnl_ncacheinfo
192 uint32_t nci_confirmed; /**< Time since neighbour validty was last confirmed */
193 uint32_t nci_used; /**< Time since neighbour entry was last ued */
194 uint32_t nci_updated; /**< Time since last update */
195 uint32_t nci_refcnt; /**< Reference counter */
207 struct nl_addr *n_lladdr;
208 struct nl_addr *n_dst;
210 struct rtnl_ncacheinfo n_cacheinfo;
211 uint32_t n_state_mask;
212 uint32_t n_flag_mask;
217 struct rtnl_addr_cacheinfo
219 /* Preferred lifetime in seconds */
220 uint32_t aci_prefered;
222 /* Valid lifetime in seconds */
225 /* Timestamp of creation in 1/100s seince boottime */
228 /* Timestamp of last update in 1/100s since boottime */
242 struct nl_addr *a_peer;
243 struct nl_addr *a_local;
244 struct nl_addr *a_bcast;
245 struct nl_addr *a_anycast;
246 struct nl_addr *a_multicast;
248 struct rtnl_addr_cacheinfo a_cacheinfo;
250 char a_label[IFNAMSIZ];
251 uint32_t a_flag_mask;
252 struct rtnl_link *a_link;
258 uint8_t rtnh_flag_mask;
261 uint32_t rtnh_ifindex;
262 struct nl_addr * rtnh_gateway;
263 uint32_t ce_mask; /* HACK to support attr macros */
264 struct nl_list_head rtnh_list;
265 uint32_t rtnh_realms;
281 struct nl_addr * rt_dst;
282 struct nl_addr * rt_src;
286 uint32_t rt_metrics[RTAX_MAX];
287 uint32_t rt_metrics_mask;
289 struct nl_addr * rt_pref_src;
290 struct nl_list_head rt_nexthops;
291 struct rtnl_rtcacheinfo rt_cacheinfo;
292 uint32_t rt_flag_mask;
300 uint8_t r_dsfield; /* ipv4 only */
308 uint32_t r_flow; /* ipv4 only */
309 struct nl_addr *r_src;
310 struct nl_addr *r_dst;
311 char r_iifname[IFNAMSIZ];
312 char r_oifname[IFNAMSIZ];
315 struct rtnl_neightbl_parms
318 * Interface index of the device this parameter set is assigned
319 * to or 0 for the default set.
321 uint32_t ntp_ifindex;
324 * Number of references to this parameter set.
329 * Queue length for pending arp requests, i.e. the number of
330 * packets which are accepted from other layers while the
331 * neighbour address is still being resolved
333 uint32_t ntp_queue_len;
336 * Number of requests to send to the user level ARP daemon.
337 * Specify 0 to disable.
339 uint32_t ntp_app_probes;
342 * Maximum number of retries for unicast solicitation.
344 uint32_t ntp_ucast_probes;
347 * Maximum number of retries for multicast solicitation.
349 uint32_t ntp_mcast_probes;
352 * Base value in milliseconds to ompute reachable time, see RFC2461.
354 uint64_t ntp_base_reachable_time;
357 * Actual reachable time (read-only)
359 uint64_t ntp_reachable_time; /* secs */
362 * The time in milliseconds between retransmitted Neighbor
363 * Solicitation messages.
365 uint64_t ntp_retrans_time;
368 * Interval in milliseconds to check for stale neighbour
371 uint64_t ntp_gc_stale_time; /* secs */
374 * Delay in milliseconds for the first time probe if
375 * the neighbour is reachable.
377 uint64_t ntp_probe_delay; /* secs */
380 * Maximum delay in milliseconds of an answer to a neighbour
381 * solicitation message.
383 uint64_t ntp_anycast_delay;
386 * Minimum age in milliseconds before a neighbour entry
389 uint64_t ntp_locktime;
392 * Delay in milliseconds before answering to an ARP request
393 * for which a proxy ARP entry exists.
395 uint64_t ntp_proxy_delay;
398 * Queue length for the delayed proxy arp requests.
400 uint32_t ntp_proxy_qlen;
403 * Mask of available parameter attributes
408 #define NTBLNAMSIZ 32
418 char nt_name[NTBLNAMSIZ];
420 uint32_t nt_gc_thresh1;
421 uint32_t nt_gc_thresh2;
422 uint32_t nt_gc_thresh3;
423 uint64_t nt_gc_interval;
424 struct ndt_config nt_config;
425 struct rtnl_neightbl_parms nt_parms;
426 struct ndt_stats nt_stats;
432 uint16_t rs_overhead;
433 int16_t rs_cell_align;
461 #define NL_TC_GENERIC(pre) \
463 uint32_t pre ##_family; \
464 uint32_t pre ##_ifindex; \
465 uint32_t pre ##_handle; \
466 uint32_t pre ##_parent; \
467 uint32_t pre ##_info; \
468 uint32_t pre ##_mtu; \
469 uint32_t pre ##_mpu; \
470 uint32_t pre ##_overhead; \
471 uint32_t pre ##_linktype; \
472 char pre ##_kind[TCKINDSIZ]; \
473 struct nl_data * pre ##_opts; \
474 uint64_t pre ##_stats[RTNL_TC_STATS_MAX+1]; \
475 struct nl_data * pre ##_xstats; \
476 struct nl_data * pre ##_subdata; \
477 struct rtnl_link * pre ##_link; \
478 struct rtnl_tc_ops * pre ##_ops; \
479 enum rtnl_tc_type pre ##_type
509 struct nl_data * cu_pcnt;
510 struct nl_data * cu_selector;
511 struct nl_data * cu_act;
512 struct nl_data * cu_police;
513 char cu_indev[IFNAMSIZ];
519 struct rtnl_ematch_tree *cg_ematch;
526 struct nl_data * cf_act;
527 struct nl_data * cf_police;
528 char cf_indev[IFNAMSIZ];
541 struct nl_list_head e_childs;
542 struct nl_list_head e_list;
543 struct rtnl_ematch_ops *e_ops;
548 struct rtnl_ematch_tree
551 struct nl_list_head et_list;
555 struct rtnl_dsmark_qdisc
557 uint16_t qdm_indices;
558 uint16_t qdm_default_index;
559 uint32_t qdm_set_tc_index;
563 struct rtnl_dsmark_class
579 uint8_t qp_priomap[TC_PRIO_MAX+1];
586 struct rtnl_ratespec qt_rate;
587 uint32_t qt_rate_bucket;
588 uint32_t qt_rate_txtime;
589 struct rtnl_ratespec qt_peakrate;
590 uint32_t qt_peakrate_bucket;
591 uint32_t qt_peakrate_txtime;
605 struct rtnl_netem_corr
609 uint32_t nmc_duplicate;
612 struct rtnl_netem_reo
614 uint32_t nmro_probability;
615 uint32_t nmro_correlation;
618 struct rtnl_netem_crpt
620 uint32_t nmcr_probability;
621 uint32_t nmcr_correlation;
624 struct rtnl_netem_dist
632 uint32_t qnm_latency;
636 uint32_t qnm_duplicate;
639 struct rtnl_netem_corr qnm_corr;
640 struct rtnl_netem_reo qnm_ro;
641 struct rtnl_netem_crpt qnm_crpt;
642 struct rtnl_netem_dist qnm_dist;
645 struct rtnl_htb_qdisc
647 uint32_t qh_rate2quantum;
650 uint32_t qh_direct_pkts;
653 struct rtnl_htb_class
656 struct rtnl_ratespec ch_rate;
657 struct rtnl_ratespec ch_ceil;
667 struct tc_cbq_lssopt cbq_lss;
668 struct tc_ratespec cbq_rate;
669 struct tc_cbq_wrropt cbq_wrr;
670 struct tc_cbq_ovl cbq_ovl;
671 struct tc_cbq_fopt cbq_fopt;
672 struct tc_cbq_police cbq_police;
683 uint8_t qr_scell_log;
697 struct nl_addr * lr_addr;
709 struct flnl_request * fr_req;
711 uint8_t fr_prefixlen;
718 #define GENL_OP_HAS_POLICY 1
719 #define GENL_OP_HAS_DOIT 2
720 #define GENL_OP_HAS_DUMPIT 4
722 struct genl_family_op
727 struct nl_list_head o_list;
730 struct genl_family_grp {
731 struct genl_family *family; /* private */
732 struct nl_list_head list; /* private */
733 char name[GENL_NAMSIZ];
742 char gf_name[GENL_NAMSIZ];
747 struct nl_list_head gf_ops;
748 struct nl_list_head gf_mc_grps;
765 struct nl_addr * src;
766 struct nl_addr * dst;
767 union nfnl_ct_proto proto;
772 union nfnl_ct_protoinfo {
783 union nfnl_ct_protoinfo ct_protoinfo;
786 uint32_t ct_status_mask;
792 struct nfnl_ct_dir ct_orig;
793 struct nfnl_ct_dir ct_repl;
796 union nfnl_exp_protodata {
808 // Allow for different master/expect l4 protocols
809 struct nfnl_exp_proto
812 union nfnl_exp_protodata l4protodata;
815 struct nfnl_exp_dir {
816 struct nl_addr * src;
817 struct nl_addr * dst;
818 struct nfnl_exp_proto proto;
825 uint32_t exp_timeout;
830 char * exp_helper_name;
834 struct nfnl_exp_dir exp_expect;
835 struct nfnl_exp_dir exp_master;
836 struct nfnl_exp_dir exp_mask;
837 struct nfnl_exp_dir exp_nat;
844 uint8_t log_copy_mode;
845 uint32_t log_copy_range;
846 uint32_t log_flush_timeout;
847 uint32_t log_alloc_size;
848 uint32_t log_queue_threshold;
850 uint32_t log_flag_mask;
853 struct nfnl_log_msg {
856 uint8_t log_msg_family;
857 uint8_t log_msg_hook;
858 uint16_t log_msg_hwproto;
859 uint32_t log_msg_mark;
860 struct timeval log_msg_timestamp;
861 uint32_t log_msg_indev;
862 uint32_t log_msg_outdev;
863 uint32_t log_msg_physindev;
864 uint32_t log_msg_physoutdev;
865 uint8_t log_msg_hwaddr[8];
866 int log_msg_hwaddr_len;
867 void * log_msg_payload;
868 int log_msg_payload_len;
869 char * log_msg_prefix;
870 uint32_t log_msg_uid;
871 uint32_t log_msg_gid;
872 uint32_t log_msg_seq;
873 uint32_t log_msg_seq_global;
879 uint16_t queue_group;
880 uint32_t queue_maxlen;
881 uint32_t queue_copy_range;
882 uint8_t queue_copy_mode;
885 struct nfnl_queue_msg {
888 uint16_t queue_msg_group;
889 uint8_t queue_msg_family;
890 uint8_t queue_msg_hook;
891 uint16_t queue_msg_hwproto;
892 uint32_t queue_msg_packetid;
893 uint32_t queue_msg_mark;
894 struct timeval queue_msg_timestamp;
895 uint32_t queue_msg_indev;
896 uint32_t queue_msg_outdev;
897 uint32_t queue_msg_physindev;
898 uint32_t queue_msg_physoutdev;
899 uint8_t queue_msg_hwaddr[8];
900 int queue_msg_hwaddr_len;
901 void * queue_msg_payload;
902 int queue_msg_payload_len;
903 uint32_t queue_msg_verdict;
906 struct ematch_quoted {