diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-03 10:27:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-12-11 09:23:47 +0100 |
commit | 487ee687d5bba82ee1054d74961afe122260811f (patch) | |
tree | 9e5f40bf34a138c40a109de3b1c7dd80a771e8fd /src/nm-connectivity.h | |
parent | e0191d420162fa78561ab1f45749ef2cd6464626 (diff) | |
download | NetworkManager-487ee687d5bba82ee1054d74961afe122260811f.tar.gz |
libnm: add nm_connectivity_state_cmp() helper
Diffstat (limited to 'src/nm-connectivity.h')
-rw-r--r-- | src/nm-connectivity.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nm-connectivity.h b/src/nm-connectivity.h index fad248be7b..f262298a82 100644 --- a/src/nm-connectivity.h +++ b/src/nm-connectivity.h @@ -24,6 +24,21 @@ #include "nm-dbus-interface.h" +/*****************************************************************************/ + +static inline int +nm_connectivity_state_cmp (NMConnectivityState a, NMConnectivityState b) +{ + if (a == NM_CONNECTIVITY_PORTAL && b == NM_CONNECTIVITY_LIMITED) + return 1; + if (b == NM_CONNECTIVITY_PORTAL && a == NM_CONNECTIVITY_LIMITED) + return -1; + NM_CMP_DIRECT (a, b); + return 0; +} + +/*****************************************************************************/ + #define NM_CONNECTIVITY_ERROR ((NMConnectivityState) -1) #define NM_CONNECTIVITY_FAKE ((NMConnectivityState) -2) #define NM_CONNECTIVITY_CANCELLED ((NMConnectivityState) -3) |