Files
ModemManager/src/mm-netlink.h
T
Dan Williams 0a94b0138d netlink: add RTM_GETLINK support to read MAC address
Since we're also now reading responses we need to check sender
credentials to make sure we're talking to the kernel, and not
some other process spoofing netlink.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-02-18 21:06:19 +00:00

64 lines
2.9 KiB
C

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Basic netlink support from libqmi:
* Copyright (C) 2020 Eric Caruso <ejcaruso@chromium.org>
* Copyright (C) 2020 Andrew Lassalle <andrewlassalle@chromium.org>
*
* Copyright (C) 2021 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_NETLINK_H
#define MM_NETLINK_H
#include <glib-object.h>
#include <gio/gio.h>
G_BEGIN_DECLS
#define MM_TYPE_NETLINK (mm_netlink_get_type ())
#define MM_NETLINK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MM_TYPE_NETLINK, MMNetlink))
#define MM_NETLINK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MM_TYPE_NETLINK, MMNetlinkClass))
#define MM_NETLINK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MM_TYPE_NETLINK, MMNetlinkClass))
#define MM_IS_NETLINK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MM_TYPE_NETLINK))
#define MM_IS_NETLINK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MM_TYPE_NETLINK))
typedef struct _MMNetlink MMNetlink;
typedef struct _MMNetlinkClass MMNetlinkClass;
GType mm_netlink_get_type (void) G_GNUC_CONST;
MMNetlink *mm_netlink_get (void);
void mm_netlink_setlink (MMNetlink *self,
guint ifindex,
gboolean up,
guint mtu,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_netlink_setlink_finish (MMNetlink *self,
GAsyncResult *res,
GError **error);
void mm_netlink_get_hwaddr (MMNetlink *self,
guint ifindex,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GByteArray *mm_netlink_get_hwaddr_finish (MMNetlink *self,
GAsyncResult *res,
GError **error);
G_END_DECLS
#endif /* MM_MODEM_HELPERS_NETLINK_H */