This is will be useful for wifi plugin and peer core code to run dhcp as
a client or as a server.
---
gsupplicant/gsupplicant.h | 1 +
gsupplicant/supplicant.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 82c9bc6..387a3aa 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -296,6 +296,7 @@ bool g_supplicant_peer_is_wps_pbc(GSupplicantPeer *peer);
bool g_supplicant_peer_is_wps_pin(GSupplicantPeer *peer);
bool g_supplicant_peer_is_in_a_group(GSupplicantPeer *peer);
GSupplicantInterface *g_supplicant_peer_get_group_interface(GSupplicantPeer
*peer);
+bool g_supplicant_peer_is_client(GSupplicantPeer *peer);
struct _GSupplicantCallbacks {
void (*system_ready) (void);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 8324cc2..c6342d5 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1098,6 +1098,28 @@ GSupplicantInterface
*g_supplicant_peer_get_group_interface(GSupplicantPeer *pee
return (GSupplicantInterface *) peer->current_group_iface;
}
+bool g_supplicant_peer_is_client(GSupplicantPeer *peer)
+{
+ GSupplicantGroup *group;
+ GSList *list;
+
+ if (!peer)
+ return false;
+
+ for (list = peer->groups; list; list = list->next) {
+ group = list->data;
+
+ if (group->role != G_SUPPLICANT_GROUP_ROLE_CLIENT ||
+ group->orig_interface != peer->interface)
+ continue;
+
+ if (group->interface == peer->current_group_iface)
+ return true;
+ }
+
+ return false;
+}
+
static void merge_network(GSupplicantNetwork *network)
{
GString *str;
--
1.8.5.5
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman