upload tizen1.0 source
[pkgs/o/oma-ds-service.git] / include / ServiceAdapter / SA_Session.h
1 /*
2  * oma-ds-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JuHak Park <juhaki.park@samsung.com>,
7  *          JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8  *          SunBong Ha <sunbong.ha@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24
25
26
27
28 /*
29  * For any sort of issue you concern as to this software,
30  * you may use following point of contact.
31  * All resources contributed on this software
32  * are orinigally written by S-Core Inc., a member of Samsung Group.
33  *
34  * SeongWon Shim <seongwon.shim@samsung.com>
35  */
36
37 /**
38  *   @SA_Session.h
39  *   @version                                                                   0.1
40  *   @brief                                                                             This file is the header file of interface of Session structure
41  */
42
43 #ifndef SA_SESSION_H_
44 #define SA_SESSION_H_
45
46 #include "ServiceAdapter/SA_Define.h"
47
48 /**
49  * @par Description: API to create Session structure
50  * This API can be used to create Session structure
51  *
52  * @par Purpose:
53  * @par Typical use case:
54  * @par Method of function operation:
55  * @par Important notes:
56  * @param[in]           enum type, protocol version(VERSION_UNKNOWN, VERSION_10, VERSION_11, VERSION_12);
57  * @param[in]           enum type, protocol type(PROTOCOL_TYPE_UNKNOWN, PROTOCOL_TYPE_DS)
58  * @param[in]           int type, account id
59  * @param[in]           int type, session id
60  * @param[in]           string type, source uri(server ip)
61  * @param[in]           string type, target uri(client identifer)
62  * @param[out]          Session structure
63  *
64  * @return                              ERROR_INTERNAL_OK on success
65  *                                                      ERROR_INTERNAL_NO_MEMORY on error
66  *
67  * @par Errors:
68  *
69  * @pre None.
70  * @post
71  * @see
72  * @remarks None.
73  *
74  * @par Sample Code:
75  * @code
76  * @endcode
77  */
78 SA_ErrorType create_session(ProtocolVersion protocolVersion, ProtocolType protocolType,
79                                 int accountId, char *sessID,  char *source, char *target, Session **pSession);
80
81 /**
82  * @par Description: API to free Session structure
83  * This API can be used to free Session structure
84  *
85  * @par Purpose:
86  * @par Typical use case:
87  * @par Method of function operation:
88  * @par Important notes:
89  * @param[in]           Session structure
90  *
91  * @return
92  *
93  * @par Errors:
94  *
95  * @pre None.
96  * @post
97  * @see
98  * @remarks None.
99  *
100  * @par Sample Code:
101  * @code
102  * @endcode
103  */
104 void free_session(Session *session);
105
106 /**
107  * @par Description: API to set Cred structure in Session structure
108  * This API can be used to set Cred structure in Session structure
109  *
110  * @par Purpose:
111  * @par Typical use case:
112  * @par Method of function operation:
113  * @par Important notes:
114  * @param[in]           Session structure
115  * @param[in]           Cred structure
116  *
117  * @return
118  *
119  * @par Errors:
120  *
121  * @pre None.
122  * @post
123  * @see
124  * @remarks None.
125  *
126  * @par Sample Code:
127  * @code
128  * @endcode
129  */
130 void set_session_cred(Session *session, Cred *cred);
131
132 /**
133  * @par Description: API to set DevInf structure in Session structure
134  * This API can be used to set DevInf structure in Session structure
135  *
136  * @par Purpose:
137  * @par Typical use case:
138  * @par Method of function operation:
139  * @par Important notes:
140  * @param[in]           Session structure
141  * @param[in]           DevInf structure
142  *
143  * @return
144  *
145  * @par Errors:
146  *
147  * @pre None.
148  * @post
149  * @see
150  * @remarks None.
151  *
152  * @par Sample Code:
153  * @code
154  * @endcode
155  */
156 void set_session_devinf(Session *session, DevInf *devInf);
157
158 /**
159  * @par Description: API to create PendingStatus structure
160  * This API can be used to set DevInf structure in Session structure
161  *
162  * @par Purpose:
163  * @par Typical use case:
164  * @par Method of function operation:
165  * @par Important notes:
166  * @param[in]           unsigned int type, msg id
167  * @param[in]           unsigned int type, cmd id
168  * @param[out]          PendingStatus structure
169  *
170  * @return                              ERROR_INTERNAL_OK on success
171  *                                                      ERROR_INTERNAL_NO_MEMORY on error
172  * @par Errors:
173  *
174  * @pre None.
175  * @post
176  * @see
177  * @remarks None.
178  *
179  * @par Sample Code:
180  * @code
181  * @endcode
182  */
183 SA_ErrorType create_pending_status(unsigned int msgID, unsigned int cmdID, PendingStatus **pPendingStatus);
184
185 /**
186  * @par Description: API to process SyncHdr structure from server
187  * This API manage responseURI
188  *                              set server info in Session structure
189  *                              check header credential
190  *                              create Status structure for header
191  *
192  * @par Purpose:
193  * @par Typical use case:
194  * @par Method of function operation:
195  * @par Important notes:
196  * @param[in]           session structure
197  * @param[in]           SyncHdr structure
198  *
199  * @return                              ERROR_INTERNAL_OK on success
200  *                                                      ERROR_INTERNAL_NO_MEMORY on error
201  * @par Errors:
202  *
203  * @pre None.
204  * @post
205  * @see
206  * @remarks None.
207  *
208  * @par Sample Code:
209  * @code
210  * @endcode
211  */
212 SA_ErrorType receive_header(Session *session, SyncHdr *header);
213
214 /**
215  * @par Description: API to process list of Status structure from server
216  * This API check credential status
217  *                              process Status structure for each type
218  *                              create AppliedStatus structure for passing to ServiceEngine
219  *
220  * @par Purpose:
221  * @par Typical use case:
222  * @par Method of function operation:
223  * @par Important notes:
224  * @param[in]           session structure
225  * @param[in]           GList type, list of Status structure
226  * @param[out]          GList type, list of AppliedStatus structure
227  *
228  * @return                              ERROR_INTERNAL_OK on success
229  *                                                      ERROR_INTERNAL_ERROR, ERROR_SERVER_FAILURE, ERROR_INTERNAL_BUSY_SIGNALING on error
230  * @par Errors:
231  *
232  * @pre None.
233  * @post
234  * @see
235  * @remarks None.
236  *
237  * @par Sample Code:
238  * @code
239  * @endcode
240  */
241 SA_ErrorType receive_statuses(Session *session, GList *receiveStatus, GList **returnStatus);
242
243 /**
244  * @par Description: API to process list of Command structure from server
245  * This API check credential status
246  *                              process Command structure for each type
247  *                              create ChangedDatastore structure for passing to ServiceEngine
248  *
249  * @par Purpose:
250  * @par Typical use case:
251  * @par Method of function operation:
252  * @par Important notes:
253  * @param[in]           session structure
254  * @param[in]           GList type, list of Command structure
255  * @param[in]           whether auto configure or not
256  * @param[out]          GList type, list of ChangedDatastore structure
257  *
258  * @return                              ERROR_INTERNAL_OK on success
259  *                                                      ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
260  * @par Errors:
261  *
262  * @pre None.
263  * @post
264  * @see
265  * @remarks None.
266  *
267  * @par Sample Code:
268  * @code
269  * @endcode
270  */
271 SA_ErrorType receive_commands(Session *session, GList *receiveCommand, bool autoConfig, GList **returnDatastore);
272
273
274 /**
275  * @par Description: API to reset cmd id(1) in session
276  *
277  * @par Purpose:
278  * @par Typical use case:
279  * @par Method of function operation:
280  * @par Important notes:
281  * @param[in]           Session structure
282  *
283  * @return
284  *
285  * @par Errors:
286  *
287  * @pre None.
288  * @post
289  * @see
290  * @remarks None.
291  *
292  * @par Sample Code:
293  * @code
294  * @endcode
295  */
296 void reset_cmdID_session(Session *session);
297
298
299 #endif /* SE_SESSION_H_ */