HomePort
comm.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_COMM_H
29 #define HOMEPORT_COMM_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include "hpd/common/hpd_map.h"
36 
37 typedef struct hpd_listeners hpd_listeners_t;
38 
39 TAILQ_HEAD(hpd_listeners, hpd_listener);
40 
41 struct hpd_listener {
42  // Navigational members
45  // Data members
49  // User data
50  void *data;
52 };
53 
54 struct hpd_request {
58  // Callback and data for returning the response to sender
61  void *data;
62 };
63 
64 struct hpd_response {
68 };
69 
70 struct hpd_value {
72  char *body;
73  size_t len;
74 };
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif //HOMEPORT_COMM_H
enum hpd_status hpd_status_t
Definition: hpd_types.h:168
void(* hpd_free_f)(void *data)
[hpd_action_f]
Definition: hpd_types.h:187
hpd_response_f on_response
Definition: comm.h:59
hpd_device_f on_attach
Definition: comm.h:47
TAILQ_ENTRY(hpd_listener) HPD_TAILQ_FIELD
TAILQ_HEAD(hpd_listeners, hpd_listener)
hpd_free_f on_free
Definition: comm.h:60
hpd_value_t * value
Definition: comm.h:57
size_t len
Definition: comm.h:73
hpd_free_f on_free
Definition: comm.h:51
#define HPD_TAILQ_FIELD
Definition: hpd_queue.h:37
hpd_request_t * request
Definition: comm.h:65
void(* hpd_response_f)(void *data, const hpd_response_t *res)
[hpd_free_f]
Definition: hpd_types.h:192
hpd_t * hpd
Definition: comm.h:44
hpd_method_t method
Definition: comm.h:56
hpd_value_t * value
Definition: comm.h:67
Definition: comm.h:70
void(* hpd_device_f)(void *data, const hpd_device_id_t *device)
Device callback for listeners.
Definition: hpd_types.h:196
hpd_value_f on_change
Definition: comm.h:46
hpd_service_id_t * service
Definition: comm.h:55
Definition: daemon.h:50
struct hpd_listeners hpd_listeners_t
Definition: comm.h:37
char * body
Definition: comm.h:72
void * data
Definition: comm.h:61
void(* hpd_value_f)(void *data, const hpd_service_id_t *service, const hpd_value_t *val)
Value callback for listeners.
Definition: hpd_types.h:194
hpd_map_t * headers
Definition: comm.h:71
hpd_device_f on_detach
Definition: comm.h:48
enum hpd_method hpd_method_t
[hpd_log_level_t]
Definition: hpd_types.h:166
void * data
Definition: comm.h:50
struct hpd_map hpd_map_t
Definition: hpd_map.h:40
hpd_status_t status
Definition: comm.h:66