Lines Matching refs:service
57 #include "thread-service.h"
58 #include "service-tracker.h"
65 thread_service_t *service;
67 void (*callback)(thread_service_t *service, void *context, bool succeeded);
81 if (probe_state->service != NULL) {
82 thread_service_release(probe_state->service);
83 probe_state->service = NULL;
96 probe_srp_service_probe_cancel(thread_service_t *service)
98 probe_state_t *probe_state = service->probe_state;
99 probe_state->service = NULL;
100 service->probe_state = NULL;
107 thread_service_release(service); // The probe state's reference to the service
126 thread_service_t *service = probe_state->service;
127 // Note: we should still have references both to probe_state and to service here because they each held references
129 probe_state->service = NULL;
130 service->probe_state = NULL;
131 if (service->service_type == anycast_service) {
132 address = &service->u.anycast.address;
135 address = &service->u.unicast.address;
136 // If the anycast service is present, we can use port 53, which we need to prefer because pre-2024 Apple BRs
137 // will not answer DNS queries on the SRP service port.
138 if (service->u.unicast.anycast_also_present) {
141 port = (service->u.unicast.port[0] << 8) | service->u.unicast.port[1];
146 INFO("service " PRI_SEGMENTED_IPv6_ADDR_SRP " not responding on port %d",
148 service->checking = false;
149 service->ignore = true; // Don't consider this service when deciding what to advertise
150 service->responding = false;
152 INFO("service " PRI_SEGMENTED_IPv6_ADDR_SRP " responded on port %d",
154 service->checking = false;
155 service->ignore = false;
156 service->checked = true;
158 service->responding = true;
161 probe_state->callback(probe_state->service, probe_state->context, succeeded);
169 thread_service_release(service); // The probe state's reference to the service
230 // failed to connect. If we haven't signaled "done" yet, probe_state->service will be non-NULL.
231 if (probe_state->service != NULL) {
317 // Query SOA for default.service.arpa--if this fails, we can't use this server.
318 dns_full_name_to_wire(NULL, &towire, "default.service.arpa");
333 probe_srp_create(addr_t *address, thread_service_t *service, void *context,
334 void (*callback)(thread_service_t *service, void *context, bool succeeded),
353 INFO("probing service " PRI_SEGMENTED_IPv6_ADDR_SRP " on port %d",
357 service->last_probe_time = srp_time();
359 service->probe_state = probe_state;
360 RETAIN_HERE(service->probe_state, probe_state);
362 probe_state->service = service;
363 thread_service_retain(probe_state->service);
374 callback(service, context, true); // We claim success here because this should never fail; if it does, it's our problem.
383 // If we've been asked to probe a service, go through the list.
385 probe_srp_anycast_service(thread_service_t *service, void *context,
386 void (*callback)(thread_service_t *service, void *context, bool succeeded),
391 memcpy(&address.sin6.sin6_addr, &service->u.anycast.address, sizeof(service->u.anycast.address));
394 return probe_srp_create(&address, service, context, callback, context_release);
398 probe_srp_unicast_service(thread_service_t *service, void *context,
399 void (*callback)(thread_service_t *service, void *context, bool succeeded),
401 if (service->checking || service->user) {
407 memcpy(&address.sin6.sin6_addr, &service->u.unicast.address, sizeof(address.sin6.sin6_addr));
408 memcpy(&address.sin6.sin6_port, service->u.unicast.port, sizeof(address.sin6.sin6_port));
409 return probe_srp_create(&address, service, context, callback, context_release);
413 probe_srp_service(thread_service_t *service, void *context,
414 void (*callback)(thread_service_t *service, void *context, bool succeeded),
418 if (service->service_type == unicast_service) {
419 probe_state = probe_srp_unicast_service(service, context, callback, context_release);
420 } else if (service->service_type == anycast_service){
421 probe_state = probe_srp_anycast_service(service, context, callback, context_release);
423 FAULT("bogus service type in probe_srp_service: %d", service->service_type);
426 callback(service, context, false); // False because this isn't a valid service