1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

netlink,network: drop "const" from opaque object parameters in supposed-to-be-public APIs

This drops the "const" specifier from the opaque object parameters to
various functions in our API.

This effectively reverts #19292 and more.

Why drop this? Our public APIs should not leak too much information
about how stuff is implemented internally. In our public APIs we
shouldn't give too many guarantees we don#t want to necessarily keep.
Specifically: in many cases it makes sense that getters actually
generate/parse/allocate data on the fly, storing/caching the result
internally, to speed things up, do things lazily or to track memory
allocations so that they can be freed later. Doing this means we need to
change the objects, even though the getters are semantically a read
operation.

We want to retain the freedom that we can change things around
internally. By exposing the objects as "const" we remove a good chunk of
that, for little gain.

See sd_bus_creds_get_description() for a real example of a getter that
implicitly caches and thus modifies the relevant object.

This removes the "const" decorators from sd-dhcp and sd-netlink, two
APIs that we intend to make public eventually even though they still are
not, leaving us the chance to still fix this before it becomes set in
stone.
This commit is contained in:
Lennart Poettering 2021-05-11 17:08:00 +02:00 committed by Yu Watanabe
parent 5c2e595767
commit 041ea9f9bb
11 changed files with 144 additions and 144 deletions

View File

@ -27,5 +27,5 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
/* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */ /* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size); int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
int dhcp_lease_save(const sd_dhcp_lease *lease, const char *lease_file); int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file); int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);

View File

@ -2052,7 +2052,7 @@ int sd_dhcp_client_send_renew(sd_dhcp_client *client) {
return client_initialize_time_events(client); return client_initialize_time_events(client);
} }
int sd_dhcp_client_is_running(const sd_dhcp_client *client) { int sd_dhcp_client_is_running(sd_dhcp_client *client) {
if (!client) if (!client)
return 0; return 0;

View File

@ -31,7 +31,7 @@
#include "tmpfile-util.h" #include "tmpfile-util.h"
#include "unaligned.h" #include "unaligned.h"
int sd_dhcp_lease_get_address(const sd_dhcp_lease *lease, struct in_addr *addr) { int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -42,7 +42,7 @@ int sd_dhcp_lease_get_address(const sd_dhcp_lease *lease, struct in_addr *addr)
return 0; return 0;
} }
int sd_dhcp_lease_get_broadcast(const sd_dhcp_lease *lease, struct in_addr *addr) { int sd_dhcp_lease_get_broadcast(sd_dhcp_lease *lease, struct in_addr *addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -53,7 +53,7 @@ int sd_dhcp_lease_get_broadcast(const sd_dhcp_lease *lease, struct in_addr *addr
return 0; return 0;
} }
int sd_dhcp_lease_get_lifetime(const sd_dhcp_lease *lease, uint32_t *lifetime) { int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(lifetime, -EINVAL); assert_return(lifetime, -EINVAL);
@ -64,7 +64,7 @@ int sd_dhcp_lease_get_lifetime(const sd_dhcp_lease *lease, uint32_t *lifetime) {
return 0; return 0;
} }
int sd_dhcp_lease_get_t1(const sd_dhcp_lease *lease, uint32_t *t1) { int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(t1, -EINVAL); assert_return(t1, -EINVAL);
@ -75,7 +75,7 @@ int sd_dhcp_lease_get_t1(const sd_dhcp_lease *lease, uint32_t *t1) {
return 0; return 0;
} }
int sd_dhcp_lease_get_t2(const sd_dhcp_lease *lease, uint32_t *t2) { int sd_dhcp_lease_get_t2(sd_dhcp_lease *lease, uint32_t *t2) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(t2, -EINVAL); assert_return(t2, -EINVAL);
@ -86,7 +86,7 @@ int sd_dhcp_lease_get_t2(const sd_dhcp_lease *lease, uint32_t *t2) {
return 0; return 0;
} }
int sd_dhcp_lease_get_mtu(const sd_dhcp_lease *lease, uint16_t *mtu) { int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(mtu, -EINVAL); assert_return(mtu, -EINVAL);
@ -98,7 +98,7 @@ int sd_dhcp_lease_get_mtu(const sd_dhcp_lease *lease, uint16_t *mtu) {
} }
int sd_dhcp_lease_get_servers( int sd_dhcp_lease_get_servers(
const sd_dhcp_lease *lease, sd_dhcp_lease *lease,
sd_dhcp_lease_server_type_t what, sd_dhcp_lease_server_type_t what,
const struct in_addr **addr) { const struct in_addr **addr) {
@ -114,26 +114,26 @@ int sd_dhcp_lease_get_servers(
return (int) lease->servers[what].size; return (int) lease->servers[what].size;
} }
int sd_dhcp_lease_get_dns(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_DNS, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_DNS, addr);
} }
int sd_dhcp_lease_get_ntp(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_NTP, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_NTP, addr);
} }
int sd_dhcp_lease_get_sip(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SIP, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SIP, addr);
} }
int sd_dhcp_lease_get_pop3(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_pop3(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_POP3, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_POP3, addr);
} }
int sd_dhcp_lease_get_smtp(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_smtp(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SMTP, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SMTP, addr);
} }
int sd_dhcp_lease_get_lpr(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_lpr(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_LPR, addr); return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_LPR, addr);
} }
int sd_dhcp_lease_get_domainname(const sd_dhcp_lease *lease, const char **domainname) { int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(domainname, -EINVAL); assert_return(domainname, -EINVAL);
@ -144,7 +144,7 @@ int sd_dhcp_lease_get_domainname(const sd_dhcp_lease *lease, const char **domain
return 0; return 0;
} }
int sd_dhcp_lease_get_hostname(const sd_dhcp_lease *lease, const char **hostname) { int sd_dhcp_lease_get_hostname(sd_dhcp_lease *lease, const char **hostname) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(hostname, -EINVAL); assert_return(hostname, -EINVAL);
@ -155,7 +155,7 @@ int sd_dhcp_lease_get_hostname(const sd_dhcp_lease *lease, const char **hostname
return 0; return 0;
} }
int sd_dhcp_lease_get_root_path(const sd_dhcp_lease *lease, const char **root_path) { int sd_dhcp_lease_get_root_path(sd_dhcp_lease *lease, const char **root_path) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(root_path, -EINVAL); assert_return(root_path, -EINVAL);
@ -166,7 +166,7 @@ int sd_dhcp_lease_get_root_path(const sd_dhcp_lease *lease, const char **root_pa
return 0; return 0;
} }
int sd_dhcp_lease_get_router(const sd_dhcp_lease *lease, const struct in_addr **addr) { int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -177,7 +177,7 @@ int sd_dhcp_lease_get_router(const sd_dhcp_lease *lease, const struct in_addr **
return (int) lease->router_size; return (int) lease->router_size;
} }
int sd_dhcp_lease_get_netmask(const sd_dhcp_lease *lease, struct in_addr *addr) { int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -188,7 +188,7 @@ int sd_dhcp_lease_get_netmask(const sd_dhcp_lease *lease, struct in_addr *addr)
return 0; return 0;
} }
int sd_dhcp_lease_get_server_identifier(const sd_dhcp_lease *lease, struct in_addr *addr) { int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -199,7 +199,7 @@ int sd_dhcp_lease_get_server_identifier(const sd_dhcp_lease *lease, struct in_ad
return 0; return 0;
} }
int sd_dhcp_lease_get_next_server(const sd_dhcp_lease *lease, struct in_addr *addr) { int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL); assert_return(addr, -EINVAL);
@ -214,7 +214,7 @@ int sd_dhcp_lease_get_next_server(const sd_dhcp_lease *lease, struct in_addr *ad
* The returned routes array must be freed by the caller. * The returned routes array must be freed by the caller.
* Route objects have the same lifetime of the lease and must not be freed. * Route objects have the same lifetime of the lease and must not be freed.
*/ */
int sd_dhcp_lease_get_routes(const sd_dhcp_lease *lease, sd_dhcp_route ***routes) { int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, sd_dhcp_route ***routes) {
sd_dhcp_route **ret; sd_dhcp_route **ret;
unsigned i; unsigned i;
@ -235,7 +235,7 @@ int sd_dhcp_lease_get_routes(const sd_dhcp_lease *lease, sd_dhcp_route ***routes
return (int) lease->static_route_size; return (int) lease->static_route_size;
} }
int sd_dhcp_lease_get_search_domains(const sd_dhcp_lease *lease, char ***domains) { int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains) {
size_t r; size_t r;
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
@ -250,7 +250,7 @@ int sd_dhcp_lease_get_search_domains(const sd_dhcp_lease *lease, char ***domains
return -ENODATA; return -ENODATA;
} }
int sd_dhcp_lease_get_vendor_specific(const sd_dhcp_lease *lease, const void **data, size_t *data_len) { int sd_dhcp_lease_get_vendor_specific(sd_dhcp_lease *lease, const void **data, size_t *data_len) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(data, -EINVAL); assert_return(data, -EINVAL);
assert_return(data_len, -EINVAL); assert_return(data_len, -EINVAL);
@ -868,7 +868,7 @@ int dhcp_lease_new(sd_dhcp_lease **ret) {
return 0; return 0;
} }
int dhcp_lease_save(const sd_dhcp_lease *lease, const char *lease_file) { int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
_cleanup_(unlink_and_freep) char *temp_path = NULL; _cleanup_(unlink_and_freep) char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL; _cleanup_fclose_ FILE *f = NULL;
struct sd_dhcp_raw_option *option; struct sd_dhcp_raw_option *option;
@ -1313,7 +1313,7 @@ int dhcp_lease_set_default_subnet_mask(sd_dhcp_lease *lease) {
return 0; return 0;
} }
int sd_dhcp_lease_get_client_id(const sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len) { int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(client_id, -EINVAL); assert_return(client_id, -EINVAL);
assert_return(client_id_len, -EINVAL); assert_return(client_id_len, -EINVAL);
@ -1348,7 +1348,7 @@ int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const void *client_id, size_t
return 0; return 0;
} }
int sd_dhcp_lease_get_timezone(const sd_dhcp_lease *lease, const char **tz) { int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **tz) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(tz, -EINVAL); assert_return(tz, -EINVAL);
@ -1359,7 +1359,7 @@ int sd_dhcp_lease_get_timezone(const sd_dhcp_lease *lease, const char **tz) {
return 0; return 0;
} }
int sd_dhcp_route_get_destination(const sd_dhcp_route *route, struct in_addr *destination) { int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination) {
assert_return(route, -EINVAL); assert_return(route, -EINVAL);
assert_return(destination, -EINVAL); assert_return(destination, -EINVAL);
@ -1367,7 +1367,7 @@ int sd_dhcp_route_get_destination(const sd_dhcp_route *route, struct in_addr *de
return 0; return 0;
} }
int sd_dhcp_route_get_destination_prefix_length(const sd_dhcp_route *route, uint8_t *length) { int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length) {
assert_return(route, -EINVAL); assert_return(route, -EINVAL);
assert_return(length, -EINVAL); assert_return(length, -EINVAL);
@ -1375,7 +1375,7 @@ int sd_dhcp_route_get_destination_prefix_length(const sd_dhcp_route *route, uint
return 0; return 0;
} }
int sd_dhcp_route_get_gateway(const sd_dhcp_route *route, struct in_addr *gateway) { int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway) {
assert_return(route, -EINVAL); assert_return(route, -EINVAL);
assert_return(gateway, -EINVAL); assert_return(gateway, -EINVAL);
@ -1383,7 +1383,7 @@ int sd_dhcp_route_get_gateway(const sd_dhcp_route *route, struct in_addr *gatewa
return 0; return 0;
} }
int sd_dhcp_route_get_option(const sd_dhcp_route *route) { int sd_dhcp_route_get_option(sd_dhcp_route *route) {
assert_return(route, -EINVAL); assert_return(route, -EINVAL);
return route->option; return route->option;

View File

@ -152,7 +152,7 @@ int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_famil
return 0; return 0;
} }
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family) { int sd_genl_message_get_family(sd_netlink *nl, sd_netlink_message *m, sd_genl_family_t *family) {
uint16_t type; uint16_t type;
int r; int r;

View File

@ -114,7 +114,7 @@ sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m) {
return NULL; return NULL;
} }
int sd_netlink_message_get_type(const sd_netlink_message *m, uint16_t *type) { int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type) {
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
assert_return(type, -EINVAL); assert_return(type, -EINVAL);
@ -132,7 +132,7 @@ int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags) {
return 0; return 0;
} }
int sd_netlink_message_is_broadcast(const sd_netlink_message *m) { int sd_netlink_message_is_broadcast(sd_netlink_message *m) {
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
return m->broadcast; return m->broadcast;
@ -1235,14 +1235,14 @@ uint32_t rtnl_message_get_serial(sd_netlink_message *m) {
return m->hdr->nlmsg_seq; return m->hdr->nlmsg_seq;
} }
int sd_netlink_message_is_error(const sd_netlink_message *m) { int sd_netlink_message_is_error(sd_netlink_message *m) {
assert_return(m, 0); assert_return(m, 0);
assert_return(m->hdr, 0); assert_return(m->hdr, 0);
return m->hdr->nlmsg_type == NLMSG_ERROR; return m->hdr->nlmsg_type == NLMSG_ERROR;
} }
int sd_netlink_message_get_errno(const sd_netlink_message *m) { int sd_netlink_message_get_errno(sd_netlink_message *m) {
struct nlmsgerr *err; struct nlmsgerr *err;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);

View File

@ -142,7 +142,7 @@ void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata) {
return ret; return ret;
} }
int sd_netlink_slot_get_destroy_callback(const sd_netlink_slot *slot, sd_netlink_destroy_t *callback) { int sd_netlink_slot_get_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t *callback) {
assert_return(slot, -EINVAL); assert_return(slot, -EINVAL);
if (callback) if (callback)
@ -158,7 +158,7 @@ int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destr
return 0; return 0;
} }
int sd_netlink_slot_get_floating(const sd_netlink_slot *slot) { int sd_netlink_slot_get_floating(sd_netlink_slot *slot) {
assert_return(slot, -EINVAL); assert_return(slot, -EINVAL);
return slot->floating; return slot->floating;
@ -186,7 +186,7 @@ int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b) {
return 1; return 1;
} }
int sd_netlink_slot_get_description(const sd_netlink_slot *slot, const char **description) { int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description) {
assert_return(slot, -EINVAL); assert_return(slot, -EINVAL);
if (description) if (description)

View File

@ -81,7 +81,7 @@ int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags) {
return 0; return 0;
} }
int sd_rtnl_message_route_get_flags(const sd_netlink_message *m, unsigned *flags) { int sd_rtnl_message_route_get_flags(sd_netlink_message *m, unsigned *flags) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -110,7 +110,7 @@ int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table)
return 0; return 0;
} }
int sd_rtnl_message_route_get_family(const sd_netlink_message *m, int *family) { int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -125,7 +125,7 @@ int sd_rtnl_message_route_get_family(const sd_netlink_message *m, int *family) {
return 0; return 0;
} }
int sd_rtnl_message_route_get_type(const sd_netlink_message *m, unsigned char *type) { int sd_rtnl_message_route_get_type(sd_netlink_message *m, unsigned char *type) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -154,7 +154,7 @@ int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type) {
return 0; return 0;
} }
int sd_rtnl_message_route_get_protocol(const sd_netlink_message *m, unsigned char *protocol) { int sd_rtnl_message_route_get_protocol(sd_netlink_message *m, unsigned char *protocol) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -169,7 +169,7 @@ int sd_rtnl_message_route_get_protocol(const sd_netlink_message *m, unsigned cha
return 0; return 0;
} }
int sd_rtnl_message_route_get_scope(const sd_netlink_message *m, unsigned char *scope) { int sd_rtnl_message_route_get_scope(sd_netlink_message *m, unsigned char *scope) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -184,7 +184,7 @@ int sd_rtnl_message_route_get_scope(const sd_netlink_message *m, unsigned char *
return 0; return 0;
} }
int sd_rtnl_message_route_get_tos(const sd_netlink_message *m, uint8_t *tos) { int sd_rtnl_message_route_get_tos(sd_netlink_message *m, uint8_t *tos) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -199,7 +199,7 @@ int sd_rtnl_message_route_get_tos(const sd_netlink_message *m, uint8_t *tos) {
return 0; return 0;
} }
int sd_rtnl_message_route_get_table(const sd_netlink_message *m, unsigned char *table) { int sd_rtnl_message_route_get_table(sd_netlink_message *m, unsigned char *table) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -214,7 +214,7 @@ int sd_rtnl_message_route_get_table(const sd_netlink_message *m, unsigned char *
return 0; return 0;
} }
int sd_rtnl_message_route_get_dst_prefixlen(const sd_netlink_message *m, unsigned char *dst_len) { int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -229,7 +229,7 @@ int sd_rtnl_message_route_get_dst_prefixlen(const sd_netlink_message *m, unsigne
return 0; return 0;
} }
int sd_rtnl_message_route_get_src_prefixlen(const sd_netlink_message *m, unsigned char *src_len) { int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len) {
struct rtmsg *rtm; struct rtmsg *rtm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -324,7 +324,7 @@ int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags) {
return 0; return 0;
} }
int sd_rtnl_message_nexthop_get_family(const sd_netlink_message *m, uint8_t *family) { int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family) {
struct nhmsg *nhm; struct nhmsg *nhm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -338,7 +338,7 @@ int sd_rtnl_message_nexthop_get_family(const sd_netlink_message *m, uint8_t *fam
return 0; return 0;
} }
int sd_rtnl_message_nexthop_get_protocol(const sd_netlink_message *m, uint8_t *protocol) { int sd_rtnl_message_nexthop_get_protocol(sd_netlink_message *m, uint8_t *protocol) {
struct nhmsg *nhm; struct nhmsg *nhm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -378,7 +378,7 @@ int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state) {
return 0; return 0;
} }
int sd_rtnl_message_neigh_get_flags(const sd_netlink_message *m, uint8_t *flags) { int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags) {
struct ndmsg *ndm; struct ndmsg *ndm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -391,7 +391,7 @@ int sd_rtnl_message_neigh_get_flags(const sd_netlink_message *m, uint8_t *flags)
return 0; return 0;
} }
int sd_rtnl_message_neigh_get_state(const sd_netlink_message *m, uint16_t *state) { int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state) {
struct ndmsg *ndm; struct ndmsg *ndm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -404,7 +404,7 @@ int sd_rtnl_message_neigh_get_state(const sd_netlink_message *m, uint16_t *state
return 0; return 0;
} }
int sd_rtnl_message_neigh_get_family(const sd_netlink_message *m, int *family) { int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family) {
struct ndmsg *ndm; struct ndmsg *ndm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -419,7 +419,7 @@ int sd_rtnl_message_neigh_get_family(const sd_netlink_message *m, int *family) {
return 0; return 0;
} }
int sd_rtnl_message_neigh_get_ifindex(const sd_netlink_message *m, int *index) { int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *index) {
struct ndmsg *ndm; struct ndmsg *ndm;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -572,7 +572,7 @@ int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope) {
return 0; return 0;
} }
int sd_rtnl_message_addr_get_family(const sd_netlink_message *m, int *family) { int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family) {
struct ifaddrmsg *ifa; struct ifaddrmsg *ifa;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -587,7 +587,7 @@ int sd_rtnl_message_addr_get_family(const sd_netlink_message *m, int *family) {
return 0; return 0;
} }
int sd_rtnl_message_addr_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen) { int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen) {
struct ifaddrmsg *ifa; struct ifaddrmsg *ifa;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -602,7 +602,7 @@ int sd_rtnl_message_addr_get_prefixlen(const sd_netlink_message *m, unsigned cha
return 0; return 0;
} }
int sd_rtnl_message_addr_get_scope(const sd_netlink_message *m, unsigned char *scope) { int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope) {
struct ifaddrmsg *ifa; struct ifaddrmsg *ifa;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -617,7 +617,7 @@ int sd_rtnl_message_addr_get_scope(const sd_netlink_message *m, unsigned char *s
return 0; return 0;
} }
int sd_rtnl_message_addr_get_flags(const sd_netlink_message *m, unsigned char *flags) { int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags) {
struct ifaddrmsg *ifa; struct ifaddrmsg *ifa;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -632,7 +632,7 @@ int sd_rtnl_message_addr_get_flags(const sd_netlink_message *m, unsigned char *f
return 0; return 0;
} }
int sd_rtnl_message_addr_get_ifindex(const sd_netlink_message *m, int *ifindex) { int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex) {
struct ifaddrmsg *ifa; struct ifaddrmsg *ifa;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -692,7 +692,7 @@ int sd_rtnl_message_new_addr_update(sd_netlink *rtnl, sd_netlink_message **ret,
return 0; return 0;
} }
int sd_rtnl_message_link_get_ifindex(const sd_netlink_message *m, int *ifindex) { int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex) {
struct ifinfomsg *ifi; struct ifinfomsg *ifi;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -707,7 +707,7 @@ int sd_rtnl_message_link_get_ifindex(const sd_netlink_message *m, int *ifindex)
return 0; return 0;
} }
int sd_rtnl_message_link_get_flags(const sd_netlink_message *m, unsigned *flags) { int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags) {
struct ifinfomsg *ifi; struct ifinfomsg *ifi;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -722,7 +722,7 @@ int sd_rtnl_message_link_get_flags(const sd_netlink_message *m, unsigned *flags)
return 0; return 0;
} }
int sd_rtnl_message_link_get_type(const sd_netlink_message *m, unsigned short *type) { int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type) {
struct ifinfomsg *ifi; struct ifinfomsg *ifi;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -737,7 +737,7 @@ int sd_rtnl_message_link_get_type(const sd_netlink_message *m, unsigned short *t
return 0; return 0;
} }
int sd_rtnl_message_get_family(const sd_netlink_message *m, int *family) { int sd_rtnl_message_get_family(sd_netlink_message *m, int *family) {
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
assert_return(family, -EINVAL); assert_return(family, -EINVAL);
@ -835,7 +835,7 @@ int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char
return 0; return 0;
} }
int sd_rtnl_message_addrlabel_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen) { int sd_rtnl_message_addrlabel_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen) {
struct ifaddrlblmsg *addrlabel; struct ifaddrlblmsg *addrlabel;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -884,7 +884,7 @@ int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, uint8_t t
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_tos(const sd_netlink_message *m, uint8_t *tos) { int sd_rtnl_message_routing_policy_rule_get_tos(sd_netlink_message *m, uint8_t *tos) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -912,7 +912,7 @@ int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, uint8_t
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_table(const sd_netlink_message *m, uint8_t *table) { int sd_rtnl_message_routing_policy_rule_get_table(sd_netlink_message *m, uint8_t *table) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -939,7 +939,7 @@ int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, uint32_
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_flags(const sd_netlink_message *m, uint32_t *flags) { int sd_rtnl_message_routing_policy_rule_get_flags(sd_netlink_message *m, uint32_t *flags) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -966,7 +966,7 @@ int sd_rtnl_message_routing_policy_rule_set_fib_type(sd_netlink_message *m, uint
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_fib_type(const sd_netlink_message *m, uint8_t *type) { int sd_rtnl_message_routing_policy_rule_get_fib_type(sd_netlink_message *m, uint8_t *type) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -994,7 +994,7 @@ int sd_rtnl_message_routing_policy_rule_set_fib_dst_prefixlen(sd_netlink_message
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_fib_dst_prefixlen(const sd_netlink_message *m, uint8_t *len) { int sd_rtnl_message_routing_policy_rule_get_fib_dst_prefixlen(sd_netlink_message *m, uint8_t *len) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
@ -1022,7 +1022,7 @@ int sd_rtnl_message_routing_policy_rule_set_fib_src_prefixlen(sd_netlink_message
return 0; return 0;
} }
int sd_rtnl_message_routing_policy_rule_get_fib_src_prefixlen(const sd_netlink_message *m, uint8_t *len) { int sd_rtnl_message_routing_policy_rule_get_fib_src_prefixlen(sd_netlink_message *m, uint8_t *len) {
struct fib_rule_hdr *frh; struct fib_rule_hdr *frh;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);

View File

@ -742,7 +742,7 @@ int sd_netlink_call(sd_netlink *rtnl,
return sd_netlink_read(rtnl, serial, usec, ret); return sd_netlink_read(rtnl, serial, usec, ret);
} }
int sd_netlink_get_events(const sd_netlink *rtnl) { int sd_netlink_get_events(sd_netlink *rtnl) {
assert_return(rtnl, -EINVAL); assert_return(rtnl, -EINVAL);
assert_return(!rtnl_pid_changed(rtnl), -ECHILD); assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
@ -752,7 +752,7 @@ int sd_netlink_get_events(const sd_netlink *rtnl) {
return 0; return 0;
} }
int sd_netlink_get_timeout(const sd_netlink *rtnl, uint64_t *timeout_usec) { int sd_netlink_get_timeout(sd_netlink *rtnl, uint64_t *timeout_usec) {
struct reply_callback *c; struct reply_callback *c;
assert_return(rtnl, -EINVAL); assert_return(rtnl, -EINVAL);

View File

@ -206,7 +206,7 @@ int sd_dhcp_client_set_fallback_lease_lifetime(
int sd_dhcp_client_add_option(sd_dhcp_client *client, sd_dhcp_option *v); int sd_dhcp_client_add_option(sd_dhcp_client *client, sd_dhcp_option *v);
int sd_dhcp_client_add_vendor_option(sd_dhcp_client *client, sd_dhcp_option *v); int sd_dhcp_client_add_vendor_option(sd_dhcp_client *client, sd_dhcp_option *v);
int sd_dhcp_client_is_running(const sd_dhcp_client *client); int sd_dhcp_client_is_running(sd_dhcp_client *client);
int sd_dhcp_client_stop(sd_dhcp_client *client); int sd_dhcp_client_stop(sd_dhcp_client *client);
int sd_dhcp_client_start(sd_dhcp_client *client); int sd_dhcp_client_start(sd_dhcp_client *client);
int sd_dhcp_client_send_release(sd_dhcp_client *client); int sd_dhcp_client_send_release(sd_dhcp_client *client);

View File

@ -46,36 +46,36 @@ typedef enum sd_dhcp_lease_server_type_t {
_SD_ENUM_FORCE_S64(DHCP_LEASE_SERVER_TYPE), _SD_ENUM_FORCE_S64(DHCP_LEASE_SERVER_TYPE),
} sd_dhcp_lease_server_type_t; } sd_dhcp_lease_server_type_t;
int sd_dhcp_lease_get_address(const sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_lifetime(const sd_dhcp_lease *lease, uint32_t *lifetime); int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime);
int sd_dhcp_lease_get_t1(const sd_dhcp_lease *lease, uint32_t *t1); int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1);
int sd_dhcp_lease_get_t2(const sd_dhcp_lease *lease, uint32_t *t2); int sd_dhcp_lease_get_t2(sd_dhcp_lease *lease, uint32_t *t2);
int sd_dhcp_lease_get_broadcast(const sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_broadcast(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_netmask(const sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_router(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_next_server(const sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_server_identifier(const sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_servers(const sd_dhcp_lease *lease, sd_dhcp_lease_server_type_t what, const struct in_addr **addr); int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type_t what, const struct in_addr **addr);
int sd_dhcp_lease_get_dns(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_ntp(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_sip(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_pop3(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_pop3(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_smtp(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_smtp(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_lpr(const sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_lpr(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_mtu(const sd_dhcp_lease *lease, uint16_t *mtu); int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu);
int sd_dhcp_lease_get_domainname(const sd_dhcp_lease *lease, const char **domainname); int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname);
int sd_dhcp_lease_get_search_domains(const sd_dhcp_lease *lease, char ***domains); int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains);
int sd_dhcp_lease_get_hostname(const sd_dhcp_lease *lease, const char **hostname); int sd_dhcp_lease_get_hostname(sd_dhcp_lease *lease, const char **hostname);
int sd_dhcp_lease_get_root_path(const sd_dhcp_lease *lease, const char **root_path); int sd_dhcp_lease_get_root_path(sd_dhcp_lease *lease, const char **root_path);
int sd_dhcp_lease_get_routes(const sd_dhcp_lease *lease, sd_dhcp_route ***routes); int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, sd_dhcp_route ***routes);
int sd_dhcp_lease_get_vendor_specific(const sd_dhcp_lease *lease, const void **data, size_t *data_len); int sd_dhcp_lease_get_vendor_specific(sd_dhcp_lease *lease, const void **data, size_t *data_len);
int sd_dhcp_lease_get_client_id(const sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len); int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len);
int sd_dhcp_lease_get_timezone(const sd_dhcp_lease *lease, const char **timezone); int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone);
int sd_dhcp_route_get_destination(const sd_dhcp_route *route, struct in_addr *destination); int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination);
int sd_dhcp_route_get_destination_prefix_length(const sd_dhcp_route *route, uint8_t *length); int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length);
int sd_dhcp_route_get_gateway(const sd_dhcp_route *route, struct in_addr *gateway); int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway);
int sd_dhcp_route_get_option(const sd_dhcp_route *route); int sd_dhcp_route_get_option(sd_dhcp_route *route);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);

View File

@ -73,8 +73,8 @@ int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeou
sd_netlink_message **reply); sd_netlink_message **reply);
int sd_netlink_read(sd_netlink *nl, uint32_t serial, uint64_t timeout, sd_netlink_message **reply); int sd_netlink_read(sd_netlink *nl, uint32_t serial, uint64_t timeout, sd_netlink_message **reply);
int sd_netlink_get_events(const sd_netlink *nl); int sd_netlink_get_events(sd_netlink *nl);
int sd_netlink_get_timeout(const sd_netlink *nl, uint64_t *timeout); int sd_netlink_get_timeout(sd_netlink *nl, uint64_t *timeout);
int sd_netlink_process(sd_netlink *nl, sd_netlink_message **ret); int sd_netlink_process(sd_netlink *nl, sd_netlink_message **ret);
int sd_netlink_wait(sd_netlink *nl, uint64_t timeout); int sd_netlink_wait(sd_netlink *nl, uint64_t timeout);
@ -137,33 +137,33 @@ sd_netlink_message *sd_netlink_message_ref(sd_netlink_message *m);
sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m); sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m);
int sd_netlink_message_request_dump(sd_netlink_message *m, int dump); int sd_netlink_message_request_dump(sd_netlink_message *m, int dump);
int sd_netlink_message_is_error(const sd_netlink_message *m); int sd_netlink_message_is_error(sd_netlink_message *m);
int sd_netlink_message_get_errno(const sd_netlink_message *m); int sd_netlink_message_get_errno(sd_netlink_message *m);
int sd_netlink_message_get_type(const sd_netlink_message *m, uint16_t *type); int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type);
int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags); int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags);
int sd_netlink_message_is_broadcast(const sd_netlink_message *m); int sd_netlink_message_is_broadcast(sd_netlink_message *m);
/* rtnl */ /* rtnl */
int sd_rtnl_message_get_family(const sd_netlink_message *m, int *family); int sd_rtnl_message_get_family(sd_netlink_message *m, int *family);
int sd_rtnl_message_new_addr(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int family); int sd_rtnl_message_new_addr(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int family);
int sd_rtnl_message_new_addr_update(sd_netlink *nl, sd_netlink_message **ret, int index, int family); int sd_rtnl_message_new_addr_update(sd_netlink *nl, sd_netlink_message **ret, int index, int family);
int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen); int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope); int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope);
int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags); int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags);
int sd_rtnl_message_addr_get_family(const sd_netlink_message *m, int *family); int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family);
int sd_rtnl_message_addr_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen); int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen);
int sd_rtnl_message_addr_get_scope(const sd_netlink_message *m, unsigned char *scope); int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope);
int sd_rtnl_message_addr_get_flags(const sd_netlink_message *m, unsigned char *flags); int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags);
int sd_rtnl_message_addr_get_ifindex(const sd_netlink_message *m, int *ifindex); int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex);
int sd_rtnl_message_new_link(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index); int sd_rtnl_message_new_link(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index);
int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change); int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change);
int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type); int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type);
int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family); int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family);
int sd_rtnl_message_link_get_ifindex(const sd_netlink_message *m, int *ifindex); int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex);
int sd_rtnl_message_link_get_flags(const sd_netlink_message *m, unsigned *flags); int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags);
int sd_rtnl_message_link_get_type(const sd_netlink_message *m, unsigned short *type); int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type);
int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol); int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol);
int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen); int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
@ -172,46 +172,46 @@ int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope);
int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags); int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags);
int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table); int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table);
int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type); int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type);
int sd_rtnl_message_route_get_flags(const sd_netlink_message *m, unsigned *flags); int sd_rtnl_message_route_get_flags(sd_netlink_message *m, unsigned *flags);
int sd_rtnl_message_route_get_family(const sd_netlink_message *m, int *family); int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family);
int sd_rtnl_message_route_get_protocol(const sd_netlink_message *m, unsigned char *protocol); int sd_rtnl_message_route_get_protocol(sd_netlink_message *m, unsigned char *protocol);
int sd_rtnl_message_route_get_scope(const sd_netlink_message *m, unsigned char *scope); int sd_rtnl_message_route_get_scope(sd_netlink_message *m, unsigned char *scope);
int sd_rtnl_message_route_get_tos(const sd_netlink_message *m, unsigned char *tos); int sd_rtnl_message_route_get_tos(sd_netlink_message *m, unsigned char *tos);
int sd_rtnl_message_route_get_table(const sd_netlink_message *m, unsigned char *table); int sd_rtnl_message_route_get_table(sd_netlink_message *m, unsigned char *table);
int sd_rtnl_message_route_get_dst_prefixlen(const sd_netlink_message *m, unsigned char *dst_len); int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len);
int sd_rtnl_message_route_get_src_prefixlen(const sd_netlink_message *m, unsigned char *src_len); int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len);
int sd_rtnl_message_route_get_type(const sd_netlink_message *m, unsigned char *type); int sd_rtnl_message_route_get_type(sd_netlink_message *m, unsigned char *type);
int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nhmsg_type, int nh_family, unsigned char nh_protocol); int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nhmsg_type, int nh_family, unsigned char nh_protocol);
int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags); int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags);
int sd_rtnl_message_nexthop_get_family(const sd_netlink_message *m, uint8_t *family); int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family);
int sd_rtnl_message_nexthop_get_protocol(const sd_netlink_message *m, uint8_t *protocol); int sd_rtnl_message_nexthop_get_protocol(sd_netlink_message *m, uint8_t *protocol);
int sd_rtnl_message_new_neigh(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int nda_family); int sd_rtnl_message_new_neigh(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int nda_family);
int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags); int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags);
int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state); int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state);
int sd_rtnl_message_neigh_get_family(const sd_netlink_message *m, int *family); int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family);
int sd_rtnl_message_neigh_get_ifindex(const sd_netlink_message *m, int *index); int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *index);
int sd_rtnl_message_neigh_get_state(const sd_netlink_message *m, uint16_t *state); int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state);
int sd_rtnl_message_neigh_get_flags(const sd_netlink_message *m, uint8_t *flags); int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags);
int sd_rtnl_message_new_addrlabel(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifindex, int ifal_family); int sd_rtnl_message_new_addrlabel(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifindex, int ifal_family);
int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen); int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
int sd_rtnl_message_addrlabel_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen); int sd_rtnl_message_addrlabel_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen);
int sd_rtnl_message_new_routing_policy_rule(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifal_family); int sd_rtnl_message_new_routing_policy_rule(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifal_family);
int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, uint8_t tos); int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, uint8_t tos);
int sd_rtnl_message_routing_policy_rule_get_tos(const sd_netlink_message *m, uint8_t *tos); int sd_rtnl_message_routing_policy_rule_get_tos(sd_netlink_message *m, uint8_t *tos);
int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, uint8_t table); int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, uint8_t table);
int sd_rtnl_message_routing_policy_rule_get_table(const sd_netlink_message *m, uint8_t *table); int sd_rtnl_message_routing_policy_rule_get_table(sd_netlink_message *m, uint8_t *table);
int sd_rtnl_message_routing_policy_rule_set_fib_src_prefixlen(sd_netlink_message *m, uint8_t len); int sd_rtnl_message_routing_policy_rule_set_fib_src_prefixlen(sd_netlink_message *m, uint8_t len);
int sd_rtnl_message_routing_policy_rule_get_fib_src_prefixlen(const sd_netlink_message *m, uint8_t *len); int sd_rtnl_message_routing_policy_rule_get_fib_src_prefixlen(sd_netlink_message *m, uint8_t *len);
int sd_rtnl_message_routing_policy_rule_set_fib_dst_prefixlen(sd_netlink_message *m, uint8_t len); int sd_rtnl_message_routing_policy_rule_set_fib_dst_prefixlen(sd_netlink_message *m, uint8_t len);
int sd_rtnl_message_routing_policy_rule_get_fib_dst_prefixlen(const sd_netlink_message *m, uint8_t *len); int sd_rtnl_message_routing_policy_rule_get_fib_dst_prefixlen(sd_netlink_message *m, uint8_t *len);
int sd_rtnl_message_routing_policy_rule_set_fib_type(sd_netlink_message *m, uint8_t type); int sd_rtnl_message_routing_policy_rule_set_fib_type(sd_netlink_message *m, uint8_t type);
int sd_rtnl_message_routing_policy_rule_get_fib_type(const sd_netlink_message *m, uint8_t *type); int sd_rtnl_message_routing_policy_rule_get_fib_type(sd_netlink_message *m, uint8_t *type);
int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, uint32_t flags); int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, uint32_t flags);
int sd_rtnl_message_routing_policy_rule_get_flags(const sd_netlink_message *m, uint32_t *flags); int sd_rtnl_message_routing_policy_rule_get_flags(sd_netlink_message *m, uint32_t *flags);
int sd_rtnl_message_new_qdisc(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int tcm_family, int tcm_ifindex); int sd_rtnl_message_new_qdisc(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int tcm_family, int tcm_ifindex);
int sd_rtnl_message_set_qdisc_parent(sd_netlink_message *m, uint32_t parent); int sd_rtnl_message_set_qdisc_parent(sd_netlink_message *m, uint32_t parent);
@ -252,7 +252,7 @@ int sd_nfnl_nft_message_add_setelem_end(sd_netlink_message *m);
/* genl */ /* genl */
int sd_genl_socket_open(sd_netlink **nl); int sd_genl_socket_open(sd_netlink **nl);
int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **m); int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **m);
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family); int sd_genl_message_get_family(sd_netlink *nl, sd_netlink_message *m, sd_genl_family_t *family);
/* slot */ /* slot */
sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl); sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl);
@ -261,11 +261,11 @@ sd_netlink_slot *sd_netlink_slot_unref(sd_netlink_slot *nl);
sd_netlink *sd_netlink_slot_get_netlink(sd_netlink_slot *slot); sd_netlink *sd_netlink_slot_get_netlink(sd_netlink_slot *slot);
void *sd_netlink_slot_get_userdata(sd_netlink_slot *slot); void *sd_netlink_slot_get_userdata(sd_netlink_slot *slot);
void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata); void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata);
int sd_netlink_slot_get_destroy_callback(const sd_netlink_slot *slot, sd_netlink_destroy_t *callback); int sd_netlink_slot_get_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t *callback);
int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t callback); int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t callback);
int sd_netlink_slot_get_floating(const sd_netlink_slot *slot); int sd_netlink_slot_get_floating(sd_netlink_slot *slot);
int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b); int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b);
int sd_netlink_slot_get_description(const sd_netlink_slot *slot, const char **description); int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description);
int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description); int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref);