xref: /aosp_15_r20/external/libnl/include/nl-priv-dynamic-route/nl-priv-dynamic-route.h (revision 4dc78e53d49367fa8e61b07018507c90983a077d)
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3  * Copyright (c) 2003-2013 Thomas Graf <[email protected]>
4  * Copyright (c) 2013 Sassano Systems LLC <[email protected]>
5  */
6 
7 #ifndef __NL_PRIVATE_TYPES_NL_ROUTE_H__
8 #define __NL_PRIVATE_TYPES_NL_ROUTE_H__
9 
10 struct rtnl_ematch {
11 	uint16_t e_id;
12 	uint16_t e_kind;
13 	uint16_t e_flags;
14 	uint16_t e_index;
15 	size_t e_datalen;
16 
17 	struct nl_list_head e_childs;
18 	struct nl_list_head e_list;
19 	struct rtnl_ematch_ops *e_ops;
20 
21 	void *e_data;
22 };
23 
24 struct rtnl_ematch_tree {
25 	uint16_t et_progid;
26 	struct nl_list_head et_list;
27 };
28 
29 /*****************************************************************************/
30 
31 /**
32  * Traffic control object operations
33  * @ingroup tc
34  *
35  * This structure holds function pointers and settings implementing
36  * the features of each traffic control object implementation.
37  */
38 struct rtnl_tc_ops {
39 	/**
40 	 * Name of traffic control module
41 	 */
42 	char *to_kind;
43 
44 	/**
45 	 * Type of traffic control object
46 	 */
47 	enum rtnl_tc_type to_type;
48 
49 	/**
50 	 * Size of private data
51 	 */
52 	size_t to_size;
53 
54 	/**
55 	 * Dump callbacks
56 	 */
57 	void (*to_dump[NL_DUMP_MAX + 1])(struct rtnl_tc *, void *,
58 					 struct nl_dump_params *);
59 	/**
60 	 * Used to fill the contents of TCA_OPTIONS
61 	 */
62 	int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
63 
64 	/**
65 	 * Uesd to to fill tc related messages, unlike with to_msg_fill,
66 	 * the contents is not encapsulated with a TCA_OPTIONS nested
67 	 * attribute.
68 	 */
69 	int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
70 
71 	/**
72 	 * TCA_OPTIONS message parser
73 	 */
74 	int (*to_msg_parser)(struct rtnl_tc *, void *);
75 
76 	/**
77 	 * Called before a tc object is destroyed
78 	 */
79 	void (*to_free_data)(struct rtnl_tc *, void *);
80 
81 	/**
82 	 * Called whenever a classifier object needs to be cloned
83 	 */
84 	int (*to_clone)(void *, void *);
85 
86 	/**
87 	 * Internal, don't touch
88 	 */
89 	struct nl_list_head to_list;
90 };
91 
92 extern struct rtnl_tc_ops *rtnl_tc_lookup_ops(enum rtnl_tc_type, const char *);
93 
94 struct rtnl_tc_ops *rtnl_tc_get_ops(struct rtnl_tc *);
95 
96 struct rtnl_nexthop {
97 	uint8_t rtnh_flags;
98 	uint8_t rtnh_flag_mask;
99 	uint8_t rtnh_weight;
100 	/* 1 byte spare */
101 	uint32_t rtnh_ifindex;
102 	struct nl_addr *rtnh_gateway;
103 	uint32_t ce_mask; /* HACK to support attr macros */
104 	struct nl_list_head rtnh_list;
105 	uint32_t rtnh_realms;
106 	struct nl_addr *rtnh_newdst;
107 	struct nl_addr *rtnh_via;
108 	struct rtnl_nh_encap *rtnh_encap;
109 };
110 
111 #endif /* __NL_PRIVATE_TYPES_NL_ROUTE_H__ */
112