28 #ifndef HOMEPORT_HPD_SHARED_API_H
29 #define HOMEPORT_HPD_SHARED_API_H
50 #define HPD_LOG_ERROR(CONTEXT, FMT, ...) hpd_logf((CONTEXT), HPD_L_ERROR, __FILE__, __LINE__, (FMT), ##__VA_ARGS__)
51 #define HPD_LOG_WARN(CONTEXT, FMT, ...) hpd_logf((CONTEXT), HPD_L_WARN , __FILE__, __LINE__, (FMT), ##__VA_ARGS__)
52 #define HPD_LOG_INFO(CONTEXT, FMT, ...) hpd_logf((CONTEXT), HPD_L_INFO , __FILE__, __LINE__, (FMT), ##__VA_ARGS__)
53 #define HPD_LOG_DEBUG(CONTEXT, FMT, ...) hpd_logf((CONTEXT), HPD_L_DEBUG, __FILE__, __LINE__, (FMT), ##__VA_ARGS__)
54 #define HPD_LOG_VERBOSE(CONTEXT, FMT, ...) hpd_logf((CONTEXT), HPD_L_VERBOSE, __FILE__, __LINE__, (FMT), ##__VA_ARGS__)
56 #define HPD_LOG_RETURN(CONTEXT, E, FMT, ...) do { HPD_LOG_DEBUG((CONTEXT), (FMT), ##__VA_ARGS__); return (E); } while(0)
57 #define HPD_LOG_RETURN_E_NULL(CONTEXT) HPD_LOG_RETURN((CONTEXT), HPD_E_NULL, "Unexpected null pointer.")
58 #define HPD_LOG_RETURN_E_ALLOC(CONTEXT) HPD_LOG_RETURN((CONTEXT), HPD_E_ALLOC, "Unable to allocate memory.")
60 #define HPD_LOG_RETURN_E_SNPRINTF(CONTEXT) HPD_LOG_RETURN((CONTEXT), HPD_E_UNKNOWN, "snprintf failed.")
117 #define hpd_service_foreach_action(RC, ACTION, ID) for ( \
118 (RC) = hpd_service_first_action((ID), &(ACTION)); \
120 (RC) = hpd_service_next_action(&(ACTION)))
121 #define hpd_adapter_foreach_attr(RC, PAIR, ID) for ( \
122 (RC) = hpd_adapter_first_attr((ID), &(PAIR)); \
124 (RC) = hpd_adapter_next_attr(&(PAIR)))
125 #define hpd_device_foreach_attr(RC, PAIR, ID) for ( \
126 (RC) = hpd_device_first_attr((ID), &(PAIR)); \
128 (RC) = hpd_device_next_attr(&(PAIR)))
129 #define hpd_service_foreach_attr(RC, PAIR, ID) for ( \
130 (RC) = hpd_service_first_attr((ID), &(PAIR)); \
132 (RC) = hpd_service_next_attr(&(PAIR)))
133 #define hpd_parameter_foreach_attr(RC, PAIR, ID) for ( \
134 (RC) = hpd_parameter_first_attr((ID), &(PAIR)); \
136 (RC) = hpd_parameter_next_attr(&(PAIR)))
178 #define hpd_foreach_adapter(RC, ADAPTER, HPD) for ( \
179 (RC) = hpd_first_adapter((HPD), &(ADAPTER)); \
180 !(RC) && (ADAPTER); \
181 (RC) = hpd_next_adapter(&(ADAPTER)))
182 #define hpd_foreach_device(RC, DEVICE, HPD) for ( \
183 (RC) = hpd_first_device((HPD), &(DEVICE)); \
185 (RC) = hpd_next_device(&(DEVICE)))
186 #define hpd_foreach_service(RC, SERVICE, HPD) for ( \
187 (RC) = hpd_first_service((HPD), &(SERVICE)); \
188 !(RC) && (SERVICE); \
189 (RC) = hpd_next_service(&(SERVICE)))
190 #define hpd_adapter_foreach_device(RC, DEVICE, ADAPTER) for ( \
191 (RC) = hpd_adapter_first_device((ADAPTER), &(DEVICE)); \
193 (RC) = hpd_adapter_next_device(&(DEVICE)))
194 #define hpd_adapter_foreach_service(RC, SERVICE, ADAPTER) for ( \
195 (RC) = hpd_adapter_first_service((ADAPTER), &(SERVICE)); \
196 !(RC) && (SERVICE); \
197 (RC) = hpd_adapter_next_service(&(SERVICE)))
198 #define hpd_device_foreach_service(RC, SERVICE, DEVICE) for ( \
199 (RC) = hpd_device_first_service((DEVICE), &(SERVICE)); \
200 !(RC) && (SERVICE); \
201 (RC) = hpd_device_next_service(&(SERVICE)))
202 #define hpd_service_foreach_parameter(RC, PARAMETER, SERVICE) for ( \
203 (RC) = hpd_service_first_parameter((SERVICE), &(PARAMETER)); \
204 !(RC) && (PARAMETER); \
205 (RC) = hpd_service_next_parameter(&(PARAMETER)))
225 #define hpd_value_foreach_header(RC, PAIR, VALUE) for ( \
226 (RC) = hpd_value_first_header((VALUE), &(PAIR)); \
228 (RC) = hpd_value_next_header(&(PAIR)))
235 #endif //HOMEPORT_HPD_SHARED_API_H
hpd_error_t hpd_adapter_first_device(const hpd_adapter_id_t *adapter_id, hpd_device_id_t **device_id)
hpd_error_t hpd_adapter_first_service(const hpd_adapter_id_t *adapter_id, hpd_service_id_t **service_id)
hpd_error_t hpd_value_set_headers(hpd_value_t *value,...)
hpd_error_t hpd_device_next_attr(hpd_pair_t **pair)
hpd_error_t hpd_next_device(hpd_device_id_t **device_id)
hpd_error_t hpd_service_get_attr(const hpd_service_id_t *id, const char *key, const char **val)
hpd_error_t hpd_adapter_get_attrs(const hpd_adapter_id_t *id,...)
hpd_error_t hpd_service_next_parameter(hpd_parameter_id_t **parameter_id)
hpd_error_t hpd_service_get_adapter(const hpd_service_id_t *sid, hpd_adapter_id_t **aid)
hpd_error_t hpd_adapter_first_attr(const hpd_adapter_id_t *id, hpd_pair_t **pair)
hpd_error_t hpd_service_id_alloc(hpd_service_id_t **id, hpd_t *hpd, const char *aid, const char *did, const char *sid)
hpd_error_t hpd_adapter_next_device(hpd_device_id_t **device_id)
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 hpd_value_alloc(hpd_value_t **value, const char *body, int len)
[Browsing foreach loops]
hpd_error_t hpd_module_add_option(const hpd_module_t *context, const char *name, const char *arg, int flags, const char *doc)
[hpd_t functions]
hpd_error_t hpd_value_vallocf(hpd_value_t **value, const char *fmt, va_list vp)
hpd_error_t hpd_value_get_body(const hpd_value_t *value, const char **body, size_t *len)
hpd_error_t hpd_parameter_get_service(const hpd_parameter_id_t *pid, hpd_service_id_t **sid)
hpd_error_t hpd_device_next_service(hpd_service_id_t **service_id)
enum hpd_log_level hpd_log_level_t
hpd_error_t hpd_device_id_alloc(hpd_device_id_t **id, hpd_t *hpd, const char *aid, const char *did)
hpd_error_t hpd_parameter_get_attr(const hpd_parameter_id_t *id, const char *key, const char **val)
hpd_error_t hpd_vlogf(const hpd_module_t *context, hpd_log_level_t level, const char *file, int line, const char *fmt, va_list vp)
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_error_t hpd_value_copy(hpd_value_t **dst, const hpd_value_t *src)
hpd_error_t hpd_adapter_id_alloc(hpd_adapter_id_t **id, hpd_t *hpd, const char *aid)
[log functions]
hpd_error_t hpd_pair_get(const hpd_pair_t *pair, const char **key, const char **value)
[hpd_action_t functions]
hpd_error_t hpd_service_next_action(hpd_action_t **action)
hpd_error_t hpd_adapter_next_service(hpd_service_id_t **service_id)
hpd_error_t hpd_parameter_get_adapter(const hpd_parameter_id_t *pid, hpd_adapter_id_t **aid)
hpd_error_t hpd_value_get_headers(const hpd_value_t *value,...)
hpd_error_t hpd_device_id_copy(hpd_device_id_t **dst, const hpd_device_id_t *src)
hpd_error_t hpd_adapter_get_id(const hpd_adapter_id_t *aid, const char **id)
[id_t functions]
hpd_error_t hpd_parameter_get_hpd(const hpd_parameter_id_t *pid, hpd_t **hpd)
hpd_error_t hpd_parameter_get_id(const hpd_parameter_id_t *pid, const char **id)
[hpd_service_t functions]
hpd_error_t hpd_service_id_copy(hpd_service_id_t **dst, const hpd_service_id_t *src)
hpd_error_t hpd_service_first_action(const hpd_service_id_t *id, hpd_action_t **action)
hpd_error_t hpd_parameter_first_attr(const hpd_parameter_id_t *id, hpd_pair_t **pair)
hpd_error_t hpd_device_get_id(const hpd_device_id_t *did, const char **id)
[hpd_adapter_t functions]
hpd_error_t hpd_module_get_id(const hpd_module_t *context, const char **id)
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 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,...)
enum hpd_error hpd_error_t
hpd_error_t hpd_device_get_hpd(const hpd_device_id_t *did, hpd_t **hpd)
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)
hpd_error_t hpd_service_get_hpd(const hpd_service_id_t *sid, hpd_t **hpd)
hpd_error_t hpd_adapter_id_copy(hpd_adapter_id_t **dst, const hpd_adapter_id_t *src)
hpd_error_t hpd_adapter_next_attr(hpd_pair_t **pair)
hpd_error_t hpd_device_id_free(hpd_device_id_t *id)
hpd_error_t hpd_device_first_service(const hpd_device_id_t *device_id, hpd_service_id_t **service_id)
hpd_error_t hpd_first_service(hpd_t *hpd, hpd_service_id_t **service_id)
hpd_error_t hpd_logf(const hpd_module_t *context, hpd_log_level_t level, const char *file, int line, const char *fmt,...)
[hpd_t functions]
static struct ev_loop * loop
hpd_error_t hpd_service_get_device(const hpd_service_id_t *sid, hpd_device_id_t **did)
hpd_error_t hpd_value_next_header(hpd_pair_t **pair)
hpd_error_t hpd_value_free(hpd_value_t *value)
hpd_error_t hpd_device_get_attr(const hpd_device_id_t *id, const char *key, const char **val)
hpd_error_t hpd_action_get_method(const hpd_action_t *action, hpd_method_t *method)
[model foreach loops]
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)
hpd_error_t hpd_value_get_header(const hpd_value_t *value, const char *key, const char **val)
hpd_error_t hpd_first_device(hpd_t *hpd, hpd_device_id_t **device_id)
hpd_error_t hpd_device_first_attr(const hpd_device_id_t *id, hpd_pair_t **pair)
hpd_error_t hpd_adapter_id_free(hpd_adapter_id_t *id)
hpd_error_t hpd_device_get_attrs(const hpd_device_id_t *id,...)
hpd_error_t hpd_next_adapter(hpd_adapter_id_t **adapter_id)
hpd_error_t hpd_next_service(hpd_service_id_t **service_id)
hpd_error_t hpd_service_first_parameter(const hpd_service_id_t *service_id, hpd_parameter_id_t **parameter_id)
hpd_error_t hpd_service_get_attrs(const hpd_service_id_t *id,...)
hpd_error_t hpd_value_set_header(hpd_value_t *value, const char *key, const char *val)
hpd_error_t hpd_value_allocf(hpd_value_t **value, const char *fmt,...)
hpd_error_t hpd_service_id_free(hpd_service_id_t *id)
struct ev_loop hpd_ev_loop_t
hpd_error_t hpd_value_first_header(const hpd_value_t *value, hpd_pair_t **pair)
enum hpd_method hpd_method_t
[hpd_log_level_t]
hpd_error_t hpd_device_get_adapter(const hpd_device_id_t *did, hpd_adapter_id_t **aid)
hpd_error_t hpd_get_loop(hpd_t *hpd, hpd_ev_loop_t **loop)
hpd_error_t hpd_adapter_get_hpd(const hpd_adapter_id_t *aid, hpd_t **hpd)
[hpd_pair_t functions]