API for modules implementing specific link types/semantics.
More...
API for modules implementing specific link types/semantics.
- 1) Registering/Unregistering a new link info type
static struct rtnl_link_info_ops vlan_info_ops = {
.io_name = "vlan",
.io_alloc = vlan_alloc,
.io_parse = vlan_parse,
.io_dump[NL_DUMP_BRIEF] = vlan_dump_brief,
.io_dump[NL_DUMP_FULL] = vlan_dump_full,
.io_free = vlan_free,
};
static void __init vlan_init(void)
{
}
static void __exit vlan_exit(void)
{
}
int rtnl_link_register_info(struct rtnl_link_info_ops *ops)
Register operations for a link info type.
int rtnl_link_unregister_info(struct rtnl_link_info_ops *ops)
Unregister operations for a link info type.
◆ rtnl_link_info_ops_lookup()
struct rtnl_link_info_ops* rtnl_link_info_ops_lookup |
( |
const char * |
name | ) |
|
Return operations of a specific link info type.
- Parameters
-
name | Name of link info type. |
- Note
- The returned pointer must be given back using rtnl_link_info_ops_put()
- Returns
- Pointer to operations or NULL if unavailable.
Definition at line 71 of file api.c.
◆ rtnl_link_info_ops_get()
void rtnl_link_info_ops_get |
( |
struct rtnl_link_info_ops * |
ops | ) |
|
Take reference to a set of operations.
- Parameters
-
Definition at line 87 of file api.c.
◆ rtnl_link_info_ops_put()
void rtnl_link_info_ops_put |
( |
struct rtnl_link_info_ops * |
ops | ) |
|
Give back reference to a set of operations.
- Parameters
-
Definition at line 101 of file api.c.
◆ rtnl_link_register_info()
int rtnl_link_register_info |
( |
struct rtnl_link_info_ops * |
ops | ) |
|
Register operations for a link info type.
- Parameters
-
This function must be called by modules implementing a specific link info type. It will make the operations implemented by the module available for everyone else.
- Returns
- 0 on success or a negative error code.
-
-NLE_INVAL Link info name not specified.
-
-NLE_EXIST Operations for address family already registered.
Definition at line 124 of file api.c.
◆ rtnl_link_unregister_info()
int rtnl_link_unregister_info |
( |
struct rtnl_link_info_ops * |
ops | ) |
|
Unregister operations for a link info type.
- Parameters
-
This function must be called if a module implementing a specific link info type is unloaded or becomes unavailable. It must provide a set of operations which have previously been registered using rtnl_link_register_info().
- Returns
- 0 on success or a negative error code
-
_NLE_OPNOTSUPP Link info operations not registered.
-
-NLE_BUSY Link info operations still in use.
Definition at line 159 of file api.c.
◆ rtnl_link_af_ops_lookup()
struct rtnl_link_af_ops* rtnl_link_af_ops_lookup |
( |
const unsigned int |
family | ) |
|
Return operations of a specific link address family.
- Parameters
-
- Note
- The returned pointer must be given back using rtnl_link_af_ops_put()
- Returns
- Pointer to operations or NULL if unavailable.
Definition at line 206 of file api.c.
◆ rtnl_link_af_ops_put()
void rtnl_link_af_ops_put |
( |
struct rtnl_link_af_ops * |
ops | ) |
|
Give back reference to a set of operations.
- Parameters
-
ops | Address family operations. |
Definition at line 223 of file api.c.
◆ rtnl_link_af_alloc()
void* rtnl_link_af_alloc |
( |
struct rtnl_link * |
link, |
|
|
const struct rtnl_link_af_ops * |
ops |
|
) |
| |
Allocate and return data buffer for link address family modules.
- Parameters
-
link | Link object |
ops | Address family operations |
This function must be called by link address family modules in all cases where the API does not provide the data buffer as argument already. This typically includes set functions the module provides. Calling this function is strictly required to ensure proper allocation of the buffer upon first use. Link objects will NOT proactively allocate a data buffer for each registered link address family.
- Returns
- Pointer to data buffer or NULL on error.
Definition at line 246 of file api.c.
Referenced by rtnl_link_inet_set_conf().
◆ rtnl_link_af_data()
void* rtnl_link_af_data |
( |
const struct rtnl_link * |
link, |
|
|
const struct rtnl_link_af_ops * |
ops |
|
) |
| |
Return data buffer for link address family modules.
- Parameters
-
link | Link object |
ops | Address family operations |
This function returns a pointer to the data buffer for the specified link address family module or NULL if the buffer was not allocated yet. This function is typically used by get functions of modules which are not interested in having the data buffer allocated if no values have been set yet.
- Returns
- Pointer to data buffer or NULL on error.
Definition at line 281 of file api.c.
Referenced by rtnl_link_inet_get_conf().
◆ rtnl_link_af_register()
int rtnl_link_af_register |
( |
struct rtnl_link_af_ops * |
ops | ) |
|
Register operations for a link address family.
- Parameters
-
ops | Address family operations |
This function must be called by modules implementing a specific link address family. It will make the operations implemented by the module available for everyone else.
- Returns
- 0 on success or a negative error code.
-
-NLE_INVAL Address family is out of range (0..AF_MAX)
-
-NLE_EXIST Operations for address family already registered.
Definition at line 302 of file api.c.
◆ rtnl_link_af_unregister()
int rtnl_link_af_unregister |
( |
struct rtnl_link_af_ops * |
ops | ) |
|
Unregister operations for a link address family.
- Parameters
-
ops | Address family operations |
This function must be called if a module implementing a specific link address family is unloaded or becomes unavailable. It must provide a set of operations which have previously been registered using rtnl_link_af_register().
- Returns
- 0 on success or a negative error code
-
-NLE_INVAL ops is NULL
-
-NLE_OBJ_NOTFOUND Address family operations not registered.
-
-NLE_BUSY Address family operations still in use.
Definition at line 341 of file api.c.
◆ rtnl_link_af_data_compare()
Compare af data for a link address family.
- Parameters
-
a | Link object a |
b | Link object b |
family | af data family |
This function will compare af_data between two links a and b of family given by arg family
- Returns
- 0 if address family specific data matches or is not present or != 0 if it mismatches.
Definition at line 382 of file api.c.
◆ rtnl_link_info_data_compare()
Compare link info data.
- Parameters
-
a | Link object a |
b | Link object b |
This function will compare link_info data between two links a and b
- Returns
- 0 if link_info data matches or is not present or != 0 if it mismatches.
Definition at line 422 of file api.c.