Lines Matching refs:nl

49 void genl_clear_family(sd_netlink *nl) {  in genl_clear_family()  argument
50 assert(nl); in genl_clear_family()
52nl->genl_family_by_name = hashmap_free_with_destructor(nl->genl_family_by_name, genl_family_free); in genl_clear_family()
53nl->genl_family_by_id = hashmap_free_with_destructor(nl->genl_family_by_id, genl_family_free); in genl_clear_family()
57 sd_netlink *nl, in genl_family_new_unsupported() argument
64 assert(nl); in genl_family_new_unsupported()
83 r = hashmap_ensure_put(&nl->genl_family_by_name, &string_hash_ops, f->name, f); in genl_family_new_unsupported()
87 f->genl = nl; in genl_family_new_unsupported()
93 sd_netlink *nl, in genl_family_new() argument
104 assert(nl); in genl_family_new()
118 r = sd_genl_message_get_family_name(nl, message, &family_name); in genl_family_new()
125 r = sd_genl_message_get_command(nl, message, &cmd); in genl_family_new()
193 r = hashmap_ensure_put(&nl->genl_family_by_id, NULL, UINT_TO_PTR(f->id), f); in genl_family_new()
197 r = hashmap_ensure_put(&nl->genl_family_by_name, &string_hash_ops, f->name, f); in genl_family_new()
199 hashmap_remove(nl->genl_family_by_id, UINT_TO_PTR(f->id)); in genl_family_new()
203 f->genl = nl; in genl_family_new()
218 sd_netlink *nl, in genl_message_new() argument
227 assert(nl); in genl_message_new()
228 assert(nl->protocol == NETLINK_GENERIC); in genl_message_new()
236 r = message_new_full(nl, family->id, type_system, in genl_message_new()
251 sd_netlink *nl, in genl_family_get_by_name_internal() argument
260 assert(nl); in genl_family_get_by_name_internal()
261 assert(nl->protocol == NETLINK_GENERIC); in genl_family_get_by_name_internal()
270 r = genl_message_new(nl, ctrl, CTRL_CMD_GETFAMILY, &req); in genl_family_get_by_name_internal()
278 if (sd_netlink_call(nl, req, 0, &reply) < 0) { in genl_family_get_by_name_internal()
279 (void) genl_family_new_unsupported(nl, name, type_system); in genl_family_get_by_name_internal()
283 return genl_family_new(nl, name, type_system, reply, ret); in genl_family_get_by_name_internal()
286 static int genl_family_get_by_name(sd_netlink *nl, const char *name, const GenericNetlinkFamily **r… in genl_family_get_by_name() argument
290 assert(nl); in genl_family_get_by_name()
291 assert(nl->protocol == NETLINK_GENERIC); in genl_family_get_by_name()
295 f = hashmap_get(nl->genl_family_by_name, name); in genl_family_get_by_name()
305 return genl_family_get_by_name_internal(nl, &nlctrl_static, CTRL_GENL_NAME, ret); in genl_family_get_by_name()
307 ctrl = hashmap_get(nl->genl_family_by_name, CTRL_GENL_NAME); in genl_family_get_by_name()
309 r = genl_family_get_by_name_internal(nl, &nlctrl_static, CTRL_GENL_NAME, &ctrl); in genl_family_get_by_name()
314 return genl_family_get_by_name_internal(nl, ctrl, name, ret); in genl_family_get_by_name()
317 static int genl_family_get_by_id(sd_netlink *nl, uint16_t id, const GenericNetlinkFamily **ret) { in genl_family_get_by_id() argument
320 assert(nl); in genl_family_get_by_id()
321 assert(nl->protocol == NETLINK_GENERIC); in genl_family_get_by_id()
324 f = hashmap_get(nl->genl_family_by_id, UINT_TO_PTR(id)); in genl_family_get_by_id()
339 sd_netlink *nl, in genl_get_type_system_and_header_size() argument
347 assert(nl); in genl_get_type_system_and_header_size()
348 assert(nl->protocol == NETLINK_GENERIC); in genl_get_type_system_and_header_size()
350 r = genl_family_get_by_id(nl, id, &f); in genl_get_type_system_and_header_size()
368 int sd_genl_message_new(sd_netlink *nl, const char *family_name, uint8_t cmd, sd_netlink_message **… in sd_genl_message_new() argument
372 assert_return(nl, -EINVAL); in sd_genl_message_new()
373 assert_return(nl->protocol == NETLINK_GENERIC, -EINVAL); in sd_genl_message_new()
377 r = genl_family_get_by_name(nl, family_name, &family); in sd_genl_message_new()
381 return genl_message_new(nl, family, cmd, ret); in sd_genl_message_new()
384 int sd_genl_message_get_family_name(sd_netlink *nl, sd_netlink_message *m, const char **ret) { in sd_genl_message_get_family_name() argument
389 assert_return(nl, -EINVAL); in sd_genl_message_get_family_name()
390 assert_return(nl->protocol == NETLINK_GENERIC, -EINVAL); in sd_genl_message_get_family_name()
398 r = genl_family_get_by_id(nl, nlmsg_type, &family); in sd_genl_message_get_family_name()
406 int sd_genl_message_get_command(sd_netlink *nl, sd_netlink_message *m, uint8_t *ret) { in sd_genl_message_get_command() argument
412 assert_return(nl, -EINVAL); in sd_genl_message_get_command()
413 assert_return(nl->protocol == NETLINK_GENERIC, -EINVAL); in sd_genl_message_get_command()
423 r = genl_get_type_system_and_header_size(nl, nlmsg_type, NULL, &size); in sd_genl_message_get_command()
452 sd_netlink *nl, in sd_genl_add_match() argument
466 assert_return(nl, -EINVAL); in sd_genl_add_match()
467 assert_return(nl->protocol == NETLINK_GENERIC, -EINVAL); in sd_genl_add_match()
474 r = genl_family_get_by_name(nl, family_name, &f); in sd_genl_add_match()
482 return netlink_add_match_internal(nl, ret_slot, &multicast_group_id, 1, f->id, command, in sd_genl_add_match()