Blame libnm/nm-wifi-p2p-peer.c

Packit Service 87a54e
/* SPDX-License-Identifier: LGPL-2.1-or-later */
Packit 5756e2
/*
Packit 5756e2
 * Copyright (C) 2018 - 2019 Red Hat, Inc.
Packit 5756e2
 */
Packit 5756e2
Packit Service 2bceb2
#include "libnm/nm-default-libnm.h"
Packit 5756e2
Packit 5756e2
#include "nm-wifi-p2p-peer.h"
Packit 5756e2
Packit 5756e2
#include "nm-connection.h"
Packit 5756e2
#include "nm-setting-connection.h"
Packit 5756e2
#include "nm-setting-wifi-p2p.h"
Packit 5756e2
#include "nm-utils.h"
Packit 5756e2
#include "nm-dbus-interface.h"
Packit 5756e2
#include "nm-object-private.h"
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit Service a1bd4f
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_FLAGS,
Packit Service a1bd4f
                                  PROP_NAME,
Packit Service a1bd4f
                                  PROP_MANUFACTURER,
Packit Service a1bd4f
                                  PROP_MODEL,
Packit Service a1bd4f
                                  PROP_MODEL_NUMBER,
Packit Service a1bd4f
                                  PROP_SERIAL,
Packit Service a1bd4f
                                  PROP_WFD_IES,
Packit Service a1bd4f
                                  PROP_HW_ADDRESS,
Packit Service a1bd4f
                                  PROP_STRENGTH,
Packit Service a1bd4f
                                  PROP_LAST_SEEN, );
