Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / framework / san-parser / pm_sanparser.h
1 /*
2  * oma-ds-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /**
19  *   @PM_SanParser.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface and defined structure for San Parser
22  */
23
24 #ifndef PM_SANPARSER_H_
25 #define PM_SANPARSER_H_
26
27 /* FIXME : When initialize, set "Server_id" at config_tbl..
28 #define SMLDS_MOBILEDIT_SERVER                                                          (char *)"mobiledit"
29 #define SMLDS_FUNAMBOL_SERVER                                                           (char *)"funambol"
30 #define SMLDS_O3SIS_SERVER_SAN_IDENTIFIER               (char *)"O3SIS SyncML Server"
31 */
32
33 typedef enum {
34         SAN_UIMODE_UNSPECIFIED = 0,
35         SAN_UIMODE_BACKGROUND = 1,
36         SAN_UIMODE_INFORMATIVE = 2,
37         SAN_UIMODE_USER = 3
38 } san_ui_mode_e;
39
40 typedef enum {
41         SAN_INITIATOR_USER = 0,
42         SAN_INITIATOR_SERVER = 1
43 } san_initiator_e;
44
45 typedef enum {
46         SAN_SYNC_TYPE_TWO_WAY_BY_SERVER = 206,
47         SAN_SYNC_TYPE_ONE_WAY_FROM_CLIENT_BY_SERVER = 207,
48         SAN_SYNC_TYPE_REFRESH_FROM_CLIENT_BY_SERVER = 208,
49         SAN_SYNC_TYPE_ONE_WAY_FROM_SERVER_BY_SERVER = 209,
50         SAN_SYNC_TYPE_REFRESH_FROM_SERVER_BY_SERVER = 210,
51 } san_sync_type_e;
52
53 typedef struct san_cred san_cred_s;
54 struct san_cred {
55         char *cred_format;
56         char *cred_auth;
57         char *cred_data;
58 };
59
60 typedef struct san_content_type san_content_type_s;
61 struct san_content_type {
62         unsigned int type;
63         char *strType;
64 };
65
66 typedef struct san_sync_alert san_sync_alert_s;
67 struct san_sync_alert {
68         san_sync_type_e sync_type;
69         char *content_type;
70         char *server_uri;
71 };
72
73 typedef struct san_package san_package_s;
74 struct san_package {
75         char *msg_body_without_digest;
76         unsigned int msg_body_without_digest_length;
77         char *digest;
78         unsigned int version;
79         san_ui_mode_e ui_mode;
80         san_initiator_e initiator;
81         unsigned int session_id;
82         san_cred_s *cred;
83         char *server_id;
84         unsigned int cnt_sync_alerts;
85         san_sync_alert_s *sync_alerts;
86 };
87
88 /**
89  * @par Description: API to parse for SAN version 1.2
90  *
91  *
92  * @par Purpose:
93  * @par Typical use case:
94  * @par Method of function operation:
95  * @par Important notes:
96  * @param[in]           string type, msg body
97  * @param[in]           unsigned int type, size of msg
98  * @param[out]
99  *
100  * @return                              san_package_s structure on success
101  *                                                      NULL on error
102  *
103  * @par Errors:
104  *
105  * @pre None.
106  * @post
107  * @see
108  * @remarks None.
109  *
110  * @par Sample Code:
111  * @code
112  * @endcode
113  */
114 san_package_s *san_package_12_parser(const char *msg_body, unsigned int msg_size);
115
116 /**
117  * @par Description: API to parse for SAN version 1.1
118  *
119  *
120  * @par Purpose:
121  * @par Typical use case:
122  * @par Method of function operation:
123  * @par Important notes:
124  * @param[in]           string type, msg body
125  * @param[in]           unsigned int type, size of msg
126  * @param[out]
127  *
128  * @return                              san_package_s structure on success
129  *                                                      NULL on error
130  *
131  * @par Errors:
132  *
133  * @pre None.
134  * @post
135  * @see
136  * @remarks None.
137  *
138  * @par Sample Code:
139  * @code
140  * @endcode
141  */
142 san_package_s *san_package_11_parser(const char *msg_body, unsigned int msg_size);
143
144 /**
145  * @par Description: API to free san_package_s structure
146  *
147  *
148  * @par Purpose:
149  * @par Typical use case:
150  * @par Method of function operation:
151  * @par Important notes:
152  * @param[in]           san_package_s structure
153  * @param[out]
154  *
155  * @return
156  *
157  * @par Errors:
158  *
159  * @pre None.
160  * @post
161  * @see
162  * @remarks None.
163  *
164  * @par Sample Code:
165  * @code
166  * @endcode
167  */
168 void sanPackageParserFree(void *point);
169
170 /**
171  * @par Description: API to print SAN msg for debugging
172  *
173  *
174  * @par Purpose:
175  * @par Typical use case:
176  * @par Method of function operation:
177  * @par Important notes:
178  * @param[in]           san_package_s structure
179  * @param[out]
180  *
181  * @return
182  *
183  * @par Errors:
184  *
185  * @pre None.
186  * @post
187  * @see
188  * @remarks None.
189  *
190  * @par Sample Code:
191  * @code
192  * @endcode
193  */
194 void sanPrintMsg(san_package_s * san);
195
196 /**
197  * @par Description: API to parse ip push message
198  *
199  *
200  * @par Purpose:
201  * @par Typical use case:
202  * @par Method of function operation:
203  * @par Important notes:
204  * @param[in]           data(ip push message)
205  * @param[out]          san_package_s structure
206  * @param[out]          id
207  *
208  * @return                              1 on success
209  *                                              0 on fail
210  *
211  * @par Errors:
212  *
213  * @pre None.
214  * @post
215  * @see
216  * @remarks None.
217  *
218  * @par Sample Code:
219  * @code
220  * @endcode
221  */
222 int parse_ip_push_msg(char *data, san_package_s ** sanpackage, char **id);
223
224 #endif                          /* PM_SANPARSER_H_ */