HomePort
discovery_api.c
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Aalborg University. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are
5  * permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this list of
8  * conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  * of conditions and the following disclaimer in the documentation and/or other materials
12  * provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY Aalborg University ''AS IS'' AND ANY EXPRESS OR IMPLIED
15  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Aalborg University OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * The views and conclusions contained in the software and documentation are those of the
25  * authors and should not be interpreted as representing official policies, either expressed
26  */
27 
28 #include "daemon.h"
29 #include "hpd/hpd_shared_api.h"
30 #include "discovery.h"
31 #include "log.h"
32 #include "model.h"
33 
35 {
36  if (!id || !hpd || !aid) LOG_RETURN_E_NULL();
37  return discovery_alloc_aid(id, hpd, aid);
38 }
39 
41 {
42  if (!dst || !src) LOG_RETURN_E_NULL();
43  return discovery_copy_aid(dst, src);
44 }
45 
47 {
48  if (!id) LOG_RETURN_E_NULL();
49  return discovery_free_aid(id);
50 }
51 
52 hpd_error_t hpd_device_id_alloc(hpd_device_id_t **id, hpd_t *hpd, const char *aid, const char *did)
53 {
54  if (!id || !hpd || !aid || !did) LOG_RETURN_E_NULL();
55  return discovery_alloc_did(id, hpd, aid, did);
56 }
57 
59 {
60  if (!dst || !src) LOG_RETURN_E_NULL();
61  return discovery_copy_did(dst, src);
62 }
63 
65 {
66  if (!id) LOG_RETURN_E_NULL();
67  return discovery_free_did(id);
68 }
69 
70 hpd_error_t hpd_service_id_alloc(hpd_service_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid)
71 {
72  if (!id || !hpd || !aid || !did || !sid) LOG_RETURN_E_NULL();
73  return discovery_alloc_sid(id, hpd, aid, did, sid);
74 }
75 
77 {
78  if (!dst || !src) LOG_RETURN_E_NULL();
79  return discovery_copy_sid(dst, src);
80 }
81 
83 {
84  if (!id)
86  return discovery_free_sid(id);
87 }
88 
89 hpd_error_t hpd_parameter_id_alloc(hpd_parameter_id_t **id, hpd_t *hpd, const char *aid, const char *did,
90  const char *sid, const char *pid)
91 {
92  if (!id || !hpd || !aid || !did || !sid || !pid) LOG_RETURN_E_NULL();
93  return discovery_alloc_pid(id, hpd, aid, did, sid, pid);
94 }
95 
97 {
98  if (!dst || !src) LOG_RETURN_E_NULL();
99  return discovery_copy_pid(dst, src);
100 }
101 
103 {
104  if (!id) LOG_RETURN_E_NULL();
105  return discovery_free_pid(id);
106 }
107 
108 hpd_error_t hpd_adapter_alloc(hpd_adapter_t **adapter, const char *id)
109 {
110  if (!adapter || !id) LOG_RETURN_E_NULL();
111  return discovery_alloc_adapter(adapter, id);
112 }
113 
115 {
116  if (!adapter) LOG_RETURN_E_NULL();
117  return discovery_free_adapter(adapter);
118 }
119 
121 {
122  if (!hpd || !adapter) LOG_RETURN_E_NULL();
124  if (!discovery_is_adapter_id_unique(hpd, adapter))
125  LOG_RETURN(HPD_E_NOT_UNIQUE, "Adapters ids must be unique.");
126  return discovery_attach_adapter(hpd, adapter);
127 }
128 
130 {
131  if (!id || !adapter) LOG_RETURN_E_NULL();
133  hpd_error_t rc;
134  hpd_adapter_t *a;
135  if ((rc = discovery_find_adapter(id, &a))) return rc;
136  if ((rc = discovery_detach_adapter(a))) return rc;
137  (*adapter) = a;
138  return HPD_E_SUCCESS;
139 }
140 
142 {
143  if (!adapter) LOG_RETURN_E_NULL();
144  return discovery_set_adapter_data(adapter, data, on_free);
145 }
146 
147 hpd_error_t hpd_adapter_set_attr(hpd_adapter_t *adapter, const char *key, const char *val)
148 {
149  if (!adapter || !key) LOG_RETURN_E_NULL();
150  if (key[0] == '_') LOG_RETURN(HPD_E_ARGUMENT, "Keys starting with '_' is reserved for generated attributes");
151  return discovery_set_adapter_attr(adapter, key, val);
152 }
153 
155 {
156  if (!adapter) LOG_RETURN_E_NULL();
157 
158  va_list vp;
159  va_start(vp, adapter);
160  hpd_error_t rc = discovery_set_adapter_attrs_v(adapter, vp);
161  va_end(vp);
162 
163  return rc;
164 }
165 
167 {
168  if (!id || !data) LOG_RETURN_E_NULL();
170  hpd_error_t rc;
171  hpd_adapter_t *adapter;
172  if ((rc = discovery_find_adapter(id, &adapter))) return rc;
173  return discovery_get_adapter_data(adapter, data);
174 }
175 
176 hpd_error_t hpd_adapter_get_id(const hpd_adapter_id_t *aid, const char **id)
177 {
178  if (!aid || !id) LOG_RETURN_E_NULL();
180  hpd_error_t rc;
181  hpd_adapter_t *adapter;
182  if ((rc = discovery_find_adapter(aid, &adapter))) return rc;
183  return discovery_get_adapter_id(adapter, id);
184 }
185 
186 hpd_error_t hpd_adapter_get_attr(const hpd_adapter_id_t *id, const char *key, const char **val)
187 {
188  if (!id || !key || !val) LOG_RETURN_E_NULL();
190  hpd_error_t rc;
191  hpd_adapter_t *adapter;
192  if ((rc = discovery_find_adapter(id, &adapter))) return rc;
193  return discovery_get_adapter_attr(adapter, key, val);
194 }
195 
197 {
198  if (!id) LOG_RETURN_E_NULL();
200  hpd_error_t rc;
201  hpd_adapter_t *adapter;
202  if ((rc = discovery_find_adapter(id, &adapter))) return rc;
203 
204  va_list vp;
205  va_start(vp, id);
206  rc = discovery_get_adapter_attrs_v(adapter, vp);
207  va_end(vp);
208 
209  return rc;
210 }
211 
213 {
214  if (!id || !pair) LOG_RETURN_E_NULL();
216 
217  hpd_error_t rc;
218  hpd_adapter_t *adapter;
219  if ((rc = discovery_find_adapter(id, &adapter))) return rc;
220 
221  return discovery_first_adapter_attr(adapter, pair);
222 }
223 
225 {
226  if (!pair || !(*pair)) LOG_RETURN_E_NULL();
227 
228  return discovery_next_adapter_attr(pair);
229 }
230 
236 hpd_error_t hpd_device_alloc(hpd_device_t **device, const char *id)
237 {
238  if (!device || !id) LOG_RETURN_E_NULL();
239  return discovery_alloc_device(device, id);
240 }
241 
243 {
244  if (!device) LOG_RETURN_E_NULL();
245  return discovery_free_device(device);
246 }
247 
249  if (!id || !device) LOG_RETURN_E_NULL();
251  hpd_error_t rc;
252  hpd_adapter_t *adapter;
253  if ((rc = discovery_find_adapter(id, &adapter))) return rc;
254  if (!discovery_is_device_id_unique(adapter, device))
255  LOG_RETURN(HPD_E_NOT_UNIQUE, "Device ids must be unique within the adapter.");
256  return discovery_attach_device(adapter, device);
257 }
258 
260 {
261  if (!id || !device) LOG_RETURN_E_NULL();
263  hpd_error_t rc;
264  hpd_device_t *d;
265  if ((rc = discovery_find_device(id, &d))) return rc;
266  if ((rc = discovery_detach_device(d))) return rc;
267  (*device) = d;
268  return HPD_E_SUCCESS;
269 }
270 
272 {
273  if (!device) LOG_RETURN_E_NULL();
274  return discovery_set_device_data(device, data, on_free);
275 }
276 
277 hpd_error_t hpd_device_set_attr(hpd_device_t *device, const char *key, const char *val)
278 {
279  if (!device || !key) LOG_RETURN_E_NULL();
280  if (key[0] == '_') LOG_RETURN(HPD_E_ARGUMENT, "Keys starting with '_' is reserved for generated attributes");
281  return discovery_set_device_attr(device, key, val);
282 }
283 
285 {
286  if (!device) LOG_RETURN_E_NULL();
287 
288  va_list vp;
289  va_start(vp, device);
290  hpd_error_t rc = discovery_set_device_attrs_v(device, vp);
291  va_end(vp);
292 
293  return rc;
294 }
295 
297 {
298  if (!id || !data) LOG_RETURN_E_NULL();
300  hpd_error_t rc;
301  hpd_device_t *device;
302  if ((rc = discovery_find_device(id, &device))) return rc;
303  return discovery_get_device_data(device, data);
304 }
305 
306 hpd_error_t hpd_device_get_id(const hpd_device_id_t *did, const char **id)
307 {
308  if (!did || !id) LOG_RETURN_E_NULL();
310  hpd_error_t rc;
311  hpd_device_t *device;
312  if ((rc = discovery_find_device(did, &device))) return rc;
313  return discovery_get_device_id(device, id);
314 }
315 
316 hpd_error_t hpd_device_get_attr(const hpd_device_id_t *id, const char *key, const char **val)
317 {
318  if (!id || !key || !val) LOG_RETURN_E_NULL();
320  hpd_error_t rc;
321  hpd_device_t *device;
322  if ((rc = discovery_find_device(id, &device))) return rc;
323  return discovery_get_device_attr(device, key, val);
324 }
325 
327 {
328  if (!id) LOG_RETURN_E_NULL();
330  hpd_error_t rc;
331  hpd_device_t *device;
332  if ((rc = discovery_find_device(id, &device))) return rc;
333 
334  va_list vp;
335  va_start(vp, id);
336  rc = discovery_get_device_attrs_v(device, vp);
337  va_end(vp);
338 
339  return rc;
340 }
341 
343 {
344  if (!id || !pair) LOG_RETURN_E_NULL();
346 
347  hpd_error_t rc;
348  hpd_device_t *device;
349  if ((rc = discovery_find_device(id, &device))) return rc;
350 
351  return discovery_first_device_attr(device, pair);
352 }
353 
355 {
356  if (!pair || !(*pair)) LOG_RETURN_E_NULL();
357 
358  return discovery_next_device_attr(pair);
359 }
360 
361 hpd_error_t hpd_service_alloc(hpd_service_t **service, const char *id)
362 {
363  if (!service || !id) LOG_RETURN_E_NULL();
364  return discovery_alloc_service(service, id);
365 }
366 
368 {
369  if (!service) LOG_RETURN_E_NULL();
370  return discovery_free_service(service);
371 }
372 
374 {
375  if (!device || !service) LOG_RETURN_E_NULL();
376  if (!discovery_is_service_id_unique(device, service))
377  LOG_RETURN(HPD_E_NOT_UNIQUE, "Service ids must be unique within the device.");
378  return discovery_attach_service(device, service);
379 }
380 
382 {
383  if (!id || !service) LOG_RETURN_E_NULL();
385  hpd_error_t rc;
386  hpd_service_t *s;
387  if ((rc = discovery_find_service(id, &s))) return rc;
388  if ((rc = discovery_detach_service(s))) return rc;
389  (*service) = s;
390  return HPD_E_SUCCESS;
391 }
392 
394 {
395  if (!service) LOG_RETURN_E_NULL();
396  return discovery_set_service_data(service, data, on_free);
397 }
398 
399 hpd_error_t hpd_service_set_attr(hpd_service_t *service, const char *key, const char *val)
400 {
401  if (!service || !key) LOG_RETURN_E_NULL();
402  if (key[0] == '_') LOG_RETURN(HPD_E_ARGUMENT, "Keys starting with '_' is reserved for generated attributes");
403  return discovery_set_service_attr(service, key, val);
404 }
405 
407 {
408  if (!service) LOG_RETURN_E_NULL();
409 
410  va_list vp;
411  va_start(vp, service);
412  hpd_error_t rc = discovery_set_service_attrs_v(service, vp);
413  va_end(vp);
414 
415  return rc;
416 }
417 
419 {
420  if (!service || !action) LOG_RETURN_E_NULL();
421  if (method <= HPD_M_NONE || method >= HPD_M_COUNT)
422  LOG_RETURN(HPD_E_ARGUMENT, "Unknown method given to %s().", __func__);
423  return discovery_set_service_action(service, method, action);
424 }
425 
427 {
428  if (!service) LOG_RETURN_E_NULL();
429 
430  va_list vp;
431  va_start(vp, service);
433  va_end(vp);
434 
435  return rc;
436 }
437 
439 {
440  if (!id || !data) LOG_RETURN_E_NULL();
442  hpd_error_t rc;
443  hpd_service_t *service;
444  if ((rc = discovery_find_service(id, &service))) return rc;
445  return discovery_get_service_data(service, data);
446 }
447 
448 hpd_error_t hpd_service_get_id(const hpd_service_id_t *sid, const char **id)
449 {
450  if (!sid || !id) LOG_RETURN_E_NULL();
452  hpd_error_t rc;
453  hpd_service_t *service;
454  if ((rc = discovery_find_service(sid, &service))) return rc;
455  return discovery_get_service_id(service, id);
456 }
457 
458 hpd_error_t hpd_service_get_attr(const hpd_service_id_t *id, const char *key, const char **val)
459 {
460  if (!id || !key || !val) LOG_RETURN_E_NULL();
462  hpd_error_t rc;
463  hpd_service_t *service;
464  if ((rc = discovery_find_service(id, &service))) return rc;
465  return discovery_get_service_attr(service, key, val);
466 }
467 
469 {
470  if (!id) LOG_RETURN_E_NULL();
472  hpd_error_t rc;
473  hpd_service_t *service;
474  if ((rc = discovery_find_service(id, &service))) return rc;
475 
476  va_list vp;
477  va_start(vp, id);
478  rc = discovery_get_service_attrs_v(service, vp);
479  va_end(vp);
480 
481  return rc;
482 }
483 
485 {
486  if (!id || !boolean) LOG_RETURN_E_NULL();
487  if (method <= HPD_M_NONE || method >= HPD_M_COUNT) LOG_RETURN(HPD_E_ARGUMENT, "Unknown method given to %s().", __func__);
488  if (!id->device.adapter.hpd->configuration)
490  hpd_error_t rc;
491  hpd_service_t *service;
492  if ((rc = discovery_find_service(id, &service))) return rc;
493  (*boolean) = discovery_has_service_action(service, method);
494  return HPD_E_SUCCESS;
495 }
496 
498 {
499  if (!id || !action) LOG_RETURN_E_NULL();
501  hpd_error_t rc;
502  hpd_service_t *service;
503  if ((rc = discovery_find_service(id, &service))) return rc;
504  return discovery_first_action_in_service(service, action);
505 }
506 
508 {
509  if (!action || !(*action)) LOG_RETURN_E_NULL();
510  return discovery_next_action_in_service(action);
511 }
512 
514 {
515  if (!id || !pair) LOG_RETURN_E_NULL();
517 
518  hpd_error_t rc;
519  hpd_service_t *service;
520  if ((rc = discovery_find_service(id, &service))) return rc;
521 
522  return discovery_first_service_attr(service, pair);
523 }
524 
526 {
527  if (!pair || !(*pair)) LOG_RETURN_E_NULL();
528 
529  return discovery_next_service_attr(pair);
530 }
531 
532 hpd_error_t hpd_parameter_alloc(hpd_parameter_t **parameter, const char *id)
533 {
534  if (!parameter || !id) LOG_RETURN_E_NULL();
535  return discovery_alloc_parameter(parameter, id);
536 }
537 
539 {
540  if (!parameter) LOG_RETURN_E_NULL();
541  return discovery_free_parameter(parameter);
542 }
543 
545 {
546  if (!service || !parameter) LOG_RETURN_E_NULL();
547  if (!discovery_is_parameter_id_unique(service, parameter))
548  LOG_RETURN(HPD_E_NOT_UNIQUE, "Parameter ids must be unique within the service.");
549  return discovery_attach_parameter(service, parameter);
550 }
551 
553 {
554  if (!id || !parameter) LOG_RETURN_E_NULL();
556  hpd_error_t rc;
557  hpd_parameter_t *p;
558  if ((rc = discovery_find_parameter(id, &p))) return rc;
559  if ((rc = discovery_detach_parameter(p))) return rc;
560  (*parameter) = p;
561  return HPD_E_SUCCESS;
562 }
563 
564 hpd_error_t hpd_parameter_set_attr(hpd_parameter_t *parameter, const char *key, const char *val)
565 {
566  if (!parameter || !key) LOG_RETURN_E_NULL();
567  if (key[0] == '_') LOG_RETURN(HPD_E_ARGUMENT, "Keys starting with '_' is reserved for generated attributes");
568  return discovery_set_parameter_attr(parameter, key, val);
569 }
570 
572 {
573  if (!parameter) LOG_RETURN_E_NULL();
574 
575  va_list vp;
576  va_start(vp, parameter);
577  hpd_error_t rc = discovery_set_parameter_attrs_v(parameter, vp);
578  va_end(vp);
579 
580  return rc;
581 }
582 
584 {
585  if (!pid || !id) LOG_RETURN_E_NULL();
587  hpd_error_t rc;
588  hpd_parameter_t *parameter;
589  if ((rc = discovery_find_parameter(pid, &parameter))) return rc;
590  return discovery_get_parameter_id(parameter, id);
591 }
592 
593 hpd_error_t hpd_parameter_get_attr(const hpd_parameter_id_t *id, const char *key, const char **val)
594 {
595  if (!id || !key || !val) LOG_RETURN_E_NULL();
597  hpd_error_t rc;
598  hpd_parameter_t *parameter;
599  if ((rc = discovery_find_parameter(id, &parameter))) return rc;
600  return discovery_get_parameter_attr(parameter, key, val);
601 }
602 
604 {
605  if (!id) LOG_RETURN_E_NULL();
607  hpd_error_t rc;
608  hpd_parameter_t *parameter;
609  if ((rc = discovery_find_parameter(id, &parameter))) return rc;
610 
611  va_list vp;
612  va_start(vp, id);
613  rc = discovery_get_parameter_attrs_v(parameter, vp);
614  va_end(vp);
615 
616  return rc;
617 }
618 
620 {
621  if (!id || !pair) LOG_RETURN_E_NULL();
623 
624  hpd_error_t rc;
625  hpd_parameter_t *parameter;
626  if ((rc = discovery_find_parameter(id, &parameter))) return rc;
627 
628  return discovery_first_parameter_attr(parameter, pair);
629 }
630 
632 {
633  if (!pair || !(*pair)) LOG_RETURN_E_NULL();
634 
635  return discovery_next_parameter_attr(pair);
636 }
637 
639 {
640  if (!action || !method) LOG_RETURN_E_NULL();
641  return discovery_get_action_method(action, method);
642 }
643 
645 {
646  if (!aid || !hpd) LOG_RETURN_E_NULL();
647  return discovery_get_adapter_hpd(aid, hpd);
648 }
649 
651 {
652  if (!did || !hpd) LOG_RETURN_E_NULL();
653  return discovery_get_device_hpd(did, hpd);
654 }
655 
657 {
658  if (!did || !aid) LOG_RETURN_E_NULL();
659  return discovery_get_device_adapter(did, aid);
660 }
661 
663 {
664  if (!sid || !hpd) LOG_RETURN_E_NULL();
665  return discovery_get_service_hpd(sid, hpd);
666 }
667 
669 {
670  if (!sid || !aid) LOG_RETURN_E_NULL();
671  return discovery_get_service_adapter(sid, aid);
672 }
673 
675 {
676  if (!sid || !did) LOG_RETURN_E_NULL();
677  return discovery_get_service_device(sid, did);
678 }
679 
681 {
682  if (!pid || !hpd) LOG_RETURN_E_NULL();
683  return discovery_get_parameter_hpd(pid, hpd);
684 }
685 
687 {
688  if (!pid || !aid) LOG_RETURN_E_NULL();
689  return discovery_get_parameter_adapter(pid, aid);
690 }
691 
693 {
694  if (!pid || !did) LOG_RETURN_E_NULL();
695  return discovery_get_parameter_device(pid, did);
696 }
697 
699 {
700  if (!pid || !sid) LOG_RETURN_E_NULL();
701  return discovery_get_parameter_service(pid, sid);
702 }
703 
705 {
706  if (!hpd || !adapter_id) LOG_RETURN_E_NULL();
708 
709  hpd_error_t rc;
710  hpd_adapter_t *adapter;
711  if ((rc = discovery_first_hpd_adapter(hpd, &adapter))) return rc;
712 
713  if (!adapter) {
714  (*adapter_id) = NULL;
715  return HPD_E_SUCCESS;
716  }
717 
718  return discovery_alloc_aid(adapter_id, hpd, adapter->id);
719 }
720 
722 {
723  if (!hpd || !device_id) LOG_RETURN_E_NULL();
725 
726  hpd_error_t rc;
727  hpd_device_t *device;
728  if ((rc = discovery_first_hpd_device(hpd, &device))) return rc;
729 
730  if (!device) {
731  (*device_id) = NULL;
732  return HPD_E_SUCCESS;
733  }
734 
735  hpd_adapter_t *adapter = device->adapter;
736  return discovery_alloc_did(device_id, hpd, adapter->id, device->id);
737 }
738 
740 {
741  if (!hpd || !service_id) LOG_RETURN_E_NULL();
743 
744  hpd_error_t rc;
745  hpd_service_t *service;
746  if ((rc = discovery_first_hpd_service(hpd, &service))) return rc;
747 
748  if (!service) {
749  (*service_id) = NULL;
750  return HPD_E_SUCCESS;
751  }
752 
753  hpd_device_t *device = service->device;
754  hpd_adapter_t *adapter = device->adapter;
755  return discovery_alloc_sid(service_id, hpd, adapter->id, device->id, service->id);
756 }
757 
759 {
760  if (!adapter_id || !device_id) LOG_RETURN_E_NULL();
761  if (!adapter_id->hpd->configuration) LOG_RETURN_HPD_STOPPED();
762 
763  hpd_error_t rc;
764  hpd_adapter_t *adapter;
765  if ((rc = discovery_find_adapter(adapter_id, &adapter))) return rc;
766 
767  hpd_device_t *device;
768  if ((rc = discovery_first_adapter_device(adapter, &device))) return rc;
769 
770  if (!device) {
771  (*device_id) = NULL;
772  return HPD_E_SUCCESS;
773  }
774 
775  hpd_t *hpd = adapter->configuration->hpd;
776  return discovery_alloc_did(device_id, hpd, adapter->id, device->id);
777 }
778 
780 {
781  if (!adapter_id || !service_id) LOG_RETURN_E_NULL();
782  if (!adapter_id->hpd->configuration) LOG_RETURN_HPD_STOPPED();
783 
784  hpd_error_t rc;
785  hpd_adapter_t *adapter;
786  if ((rc = discovery_find_adapter(adapter_id, &adapter))) return rc;
787 
788  hpd_service_t *service;
789  if ((rc = discovery_first_adapter_service(adapter, &service))) return rc;
790 
791  if (!service) {
792  (*service_id) = NULL;
793  return HPD_E_SUCCESS;
794  }
795 
796  hpd_t *hpd = adapter->configuration->hpd;
797  hpd_device_t *device = service->device;
798  return discovery_alloc_sid(service_id, hpd, adapter->id, device->id, service->id);
799 }
800 
802 {
803  if (!device_id || !service_id) LOG_RETURN_E_NULL();
804  if (!device_id->adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
805 
806  hpd_error_t rc;
807  hpd_device_t *device;
808  if ((rc = discovery_find_device(device_id, &device))) return rc;
809 
810  hpd_service_t *service;
811  if ((rc = discovery_first_device_service(device, &service))) return rc;
812 
813  if (!service) {
814  (*service_id) = NULL;
815  return HPD_E_SUCCESS;
816  }
817 
818  hpd_adapter_t *adapter = device->adapter;
819  hpd_t *hpd = adapter->configuration->hpd;
820  return discovery_alloc_sid(service_id, hpd, adapter->id, device->id, service->id);
821 }
822 
824 {
825  if (!service_id || !parameter_id) LOG_RETURN_E_NULL();
827 
828  hpd_error_t rc;
829  hpd_service_t *service;
830  if ((rc = discovery_find_service(service_id, &service))) return rc;
831 
832  hpd_parameter_t *parameter;
833  if ((rc = discovery_first_service_parameter(service, &parameter))) return rc;
834 
835  if (!parameter) {
836  (*parameter_id) = NULL;
837  return HPD_E_SUCCESS;
838  }
839 
840  hpd_device_t *device = service->device;
841  hpd_adapter_t *adapter = device->adapter;
842  hpd_t *hpd = adapter->configuration->hpd;
843  return discovery_alloc_pid(parameter_id, hpd, adapter->id, device->id, service->id, parameter->id);
844 }
845 
846 
848 {
849  if (!adapter_id || !(*adapter_id)) LOG_RETURN_E_NULL();
850  if (!(*adapter_id)->hpd->configuration) LOG_RETURN_HPD_STOPPED();
851 
852  hpd_error_t rc;
853  hpd_adapter_t *adapter;
854  if ((rc = discovery_find_adapter(*adapter_id, &adapter))) return rc;
855 
856  if ((rc = discovery_next_hpd_adapter(&adapter))) return rc;
857 
858  if (!adapter) {
859  discovery_free_aid(*adapter_id);
860  *adapter_id = NULL;
861  return HPD_E_SUCCESS;
862  }
863 
864  hpd_t *hpd = adapter->configuration->hpd;
865  if ((rc = discovery_set_aid(*adapter_id, hpd, adapter->id))) {
866  discovery_free_aid(*adapter_id);
867  *adapter_id = NULL;
868  }
869  return rc;
870 }
871 
873 {
874  if (!device_id || !(*device_id)) LOG_RETURN_E_NULL();
875  if (!(*device_id)->adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
876 
877  hpd_error_t rc;
878  hpd_device_t *device;
879  if ((rc = discovery_find_device(*device_id, &device))) return rc;
880 
881  if ((rc = discovery_next_hpd_device(&device))) return rc;
882 
883  if (!device) {
884  discovery_free_did(*device_id);
885  *device_id = NULL;
886  return HPD_E_SUCCESS;
887  }
888 
889  hpd_adapter_t *adapter = device->adapter;
890  hpd_t *hpd = adapter->configuration->hpd;
891  if ((rc = discovery_set_did(*device_id, hpd, adapter->id, device->id))) {
892  discovery_free_did(*device_id);
893  *device_id = NULL;
894  }
895  return rc;
896 }
897 
899 {
900  if (!service_id || !(*service_id)) LOG_RETURN_E_NULL();
901  if (!(*service_id)->device.adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
902 
903  hpd_error_t rc;
904  hpd_service_t *service;
905  if ((rc = discovery_find_service(*service_id, &service))) return rc;
906 
907  if ((rc = discovery_next_hpd_service(&service))) return rc;
908 
909  if (!service) {
910  discovery_free_sid(*service_id);
911  *service_id = NULL;
912  return HPD_E_SUCCESS;
913  }
914 
915  hpd_device_t *device = service->device;
916  hpd_adapter_t *adapter = device->adapter;
917  hpd_t *hpd = adapter->configuration->hpd;
918  if ((rc = discovery_set_sid(*service_id, hpd, adapter->id, device->id, service->id))) {
919  discovery_free_sid(*service_id);
920  *service_id = NULL;
921  }
922  return rc;
923 }
924 
926 {
927  if (!device_id || !(*device_id)) LOG_RETURN_E_NULL();
928  if (!(*device_id)->adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
929 
930  hpd_error_t rc;
931  hpd_device_t *device;
932  if ((rc = discovery_find_device(*device_id, &device))) return rc;
933 
934  if ((rc = discovery_next_adapter_device(&device))) return rc;
935 
936  if (!device) {
937  discovery_free_did(*device_id);
938  *device_id = NULL;
939  return HPD_E_SUCCESS;
940  }
941 
942  hpd_adapter_t *adapter = device->adapter;
943  hpd_t *hpd = adapter->configuration->hpd;
944  if ((rc = discovery_set_did(*device_id, hpd, adapter->id, device->id))) {
945  discovery_free_did(*device_id);
946  *device_id = NULL;
947  }
948  return rc;
949 }
950 
952 {
953  if (!service_id || !(*service_id)) LOG_RETURN_E_NULL();
954  if (!(*service_id)->device.adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
955 
956  hpd_error_t rc;
957  hpd_service_t *service;
958  if ((rc = discovery_find_service(*service_id, &service))) return rc;
959 
960  if ((rc = discovery_next_adapter_service(&service))) return rc;
961 
962  if (!service) {
963  discovery_free_sid(*service_id);
964  *service_id = NULL;
965  return HPD_E_SUCCESS;
966  }
967 
968  hpd_device_t *device = service->device;
969  hpd_adapter_t *adapter = device->adapter;
970  hpd_t *hpd = adapter->configuration->hpd;
971  if ((rc = discovery_set_sid(*service_id, hpd, adapter->id, device->id, service->id))) {
972  discovery_free_sid(*service_id);
973  *service_id = NULL;
974  }
975  return rc;
976 }
977 
979 {
980  if (!service_id || !(*service_id)) LOG_RETURN_E_NULL();
981  if (!(*service_id)->device.adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
982 
983  hpd_error_t rc;
984  hpd_service_t *service;
985  if ((rc = discovery_find_service(*service_id, &service))) return rc;
986 
987  if ((rc = discovery_next_device_service(&service))) return rc;
988 
989  if (!service) {
990  discovery_free_sid(*service_id);
991  *service_id = NULL;
992  return HPD_E_SUCCESS;
993  }
994 
995  hpd_device_t *device = service->device;
996  hpd_adapter_t *adapter = device->adapter;
997  hpd_t *hpd = adapter->configuration->hpd;
998  if ((rc = discovery_set_sid(*service_id, hpd, adapter->id, device->id, service->id))) {
999  discovery_free_sid(*service_id);
1000  *service_id = NULL;
1001  }
1002  return rc;
1003 }
1004 
1006 {
1007  if (!parameter_id || !(*parameter_id)) LOG_RETURN_E_NULL();
1008  if (!(*parameter_id)->service.device.adapter.hpd->configuration) LOG_RETURN_HPD_STOPPED();
1009 
1010  hpd_error_t rc;
1011  hpd_parameter_t *parameter;
1012  if ((rc = discovery_find_parameter(*parameter_id, &parameter))) return rc;
1013 
1014  if ((rc = discovery_next_service_parameter(&parameter))) return rc;
1015 
1016  if (!parameter) {
1017  discovery_free_pid(*parameter_id);
1018  *parameter_id = NULL;
1019  return HPD_E_SUCCESS;
1020  }
1021 
1022  hpd_service_t *service = parameter->service;
1023  hpd_device_t *device = service->device;
1024  hpd_adapter_t *adapter = device->adapter;
1025  hpd_t *hpd = adapter->configuration->hpd;
1026  if ((rc = discovery_set_pid(*parameter_id, hpd, adapter->id, device->id, service->id, parameter->id))) {
1027  discovery_free_pid(*parameter_id);
1028  *parameter_id = NULL;
1029  }
1030  return rc;
1031 }
1032 
1033 
1034 
1035 
1036 
1037 
1038 
1039 
1040 
1041 
1042 
1043 
1044 
1045 
1046 
hpd_error_t hpd_device_id_copy(hpd_device_id_t **dst, const hpd_device_id_t *src)
Definition: discovery_api.c:58
hpd_device_id_t device
Definition: discovery.h:49
hpd_error_t hpd_first_service(hpd_t *hpd, hpd_service_id_t **service_id)
hpd_device_t * device
Definition: model.h:92
hpd_error_t discovery_set_service_attr(hpd_service_t *service, const char *key, const char *val)
Definition: discovery.c:472
hpd_error_t discovery_get_parameter_attr(hpd_parameter_t *parameter, const char *key, const char **val)
Definition: discovery.c:375
hpd_error_t discovery_get_parameter_device(const hpd_parameter_id_t *pid, hpd_device_id_t **did)
Definition: discovery_id.c:307
void(* hpd_free_f)(void *data)
[hpd_action_f]
Definition: hpd_types.h:187
hpd_error_t discovery_next_adapter_device(hpd_device_t **device)
Definition: discovery.c:733
char * id
Definition: model.h:70
#define LOG_RETURN_E_NULL()
Definition: log.h:50
hpd_error_t discovery_set_aid(hpd_adapter_id_t *id, hpd_t *hpd, const char *aid)
HPD_E_ALLOC: id might be partially updated.
Definition: discovery_id.c:37
hpd_error_t hpd_parameter_get_hpd(const hpd_parameter_id_t *pid, hpd_t **hpd)
hpd_error_t discovery_set_service_actions_v(hpd_service_t *service, va_list vp)
Definition: discovery.c:543
hpd_error_t hpd_service_id_copy(hpd_service_id_t **dst, const hpd_service_id_t *src)
Definition: discovery_api.c:76
hpd_error_t discovery_free_service(hpd_service_t *service)
Definition: discovery.c:154
hpd_error_t discovery_free_adapter(hpd_adapter_t *adapter)
Definition: discovery.c:120
hpd_error_t discovery_find_service(const hpd_service_id_t *id, hpd_service_t **service)
Definition: discovery_id.c:251
hpd_error_t hpd_device_alloc(hpd_device_t **device, const char *id)
A note on reusing IDs: An other module or remote client may have outstanding references to the old ID...
hpd_error_t hpd_device_get_id(const hpd_device_id_t *did, const char **id)
[hpd_adapter_t functions]
hpd_error_t hpd_device_set_data(hpd_device_t *device, void *data, hpd_free_f on_free)
hpd_error_t discovery_alloc_device(hpd_device_t **device, const char *id)
Definition: discovery.c:55
hpd_error_t discovery_set_adapter_data(hpd_adapter_t *adapter, void *data, hpd_free_f on_free)
Definition: discovery.c:438
hpd_error_t discovery_next_device_attr(hpd_pair_t **pair)
Definition: discovery.c:667
hpd_error_t discovery_attach_service(hpd_device_t *device, hpd_service_t *service)
Definition: discovery.c:235
hpd_error_t discovery_set_service_data(hpd_service_t *service, void *data, hpd_free_f on_free)
Definition: discovery.c:454
hpd_error_t hpd_device_get_data(const hpd_device_id_t *id, void **data)
char * id
Definition: model.h:107
hpd_error_t discovery_free_device(hpd_device_t *device)
Definition: discovery.c:137
hpd_error_t hpd_service_alloc(hpd_service_t **service, const char *id)
[hpd_device_t functions]
hpd_error_t hpd_action_get_method(const hpd_action_t *action, hpd_method_t *method)
[model foreach loops]
hpd_error_t hpd_adapter_get_data(const hpd_adapter_id_t *id, void **data)
hpd_error_t discovery_get_adapter_hpd(const hpd_adapter_id_t *aid, hpd_t **hpd)
Definition: discovery_id.c:263
hpd_error_t discovery_first_hpd_adapter(hpd_t *hpd, hpd_adapter_t **adapter)
Definition: discovery.c:585
hpd_error_t discovery_copy_sid(hpd_service_id_t **dst, const hpd_service_id_t *src)
Definition: discovery_id.c:160
hpd_error_t hpd_adapter_set_attr(hpd_adapter_t *adapter, const char *key, const char *val)
hpd_error_t discovery_set_adapter_attr(hpd_adapter_t *adapter, const char *key, const char *val)
Definition: discovery.c:462
hpd_error_t discovery_get_device_hpd(const hpd_device_id_t *did, hpd_t **hpd)
Definition: discovery_id.c:269
hpd_error_t hpd_service_get_id(const hpd_service_id_t *sid, const char **id)
[hpd_device_t functions]
hpd_error_t hpd_service_next_attr(hpd_pair_t **pair)
hpd_error_t discovery_first_adapter_attr(hpd_adapter_t *adapter, hpd_pair_t **pair)
Definition: discovery.c:565
hpd_error_t hpd_service_has_action(const hpd_service_id_t *id, const hpd_method_t method, hpd_bool_t *boolean)
hpd_error_t hpd_parameter_get_attrs(const hpd_parameter_id_t *id,...)
hpd_error_t discovery_get_adapter_id(hpd_adapter_t *adapter, const char **id)
Definition: discovery.c:336
hpd_error_t discovery_alloc_sid(hpd_service_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid)
Definition: discovery_id.c:119
hpd_error_t hpd_adapter_id_free(hpd_adapter_id_t *id)
Definition: discovery_api.c:46
#define LOG_RETURN_HPD_STOPPED()
Definition: log.h:53
hpd_bool_t discovery_is_service_id_unique(hpd_device_t *device, hpd_service_t *service)
Definition: discovery.c:789
hpd_error_t hpd_next_adapter(hpd_adapter_id_t **adapter_id)
hpd_error_t discovery_detach_device(hpd_device_t *device)
Definition: discovery.c:288
hpd_service_id_t service
Definition: discovery.h:54
Definition: map.c:34
hpd_error_t hpd_next_service(hpd_service_id_t **service_id)
hpd_error_t hpd_service_get_hpd(const hpd_service_id_t *sid, hpd_t **hpd)
hpd_error_t hpd_service_first_parameter(const hpd_service_id_t *service_id, hpd_parameter_id_t **parameter_id)
hpd_error_t discovery_get_device_attr(hpd_device_t *device, const char *key, const char **val)
Definition: discovery.c:365
hpd_error_t hpd_adapter_id_copy(hpd_adapter_id_t **dst, const hpd_adapter_id_t *src)
Definition: discovery_api.c:40
hpd_error_t hpd_adapter_alloc(hpd_adapter_t **adapter, const char *id)
[hpd_adapter_t functions]
hpd_error_t hpd_device_id_free(hpd_device_id_t *id)
Definition: discovery_api.c:64
hpd_error_t hpd_service_get_attrs(const hpd_service_id_t *id,...)
hpd_error_t discovery_free_parameter(hpd_parameter_t *parameter)
Definition: discovery.c:172
hpd_error_t discovery_get_device_adapter(const hpd_device_id_t *did, hpd_adapter_id_t **aid)
Definition: discovery_id.c:275
hpd_error_t hpd_parameter_set_attrs(hpd_parameter_t *parameter,...)
hpd_error_t hpd_device_attach(const hpd_adapter_id_t *id, hpd_device_t *device)
hpd_error_t discovery_alloc_service(hpd_service_t **service, const char *id)
Definition: discovery.c:76
hpd_error_t hpd_service_free(hpd_service_t *service)
hpd_error_t hpd_service_set_attr(hpd_service_t *service, const char *key, const char *val)
hpd_error_t discovery_free_did(hpd_device_id_t *id)
Definition: discovery_id.c:178
hpd_t * hpd
Definition: discovery.h:39
hpd_error_t discovery_next_adapter_service(hpd_service_t **service)
Definition: discovery.c:739
hpd_error_t discovery_get_adapter_attrs_v(hpd_adapter_t *adapter, va_list vp)
Definition: discovery.c:380
hpd_error_t discovery_set_pid(hpd_parameter_id_t *id, hpd_t *hpd, const char *aid, const char *did, const char *sid, const char *pid)
HPD_E_ALLOC: id might be partially updated.
Definition: discovery_id.c:78
hpd_error_t discovery_set_service_action(hpd_service_t *service, const hpd_method_t method, hpd_action_f action)
Definition: discovery.c:482
hpd_error_t hpd_service_get_device(const hpd_service_id_t *sid, hpd_device_id_t **did)
hpd_error_t discovery_set_parameter_attr(hpd_parameter_t *parameter, const char *key, const char *val)
Definition: discovery.c:477
hpd_bool_t discovery_is_parameter_id_unique(hpd_service_t *service, hpd_parameter_t *parameter)
Definition: discovery.c:797
hpd_error_t hpd_device_get_attr(const hpd_device_id_t *id, const char *key, const char **val)
hpd_error_t hpd_device_set_attr(hpd_device_t *device, const char *key, const char *val)
hpd_error_t hpd_parameter_detach(const hpd_parameter_id_t *id, hpd_parameter_t **parameter)
hpd_error_t discovery_next_hpd_service(hpd_service_t **service)
Definition: discovery.c:704
hpd_error_t hpd_service_detach(const hpd_service_id_t *id, hpd_service_t **service)
hpd_error_t discovery_next_action_in_service(hpd_action_t **action)
Definition: discovery.c:648
hpd_error_t discovery_find_parameter(const hpd_parameter_id_t *id, hpd_parameter_t **parameter)
Definition: discovery_id.c:257
hpd_error_t discovery_first_device_attr(hpd_device_t *device, hpd_pair_t **pair)
Definition: discovery.c:570
hpd_error_t hpd_service_get_data(const hpd_service_id_t *id, void **data)
hpd_error_t hpd_adapter_set_attrs(hpd_adapter_t *adapter,...)
hpd_error_t discovery_next_hpd_device(hpd_device_t **device)
Definition: discovery.c:688
hpd_bool_t discovery_has_service_action(hpd_service_t *service, const hpd_method_t method)
Definition: discovery.c:768
hpd_error_t discovery_alloc_parameter(hpd_parameter_t **parameter, const char *id)
Definition: discovery.c:101
hpd_error_t discovery_first_action_in_service(hpd_service_t *service, hpd_action_t **action)
Definition: discovery.c:559
hpd_error_t hpd_device_detach(const hpd_device_id_t *id, hpd_device_t **device)
hpd_error_t discovery_set_adapter_attrs_v(hpd_adapter_t *adapter, va_list vp)
Definition: discovery.c:491
hpd_error_t discovery_alloc_aid(hpd_adapter_id_t **id, hpd_t *hpd, const char *aid)
Definition: discovery_id.c:89
hpd_error_t hpd_first_adapter(hpd_t *hpd, hpd_adapter_id_t **adapter_id)
hpd_error_t hpd_parameter_id_copy(hpd_parameter_id_t **dst, const hpd_parameter_id_t *src)
Definition: discovery_api.c:96
hpd_error_t hpd_first_device(hpd_t *hpd, hpd_device_id_t **device_id)
hpd_error_t hpd_device_set_attrs(hpd_device_t *device,...)
hpd_error_t hpd_service_get_attr(const hpd_service_id_t *id, const char *key, const char **val)
hpd_error_t discovery_get_parameter_adapter(const hpd_parameter_id_t *pid, hpd_adapter_id_t **aid)
Definition: discovery_id.c:302
char * id
Definition: model.h:96
hpd_error_t hpd_device_first_attr(const hpd_device_id_t *id, hpd_pair_t **pair)
hpd_error_t discovery_set_device_attr(hpd_device_t *device, const char *key, const char *val)
Definition: discovery.c:467
hpd_error_t hpd_adapter_get_attrs(const hpd_adapter_id_t *id,...)
hpd_error_t hpd_device_get_attrs(const hpd_device_id_t *id,...)
hpd_error_t hpd_service_next_parameter(hpd_parameter_id_t **parameter_id)
hpd_error_t discovery_get_service_hpd(const hpd_service_id_t *sid, hpd_t **hpd)
Definition: discovery_id.c:280
hpd_error_t discovery_get_parameter_id(hpd_parameter_t *parameter, const char **id)
Definition: discovery.c:354
data key
hpd_error_t discovery_alloc_did(hpd_device_id_t **id, hpd_t *hpd, const char *aid, const char *did)
Definition: discovery_id.c:104
hpd_configuration_t * configuration
Definition: daemon.h:52
hpd_error_t discovery_attach_parameter(hpd_service_t *service, hpd_parameter_t *parameter)
Definition: discovery.c:259
hpd_error_t hpd_service_get_adapter(const hpd_service_id_t *sid, hpd_adapter_id_t **aid)
hpd_error_t discovery_set_device_data(hpd_device_t *device, void *data, hpd_free_f on_free)
Definition: discovery.c:446
hpd_error_t discovery_copy_did(hpd_device_id_t **dst, const hpd_device_id_t *src)
Definition: discovery_id.c:155
hpd_error_t hpd_adapter_next_device(hpd_device_id_t **device_id)
hpd_error_t hpd_adapter_set_data(hpd_adapter_t *adapter, void *data, hpd_free_f on_free)
hpd_error_t hpd_service_id_free(hpd_service_id_t *id)
Definition: discovery_api.c:82
hpd_error_t discovery_attach_device(hpd_adapter_t *adapter, hpd_device_t *device)
Definition: discovery.c:208
hpd_error_t discovery_next_device_service(hpd_service_t **service)
Definition: discovery.c:755
enum hpd_error hpd_error_t
Definition: hpd_types.h:167
hpd_error_t discovery_set_sid(hpd_service_id_t *id, hpd_t *hpd, const char *aid, const char *did, const char *sid)
HPD_E_ALLOC: id might be partially updated.
Definition: discovery_id.c:64
hpd_error_t hpd_parameter_free(hpd_parameter_t *parameter)
hpd_error_t hpd_adapter_free(hpd_adapter_t *adapter)
hpd_error_t discovery_get_service_device(const hpd_service_id_t *sid, hpd_device_id_t **did)
Definition: discovery_id.c:291
hpd_error_t hpd_adapter_detach(const hpd_adapter_id_t *id, hpd_adapter_t **adapter)
hpd_error_t hpd_service_attach(hpd_device_t *device, hpd_service_t *service)
hpd_error_t discovery_get_parameter_hpd(const hpd_parameter_id_t *pid, hpd_t **hpd)
Definition: discovery_id.c:296
hpd_error_t hpd_parameter_get_service(const hpd_parameter_id_t *pid, hpd_service_id_t **sid)
#define LOG_RETURN(E, FMT,...)
Definition: log.h:48
hpd_error_t hpd_device_get_adapter(const hpd_device_id_t *did, hpd_adapter_id_t **aid)
hpd_error_t discovery_find_device(const hpd_device_id_t *id, hpd_device_t **device)
Definition: discovery_id.c:245
hpd_error_t discovery_first_adapter_device(hpd_adapter_t *adapter, hpd_device_t **device)
Definition: discovery.c:618
hpd_error_t discovery_get_parameter_attrs_v(hpd_parameter_t *parameter, va_list vp)
Definition: discovery.c:419
hpd_error_t hpd_adapter_get_hpd(const hpd_adapter_id_t *aid, hpd_t **hpd)
[hpd_pair_t functions]
hpd_bool_t discovery_is_device_id_unique(hpd_adapter_t *adapter, hpd_device_t *device)
Definition: discovery.c:781
char hpd_bool_t
Definition: hpd_types.h:35
hpd_service_t * service
Definition: model.h:105
hpd_error_t hpd_device_id_alloc(hpd_device_id_t **id, hpd_t *hpd, const char *aid, const char *did)
Definition: discovery_api.c:52
hpd_error_t hpd_service_set_action(hpd_service_t *service, const hpd_method_t method, hpd_action_f action)
hpd_error_t discovery_set_service_attrs_v(hpd_service_t *service, va_list vp)
Definition: discovery.c:517
Definition: daemon.h:50
hpd_error_t discovery_find_adapter(const hpd_adapter_id_t *id, hpd_adapter_t **adapter)
Definition: discovery_id.c:239
hpd_error_t discovery_get_service_id(hpd_service_t *service, const char **id)
Definition: discovery.c:348
hpd_error_t discovery_get_device_data(hpd_device_t *device, void **data)
Definition: discovery.c:324
hpd_error_t discovery_detach_parameter(hpd_parameter_t *parameter)
Definition: discovery.c:310
hpd_bool_t discovery_is_adapter_id_unique(hpd_t *hpd, hpd_adapter_t *adapter)
Definition: discovery.c:773
hpd_error_t hpd_adapter_first_device(const hpd_adapter_id_t *adapter_id, hpd_device_id_t **device_id)
hpd_error_t discovery_set_parameter_attrs_v(hpd_parameter_t *parameter, va_list vp)
Definition: discovery.c:530
hpd_status_t(* hpd_action_f)(void *data, hpd_request_t *req)
[hpd_module_def_t functions]
Definition: hpd_types.h:183
hpd_error_t discovery_get_parameter_service(const hpd_parameter_id_t *pid, hpd_service_id_t **sid)
Definition: discovery_id.c:312
hpd_error_t discovery_alloc_adapter(hpd_adapter_t **adapter, const char *id)
Definition: discovery.c:34
hpd_error_t hpd_adapter_id_alloc(hpd_adapter_id_t **id, hpd_t *hpd, const char *aid)
[log functions]
Definition: discovery_api.c:34
hpd_error_t hpd_adapter_first_service(const hpd_adapter_id_t *adapter_id, hpd_service_id_t **service_id)
hpd_error_t discovery_get_adapter_data(hpd_adapter_t *adapter, void **data)
Definition: discovery.c:318
hpd_error_t hpd_device_next_attr(hpd_pair_t **pair)
hpd_error_t discovery_detach_service(hpd_service_t *service)
Definition: discovery.c:302
hpd_error_t hpd_next_device(hpd_device_id_t **device_id)
hpd_error_t discovery_first_hpd_device(hpd_t *hpd, hpd_device_t **device)
Definition: discovery.c:591
hpd_error_t discovery_free_pid(hpd_parameter_id_t *id)
Definition: discovery_id.c:195
hpd_error_t discovery_copy_pid(hpd_parameter_id_t **dst, const hpd_parameter_id_t *src)
Definition: discovery_id.c:165
hpd_error_t discovery_free_aid(hpd_adapter_id_t *id)
Definition: discovery_id.c:171
hpd_error_t discovery_next_parameter_attr(hpd_pair_t **pair)
Definition: discovery.c:677
hpd_error_t hpd_service_set_attrs(hpd_service_t *service,...)
hpd_error_t discovery_set_did(hpd_device_id_t *id, hpd_t *hpd, const char *aid, const char *did)
HPD_E_ALLOC: id might be partially updated.
Definition: discovery_id.c:50
hpd_error_t hpd_parameter_alloc(hpd_parameter_t **parameter, const char *id)
[hpd_service_t functions]
hpd_error_t discovery_first_service_attr(hpd_service_t *service, hpd_pair_t **pair)
Definition: discovery.c:575
hpd_error_t discovery_get_service_attr(hpd_service_t *service, const char *key, const char **val)
Definition: discovery.c:370
hpd_error_t hpd_adapter_get_id(const hpd_adapter_id_t *aid, const char **id)
[id_t functions]
hpd_error_t discovery_alloc_pid(hpd_parameter_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid, const char *pid)
Definition: discovery_id.c:134
hpd_error_t hpd_adapter_first_attr(const hpd_adapter_id_t *id, hpd_pair_t **pair)
char * id
Definition: model.h:83
hpd_error_t hpd_parameter_get_id(const hpd_parameter_id_t *pid, const char **id)
[hpd_service_t functions]
hpd_error_t discovery_set_device_attrs_v(hpd_device_t *device, va_list vp)
Definition: discovery.c:504
hpd_error_t hpd_service_id_alloc(hpd_service_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid)
Definition: discovery_api.c:70
hpd_t * hpd
Definition: model.h:61
hpd_error_t discovery_next_hpd_adapter(hpd_adapter_t **adapter)
Definition: discovery.c:682
hpd_error_t hpd_service_set_actions(hpd_service_t *service,...)
hpd_error_t hpd_parameter_set_attr(hpd_parameter_t *parameter, const char *key, const char *val)
hpd_error_t hpd_service_first_action(const hpd_service_id_t *id, hpd_action_t **action)
hpd_error_t discovery_first_service_parameter(hpd_service_t *service, hpd_parameter_t **parameter)
Definition: discovery.c:642
hpd_error_t hpd_parameter_first_attr(const hpd_parameter_id_t *id, hpd_pair_t **pair)
hpd_error_t discovery_attach_adapter(hpd_t *hpd, hpd_adapter_t *adapter)
Definition: discovery.c:181
hpd_error_t hpd_parameter_id_free(hpd_parameter_id_t *id)
hpd_error_t hpd_parameter_next_attr(hpd_pair_t **pair)
hpd_error_t discovery_get_adapter_attr(hpd_adapter_t *adapter, const char *key, const char **val)
Definition: discovery.c:360
hpd_configuration_t * configuration
Definition: model.h:66
hpd_error_t discovery_first_hpd_service(hpd_t *hpd, hpd_service_t **service)
Definition: discovery.c:603
hpd_error_t hpd_adapter_attach(hpd_t *hpd, hpd_adapter_t *adapter)
hpd_error_t discovery_free_sid(hpd_service_id_t *id)
Definition: discovery_id.c:186
hpd_error_t discovery_first_parameter_attr(hpd_parameter_t *parameter, hpd_pair_t **pair)
Definition: discovery.c:580
hpd_error_t discovery_first_adapter_service(hpd_adapter_t *adapter, hpd_service_t **service)
Definition: discovery.c:624
hpd_error_t discovery_get_service_attrs_v(hpd_service_t *service, va_list vp)
Definition: discovery.c:406
hpd_error_t discovery_get_device_attrs_v(hpd_device_t *device, va_list vp)
Definition: discovery.c:393
hpd_error_t discovery_get_device_id(hpd_device_t *device, const char **id)
Definition: discovery.c:342
hpd_error_t discovery_next_service_attr(hpd_pair_t **pair)
Definition: discovery.c:672
hpd_error_t discovery_first_device_service(const hpd_device_t *device, hpd_service_t **service)
Definition: discovery.c:636
hpd_error_t hpd_device_next_service(hpd_service_id_t **service_id)
hpd_error_t hpd_parameter_attach(hpd_service_t *service, hpd_parameter_t *parameter)
hpd_error_t discovery_copy_aid(hpd_adapter_id_t **dst, const hpd_adapter_id_t *src)
Definition: discovery_id.c:150
hpd_error_t hpd_device_free(hpd_device_t *device)
hpd_error_t hpd_device_get_hpd(const hpd_device_id_t *did, hpd_t **hpd)
hpd_adapter_id_t adapter
Definition: discovery.h:44
enum hpd_method hpd_method_t
[hpd_log_level_t]
Definition: hpd_types.h:166
hpd_error_t hpd_parameter_get_attr(const hpd_parameter_id_t *id, const char *key, const char **val)
hpd_error_t hpd_parameter_id_alloc(hpd_parameter_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid, const char *pid)
Definition: discovery_api.c:89
hpd_error_t hpd_adapter_next_attr(hpd_pair_t **pair)
hpd_error_t discovery_get_service_data(hpd_service_t *service, void **data)
Definition: discovery.c:330
hpd_error_t hpd_device_first_service(const hpd_device_id_t *device_id, hpd_service_id_t **service_id)
hpd_error_t hpd_adapter_get_attr(const hpd_adapter_id_t *id, const char *key, const char **val)
hpd_error_t hpd_parameter_get_device(const hpd_parameter_id_t *pid, hpd_device_id_t **did)
hpd_error_t hpd_service_first_attr(const hpd_service_id_t *id, hpd_pair_t **pair)
hpd_adapter_t * adapter
Definition: model.h:79
hpd_error_t discovery_get_action_method(const hpd_action_t *action, hpd_method_t *method)
Definition: discovery.c:432
hpd_error_t discovery_detach_adapter(hpd_adapter_t *adapter)
Definition: discovery.c:274
hpd_error_t discovery_next_service_parameter(hpd_parameter_t **parameter)
Definition: discovery.c:761
hpd_error_t hpd_service_next_action(hpd_action_t **action)
hpd_error_t discovery_next_adapter_attr(hpd_pair_t **pair)
Definition: discovery.c:662
hpd_error_t hpd_adapter_next_service(hpd_service_id_t **service_id)
hpd_error_t discovery_get_service_adapter(const hpd_service_id_t *sid, hpd_adapter_id_t **aid)
Definition: discovery_id.c:286
hpd_error_t hpd_parameter_get_adapter(const hpd_parameter_id_t *pid, hpd_adapter_id_t **aid)
hpd_error_t hpd_service_set_data(hpd_service_t *service, void *data, hpd_free_f on_free)