Packit 5756e2
Packit 5756e2
typedef struct {
Packit Service a1bd4f
    GBytes *wfd_ies;
Packit Service a1bd4f
    char *  name;
Packit Service a1bd4f
    char *  manufacturer;
Packit Service a1bd4f
    char *  model;
Packit Service a1bd4f
    char *  model_number;
Packit Service a1bd4f
    char *  serial;
Packit Service a1bd4f
    char *  hw_address;
Packit Service a1bd4f
    gint32  last_seen;
Packit Service a1bd4f
    guint32 flags;
Packit Service a1bd4f
    guint8  strength;
Packit 5756e2
} NMWifiP2PPeerPrivate;
Packit 5756e2
Packit 5756e2
struct _NMWifiP2PPeer {
Packit Service a1bd4f
    NMObject             parent;
Packit Service a1bd4f
    NMWifiP2PPeerPrivate _priv;
Packit 5756e2
};
Packit 5756e2
Packit 5756e2
struct _NMWifiP2PPeerClass {
Packit Service a1bd4f
    NMObjectClass parent;
Packit 5756e2
};
Packit 5756e2
Packit Service a1bd4f
G_DEFINE_TYPE(NMWifiP2PPeer, nm_wifi_p2p_peer, NM_TYPE_OBJECT)
Packit 5756e2
Packit Service a1bd4f
#define NM_WIFI_P2P_PEER_GET_PRIVATE(self) \
Packit Service a1bd4f
    _NM_GET_PRIVATE(self, NMWifiP2PPeer, NM_IS_WIFI_P2P_PEER, NMObject)
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_flags:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the flags of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the flags
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
NM80211ApFlags
Packit Service a1bd4f
nm_wifi_p2p_peer_get_flags(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NM_802_11_AP_FLAGS_NONE);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->flags;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_name:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the name of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the name
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_name(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->name;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_manufacturer:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the manufacturer of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the manufacturer
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_manufacturer(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->manufacturer;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_model:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the model of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the model
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_model(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->model;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_model_number:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the model number of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the model number
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_model_number(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->model_number;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_serial:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the serial number of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the serial number
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_serial(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->serial;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_wfd_ies:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the WFD information elements of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: (transfer none): the #GBytes containing the WFD IEs, or %NULL.
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
GBytes *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_wfd_ies(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    NMWifiP2PPeerPrivate *priv;
Packit 5756e2
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    priv = NM_WIFI_P2P_PEER_GET_PRIVATE(peer);
Packit Service a1bd4f
    if (!priv->wfd_ies || g_bytes_get_size(priv->wfd_ies) == 0)
Packit Service a1bd4f
        return NULL;
Packit 5756e2
Packit Service a1bd4f
    return priv->wfd_ies;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_hw_address:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the hardware address of the P2P peer.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the hardware address
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
const char *
Packit Service a1bd4f
nm_wifi_p2p_peer_get_hw_address(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), NULL);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->hw_address;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_strength:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Gets the current signal strength of the P2P peer as a percentage.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the signal strength (0 to 100)
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
guint8
Packit Service a1bd4f
nm_wifi_p2p_peer_get_strength(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), 0);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->strength;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_get_last_seen:
Packit 5756e2
 * @peer: a #NMWifiP2PPeer
Packit 5756e2
 *
Packit 5756e2
 * Returns the timestamp (in CLOCK_BOOTTIME seconds) for the last time the
Packit 5756e2
 * P2P peer was seen.  A value of -1 means the P2P peer has never been seen.
Packit 5756e2
 *
Packit 5756e2
 * Returns: the last seen time in seconds
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
int
Packit Service a1bd4f
nm_wifi_p2p_peer_get_last_seen(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    g_return_val_if_fail(NM_IS_WIFI_P2P_PEER(peer), -1);
Packit 5756e2
Packit Service a1bd4f
    return NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->last_seen;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_connection_valid:
Packit 5756e2
 * @peer: an #NMWifiP2PPeer to validate @connection against
Packit 5756e2
 * @connection: an #NMConnection to validate against @peer
Packit 5756e2
 *
Packit 5756e2
 * Validates a given connection against a given Wi-Fi P2P peer to ensure that
Packit 5756e2
 * the connection may be activated with that peer. The connection must match the
Packit 5756e2
 * @peer's address and in the future possibly other attributes.
Packit 5756e2
 *
Packit 5756e2
 * Returns: %TRUE if the connection may be activated with this Wi-Fi P2P Peer,
Packit 5756e2
 * %FALSE if it cannot be.
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
gboolean
Packit Service a1bd4f
nm_wifi_p2p_peer_connection_valid(NMWifiP2PPeer *peer, NMConnection *connection)
Packit 5756e2
{
Packit Service a1bd4f
    NMSettingConnection *s_con;
Packit Service a1bd4f
    NMSettingWifiP2P *   s_wifi_p2p;
Packit Service a1bd4f
    const char *         ctype;
Packit Service a1bd4f
    const char *         hw_address;
Packit Service a1bd4f
    const char *         setting_peer;
Packit Service a1bd4f
Packit Service a1bd4f
    s_wifi_p2p =
Packit Service a1bd4f
        (NMSettingWifiP2P *) nm_connection_get_setting(connection, NM_TYPE_SETTING_WIFI_P2P);
Packit Service a1bd4f
    if (!s_wifi_p2p)
Packit Service a1bd4f
        return FALSE;
Packit Service a1bd4f
Packit Service a1bd4f
    s_con = nm_connection_get_setting_connection(connection);
Packit Service a1bd4f
    if (!s_con)
Packit Service a1bd4f
        return FALSE;
Packit Service a1bd4f
Packit Service a1bd4f
    ctype = nm_setting_connection_get_connection_type(s_con);
Packit Service a1bd4f
    if (!ctype || !nm_streq(ctype, NM_SETTING_WIFI_P2P_SETTING_NAME))
Packit Service a1bd4f
        return FALSE;
Packit Service a1bd4f
Packit Service a1bd4f
    /* HW Address check */
Packit Service a1bd4f
    hw_address = nm_wifi_p2p_peer_get_hw_address(peer);
Packit Service a1bd4f
    if (!hw_address)
Packit Service a1bd4f
        return FALSE;
Packit Service a1bd4f
Packit Service a1bd4f
    setting_peer = nm_setting_wifi_p2p_get_peer(s_wifi_p2p);
Packit Service a1bd4f
    if (!setting_peer || !nm_streq(hw_address, setting_peer))
Packit Service a1bd4f
        return FALSE;
Packit Service a1bd4f
Packit Service a1bd4f
    return TRUE;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * nm_wifi_p2p_peer_filter_connections:
Packit 5756e2
 * @peer: an #NMWifiP2PPeer to filter connections for
Packit 5756e2
 * @connections: (element-type NMConnection): an array of #NMConnections to
Packit 5756e2
 * filter
Packit 5756e2
 *
Packit 5756e2
 * Filters a given array of connections for a given #NMWifiP2PPeer object and
Packit 5756e2
 * returns connections which may be activated with the P2P peer.  Any
Packit 5756e2
 * returned connections will match the @peers's HW address and in the future
Packit 5756e2
 * possibly other attributes.
Packit 5756e2
 *
Packit 5756e2
 * To obtain the list of connections that are compatible with this P2P peer,
Packit 5756e2
 * use nm_client_get_connections() and then filter the returned list for a given
Packit 5756e2
 * #NMDevice using nm_device_filter_connections() and finally filter that list
Packit 5756e2
 * with this function.
Packit 5756e2
 *
Packit 5756e2
 * Returns: (transfer container) (element-type NMConnection): an array of
Packit 5756e2
 * #NMConnections that could be activated with the given @peer. The array should
Packit 5756e2
 * be freed with g_ptr_array_unref() when it is no longer required.
Packit 5756e2
 *
Packit 5756e2
 * Since: 1.16
Packit 5756e2
 **/
Packit 5756e2
GPtrArray *
Packit Service a1bd4f
nm_wifi_p2p_peer_filter_connections(NMWifiP2PPeer *peer, const GPtrArray *connections)
Packit 5756e2
{
Packit Service a1bd4f
    GPtrArray *filtered;
Packit Service a1bd4f
    guint      i;
Packit 5756e2
Packit Service a1bd4f
    filtered = g_ptr_array_new_with_free_func(g_object_unref);
Packit Service a1bd4f
    for (i = 0; i < connections->len; i++) {
Packit Service a1bd4f
        NMConnection *candidate = connections->pdata[i];
Packit 5756e2
Packit Service a1bd4f
        if (nm_wifi_p2p_peer_connection_valid(peer, candidate))
Packit Service a1bd4f
            g_ptr_array_add(filtered, g_object_ref(candidate));
Packit Service a1bd4f
    }
Packit 5756e2
Packit Service a1bd4f
    return filtered;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit 5756e2
static void
Packit Service a1bd4f
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Packit 5756e2
{
Packit Service a1bd4f
    NMWifiP2PPeer *peer = NM_WIFI_P2P_PEER(object);
Packit Service a1bd4f
Packit Service a1bd4f
    switch (prop_id) {
Packit Service a1bd4f
    case PROP_FLAGS:
Packit Service a1bd4f
        g_value_set_flags(value, nm_wifi_p2p_peer_get_flags(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_NAME:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_name(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_MANUFACTURER:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_manufacturer(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_MODEL:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_model(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_MODEL_NUMBER:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_model_number(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_SERIAL:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_serial(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_WFD_IES:
Packit Service a1bd4f
        g_value_set_boxed(value, nm_wifi_p2p_peer_get_wfd_ies(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_HW_ADDRESS:
Packit Service a1bd4f
        g_value_set_string(value, nm_wifi_p2p_peer_get_hw_address(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_STRENGTH:
Packit Service a1bd4f
        g_value_set_uchar(value, nm_wifi_p2p_peer_get_strength(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    case PROP_LAST_SEEN:
Packit Service a1bd4f
        g_value_set_int(value, nm_wifi_p2p_peer_get_last_seen(peer));
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    default:
Packit Service a1bd4f
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Packit Service a1bd4f
        break;
Packit Service a1bd4f
    }
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit 5756e2
static void
Packit Service a1bd4f
nm_wifi_p2p_peer_init(NMWifiP2PPeer *peer)
Packit 5756e2
{
Packit Service a1bd4f
    NM_WIFI_P2P_PEER_GET_PRIVATE(peer)->last_seen = -1;
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
static void
Packit Service a1bd4f
finalize(GObject *object)
Packit 5756e2
{
Packit Service a1bd4f
    NMWifiP2PPeerPrivate *priv = NM_WIFI_P2P_PEER_GET_PRIVATE(object);
Packit 5756e2
Packit Service a1bd4f
    g_free(priv->name);
Packit Service a1bd4f
    g_free(priv->manufacturer);
Packit Service a1bd4f
    g_free(priv->model);
Packit Service a1bd4f
    g_free(priv->model_number);
Packit Service a1bd4f
    g_free(priv->serial);
Packit Service a1bd4f
    g_free(priv->hw_address);
Packit 5756e2
Packit Service a1bd4f
    g_bytes_unref(priv->wfd_ies);
Packit 5756e2
Packit Service a1bd4f
    G_OBJECT_CLASS(nm_wifi_p2p_peer_parent_class)->finalize(object);
Packit 5756e2
}
Packit 5756e2
Packit Service a1bd4f
const NMLDBusMetaIface _nml_dbus_meta_iface_nm_wifip2ppeer = NML_DBUS_META_IFACE_INIT_PROP(
Packit Service a1bd4f
    NM_DBUS_INTERFACE_WIFI_P2P_PEER,
Packit Service a1bd4f
    nm_wifi_p2p_peer_get_type,
Packit Service a1bd4f
    NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
Packit Service a1bd4f
    NML_DBUS_META_IFACE_DBUS_PROPERTIES(
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_U("Flags", PROP_FLAGS, NMWifiP2PPeer, _priv.flags),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_IGNORE("Groups", "as"),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("HwAddress",
Packit Service a1bd4f
                                      PROP_HW_ADDRESS,
Packit Service a1bd4f
                                      NMWifiP2PPeer,
Packit Service a1bd4f
                                      _priv.hw_address),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_I("LastSeen", PROP_LAST_SEEN, NMWifiP2PPeer, _priv.last_seen),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("Manufacturer",
Packit Service a1bd4f
                                      PROP_MANUFACTURER,
Packit Service a1bd4f
                                      NMWifiP2PPeer,
Packit Service a1bd4f
                                      _priv.manufacturer),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("Model", PROP_MODEL, NMWifiP2PPeer, _priv.model),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("ModelNumber",
Packit Service a1bd4f
                                      PROP_MODEL_NUMBER,
Packit Service a1bd4f
                                      NMWifiP2PPeer,
Packit Service a1bd4f
                                      _priv.model_number),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("Name", PROP_NAME, NMWifiP2PPeer, _priv.name),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_S("Serial", PROP_SERIAL, NMWifiP2PPeer, _priv.serial),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_Y("Strength", PROP_STRENGTH, NMWifiP2PPeer, _priv.strength),
Packit Service a1bd4f
        NML_DBUS_META_PROPERTY_INIT_AY("WfdIEs", PROP_WFD_IES, NMWifiP2PPeer, _priv.wfd_ies), ), );
Packit 5756e2
Packit 5756e2
static void
Packit Service a1bd4f
nm_wifi_p2p_peer_class_init(NMWifiP2PPeerClass *klass)
Packit 5756e2
{
Packit Service a1bd4f
    GObjectClass *object_class = G_OBJECT_CLASS(klass);
Packit Service a1bd4f
Packit Service a1bd4f
    object_class->get_property = get_property;
Packit Service a1bd4f
    object_class->finalize     = finalize;
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:flags:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The flags of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_FLAGS] = g_param_spec_flags(NM_WIFI_P2P_PEER_FLAGS,
Packit Service a1bd4f
                                                    "",
Packit Service a1bd4f
                                                    "",
Packit Service a1bd4f
                                                    NM_TYPE_802_11_AP_FLAGS,
Packit Service a1bd4f
                                                    NM_802_11_AP_FLAGS_NONE,
Packit Service a1bd4f
                                                    G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:name:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The name of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_NAME] = g_param_spec_string(NM_WIFI_P2P_PEER_NAME,
Packit Service a1bd4f
                                                    "",
Packit Service a1bd4f
                                                    "",
Packit Service a1bd4f
                                                    NULL,
Packit Service a1bd4f
                                                    G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:manufacturer:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The manufacturer of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_MANUFACTURER] =
Packit Service a1bd4f
        g_param_spec_string(NM_WIFI_P2P_PEER_MANUFACTURER,
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            NULL,
Packit Service a1bd4f
                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:model:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The model of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_MODEL] = g_param_spec_string(NM_WIFI_P2P_PEER_MODEL,
Packit Service a1bd4f
                                                     "",
Packit Service a1bd4f
                                                     "",
Packit Service a1bd4f
                                                     NULL,
Packit Service a1bd4f
                                                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:model-number:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The hardware address of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_MODEL_NUMBER] =
Packit Service a1bd4f
        g_param_spec_string(NM_WIFI_P2P_PEER_MODEL_NUMBER,
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            NULL,
Packit Service a1bd4f
                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:serial:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The serial number of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_SERIAL] = g_param_spec_string(NM_WIFI_P2P_PEER_SERIAL,
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      NULL,
Packit Service a1bd4f
                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:wfd-ies:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The WFD information elements of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_WFD_IES] = g_param_spec_boxed(NM_WIFI_P2P_PEER_WFD_IES,
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      G_TYPE_BYTES,
Packit Service a1bd4f
                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:hw-address:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The hardware address of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_HW_ADDRESS] =
Packit Service a1bd4f
        g_param_spec_string(NM_WIFI_P2P_PEER_HW_ADDRESS,
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            "",
Packit Service a1bd4f
                            NULL,
Packit Service a1bd4f
                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:strength:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The current signal strength of the P2P peer.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_STRENGTH] = g_param_spec_uchar(NM_WIFI_P2P_PEER_STRENGTH,
Packit Service a1bd4f
                                                       "",
Packit Service a1bd4f
                                                       "",
Packit Service a1bd4f
                                                       0,
Packit Service a1bd4f
                                                       G_MAXUINT8,
Packit Service a1bd4f
                                                       0,
Packit Service a1bd4f
                                                       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    /**
Packit Service a1bd4f
     * NMWifiP2PPeer:last-seen:
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * The timestamp (in CLOCK_BOOTTIME seconds) for the last time the
Packit Service a1bd4f
     * P2P peer was found.  A value of -1 means the peer has never been seen.
Packit Service a1bd4f
     *
Packit Service a1bd4f
     * Since: 1.16
Packit Service a1bd4f
     **/
Packit Service a1bd4f
    obj_properties[PROP_LAST_SEEN] = g_param_spec_int(NM_WIFI_P2P_PEER_LAST_SEEN,
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      "",
Packit Service a1bd4f
                                                      -1,
Packit Service a1bd4f
                                                      G_MAXINT,
Packit Service a1bd4f
                                                      -1,
Packit Service a1bd4f
                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
Packit Service a1bd4f
Packit Service a1bd4f
    _nml_dbus_meta_class_init_with_properties(object_class, &_nml_dbus_meta_iface_nm_wifip2ppeer);
Packit 5756e2
}