gam-resource-manager: adjust to updated proxied call callback signature.
[profile/ivi/murphy.git] / src / core / domain-types.h
1 /*
2  * Copyright (c) 2012-2014, Intel Corporation
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *  * Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *  * Neither the name of Intel Corporation nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef __MURPHY_CORE_DOMAIN_TYPES_H__
31 #define __MURPHY_CORE_DOMAIN_TYPES_H__
32
33 #include <murphy/common/macros.h>
34 #include <murphy/common/msg.h>
35
36 MRP_CDECL_BEGIN
37
38
39 /*
40  * passable data types to/from domain controllers
41  */
42 typedef enum {
43     MRP_DOMCTL_END      = MRP_MSG_FIELD_INVALID,
44     MRP_DOMCTL_STRING   = MRP_MSG_FIELD_STRING,
45     MRP_DOMCTL_INTEGER  = MRP_MSG_FIELD_INT32,
46     MRP_DOMCTL_UNSIGNED = MRP_MSG_FIELD_UINT32,
47     MRP_DOMCTL_DOUBLE   = MRP_MSG_FIELD_DOUBLE,
48     MRP_DOMCTL_BOOL     = MRP_MSG_FIELD_BOOL,
49     MRP_DOMCTL_UINT8    = MRP_MSG_FIELD_UINT8,
50     MRP_DOMCTL_INT8     = MRP_MSG_FIELD_INT8,
51     MRP_DOMCTL_UINT16   = MRP_MSG_FIELD_UINT16,
52     MRP_DOMCTL_INT16    = MRP_MSG_FIELD_INT16,
53     MRP_DOMCTL_UINT32   = MRP_MSG_FIELD_UINT32,
54     MRP_DOMCTL_INT32    = MRP_MSG_FIELD_INT32,
55     MRP_DOMCTL_UINT64   = MRP_MSG_FIELD_UINT64,
56     MRP_DOMCTL_INT64    = MRP_MSG_FIELD_INT64,
57
58 #define MRP_DOMCTL_ARRAY(_type)      \
59     (mrp_domctl_type_t)MRP_MSG_FIELD_ARRAY_OF(_type)
60 #define MRP_DOMCTL_IS_ARRAY(_type)   MRP_MSG_FIELD_IS_ARRAY(_type)
61 #define MRP_DOMCTL_ARRAY_TYPE(_type) MRP_MSG_FIELD_ARRAY_TYPE(_type)
62 } mrp_domctl_type_t;
63
64
65 /*
66  * a single data value passed to/from a domain controller
67  */
68
69 typedef struct {
70     mrp_domctl_type_t  type;             /* data type */
71     union {
72         /* these are usable both in DB operations and proxied invocations */
73         const char *str;                 /* MRP_DOMCTL_STRING */
74         uint32_t    u32;                 /* MRP_DOMCTL_{UNSIGNED,UINT32} */
75         int32_t     s32;                 /* MRP_DOMCTL_{INTEGER,INT32} */
76         double      dbl;                 /* MRP_DOMCTL_DOUBLE */
77         /* these are only usable in proxied invocations */
78         int         bln;                 /* MRP_DOMCTL_BOOL */
79         uint8_t     u8;                  /* MRP_DOMCTL_UINT8 */
80         int8_t      s8;                  /* MRP_DOMCTL_INT8 */
81         uint16_t    u16;                 /* MRP_DOMCTL_UINT16 */
82         int16_t     s16;                 /* MRP_DOMCTL_INT16 */
83         uint64_t    u64;                 /* MRP_DOMCTL_UINT64 */
84         int64_t     s64;                 /* MRP_DOMCTL_INT64 */
85         void       *arr;                 /* MRP_DOMCTL_ARRAY(*) */
86     };
87     uint32_t           size;             /* size for arrays */
88 } mrp_domctl_value_t;
89
90
91 /*
92  * proxied invokation errors
93  */
94
95 typedef enum {
96     MRP_DOMAIN_OK = 0,                   /* no errors */
97     MRP_DOMAIN_NOTFOUND,                 /* domain not found */
98     MRP_DOMAIN_NOMETHOD,                 /* call domain method not found */
99     MRP_DOMAIN_FAILED,                   /* called method remotely failed */
100 } mrp_domain_error_t;
101
102 /* Type for a proxied invocation argument. */
103 typedef mrp_domctl_value_t mrp_domctl_arg_t;
104
105 MRP_CDECL_END
106
107 #endif /* __MURPHY_CORE_DOMAIN_TYPES_H__ */