HomePort
model.h
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 #ifndef HOMEPORT_MODEL_H
29 #define HOMEPORT_MODEL_H
30 
31 #include "hpd/hpd_types.h"
32 #include "hpd/common/hpd_queue.h"
33 #include "hpd/common/hpd_map.h"
34 #include "comm.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
41 typedef struct hpd_adapters hpd_adapters_t;
42 typedef struct hpd_devices hpd_devices_t;
43 typedef struct hpd_services hpd_services_t;
44 typedef struct hpd_parameters hpd_parameters_t;
45 
46 TAILQ_HEAD(hpd_adapters, hpd_adapter);
47 TAILQ_HEAD(hpd_devices, hpd_device);
48 TAILQ_HEAD(hpd_services, hpd_service);
49 TAILQ_HEAD(hpd_parameters, hpd_parameter);
50 
51 struct hpd_action {
53  hpd_method_t method; //< Method
54  hpd_action_f action; //< Action
55 };
56 
58  // Navigational members
62 };
63 
64 struct hpd_adapter {
65  // Navigational members
69  // Data members
70  char *id;
72  // User data
74  void *data;
75 };
76 
77 struct hpd_device {
78  // Navigational members
80  TAILQ_ENTRY(hpd_device) HPD_TAILQ_FIELD;
81  hpd_services_t *services;
82  // Data members
83  char *id;
84  hpd_map_t *attributes;
85  // User data
86  hpd_free_f on_free;
87  void *data;
88 };
89 
90 struct hpd_service {
91  // Navigational members
93  TAILQ_ENTRY(hpd_service) HPD_TAILQ_FIELD;
94  hpd_parameters_t *parameters;
95  // Data members
96  char *id;
97  hpd_map_t *attributes;
99  // User data
100  hpd_free_f on_free;
101  void *data;
102 };
103 
106  TAILQ_ENTRY(hpd_parameter) HPD_TAILQ_FIELD;
107  char *id;
108  hpd_map_t *attributes;
109 };
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif //HOMEPORT_MODEL_H
hpd_device_t * device
Definition: model.h:92
void(* hpd_free_f)(void *data)
[hpd_action_f]
Definition: hpd_types.h:187
struct hpd_services hpd_services_t
Definition: model.h:43
struct hpd_adapters hpd_adapters_t
Definition: model.h:41
hpd_method_t method
Definition: model.h:53
struct hpd_devices hpd_devices_t
Definition: model.h:42
hpd_action_f action
Definition: model.h:54
#define HPD_TAILQ_FIELD
Definition: hpd_queue.h:37
hpd_listeners_t listeners
Definition: model.h:60
hpd_adapters_t adapters
Definition: model.h:59
TAILQ_ENTRY(hpd_adapter) HPD_TAILQ_FIELD
hpd_map_t * attributes
Definition: model.h:71
hpd_service_t * service
Definition: model.h:105
Definition: daemon.h:50
struct hpd_listeners hpd_listeners_t
Definition: comm.h:37
hpd_status_t(* hpd_action_f)(void *data, hpd_request_t *req)
[hpd_module_def_t functions]
Definition: hpd_types.h:183
struct hpd_parameters hpd_parameters_t
Definition: model.h:44
hpd_t * hpd
Definition: model.h:61
hpd_configuration_t * configuration
Definition: model.h:66
TAILQ_HEAD(hpd_adapters, hpd_adapter)
hpd_service_t * service
Definition: model.h:52
enum hpd_method hpd_method_t
[hpd_log_level_t]
Definition: hpd_types.h:166
hpd_adapter_t * adapter
Definition: model.h:79
hpd_devices_t * devices
Definition: model.h:68
struct hpd_map hpd_map_t
Definition: hpd_map.h:40
hpd_free_f on_free
Definition: model.h:73