NetworkManager/src/core/nm-ip-config.h
Thomas Haller 615221a99c format: reformat source tree with clang-format 13.0
We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2021-11-29 09:31:09 +00:00

86 lines
2.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2008 - 2013 Red Hat, Inc.
*/
#ifndef __NM_IP_CONFIG_H__
#define __NM_IP_CONFIG_H__
#include "nm-dbus-object.h"
#include "nm-l3cfg.h"
/*****************************************************************************/
#define NM_TYPE_IP_CONFIG (nm_ip_config_get_type())
#define NM_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_IP_CONFIG, NMIPConfig))
#define NM_IP_CONFIG_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_IP_CONFIG, NMIPConfigClass))
#define NM_IS_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_IP_CONFIG))
#define NM_IS_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_IP_CONFIG))
#define NM_IP_CONFIG_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_IP_CONFIG, NMIPConfigClass))
#define NM_IP_CONFIG_L3CFG "l3cfg"
struct _NMIPConfigPrivate {
NML3Cfg *l3cfg;
const NML3ConfigData *l3cd;
GVariant *v_address_data;
GVariant *v_addresses;
GVariant *v_route_data;
GVariant *v_routes;
struct {
const NMPObject *best_default_route;
} v_gateway;
gulong l3cfg_notify_id;
};
struct _NMIPConfig {
NMDBusObject parent;
struct _NMIPConfigPrivate _priv;
};
typedef struct {
NMDBusObjectClass parent;
int addr_family;
} NMIPConfigClass;
GType nm_ip_config_get_type(void);
NMIPConfig *nm_ip_config_new(int addr_family, NML3Cfg *l3cfg);
void nm_ip_config_take_and_unexport_on_idle(NMIPConfig *self_take);
void nm_ip_config_dns_hash(const NML3ConfigData *l3cd, GChecksum *sum, int addr_family);
/*****************************************************************************/
static inline NML3Cfg *
nm_ip_config_get_l3cfg(NMIPConfig *self)
{
g_return_val_if_fail(NM_IS_IP_CONFIG(self), NULL);
return self->_priv.l3cfg;
}
static inline struct _NMDedupMultiIndex *
nm_ip_config_get_multi_index(NMIPConfig *self)
{
return nm_l3cfg_get_multi_idx(nm_ip_config_get_l3cfg(self));
}
static inline int
nm_ip_config_get_ifindex(NMIPConfig *self)
{
return nm_l3cfg_get_ifindex(nm_ip_config_get_l3cfg(self));
}
static inline int
nm_ip_config_get_addr_family(NMIPConfig *self)
{
g_return_val_if_fail(NM_IS_IP_CONFIG(self), AF_UNSPEC);
return NM_IP_CONFIG_GET_CLASS(self)->addr_family;
}
#endif /* __NM_IP_CONFIG_H__ */