4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHak Park <juhaki.park@samsung.com>,
7 * JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8 * SunBong Ha <sunbong.ha@samsung.com>
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
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.
34 * SeongWon Shim <seongwon.shim@samsung.com>
40 * @brief This file is the header file of interface of elements structure
43 #ifndef SA_ELEMENTS_H_
44 #define SA_ELEMENTS_H_
46 #include "ServiceAdapter/SA_Define.h"
49 * @par Description: API to create Anchor structure
52 * @par Typical use case:
53 * @par Method of function operation:
54 * @par Important notes:
55 * @param[in] string type, last anchor
56 * @param[in] string type, next anchor
57 * @param[out] Anchor structure
59 * @return ERROR_INTERNAL_OK on success
60 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
72 SA_ErrorType create_anchor(char *last, char *next, Anchor **pAnchor);
75 * @par Description: API to set anchor in Item structure
78 * @par Typical use case:
79 * @par Method of function operation:
80 * @par Important notes:
81 * @param[in] Item structure
82 * @param[in] Anchor structure
84 * @return ERROR_INTERNAL_OK on success
85 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
97 SA_ErrorType set_item_anchor(Item *item, Anchor *anchor);
100 * @par Description: API to set last anchor in Anchor structure
103 * @par Typical use case:
104 * @par Method of function operation:
105 * @par Important notes:
106 * @param[in] Anchor structure
107 * @param[in] string type, last anchor
109 * @return ERROR_INTERNAL_OK on success
110 * ERROR_INTERNAL_NOT_DEFINED on error
122 SA_ErrorType set_last_anchor(Anchor *anchor, char *lastAnchor);
125 * @par Description: API to set next anchor in Anchor structure
128 * @par Typical use case:
129 * @par Method of function operation:
130 * @par Important notes:
131 * @param[in] Anchor structure
132 * @param[in] string type, next anchor
134 * @return ERROR_INTERNAL_OK on success
135 * ERROR_INTERNAL_NOT_DEFINED on error
147 SA_ErrorType set_next_anchor(Anchor *anchor, char *nextAnchor);
150 * @par Description: API to free Anchor structure
153 * @par Typical use case:
154 * @par Method of function operation:
155 * @par Important notes:
156 * @param[in] Anchor structure
158 * @return ERROR_INTERNAL_OK on success
159 * ERROR_INTERNAL_NOT_DEFINED on error
171 void free_anchor(Anchor *pAnchor);
174 * @par Description: API to create Location structure
177 * @par Typical use case:
178 * @par Method of function operation:
179 * @par Important notes:
180 * @param[in] string type, location uri
181 * @param[in] string type, location name
182 * @param[out] Location structure
184 * @return ERROR_INTERNAL_OK on success
185 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
197 SA_ErrorType create_location(char *locURI, char *locName, Location **pLocation);
200 * @par Description: API to duplicate Location structure
203 * @par Typical use case:
204 * @par Method of function operation:
205 * @par Important notes:
206 * @param[in] Location structure
208 * @return Location structure on success
221 Location *dup_location(Location* pLocation);
224 * @par Description: API to get location name from Location structure
227 * @par Typical use case:
228 * @par Method of function operation:
229 * @par Important notes:
230 * @param[in] Location structure
232 * @return location name on success
245 char *get_location_locname(Location *location);
248 * @par Description: API to get location uri from Location structure
251 * @par Typical use case:
252 * @par Method of function operation:
253 * @par Important notes:
254 * @param[in] Location structure
256 * @return location uri on success
269 char *get_location_locuri(Location *location);
272 * @par Description: API to free Location structure
275 * @par Typical use case:
276 * @par Method of function operation:
277 * @par Important notes:
278 * @param[in] Location structure
293 void free_location(Location *loc);
296 * @par Description: API to create Cred structure
299 * @par Typical use case:
300 * @par Method of function operation:
301 * @par Important notes:
302 * @param[in] string type, ID
303 * @param[in] string type, password
304 * @param[in] enum type, authentication type(basic, md5..)
305 * @param[in] enum type, format type(base64..)
306 * @param[in] string type, credential
307 * @param[out] Cred structure
309 * @return ERROR_INTERNAL_OK on success
310 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
322 SA_ErrorType create_cred(char *userName, char *pwd, AuthType authType, FormatType formatType , char *data, Cred **cred);
325 * @par Description: API to create Cred structure
328 * @par Typical use case:
329 * @par Method of function operation:
330 * @par Important notes:
331 * @param[in] enum type, authentication type(basic, md5..)
332 * @param[in] credential
334 * @return Cred structure on success
347 Cred *create_cred_with_data(AuthType authType, char *data);
350 * @par Description: API to duplicate Cred structure
353 * @par Typical use case:
354 * @par Method of function operation:
355 * @par Important notes:
356 * @param[in] Cred structure
358 * @return Cred structure on success
371 Cred *dup_cred(Cred *pCred);
374 * @par Description: API to set format type in Cred structure
377 * @par Typical use case:
378 * @par Method of function operation:
379 * @par Important notes:
380 * @param[in] Cred structure
381 * @param[in] format type(base64..)
396 void set_cred_format_type(Cred *cred, FormatType formatType);
399 * @par Description: API to free Cred structure
402 * @par Typical use case:
403 * @par Method of function operation:
404 * @par Important notes:
405 * @param[in] Cred structure
420 void free_cred(Cred *cred);
423 * @par Description: API to create SyncML structure
426 * @par Typical use case:
427 * @par Method of function operation:
428 * @par Important notes:
429 * @param[in] SyncHdr structure
430 * @param[in] GList type, list of Status structure
431 * @param[in] GList type, list of Command structure
432 * @param[in] int type, final flag
433 * @param[out] SyncML structure
435 * @return ERROR_INTERNAL_OK on success
436 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
449 SA_ErrorType create_syncml(SyncHdr *syncHdr, GList *status, GList *commands, int isFinal , SyncML **pSyncML);
452 * @par Description: API to free SyncML structure
455 * @par Typical use case:
456 * @par Method of function operation:
457 * @par Important notes:
458 * @param[in] SyncML structure
473 void free_syncml(SyncML *syncML);
476 * @par Description: API to create SyncHdr structure
479 * @par Typical use case:
480 * @par Method of function operation:
481 * @par Important notes:
482 * @param[in] session structure
483 * @param[out] SyncHdr structure
485 * @return ERROR_INTERNAL_OK on success
486 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
499 SA_ErrorType create_synchdr(Session *session , SyncHdr **pSyncHdr);
502 * @par Description: API to free SyncHdr structure
505 * @par Typical use case:
506 * @par Method of function operation:
507 * @par Important notes:
508 * @param[in] SyncHdr structure
523 void free_synchdr(SyncHdr *syncHdr);
526 * @par Description: API to create Item structure
529 * @par Typical use case:
530 * @par Method of function operation:
531 * @par Important notes:
535 * @return Item structure on success
552 * @par Description: API to create Item structure using data
555 * @par Typical use case:
556 * @par Method of function operation:
557 * @par Important notes:
559 * @param[in] size of data
562 * @return Item structure on success
576 Item *create_item_for_data(const char *data, unsigned int size);
579 * @par Description: API to create Item structure using DevInf
582 * @par Typical use case:
583 * @par Method of function operation:
584 * @par Important notes:
585 * @param[in] DevInf structure
588 * @return Item structure on success
602 Item *create_item_for_devinf(DevInf *devInf);
605 * @par Description: API to set Location(target) structure in Item structure
608 * @par Typical use case:
609 * @par Method of function operation:
610 * @par Important notes:
611 * @param[in] Item structure
612 * @param[in] Location structure
628 void set_item_target(Item *item, Location *target);
631 * @par Description: API to set Location(source) structure in Item structure
634 * @par Typical use case:
635 * @par Method of function operation:
636 * @par Important notes:
637 * @param[in] Item structure
638 * @param[in] Location structure
654 void set_item_source(Item *item, Location *source);
657 * @par Description: API to free Item structure
660 * @par Typical use case:
661 * @par Method of function operation:
662 * @par Important notes:
663 * @param[in] Item structure
679 void free_item(Item *item);
682 * @par Description: API to duplicate Chal structure
685 * @par Typical use case:
686 * @par Method of function operation:
687 * @par Important notes:
688 * @param[in] Chal structure
691 * @return Chal structure on success
705 Chal *dup_chal(Chal *pChal);
708 * @par Description: API to free Chal structure
711 * @par Typical use case:
712 * @par Method of function operation:
713 * @par Important notes:
714 * @param[in] Chal structure
730 void free_chal(Chal *chal);
733 * @par Description: API to compare server credential with local credential
736 * @par Typical use case:
737 * @par Method of function operation:
738 * @par Important notes:
739 * @param[in] Cred structure
740 * @param[in] Cred structure
743 * @return ERROR_INTERNAL_OK on success
744 * ERROR_AUTH_REJECTED, ERROR_INTERNAL_NOT_DEFINED on error
757 SA_ErrorType compare_cred(Cred *hdrCred, Cred *sessionCred);
760 * @par Description: API to convert AuthType
763 * @par Typical use case:
764 * @par Method of function operation:
765 * @par Important notes:
766 * @param[in] string type, auth type
769 * @return AUTH_TYPE_MD5, AUTH_TYPE_BASIC on success
770 * AUTH_TYPE_UNKNOWN on error
783 AuthType convert_auth_type(char *authType);
786 * @par Description: API to convert FormatType
789 * @par Typical use case:
790 * @par Method of function operation:
791 * @par Important notes:
792 * @param[in] string type, format type
795 * @return FORMAT_TYPE_BASE64 on success
796 * FORMAT_TYPE_UNKNOWN on error
809 FormatType convert_format_type(char *formatType);
811 #endif /* SA_ELEMENTS_H_ */