1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
/*
* sync-agent
* Copyright (c) 2012 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEFINITION_H_
#define DEFINITION_H_
#include <glib.h>
#include <stdbool.h>
#include "error.h"
#include <wbxml/wbxml.h>
#include <wbxml/wbxml_parser.h>
#include <wbxml/wbxml_tree.h>
#include <wbxml/wbxml_encoder.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef void *Content_Ptr;
typedef void *Protocol_Option_Ptr;
typedef unsigned int Protocol_Element;
/**
* @file definition.h
* @brief Define structure, enum, callback function etc...
*/
/* common definition */
/** @addtogroup protocol_binder
* @{
*/
/**
* Enumerations of encoding type
*/
typedef enum {
SYNC_AGENT_PB_ENCODING_UNKNOWN = 0, /**< Unknown*/
SYNC_AGENT_PB_ENCODING_XML, /**< XML*/
SYNC_AGENT_PB_ENCODING_WBXML_10, /**< WBXML 1.0*/
SYNC_AGENT_PB_ENCODING_WBXML_11, /**< WBXML 1.1*/
SYNC_AGENT_PB_ENCODING_WBXML_12, /**< WBXML 1.2*/
SYNC_AGENT_PB_ENCODING_WBXML_13 /**< WBXML 1.3*/
} sync_agent_pb_encoding_e;
/**
* Enumerations of decoding type
*/
typedef enum {
SYNC_AGENT_PB_DECODING_UNKNOWN = 0, /**< Unknown*/
SYNC_AGENT_PB_DECODING_XML, /**< XML*/
SYNC_AGENT_PB_DECODING_WBXML /**< WBXML*/
} sync_agent_pb_decoding_e;
/**
* Enumerations of Protocol that supports by sync_agent_pb_protocol_e binder
*/
typedef enum {
SYNC_AGENT_PB_PROTOCOL_UNKNOWN = 0, /**< Unknown*/
SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML10, /**< SYNCML1.0*/
SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML11, /**< SYNCML1.1*/
SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12, /**< SYNCML1.2*/
SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF10,
/**< SYNCML Device Information 1.0 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF11,
/**< SYNCML Device Information 1.1 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF12,
/**< SYNCML Device Information 1.2 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF10,
/**< SYNCML Meta Information 1.0 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF11,
/**< SYNCML Meta Information 1.1 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF12,
/**< SYNCML Meta Information 1.2 */
SYNC_AGENT_PB_PROTOCOL_SYNCML_DMDDF12,
/**< SYNCML DM DDF 1.2 */
SYNC_AGENT_PB_PROTOCOL_ACTIVESYNC,
/**< EAS */
SYNC_AGENT_PB_PROTOCOL_PROV10,
/**< EAS Provisioning */
SYNC_AGENT_PB_PROTOCOL_MAX_COUNT
/**< for counting supporting protocol */
} sync_agent_pb_protocol_e;
/* protocol binder */
/**
* Structure for protocol binder
*/
typedef struct protocol_binder_info sync_agent_pb_protocol_binder_info_s;
/**
* Restrict Condition Checker callback
*
* @param[in] enc sync_agent_pb_encoding_e value
* @param[in] option Protocol_Option_Ptr
* @param[in] restrict_params list of restrict parameter
* @param[in] arguments list of parameter
*
* @return 1 on success, 0 on error
*
* @par Since:
*
*
* @see
*
*/
typedef bool(*sync_agent_restrict_condition_checker_cb) (sync_agent_pb_encoding_e enc, Protocol_Option_Ptr option, GList * restrict_params, GList * arguments);
/**
* Binder Object converter function
*
* @param[in] binder sync_agent_pb_protocol_binder_info_s pointer
* @param[in] content void pointer
* @param[in] wbxml_dom_node WBXMLTreeNode
*
* @return SYNC_AGENT_PB_RETURN_OK on success, otherwise error
*
* @par Since:
*
*
* @see
*
*/
typedef sync_agent_pb_error_e(*sync_agent_binder_object_converter_cb) (sync_agent_pb_protocol_binder_info_s * binder, Content_Ptr content, WBXMLTreeNode ** wbxml_dom_node);
/* reverse protocol binder */
/*typedef struct _Reverse_binder_function_info Reverse_binder_function_info;*/
/*typedef struct _Reverse_binder_function_set Reverse_binder_function_set;*/
/**
* Structure for reverse protocol binder
*/
typedef struct protocol_binder_reverse_info sync_agent_pb_protocol_binder_reverse_info_s;
/**
* Reverse Binder Object converter function
*
* @param[in] reverse_binder sync_agent_pb_protocol_binder_reverse_info_s pointer
* @param[in] wbxml_dom_node WBXMLTreeNode
* @param[in] content Content_Ptr pointer
*
* @return SYNC_AGENT_PB_RETURN_OK on success, otherwise error
*
* @par Since:
*
*
* @see
*
*/
typedef sync_agent_pb_error_e(*sync_agent_reverse_binder_object_converter_cb) (sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content);
/* protocol binder & reverse protocol binder callback */
/**
* Structure for Binder function set
*/
typedef struct protocol_binder_function_set sync_agent_pb_protocol_binder_function_set_s;
/**
* Structure for Binder function info
*/
typedef struct protocol_binder_function_info sync_agent_pb_function_info_s;
struct protocol_binder_function_info {
Protocol_Element protocol_element; /**< Defined element */
char *protocol_element_xml_name; /**< Xml element name */
sync_agent_binder_object_converter_cb binder_object_converter_function; /**< Callback function for object converter*/
sync_agent_reverse_binder_object_converter_cb reverse_binder_object_converter_function; /**< Callback function for reverse object converter*/
bool isTerminal; /**< Whether current node is terminal or not */
};
/**
* @}
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* DEFINITION_H_ */
|