types.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. /*
  2. * netlink-private/types.h Netlink Types (Private)
  3. *
  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
  7. * of the License.
  8. *
  9. * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
  10. */
  11. #ifndef NETLINK_LOCAL_TYPES_H_
  12. #define NETLINK_LOCAL_TYPES_H_
  13. #include <netlink/list.h>
  14. #include <netlink/route/link.h>
  15. #include <netlink/route/qdisc.h>
  16. #include <netlink/route/rtnl.h>
  17. #include <netlink/route/route.h>
  18. #include <netlink-private/route/tc-api.h>
  19. #define NL_SOCK_BUFSIZE_SET (1<<0)
  20. #define NL_SOCK_PASSCRED (1<<1)
  21. #define NL_OWN_PORT (1<<2)
  22. #define NL_MSG_PEEK (1<<3)
  23. #define NL_NO_AUTO_ACK (1<<4)
  24. #define NL_MSG_CRED_PRESENT 1
  25. struct nl_cache_ops;
  26. struct nl_sock;
  27. struct nl_object;
  28. struct nl_hash_table;
  29. struct nl_cb
  30. {
  31. nl_recvmsg_msg_cb_t cb_set[NL_CB_TYPE_MAX+1];
  32. void * cb_args[NL_CB_TYPE_MAX+1];
  33. nl_recvmsg_err_cb_t cb_err;
  34. void * cb_err_arg;
  35. /** May be used to replace nl_recvmsgs with your own implementation
  36. * in all internal calls to nl_recvmsgs. */
  37. int (*cb_recvmsgs_ow)(struct nl_sock *,
  38. struct nl_cb *);
  39. /** Overwrite internal calls to nl_recv, must return the number of
  40. * octets read and allocate a buffer for the received data. */
  41. int (*cb_recv_ow)(struct nl_sock *,
  42. struct sockaddr_nl *,
  43. unsigned char **,
  44. struct ucred **);
  45. /** Overwrites internal calls to nl_send, must send the netlink
  46. * message. */
  47. int (*cb_send_ow)(struct nl_sock *,
  48. struct nl_msg *);
  49. int cb_refcnt;
  50. };
  51. struct nl_sock
  52. {
  53. struct sockaddr_nl s_local;
  54. struct sockaddr_nl s_peer;
  55. int s_fd;
  56. int s_proto;
  57. unsigned int s_seq_next;
  58. unsigned int s_seq_expect;
  59. int s_flags;
  60. struct nl_cb * s_cb;
  61. size_t s_bufsize;
  62. };
  63. struct nl_cache
  64. {
  65. struct nl_list_head c_items;
  66. int c_nitems;
  67. int c_iarg1;
  68. int c_iarg2;
  69. int c_refcnt;
  70. unsigned int c_flags;
  71. struct nl_hash_table * hashtable;
  72. struct nl_cache_ops * c_ops;
  73. };
  74. struct nl_cache_assoc
  75. {
  76. struct nl_cache * ca_cache;
  77. change_func_t ca_change;
  78. void * ca_change_data;
  79. };
  80. struct nl_cache_mngr
  81. {
  82. int cm_protocol;
  83. int cm_flags;
  84. int cm_nassocs;
  85. struct nl_sock * cm_sock;
  86. struct nl_sock * cm_sync_sock;
  87. struct nl_cache_assoc * cm_assocs;
  88. };
  89. struct nl_parser_param;
  90. #define LOOSE_COMPARISON 1
  91. #define NL_OBJ_MARK 1
  92. struct nl_data
  93. {
  94. size_t d_size;
  95. void * d_data;
  96. };
  97. struct nl_addr
  98. {
  99. int a_family;
  100. unsigned int a_maxsize;
  101. unsigned int a_len;
  102. int a_prefixlen;
  103. int a_refcnt;
  104. char a_addr[0];
  105. };
  106. struct nl_msg
  107. {
  108. int nm_protocol;
  109. int nm_flags;
  110. struct sockaddr_nl nm_src;
  111. struct sockaddr_nl nm_dst;
  112. struct ucred nm_creds;
  113. struct nlmsghdr * nm_nlh;
  114. size_t nm_size;
  115. int nm_refcnt;
  116. };
  117. struct rtnl_link_map
  118. {
  119. uint64_t lm_mem_start;
  120. uint64_t lm_mem_end;
  121. uint64_t lm_base_addr;
  122. uint16_t lm_irq;
  123. uint8_t lm_dma;
  124. uint8_t lm_port;
  125. };
  126. #define IFQDISCSIZ 32
  127. struct rtnl_link
  128. {
  129. NLHDR_COMMON
  130. char l_name[IFNAMSIZ];
  131. uint32_t l_family;
  132. uint32_t l_arptype;
  133. uint32_t l_index;
  134. uint32_t l_flags;
  135. uint32_t l_change;
  136. uint32_t l_mtu;
  137. uint32_t l_link;
  138. uint32_t l_txqlen;
  139. uint32_t l_weight;
  140. uint32_t l_master;
  141. struct nl_addr * l_addr;
  142. struct nl_addr * l_bcast;
  143. char l_qdisc[IFQDISCSIZ];
  144. struct rtnl_link_map l_map;
  145. uint64_t l_stats[RTNL_LINK_STATS_MAX+1];
  146. uint32_t l_flag_mask;
  147. uint32_t l_num_vf;
  148. uint8_t l_operstate;
  149. uint8_t l_linkmode;
  150. /* 2 byte hole */
  151. char * l_info_kind;
  152. struct rtnl_link_info_ops * l_info_ops;
  153. void * l_af_data[AF_MAX];
  154. void * l_info;
  155. char * l_ifalias;
  156. uint32_t l_promiscuity;
  157. uint32_t l_num_tx_queues;
  158. uint32_t l_num_rx_queues;
  159. uint32_t l_group;
  160. uint8_t l_carrier;
  161. /* 3 byte hole */
  162. struct rtnl_link_af_ops * l_af_ops;
  163. };
  164. struct rtnl_ncacheinfo
  165. {
  166. uint32_t nci_confirmed; /**< Time since neighbour validty was last confirmed */
  167. uint32_t nci_used; /**< Time since neighbour entry was last ued */
  168. uint32_t nci_updated; /**< Time since last update */
  169. uint32_t nci_refcnt; /**< Reference counter */
  170. };
  171. struct rtnl_neigh
  172. {
  173. NLHDR_COMMON
  174. uint32_t n_family;
  175. uint32_t n_ifindex;
  176. uint16_t n_state;
  177. uint8_t n_flags;
  178. uint8_t n_type;
  179. struct nl_addr *n_lladdr;
  180. struct nl_addr *n_dst;
  181. uint32_t n_probes;
  182. struct rtnl_ncacheinfo n_cacheinfo;
  183. uint32_t n_state_mask;
  184. uint32_t n_flag_mask;
  185. uint32_t n_master;
  186. };
  187. struct rtnl_addr_cacheinfo
  188. {
  189. /* Preferred lifetime in seconds */
  190. uint32_t aci_prefered;
  191. /* Valid lifetime in seconds */
  192. uint32_t aci_valid;
  193. /* Timestamp of creation in 1/100s seince boottime */
  194. uint32_t aci_cstamp;
  195. /* Timestamp of last update in 1/100s since boottime */
  196. uint32_t aci_tstamp;
  197. };
  198. struct rtnl_addr
  199. {
  200. NLHDR_COMMON
  201. uint8_t a_family;
  202. uint8_t a_prefixlen;
  203. uint8_t a_flags;
  204. uint8_t a_scope;
  205. uint32_t a_ifindex;
  206. struct nl_addr *a_peer;
  207. struct nl_addr *a_local;
  208. struct nl_addr *a_bcast;
  209. struct nl_addr *a_anycast;
  210. struct nl_addr *a_multicast;
  211. struct rtnl_addr_cacheinfo a_cacheinfo;
  212. char a_label[IFNAMSIZ];
  213. uint32_t a_flag_mask;
  214. struct rtnl_link *a_link;
  215. };
  216. struct rtnl_nexthop
  217. {
  218. uint8_t rtnh_flags;
  219. uint8_t rtnh_flag_mask;
  220. uint8_t rtnh_weight;
  221. /* 1 byte spare */
  222. uint32_t rtnh_ifindex;
  223. struct nl_addr * rtnh_gateway;
  224. uint32_t ce_mask; /* HACK to support attr macros */
  225. struct nl_list_head rtnh_list;
  226. uint32_t rtnh_realms;
  227. };
  228. struct rtnl_route
  229. {
  230. NLHDR_COMMON
  231. uint8_t rt_family;
  232. uint8_t rt_dst_len;
  233. uint8_t rt_src_len;
  234. uint8_t rt_tos;
  235. uint8_t rt_protocol;
  236. uint8_t rt_scope;
  237. uint8_t rt_type;
  238. uint8_t rt_nmetrics;
  239. uint32_t rt_flags;
  240. struct nl_addr * rt_dst;
  241. struct nl_addr * rt_src;
  242. uint32_t rt_table;
  243. uint32_t rt_iif;
  244. uint32_t rt_prio;
  245. uint32_t rt_metrics[RTAX_MAX];
  246. uint32_t rt_metrics_mask;
  247. uint32_t rt_nr_nh;
  248. struct nl_addr * rt_pref_src;
  249. struct nl_list_head rt_nexthops;
  250. struct rtnl_rtcacheinfo rt_cacheinfo;
  251. uint32_t rt_flag_mask;
  252. };
  253. struct rtnl_rule
  254. {
  255. NLHDR_COMMON
  256. uint8_t r_family;
  257. uint8_t r_action;
  258. uint8_t r_dsfield; /* ipv4 only */
  259. uint8_t r_unused;
  260. uint32_t r_table;
  261. uint32_t r_flags;
  262. uint32_t r_prio;
  263. uint32_t r_mark;
  264. uint32_t r_mask;
  265. uint32_t r_goto;
  266. uint32_t r_flow; /* ipv4 only */
  267. struct nl_addr *r_src;
  268. struct nl_addr *r_dst;
  269. char r_iifname[IFNAMSIZ];
  270. char r_oifname[IFNAMSIZ];
  271. };
  272. struct rtnl_neightbl_parms
  273. {
  274. /**
  275. * Interface index of the device this parameter set is assigned
  276. * to or 0 for the default set.
  277. */
  278. uint32_t ntp_ifindex;
  279. /**
  280. * Number of references to this parameter set.
  281. */
  282. uint32_t ntp_refcnt;
  283. /**
  284. * Queue length for pending arp requests, i.e. the number of
  285. * packets which are accepted from other layers while the
  286. * neighbour address is still being resolved
  287. */
  288. uint32_t ntp_queue_len;
  289. /**
  290. * Number of requests to send to the user level ARP daemon.
  291. * Specify 0 to disable.
  292. */
  293. uint32_t ntp_app_probes;
  294. /**
  295. * Maximum number of retries for unicast solicitation.
  296. */
  297. uint32_t ntp_ucast_probes;
  298. /**
  299. * Maximum number of retries for multicast solicitation.
  300. */
  301. uint32_t ntp_mcast_probes;
  302. /**
  303. * Base value in milliseconds to ompute reachable time, see RFC2461.
  304. */
  305. uint64_t ntp_base_reachable_time;
  306. /**
  307. * Actual reachable time (read-only)
  308. */
  309. uint64_t ntp_reachable_time; /* secs */
  310. /**
  311. * The time in milliseconds between retransmitted Neighbor
  312. * Solicitation messages.
  313. */
  314. uint64_t ntp_retrans_time;
  315. /**
  316. * Interval in milliseconds to check for stale neighbour
  317. * entries.
  318. */
  319. uint64_t ntp_gc_stale_time; /* secs */
  320. /**
  321. * Delay in milliseconds for the first time probe if
  322. * the neighbour is reachable.
  323. */
  324. uint64_t ntp_probe_delay; /* secs */
  325. /**
  326. * Maximum delay in milliseconds of an answer to a neighbour
  327. * solicitation message.
  328. */
  329. uint64_t ntp_anycast_delay;
  330. /**
  331. * Minimum age in milliseconds before a neighbour entry
  332. * may be replaced.
  333. */
  334. uint64_t ntp_locktime;
  335. /**
  336. * Delay in milliseconds before answering to an ARP request
  337. * for which a proxy ARP entry exists.
  338. */
  339. uint64_t ntp_proxy_delay;
  340. /**
  341. * Queue length for the delayed proxy arp requests.
  342. */
  343. uint32_t ntp_proxy_qlen;
  344. /**
  345. * Mask of available parameter attributes
  346. */
  347. uint32_t ntp_mask;
  348. };
  349. #define NTBLNAMSIZ 32
  350. /**
  351. * Neighbour table
  352. * @ingroup neightbl
  353. */
  354. struct rtnl_neightbl
  355. {
  356. NLHDR_COMMON
  357. char nt_name[NTBLNAMSIZ];
  358. uint32_t nt_family;
  359. uint32_t nt_gc_thresh1;
  360. uint32_t nt_gc_thresh2;
  361. uint32_t nt_gc_thresh3;
  362. uint64_t nt_gc_interval;
  363. struct ndt_config nt_config;
  364. struct rtnl_neightbl_parms nt_parms;
  365. struct ndt_stats nt_stats;
  366. };
  367. struct rtnl_ratespec
  368. {
  369. uint8_t rs_cell_log;
  370. uint16_t rs_overhead;
  371. int16_t rs_cell_align;
  372. uint16_t rs_mpu;
  373. uint32_t rs_rate;
  374. };
  375. struct rtnl_tstats
  376. {
  377. struct {
  378. uint64_t bytes;
  379. uint64_t packets;
  380. } tcs_basic;
  381. struct {
  382. uint32_t bps;
  383. uint32_t pps;
  384. } tcs_rate_est;
  385. struct {
  386. uint32_t qlen;
  387. uint32_t backlog;
  388. uint32_t drops;
  389. uint32_t requeues;
  390. uint32_t overlimits;
  391. } tcs_queue;
  392. };
  393. #define TCKINDSIZ 32
  394. #define NL_TC_GENERIC(pre) \
  395. NLHDR_COMMON \
  396. uint32_t pre ##_family; \
  397. uint32_t pre ##_ifindex; \
  398. uint32_t pre ##_handle; \
  399. uint32_t pre ##_parent; \
  400. uint32_t pre ##_info; \
  401. uint32_t pre ##_mtu; \
  402. uint32_t pre ##_mpu; \
  403. uint32_t pre ##_overhead; \
  404. uint32_t pre ##_linktype; \
  405. char pre ##_kind[TCKINDSIZ]; \
  406. struct nl_data * pre ##_opts; \
  407. uint64_t pre ##_stats[RTNL_TC_STATS_MAX+1]; \
  408. struct nl_data * pre ##_xstats; \
  409. struct nl_data * pre ##_subdata; \
  410. struct rtnl_link * pre ##_link; \
  411. struct rtnl_tc_ops * pre ##_ops; \
  412. enum rtnl_tc_type pre ##_type
  413. struct rtnl_tc
  414. {
  415. NL_TC_GENERIC(tc);
  416. };
  417. struct rtnl_qdisc
  418. {
  419. NL_TC_GENERIC(q);
  420. };
  421. struct rtnl_class
  422. {
  423. NL_TC_GENERIC(c);
  424. };
  425. struct rtnl_cls
  426. {
  427. NL_TC_GENERIC(c);
  428. uint16_t c_prio;
  429. uint16_t c_protocol;
  430. };
  431. struct rtnl_u32
  432. {
  433. uint32_t cu_divisor;
  434. uint32_t cu_hash;
  435. uint32_t cu_classid;
  436. uint32_t cu_link;
  437. struct nl_data * cu_pcnt;
  438. struct nl_data * cu_selector;
  439. struct nl_data * cu_act;
  440. struct nl_data * cu_police;
  441. char cu_indev[IFNAMSIZ];
  442. int cu_mask;
  443. };
  444. struct rtnl_cgroup
  445. {
  446. struct rtnl_ematch_tree *cg_ematch;
  447. int cg_mask;
  448. };
  449. struct rtnl_fw
  450. {
  451. uint32_t cf_classid;
  452. struct nl_data * cf_act;
  453. struct nl_data * cf_police;
  454. char cf_indev[IFNAMSIZ];
  455. uint32_t cf_fwmask;
  456. int cf_mask;
  457. };
  458. struct rtnl_ematch
  459. {
  460. uint16_t e_id;
  461. uint16_t e_kind;
  462. uint16_t e_flags;
  463. uint16_t e_index;
  464. size_t e_datalen;
  465. struct nl_list_head e_childs;
  466. struct nl_list_head e_list;
  467. struct rtnl_ematch_ops *e_ops;
  468. void * e_data;
  469. };
  470. struct rtnl_ematch_tree
  471. {
  472. uint16_t et_progid;
  473. struct nl_list_head et_list;
  474. };
  475. struct rtnl_dsmark_qdisc
  476. {
  477. uint16_t qdm_indices;
  478. uint16_t qdm_default_index;
  479. uint32_t qdm_set_tc_index;
  480. uint32_t qdm_mask;
  481. };
  482. struct rtnl_dsmark_class
  483. {
  484. uint8_t cdm_bmask;
  485. uint8_t cdm_value;
  486. uint32_t cdm_mask;
  487. };
  488. struct rtnl_fifo
  489. {
  490. uint32_t qf_limit;
  491. uint32_t qf_mask;
  492. };
  493. struct rtnl_prio
  494. {
  495. uint32_t qp_bands;
  496. uint8_t qp_priomap[TC_PRIO_MAX+1];
  497. uint32_t qp_mask;
  498. };
  499. struct rtnl_tbf
  500. {
  501. uint32_t qt_limit;
  502. struct rtnl_ratespec qt_rate;
  503. uint32_t qt_rate_bucket;
  504. uint32_t qt_rate_txtime;
  505. struct rtnl_ratespec qt_peakrate;
  506. uint32_t qt_peakrate_bucket;
  507. uint32_t qt_peakrate_txtime;
  508. uint32_t qt_mask;
  509. };
  510. struct rtnl_sfq
  511. {
  512. uint32_t qs_quantum;
  513. uint32_t qs_perturb;
  514. uint32_t qs_limit;
  515. uint32_t qs_divisor;
  516. uint32_t qs_flows;
  517. uint32_t qs_mask;
  518. };
  519. struct rtnl_netem_corr
  520. {
  521. uint32_t nmc_delay;
  522. uint32_t nmc_loss;
  523. uint32_t nmc_duplicate;
  524. };
  525. struct rtnl_netem_reo
  526. {
  527. uint32_t nmro_probability;
  528. uint32_t nmro_correlation;
  529. };
  530. struct rtnl_netem_crpt
  531. {
  532. uint32_t nmcr_probability;
  533. uint32_t nmcr_correlation;
  534. };
  535. struct rtnl_netem_dist
  536. {
  537. int16_t * dist_data;
  538. size_t dist_size;
  539. };
  540. struct rtnl_netem
  541. {
  542. uint32_t qnm_latency;
  543. uint32_t qnm_limit;
  544. uint32_t qnm_loss;
  545. uint32_t qnm_gap;
  546. uint32_t qnm_duplicate;
  547. uint32_t qnm_jitter;
  548. uint32_t qnm_mask;
  549. struct rtnl_netem_corr qnm_corr;
  550. struct rtnl_netem_reo qnm_ro;
  551. struct rtnl_netem_crpt qnm_crpt;
  552. struct rtnl_netem_dist qnm_dist;
  553. };
  554. struct rtnl_htb_qdisc
  555. {
  556. uint32_t qh_rate2quantum;
  557. uint32_t qh_defcls;
  558. uint32_t qh_mask;
  559. uint32_t qh_direct_pkts;
  560. };
  561. struct rtnl_htb_class
  562. {
  563. uint32_t ch_prio;
  564. struct rtnl_ratespec ch_rate;
  565. struct rtnl_ratespec ch_ceil;
  566. uint32_t ch_rbuffer;
  567. uint32_t ch_cbuffer;
  568. uint32_t ch_quantum;
  569. uint32_t ch_mask;
  570. uint32_t ch_level;
  571. };
  572. struct rtnl_cbq
  573. {
  574. struct tc_cbq_lssopt cbq_lss;
  575. struct tc_ratespec cbq_rate;
  576. struct tc_cbq_wrropt cbq_wrr;
  577. struct tc_cbq_ovl cbq_ovl;
  578. struct tc_cbq_fopt cbq_fopt;
  579. struct tc_cbq_police cbq_police;
  580. };
  581. struct rtnl_red
  582. {
  583. uint32_t qr_limit;
  584. uint32_t qr_qth_min;
  585. uint32_t qr_qth_max;
  586. uint8_t qr_flags;
  587. uint8_t qr_wlog;
  588. uint8_t qr_plog;
  589. uint8_t qr_scell_log;
  590. uint32_t qr_mask;
  591. };
  592. struct rtnl_plug
  593. {
  594. int action;
  595. uint32_t limit;
  596. };
  597. struct flnl_request
  598. {
  599. NLHDR_COMMON
  600. struct nl_addr * lr_addr;
  601. uint32_t lr_fwmark;
  602. uint8_t lr_tos;
  603. uint8_t lr_scope;
  604. uint8_t lr_table;
  605. };
  606. struct flnl_result
  607. {
  608. NLHDR_COMMON
  609. struct flnl_request * fr_req;
  610. uint8_t fr_table_id;
  611. uint8_t fr_prefixlen;
  612. uint8_t fr_nh_sel;
  613. uint8_t fr_type;
  614. uint8_t fr_scope;
  615. uint32_t fr_error;
  616. };
  617. #define GENL_OP_HAS_POLICY 1
  618. #define GENL_OP_HAS_DOIT 2
  619. #define GENL_OP_HAS_DUMPIT 4
  620. struct genl_family_op
  621. {
  622. uint32_t o_id;
  623. uint32_t o_flags;
  624. struct nl_list_head o_list;
  625. };
  626. struct genl_family_grp {
  627. struct genl_family *family; /* private */
  628. struct nl_list_head list; /* private */
  629. char name[GENL_NAMSIZ];
  630. u_int32_t id;
  631. };
  632. struct genl_family
  633. {
  634. NLHDR_COMMON
  635. uint16_t gf_id;
  636. char gf_name[GENL_NAMSIZ];
  637. uint32_t gf_version;
  638. uint32_t gf_hdrsize;
  639. uint32_t gf_maxattr;
  640. struct nl_list_head gf_ops;
  641. struct nl_list_head gf_mc_grps;
  642. };
  643. union nfnl_ct_proto
  644. {
  645. struct {
  646. uint16_t src;
  647. uint16_t dst;
  648. } port;
  649. struct {
  650. uint16_t id;
  651. uint8_t type;
  652. uint8_t code;
  653. } icmp;
  654. };
  655. struct nfnl_ct_dir {
  656. struct nl_addr * src;
  657. struct nl_addr * dst;
  658. union nfnl_ct_proto proto;
  659. uint64_t packets;
  660. uint64_t bytes;
  661. };
  662. union nfnl_ct_protoinfo {
  663. struct {
  664. uint8_t state;
  665. } tcp;
  666. };
  667. struct nfnl_ct {
  668. NLHDR_COMMON
  669. uint8_t ct_family;
  670. uint8_t ct_proto;
  671. union nfnl_ct_protoinfo ct_protoinfo;
  672. uint32_t ct_status;
  673. uint32_t ct_status_mask;
  674. uint32_t ct_timeout;
  675. uint32_t ct_mark;
  676. uint32_t ct_use;
  677. uint32_t ct_id;
  678. struct nfnl_ct_dir ct_orig;
  679. struct nfnl_ct_dir ct_repl;
  680. };
  681. union nfnl_exp_protodata {
  682. struct {
  683. uint16_t src;
  684. uint16_t dst;
  685. } port;
  686. struct {
  687. uint16_t id;
  688. uint8_t type;
  689. uint8_t code;
  690. } icmp;
  691. };
  692. // Allow for different master/expect l4 protocols
  693. struct nfnl_exp_proto
  694. {
  695. uint8_t l4protonum;
  696. union nfnl_exp_protodata l4protodata;
  697. };
  698. struct nfnl_exp_dir {
  699. struct nl_addr * src;
  700. struct nl_addr * dst;
  701. struct nfnl_exp_proto proto;
  702. };
  703. struct nfnl_exp {
  704. NLHDR_COMMON
  705. uint8_t exp_family;
  706. uint32_t exp_timeout;
  707. uint32_t exp_id;
  708. uint16_t exp_zone;
  709. uint32_t exp_class;
  710. uint32_t exp_flags;
  711. char * exp_helper_name;
  712. char * exp_fn;
  713. uint8_t exp_nat_dir;
  714. struct nfnl_exp_dir exp_expect;
  715. struct nfnl_exp_dir exp_master;
  716. struct nfnl_exp_dir exp_mask;
  717. struct nfnl_exp_dir exp_nat;
  718. };
  719. struct nfnl_log {
  720. NLHDR_COMMON
  721. uint16_t log_group;
  722. uint8_t log_copy_mode;
  723. uint32_t log_copy_range;
  724. uint32_t log_flush_timeout;
  725. uint32_t log_alloc_size;
  726. uint32_t log_queue_threshold;
  727. uint32_t log_flags;
  728. uint32_t log_flag_mask;
  729. };
  730. struct nfnl_log_msg {
  731. NLHDR_COMMON
  732. uint8_t log_msg_family;
  733. uint8_t log_msg_hook;
  734. uint16_t log_msg_hwproto;
  735. uint32_t log_msg_mark;
  736. struct timeval log_msg_timestamp;
  737. uint32_t log_msg_indev;
  738. uint32_t log_msg_outdev;
  739. uint32_t log_msg_physindev;
  740. uint32_t log_msg_physoutdev;
  741. uint8_t log_msg_hwaddr[8];
  742. int log_msg_hwaddr_len;
  743. void * log_msg_payload;
  744. int log_msg_payload_len;
  745. char * log_msg_prefix;
  746. uint32_t log_msg_uid;
  747. uint32_t log_msg_gid;
  748. uint32_t log_msg_seq;
  749. uint32_t log_msg_seq_global;
  750. };
  751. struct nfnl_queue {
  752. NLHDR_COMMON
  753. uint16_t queue_group;
  754. uint32_t queue_maxlen;
  755. uint32_t queue_copy_range;
  756. uint8_t queue_copy_mode;
  757. };
  758. struct nfnl_queue_msg {
  759. NLHDR_COMMON
  760. uint16_t queue_msg_group;
  761. uint8_t queue_msg_family;
  762. uint8_t queue_msg_hook;
  763. uint16_t queue_msg_hwproto;
  764. uint32_t queue_msg_packetid;
  765. uint32_t queue_msg_mark;
  766. struct timeval queue_msg_timestamp;
  767. uint32_t queue_msg_indev;
  768. uint32_t queue_msg_outdev;
  769. uint32_t queue_msg_physindev;
  770. uint32_t queue_msg_physoutdev;
  771. uint8_t queue_msg_hwaddr[8];
  772. int queue_msg_hwaddr_len;
  773. void * queue_msg_payload;
  774. int queue_msg_payload_len;
  775. uint32_t queue_msg_verdict;
  776. };
  777. struct ematch_quoted {
  778. char * data;
  779. size_t len;
  780. int index;
  781. };
  782. #endif