Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / service-adapter / sa_session.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  *   @SA_Session.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface of Session structure
22  */
23
24 #ifndef SA_SESSION_H_
25 #define SA_SESSION_H_
26
27 #include "service-adapter/sa_define.h"
28
29 /**
30  * @par Description: API to create session_s structure
31  * This API can be used to create session_s structure
32  *
33  * @par Purpose:
34  * @par Typical use case:
35  * @par Method of function operation:
36  * @par Important notes:
37  * @param[in]           enum type, protocol version(VERSION_UNKNOWN, VERSION_10, VERSION_11, VERSION_12);
38  * @param[in]           enum type, protocol type(PROTOCOL_TYPE_UNKNOWN , PROTOCOL_TYPE_DS)
39  * @param[in]           int type, account id
40  * @param[in]           int type, session id
41  * @param[in]           string type, source uri(server ip)
42  * @param[in]           string type, target uri(client identifer)
43  * @param[out]          session_s structure
44  *
45  * @return                              ERROR_INTERNAL_OK on success
46  *                                                      ERROR_INTERNAL_NO_MEMORY on error
47  *
48  * @par Errors:
49  *
50  * @pre None.
51  * @post
52  * @see
53  * @remarks None.
54  *
55  * @par Sample Code:
56  * @code
57  * @endcode
58  */
59 sa_error_type_e create_session(protocol_version_e protocol_version, protocol_type_e protocol_type, int account_id, char *sess_id, location_s * source_location, location_s * target_location, session_s ** session);
60
61 /**
62  * @par Description: API to free session_s structure
63  * This API can be used to free session_s structure
64  *
65  * @par Purpose:
66  * @par Typical use case:
67  * @par Method of function operation:
68  * @par Important notes:
69  * @param[in]           session_s structure
70  *
71  * @return
72  *
73  * @par Errors:
74  *
75  * @pre None.
76  * @post
77  * @see
78  * @remarks None.
79  *
80  * @par Sample Code:
81  * @code
82  * @endcode
83  */
84 void free_session(session_s * session);
85
86 /**
87  * @par Description: API to set cred_s structure in session_s structure
88  * This API can be used to set cred_s structure in session_s structure
89  *
90  * @par Purpose:
91  * @par Typical use case:
92  * @par Method of function operation:
93  * @par Important notes:
94  * @param[in]           session_s structure
95  * @param[in]           cred_s structure
96  *
97  * @return
98  *
99  * @par Errors:
100  *
101  * @pre None.
102  * @post
103  * @see
104  * @remarks None.
105  *
106  * @par Sample Code:
107  * @code
108  * @endcode
109  */
110 void set_session_cred(session_s * session, cred_s * cred);
111
112 /**
113  * @par Description: API to set devinf_s structure in session_s structure
114  * This API can be used to set devinf_s structure in session_s structure
115  *
116  * @par Purpose:
117  * @par Typical use case:
118  * @par Method of function operation:
119  * @par Important notes:
120  * @param[in]           session_s structure
121  * @param[in]           devinf_s structure
122  *
123  * @return
124  *
125  * @par Errors:
126  *
127  * @pre None.
128  * @post
129  * @see
130  * @remarks None.
131  *
132  * @par Sample Code:
133  * @code
134  * @endcode
135  */
136 void set_session_devinf(session_s * session, devinf_s * devInf);
137
138 /**
139  * @par Description: API to create command_status_s structure
140  * This API can be used to set devinf_s structure in session_s structure
141  *
142  * @par Purpose:
143  * @par Typical use case:
144  * @par Method of function operation:
145  * @par Important notes:
146  * @param[in]           unsigned int type, msg id
147  * @param[in]           unsigned int type, cmd id
148  * @param[out]          command_status_s structure
149  *
150  * @return                              ERROR_INTERNAL_OK on success
151  *                                                      ERROR_INTERNAL_NO_MEMORY on error
152  * @par Errors:
153  *
154  * @pre None.
155  * @post
156  * @see
157  * @remarks None.
158  *
159  * @par Sample Code:
160  * @code
161  * @endcode
162  */
163 sa_error_type_e create_command_status(unsigned int msg_id, unsigned int cmdID, command_status_s ** command_status);
164
165 /**
166  * @par Description: API to process sync_hdr_s structure from server
167  * This API manage responseURI
168  *                              set server info in session_s structure
169  *                              check header credential
170  *                              create Status structure for header
171  *
172  * @par Purpose:
173  * @par Typical use case:
174  * @par Method of function operation:
175  * @par Important notes:
176  * @param[in]           session_s structure
177  * @param[in]           sync_hdr_s structure
178  *
179  * @return                              ERROR_INTERNAL_OK on success
180  *                                                      ERROR_INTERNAL_NO_MEMORY on error
181  * @par Errors:
182  *
183  * @pre None.
184  * @post
185  * @see
186  * @remarks None.
187  *
188  * @par Sample Code:
189  * @code
190  * @endcode
191  */
192 sa_error_type_e receive_header(session_s * session, sync_hdr_s * header);
193
194 /**
195  * @par Description: API to process list of status_s structure from server
196  * This API check credential status
197  *                              process Status structure for each type
198  *                              create AppliedStatus structure for passing to ServiceEngine
199  *
200  * @par Purpose:
201  * @par Typical use case:
202  * @par Method of function operation:
203  * @par Important notes:
204  * @param[in]           session_s structure
205  * @param[in]           GList type, list of status_s structure
206  * @param[out]          GList type, list of applied_status_s structure
207  *
208  * @return                              ERROR_INTERNAL_OK on success
209  *                                                      ERROR_INTERNAL_ERROR, ERROR_SERVER_FAILURE, ERROR_INTERNAL_BUSY_SIGNALING on error
210  * @par Errors:
211  *
212  * @pre None.
213  * @post
214  * @see
215  * @remarks None.
216  *
217  * @par Sample Code:
218  * @code
219  * @endcode
220  */
221 sa_error_type_e receive_statuses(session_s * session, GList * receive_status, GList ** return_status);
222
223 /**
224  * @par Description: API to process list of command_s structure from server
225  * This API check credential status
226  *                              process command_ structure for each type
227  *                              create changed_datastore_s structure for passing to ServiceEngine
228  *
229  * @par Purpose:
230  * @par Typical use case:
231  * @par Method of function operation:
232  * @par Important notes:
233  * @param[in]           session structure
234  * @param[in]           GList type, list of command_s structure
235  * @param[in]           whether auto configure or not
236  * @param[out]          GList type, list of changed_datastore_s structure
237  *
238  * @return                              ERROR_INTERNAL_OK on success
239  *                                                      ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
240  * @par Errors:
241  *
242  * @pre None.
243  * @post
244  * @see
245  * @remarks None.
246  *
247  * @par Sample Code:
248  * @code
249  * @endcode
250  */
251 sa_error_type_e receive_commands(session_s * session, GList * receive_command, bool auto_config, GList ** return_datastore);
252
253 /**
254  * @par Description: API to reset cmd id(1) in session
255  *
256  * @par Purpose:
257  * @par Typical use case:
258  * @par Method of function operation:
259  * @par Important notes:
260  * @param[in]           session_s structure
261  *
262  * @return
263  *
264  * @par Errors:
265  *
266  * @pre None.
267  * @post
268  * @see
269  * @remarks None.
270  *
271  * @par Sample Code:
272  * @code
273  * @endcode
274  */
275 void reset_cmd_id_session(session_s * session);
276
277 #endif                          /* SE_SESSION_H_ */