2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_SOCIAL_LIBSERVICE_PLUGIN_MESSAGE_H__
18 #define __TIZEN_SOCIAL_LIBSERVICE_PLUGIN_MESSAGE_H__
30 PLUGIN_MESSAGE_TYPE_FUNCTION = 1,
31 PLUGIN_MESSAGE_TYPE_CALLBACK = 2,
32 } plugin_message_type_e;
35 #define PLUGIN_DATA_TYPE_INT 'i'
36 #define PLUGIN_DATA_TYPE_LONG 'l'
39 // INT/LONG -> NUM (64bit)
40 #define PLUGIN_DATA_TYPE_NUM 'n'
41 #define PLUGIN_DATA_TYPE_STRING 's'
42 #define PLUGIN_DATA_TYPE_BOOL 'b'
43 #define PLUGIN_DATA_TYPE_ARRAY 'a'
44 #define PLUGIN_DATA_TYPE_UNKNOWN 'u'
46 typedef char plugin_data_type;
57 typedef long long int pmnumber;
58 typedef char *pmstring;
63 PLUGIN_MESSAGE_ELEMENT_CONTEXT_ID,
64 PLUGIN_MESSAGE_ELEMENT_FUNCTION_NAME,
65 PLUGIN_MESSAGE_ELEMENT_PARAMETER_MANDATORY,
66 PLUGIN_MESSAGE_ELEMENT_PARAMETER_OPTIONAL,
67 PLUGIN_MESSAGE_ELEMENT_REQUEST_ID,
68 PLUGIN_MESSAGE_ELEMENT_MESSAGE_TYPE,
69 PLUGIN_MESSAGE_ELEMENT_RESULT_CODE,
70 PLUGIN_MESSAGE_ELEMENT_RESULT_MESSAGE,
71 } plugin_message_element_e;
73 typedef struct _plugin_message_s *plugin_message_h;
75 typedef struct _plugin_message_array_s *plugin_message_array_h;
78 int plugin_message_create(plugin_message_h *message);
80 void plugin_message_destroy(plugin_message_h message);
82 int plugin_message_set_value_number(plugin_message_h message, plugin_message_element_e field, pmnumber value);
84 int plugin_message_get_value_number(plugin_message_h message, plugin_message_element_e field, pmnumber *value);
86 int plugin_message_set_value_string(plugin_message_h message, plugin_message_element_e field, const char *value);
88 int plugin_message_get_value_string(plugin_message_h message, plugin_message_element_e field, char **value);
90 int plugin_message_set_value_bool(plugin_message_h message, plugin_message_element_e field, bool value);
92 int plugin_message_get_value_bool(plugin_message_h message, plugin_message_element_e field, bool *value);
95 int plugin_message_set_param_number(plugin_message_h message, int param_index, pmnumber value);
97 int plugin_message_get_param_number(plugin_message_h message, int param_index, pmnumber *value);
99 int plugin_message_set_param_string(plugin_message_h message, int param_index, const char *value);
101 int plugin_message_get_param_string(plugin_message_h message, int param_index, char **value);
103 int plugin_message_set_param_bool(plugin_message_h message, int param_index, bool value);
105 int plugin_message_get_param_bool(plugin_message_h message, int param_index, bool *value);
107 int plugin_message_set_param_array(plugin_message_h message, int param_index, plugin_message_array_h value);
109 int plugin_message_get_param_array(plugin_message_h message, int param_index, plugin_message_array_h *value);
112 int plugin_message_set_opt_param_number(plugin_message_h message, int param_index, pmnumber value);
114 int plugin_message_get_opt_param_number(plugin_message_h message, int param_index, pmnumber *value);
116 int plugin_message_set_opt_param_string(plugin_message_h message, int param_index, const char *value);
118 int plugin_message_get_opt_param_string(plugin_message_h message, int param_index, char **value);
120 int plugin_message_set_opt_param_bool(plugin_message_h message, int param_index, bool value);
122 int plugin_message_get_opt_param_bool(plugin_message_h message, int param_index, bool *value);
124 int plugin_message_set_opt_param_array(plugin_message_h message, int param_index, plugin_message_array_h value);
126 int plugin_message_get_opt_param_array(plugin_message_h message, int param_index, plugin_message_array_h *value);
129 int plugin_message_serialize(plugin_message_h message, char **data);
131 int plugin_message_deserialize(const char *data, plugin_message_h *message);
134 int plugin_message_array_create(const plugin_data_type *type_string, plugin_message_array_h *array);
136 void plugin_message_array_destroy(plugin_message_array_h array);
138 int plugin_message_array_add_element(plugin_message_array_h array, ...);
140 int plugin_message_array_get_element(plugin_message_array_h array, int idx, ...);
146 #endif /* __TIZEN_SOCIAL_LIBSERVICE_PLUGIN_MESSAGE_H__ */