[PATCH 2/7] service: Add 'service_set_proxy_method' function.
Grant Erickson <[email protected]> Tue, 4 Mar 2025 13:03:00 -0800
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <7441cb904a35bd70b37b79a93c609e1f45cfc66e.1741121901.git.gerickson@nuovations.com> |
Allows for logging, setting, and dispatching property changed
notifications for the network service proxy method and associated URL,
if any, from a single place.
---
src/service.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/service.c b/src/service.c
index b261f4ce0681..db6ec26240fd 100644
--- a/src/service.c
+++ b/src/service.c
@@ -5569,6 +5569,37 @@ const char * const *connman_service_get_timeservers(const struct connman_service
return (const char * const *)service->timeservers;
}
+static void service_set_proxy_method(struct connman_service *service,
+ enum connman_service_proxy_method method,
+ bool donotifier,
+ bool (*handler)(struct connman_service *service,
+ enum connman_service_proxy_method method,
+ const void *context),
+ const void *context)
+{
+ DBG("service %p (%s) method %d (%s) donotifier %u "
+ "handler %p, context %p",
+ service, connman_service_get_identifier(service),
+ method, proxymethod2string(method),
+ donotifier,
+ handler,
+ context);
+
+ if (!service || service->hidden)
+ return;
+
+ service->proxy = method;
+
+ if (handler != NULL)
+ if (handler(service, method, context) != true)
+ return;
+
+ proxy_changed(service);
+
+ if (donotifier)
+ __connman_notifier_proxy_changed(service);
+}
+
/**
* @brief
* Set the web proxy method of the specified service.
--
2.45.0