diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-15 16:06:12 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-15 18:10:04 +0900 |
commit | ee38400bbaf04ff093c5450a554d5cc70face217 (patch) | |
tree | 1738883da07e132ee0758ad0bdcb5403c6e9ca80 /src/systemd | |
parent | sd-bus: rename argument (diff) | |
download | systemd-ee38400bbaf04ff093c5450a554d5cc70face217.tar.gz systemd-ee38400bbaf04ff093c5450a554d5cc70face217.tar.bz2 systemd-ee38400bbaf04ff093c5450a554d5cc70face217.zip |
sd-netlink: introduce sd_netlink_slot
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-netlink.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h index 01b33c8fc..357a50352 100644 --- a/src/systemd/sd-netlink.h +++ b/src/systemd/sd-netlink.h @@ -33,6 +33,7 @@ _SD_BEGIN_DECLARATIONS; typedef struct sd_netlink sd_netlink; typedef struct sd_genl_socket sd_genl_socket; typedef struct sd_netlink_message sd_netlink_message; +typedef struct sd_netlink_slot sd_netlink_slot; typedef enum {SD_GENL_ID_CTRL, SD_GENL_WIREGUARD, SD_GENL_FOU} sd_genl_family; /* callback */ @@ -50,11 +51,9 @@ sd_netlink *sd_netlink_ref(sd_netlink *nl); sd_netlink *sd_netlink_unref(sd_netlink *nl); int sd_netlink_send(sd_netlink *nl, sd_netlink_message *message, uint32_t *serial); -int sd_netlink_call_async(sd_netlink *nl, sd_netlink_message *message, - sd_netlink_message_handler_t callback, - sd_netlink_destroy_t destoy_callback, - void *userdata, uint64_t usec, uint32_t *serial); -int sd_netlink_call_async_cancel(sd_netlink *nl, uint32_t serial); +int sd_netlink_call_async(sd_netlink *nl, sd_netlink_slot **ret_slot, sd_netlink_message *message, + sd_netlink_message_handler_t callback, sd_netlink_destroy_t destoy_callback, + void *userdata, uint64_t usec); int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeout, sd_netlink_message **reply); @@ -63,8 +62,9 @@ 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_wait(sd_netlink *nl, uint64_t timeout); -int sd_netlink_add_match(sd_netlink *nl, uint16_t match, sd_netlink_message_handler_t c, void *userdata); -int sd_netlink_remove_match(sd_netlink *nl, uint16_t match, sd_netlink_message_handler_t c, void *userdata); +int sd_netlink_add_match(sd_netlink *nl, sd_netlink_slot **ret_slot, uint16_t match, + sd_netlink_message_handler_t callback, + sd_netlink_destroy_t destroy_callback, void *userdata); int sd_netlink_attach_event(sd_netlink *nl, sd_event *e, int64_t priority); int sd_netlink_detach_event(sd_netlink *nl); @@ -178,13 +178,18 @@ int sd_rtnl_message_routing_policy_rule_get_rtm_dst_prefixlen(sd_netlink_message int sd_rtnl_message_routing_policy_rule_set_rtm_type(sd_netlink_message *m, unsigned char type); int sd_rtnl_message_routing_policy_rule_get_rtm_type(sd_netlink_message *m, unsigned char *type); -_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref); -_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_message, sd_netlink_message_unref); - /* genl */ int sd_genl_socket_open(sd_netlink **nl); int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m); +/* slot */ +sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl); +sd_netlink_slot *sd_netlink_slot_unref(sd_netlink_slot *nl); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_message, sd_netlink_message_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_slot, sd_netlink_slot_unref); + _SD_END_DECLARATIONS; #endif |