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 elements structure
24 #ifndef SA_ELEMENTS_H_
25 #define SA_ELEMENTS_H_
27 #include "service-adapter/sa_define.h"
30 * @par Description: API to create anchor_s structure
33 * @par Typical use case:
34 * @par Method of function operation:
35 * @par Important notes:
36 * @param[in] string type, last anchor
37 * @param[in] string type, next anchor
38 * @param[out] anchor_s structure
40 * @return ERROR_INTERNAL_OK on success
41 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
53 sa_error_type_e create_anchor(char *last, char *next, anchor_s ** anchor);
56 * @par Description: API to set anchor in item_s structure
59 * @par Typical use case:
60 * @par Method of function operation:
61 * @par Important notes:
62 * @param[in] item_s structure
63 * @param[in] anchor_s structure
65 * @return ERROR_INTERNAL_OK on success
66 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
78 sa_error_type_e set_item_anchor(item_s * item, anchor_s * anchor);
81 * @par Description: API to set last anchor in anchor_s structure
84 * @par Typical use case:
85 * @par Method of function operation:
86 * @par Important notes:
87 * @param[in] anchor_s structure
88 * @param[in] string type, last anchor
90 * @return ERROR_INTERNAL_OK on success
91 * ERROR_INTERNAL_NOT_DEFINED on error
103 sa_error_type_e set_last_anchor(anchor_s * anchor, char *lastAnchor);
106 * @par Description: API to set next anchor in anchor_s structure
109 * @par Typical use case:
110 * @par Method of function operation:
111 * @par Important notes:
112 * @param[in] anchor_s structure
113 * @param[in] string type, next anchor
115 * @return ERROR_INTERNAL_OK on success
116 * ERROR_INTERNAL_NOT_DEFINED on error
128 sa_error_type_e set_next_anchor(anchor_s * anchor, char *nextAnchor);
131 * @par Description: API to free anchor_s structure
134 * @par Typical use case:
135 * @par Method of function operation:
136 * @par Important notes:
137 * @param[in] anchor_s structure
139 * @return ERROR_INTERNAL_OK on success
140 * ERROR_INTERNAL_NOT_DEFINED on error
152 void free_anchor(anchor_s * anchor);
155 * @par Description: API to create location_s structure
158 * @par Typical use case:
159 * @par Method of function operation:
160 * @par Important notes:
161 * @param[in] string type, location uri
162 * @param[in] string type, location name
163 * @param[out] location_s structure
165 * @return ERROR_INTERNAL_OK on success
166 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
178 sa_error_type_e create_location(char *loc_uri, char *loc_name, location_s ** location);
181 * @par Description: API to duplicate location_s structure
184 * @par Typical use case:
185 * @par Method of function operation:
186 * @par Important notes:
187 * @param[in] location_s structure
189 * @return location_s structure on success
202 location_s *dup_location(location_s * location);
205 * @par Description: API to get location name from location_s structure
208 * @par Typical use case:
209 * @par Method of function operation:
210 * @par Important notes:
211 * @param[in] location_s structure
213 * @return location name on success
226 char *get_location_loc_name(location_s * location);
229 * @par Description: API to get location uri from location_s structure
232 * @par Typical use case:
233 * @par Method of function operation:
234 * @par Important notes:
235 * @param[in] location_s structure
237 * @return location uri on success
250 char *get_location_loc_uri(location_s * location);
253 * @par Description: API to free location_s structure
256 * @par Typical use case:
257 * @par Method of function operation:
258 * @par Important notes:
259 * @param[in] location_s structure
274 void free_location(location_s * location);
277 * @par Description: API to create cred_s structure
280 * @par Typical use case:
281 * @par Method of function operation:
282 * @par Important notes:
283 * @param[in] string type, ID
284 * @param[in] string type, password
285 * @param[in] enum type, authentication type(basic, md5..)
286 * @param[in] enum type, format type(base64..)
287 * @param[in] string type, credential
288 * @param[out] cred_s structure
290 * @return ERROR_INTERNAL_OK on success
291 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
303 sa_error_type_e create_cred(char *user_name, char *pwd, auth_type_e auth_type, format_type_e format_type, char *data, cred_s ** cred);
306 * @par Description: API to create cred_s structure
309 * @par Typical use case:
310 * @par Method of function operation:
311 * @par Important notes:
312 * @param[in] enum type, authentication type(basic, md5..)
313 * @param[in] credential
315 * @return cred_s structure on success
328 cred_s *create_cred_with_data(auth_type_e auth_type, char *data);
331 * @par Description: API to duplicate cred_s structure
334 * @par Typical use case:
335 * @par Method of function operation:
336 * @par Important notes:
337 * @param[in] cred_s structure
339 * @return cred_s structure on success
352 cred_s *dup_cred(cred_s * cred);
355 * @par Description: API to set format type in cred_s structure
358 * @par Typical use case:
359 * @par Method of function operation:
360 * @par Important notes:
361 * @param[in] cred_s structure
362 * @param[in] format type(base64..)
377 void set_cred_format_type(cred_s * cred, format_type_e format_type);
380 * @par Description: API to free cred_s structure
383 * @par Typical use case:
384 * @par Method of function operation:
385 * @par Important notes:
386 * @param[in] cred_s structure
401 void free_cred(cred_s * cred);
404 * @par Description: API to create syncml_s structure
407 * @par Typical use case:
408 * @par Method of function operation:
409 * @par Important notes:
410 * @param[in] sync_hdr_s structure
411 * @param[in] GList type, list of status_s structure
412 * @param[in] GList type, list of command_s structure
413 * @param[in] int type, final flag
414 * @param[out] syncml_s structure
416 * @return ERROR_INTERNAL_OK on success
417 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
430 sa_error_type_e create_syncml(sync_hdr_s * sync_hdr, GList * status, GList * commands, int is_final, syncml_s ** syncml);
433 * @par Description: API to free syncml_s structure
436 * @par Typical use case:
437 * @par Method of function operation:
438 * @par Important notes:
439 * @param[in] syncml_s structure
454 void free_syncml(syncml_s * syncml);
457 * @par Description: API to create sync_hdr_s structure
460 * @par Typical use case:
461 * @par Method of function operation:
462 * @par Important notes:
463 * @param[in] session_s structure
464 * @param[out] sync_hdr_s structure
466 * @return ERROR_INTERNAL_OK on success
467 * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error
480 sa_error_type_e create_sync_hdr(session_s * session, sync_hdr_s ** sync_hdr);
483 * @par Description: API to free SyncHdr structure
486 * @par Typical use case:
487 * @par Method of function operation:
488 * @par Important notes:
489 * @param[in] SyncHdr structure
504 void free_sync_hdr(sync_hdr_s * sync_hdr);
507 * @par Description: API to create item_s structure
510 * @par Typical use case:
511 * @par Method of function operation:
512 * @par Important notes:
516 * @return item_s structure on success
530 item_s *create_item();
533 * @par Description: API to create item_s structure using data
536 * @par Typical use case:
537 * @par Method of function operation:
538 * @par Important notes:
540 * @param[in] size of data
543 * @return item_s structure on success
557 item_s *create_item_for_data(const char *data, unsigned int size);
560 * @par Description: API to create item_s structure using DevInf
563 * @par Typical use case:
564 * @par Method of function operation:
565 * @par Important notes:
566 * @param[in] devinf_s structure
569 * @return item_s structure on success
583 item_s *create_item_for_devinf(devinf_s * devinf);
586 * @par Description: API to set location_s(target) structure in item_s structure
589 * @par Typical use case:
590 * @par Method of function operation:
591 * @par Important notes:
592 * @param[in] item_s structure
593 * @param[in] location_s structure
609 void set_item_target(item_s * item, location_s * target);
612 * @par Description: API to set location_s(source) structure in item_s structure
615 * @par Typical use case:
616 * @par Method of function operation:
617 * @par Important notes:
618 * @param[in] item_s structure
619 * @param[in] location_s structure
635 void set_item_source(item_s * item, location_s * source);
638 * @par Description: API to free item_s structure
641 * @par Typical use case:
642 * @par Method of function operation:
643 * @par Important notes:
644 * @param[in] item_s structure
660 void free_item(item_s * item);
663 * @par Description: API to duplicate chal_s structure
666 * @par Typical use case:
667 * @par Method of function operation:
668 * @par Important notes:
669 * @param[in] chal_s structure
672 * @return chal_s structure on success
686 chal_s *dup_chal(chal_s * chal);
689 * @par Description: API to free chal_s structure
692 * @par Typical use case:
693 * @par Method of function operation:
694 * @par Important notes:
695 * @param[in] chal_s structure
711 void free_chal(chal_s * chal);
714 * @par Description: API to compare server credential with local credential
717 * @par Typical use case:
718 * @par Method of function operation:
719 * @par Important notes:
720 * @param[in] cred_s structure
721 * @param[in] cred_s structure
724 * @return ERROR_INTERNAL_OK on success
725 * ERROR_AUTH_REJECTED, ERROR_INTERNAL_NOT_DEFINED on error
738 sa_error_type_e compare_cred(cred_s * hdr_cred, cred_s * session_cred);
741 * @par Description: API to convert auth_type_e
744 * @par Typical use case:
745 * @par Method of function operation:
746 * @par Important notes:
747 * @param[in] string type, auth type
750 * @return AUTH_TYPE_MD5, AUTH_TYPE_BASIC on success
751 * AUTH_TYPE_UNKNOWN on error
764 auth_type_e convert_auth_type(char *auth_type);
767 * @par Description: API to convert format_type_e
770 * @par Typical use case:
771 * @par Method of function operation:
772 * @par Important notes:
773 * @param[in] string type, format type
776 * @return FORMAT_TYPE_BASE64 on success
777 * FORMAT_TYPE_UNKNOWN on error
790 format_type_e convert_format_type(char *format_type);
793 * @par Description: API to create mem_s structure
796 * @par Typical use case:
797 * @par Method of function operation:
798 * @par Important notes:
802 * @return mem_s structure on success
819 * @par Description: API to set shared_mem
822 * @par Typical use case:
823 * @par Method of function operation:
824 * @par Important notes:
826 * @param[in] shared_mem
841 void set_mem_shared_mem(mem_s * mem, int shared_mem);
844 * @par Description: API to set free_mem
847 * @par Typical use case:
848 * @par Method of function operation:
849 * @par Important notes:
851 * @param[in] free_mem
866 void set_mem_free_mem(mem_s * mem, unsigned int free_mem);
869 * @par Description: API to set free_id
872 * @par Typical use case:
873 * @par Method of function operation:
874 * @par Important notes:
891 void set_mem_free_id(mem_s * mem, unsigned int free_id);
893 #endif /* SA_ELEMENTS_H_ */