mirror_frr/zebra/ge_netlink.h
Carmine Scarpitta 959267f7c2 zebra: Add function to resolve Generic Netlink family
Generic Netlink is an extension of Netlink meant for kernel-user space
communications. It supports the dynamic allocation of communication
channels. Kernel and user space applications register their services
with a Generic Netlink controller. The Generic Netlink controller is
responsible for assigning a unique channel number with each service.
Clients who want to use a service query the controller to see if
the service exists and to determine the correct channel number. The
channel number is used to access the requested service.

This commit adds the base functionality to get the channel number
assigned to a specific service. More precisely, this commit adds a
function `genl_resolve_family()` that takes the service name (called
family in the Generic Netlink terminology) as an input parameter and
queries the Generic Netlink controller to get the channel number
assigned with the requested service.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-12-14 14:56:44 +01:00

37 lines
635 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Header file exported by ge_netlink.c to zebra.
* Copyright (C) 2022, Carmine Scarpitta
*/
#ifndef _ZEBRA_GE_NETLINK_H
#define _ZEBRA_GE_NETLINK_H
#include "zebra_dplane.h"
#ifdef HAVE_NETLINK
#include <linux/genetlink.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Generic Netlink request message */
struct genl_request {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[1024];
};
extern int genl_resolve_family(const char *family);
extern void ge_netlink_init(struct zebra_ns *zns);
#ifdef __cplusplus
}
#endif
#endif /* HAVE_NETLINK */
#endif /* _ZEBRA_GE_NETLINK_H */