mirror of
https://github.com/systemd/systemd.git
synced 2025-01-06 17:18:12 +03:00
util: introduce bus_message_read_ifindex()
This commit is contained in:
parent
10d4620467
commit
3dd95ab6c5
@ -4,6 +4,26 @@
|
||||
|
||||
#include "resolve-util.h"
|
||||
|
||||
int bus_message_read_ifindex(sd_bus_message *message, sd_bus_error *error, int *ret) {
|
||||
int ifindex, r;
|
||||
|
||||
assert(message);
|
||||
assert(ret);
|
||||
|
||||
assert_cc(sizeof(int) == sizeof(int32_t));
|
||||
|
||||
r = sd_bus_message_read(message, "i", &ifindex);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ifindex <= 0)
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid interface index");
|
||||
|
||||
*ret = ifindex;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bus_message_read_family(sd_bus_message *message, sd_bus_error *error, int *ret) {
|
||||
int family, r;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "in-addr-util.h"
|
||||
#include "socket-netlink.h"
|
||||
|
||||
int bus_message_read_ifindex(sd_bus_message *message, sd_bus_error *error, int *ret);
|
||||
int bus_message_read_family(sd_bus_message *message, sd_bus_error *error, int *ret);
|
||||
int bus_message_read_in_addr_auto(sd_bus_message *message, sd_bus_error *error, int *ret_family, union in_addr_union *ret_addr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user