3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * @brief This file is the header file of interface of Session structure
27 #include "service-adapter/sa_define.h"
30 * @par Description: API to create session_s structure
31 * This API can be used to create session_s structure
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
45 * @return ERROR_INTERNAL_OK on success
46 * ERROR_INTERNAL_NO_MEMORY on error
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);
62 * @par Description: API to free session_s structure
63 * This API can be used to free session_s structure
66 * @par Typical use case:
67 * @par Method of function operation:
68 * @par Important notes:
69 * @param[in] session_s structure
84 void free_session(session_s * session);
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
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
110 void set_session_cred(session_s * session, cred_s * cred);
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
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
136 void set_session_devinf(session_s * session, devinf_s * devInf);
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
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
150 * @return ERROR_INTERNAL_OK on success
151 * ERROR_INTERNAL_NO_MEMORY on error
163 sa_error_type_e create_command_status(unsigned int msg_id, unsigned int cmdID, command_status_s ** command_status);
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
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
179 * @return ERROR_INTERNAL_OK on success
180 * ERROR_INTERNAL_NO_MEMORY on error
192 sa_error_type_e receive_header(session_s * session, sync_hdr_s * header);
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
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
208 * @return ERROR_INTERNAL_OK on success
209 * ERROR_INTERNAL_ERROR, ERROR_SERVER_FAILURE, ERROR_INTERNAL_BUSY_SIGNALING on error
221 sa_error_type_e receive_statuses(session_s * session, GList * receive_status, GList ** return_status);
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
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
238 * @return ERROR_INTERNAL_OK on success
239 * ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
251 sa_error_type_e receive_commands(session_s * session, GList * receive_command, bool auto_config, GList ** return_datastore);
254 * @par Description: API to reset cmd id(1) in session
257 * @par Typical use case:
258 * @par Method of function operation:
259 * @par Important notes:
260 * @param[in] session_s structure
275 void reset_cmd_id_session(session_s * session);
277 #endif /* SE_SESSION_H_ */