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.
18 #ifndef SA_ELEMENTS_H_
19 #define SA_ELEMENTS_H_
22 #include "common/dm_error.h"
23 #include "serviceadapter/sa_define.h"
26 * @par Description: API to create hmac
30 * @par Typical use case:
31 * @par Method of function operation:
32 * @par Important notes:
33 * @param[in] string type, auth name
34 * @param[in] string type, auth type
35 * @param[out] session structure
38 * @return DM_OK on success
52 DM_ERROR create_hmac(char *auth_name, char *auth_type, char *mac, Session ** session);
55 * @par Description: API to create location
59 * @par Typical use case:
60 * @par Method of function operation:
61 * @par Important notes:
62 * @param[in] string type, location uri
63 * @param[in] string type, location name
64 * @param[out] location structure
67 * @return DM_OK on success
81 DM_ERROR create_location(const char *locURI, const char *locName, Location ** pLocation);
84 * @par Description: API to duplicate location
88 * @par Typical use case:
89 * @par Method of function operation:
90 * @par Important notes:
91 * @param[out] location structure
94 * @return location structure
108 Location *dup_location(Location * pLocation);
111 * @par Description: API to get location name
115 * @par Typical use case:
116 * @par Method of function operation:
117 * @par Important notes:
118 * @param[out] location structure
121 * @return location name
135 char *get_location_locname(Location * location);
138 * @par Description: API to get location uri
142 * @par Typical use case:
143 * @par Method of function operation:
144 * @par Important notes:
145 * @param[out] location structure
148 * @return location uri
162 char *get_location_locuri(Location * location);
165 * @par Description: API to free location
169 * @par Typical use case:
170 * @par Method of function operation:
171 * @par Important notes:
172 * @param[in] location structure
189 void free_location(Location * loc);
192 * @par Description: API to free cred
196 * @par Typical use case:
197 * @par Method of function operation:
198 * @par Important notes:
199 * @param[out] cred structure
216 void free_cred(Cred * cred);
219 * @par Description: API to create auth cred
223 * @par Typical use case:
224 * @par Method of function operation:
225 * @par Important notes:
226 * @param[in] string type, user name
227 * @param[in] enum type, AuthType
228 * @param[in] enum type, FormatType
229 * @param[in] string type, data
230 * @param[out] cred structure
247 DM_ERROR create_auth_cred(char *userName, char *pwd, AuthType authType, FormatType formatType, char *data, Cred ** cred);
250 * @par Description: API to create cred with data
254 * @par Typical use case:
255 * @par Method of function operation:
256 * @par Important notes:
257 * @param[in] enum type, AuthType
258 * @param[in] string type, data
261 * @return Cred structure
275 Cred *create_credwithdata(AuthType authType, char *data);
278 * @par Description: API to set cred format type
282 * @par Typical use case:
283 * @par Method of function operation:
284 * @par Important notes:
285 * @param[in] Cred structure
286 * @param[in] enum type, format type
303 void set_credformattype(Cred * cred, FormatType formatType);
306 * @par Description: API to check server cred
310 * @par Typical use case:
311 * @par Method of function operation:
312 * @par Important notes:
313 * @param[in] Cred structure
314 * @param[in] session structure
317 * @return DM_OK on success
331 DM_ERROR check_server_cred(Cred * hdrCred, Session * session); // Cred *sessionCred);
334 * @par Description: API to create challenge
338 * @par Typical use case:
339 * @par Method of function operation:
340 * @par Important notes:
341 * @param[in] enum type, format type
342 * @param[in] enum type, auth type
343 * @param[in] string type, next nonce
344 * @param[in] chanlenge stturcture
347 * @return DM_OK on success
361 DM_ERROR create_chal(FormatType format, AuthType type, char *nextnonce, Chal ** pChal);
364 * @par Description: API to free challenge
368 * @par Typical use case:
369 * @par Method of function operation:
370 * @par Important notes:
371 * @param[in] challenge structure
388 void free_chal(Chal * pChal);
391 * @par Description: API to duplicate chalenge
395 * @par Typical use case:
396 * @par Method of function operation:
397 * @par Important notes:
398 * @param[in] challenge structure
401 * @return challenge structure
415 Chal *dup_chal(Chal * pChal);
418 * @par Description: API to free challenge
422 * @par Typical use case:
423 * @par Method of function operation:
424 * @par Important notes:
425 * @param[in] challenge structure
442 void free_hmac(Hmac * hmac);
445 * @par Description: API to convert to string to auth type
449 * @par Typical use case:
450 * @par Method of function operation:
451 * @par Important notes:
452 * @param[in] string type, auth type
469 AuthType converttoauthtype(char *authType);
472 * @par Description: API to convert to string to format type
476 * @par Typical use case:
477 * @par Method of function operation:
478 * @par Important notes:
479 * @param[in] string type, format type
496 FormatType converttoformattype(char *formatType);
499 * @par Description: API to construct item
503 * @par Typical use case:
504 * @par Method of function operation:
505 * @par Important notes:
506 * @param[in] string type, source uri
507 * @param[in] string type, source uri
508 * @param[in] string type, format
509 * @param[in] string type, contenttype
510 * @param[in] string type, data
511 * @param[in] int type, size
512 * @param[in] int type, moredata
513 * @param[out] item structure
515 * @return DM_OK on success
529 DM_ERROR construct_Item(char *sourceUrl, const char *format, const char *contenttype, const char *data, unsigned int size, int moreData, Item ** pItem);
532 * @par Description: API to construct item
536 * @par Typical use case:
537 * @par Method of function operation:
538 * @par Important notes:
540 * @return item structure
557 * @par Description: API to construct item
561 * @par Typical use case:
562 * @par Method of function operation:
563 * @par Important notes:
564 * @param[in] string type, data
565 * @param[in] int type, size
566 * @param[out] item structure
568 * @return DM_OK on success
583 DM_ERROR create_item_data(char *data, unsigned int size, Item ** pItem);
586 * @par Description: API to set item target uri
590 * @par Typical use case:
591 * @par Method of function operation:
592 * @par Important notes:
593 * @param[in] item structure
594 * @param[in] location structure
610 void set_itemtarget(Item * item, Location * target);
613 * @par Description: API to set item source uri
617 * @par Typical use case:
618 * @par Method of function operation:
619 * @par Important notes:
620 * @param[in] item structure
621 * @param[in] location structure
637 void set_itemsource(Item * item, Location * source);
640 * @par Description: API to free item
644 * @par Typical use case:
645 * @par Method of function operation:
646 * @par Important notes:
647 * @param[in] item structure
663 void free_Item(Item * item);
666 * @par Description: API to create syncml
670 * @par Typical use case:
671 * @par Method of function operation:
672 * @par Important notes:
673 * @param[in] sync header structure
674 * @param[in] status list
675 * @param[in] command list
676 * @param[in] int type is final
677 * @param[out] syncml structure
679 * @return DM_OK on success
694 DM_ERROR create_syncml(SyncHdr * syncHdr, GList * status, GList * commands, int isFinal, SyncML ** pSyncML);
697 * @par Description: API to free syncml
701 * @par Typical use case:
702 * @par Method of function operation:
703 * @par Important notes:
704 * @param[in] syncml structure
720 void free_syncml(SyncML * syncML);
723 * @par Description: API to create syncml header
727 * @par Typical use case:
728 * @par Method of function operation:
729 * @par Important notes:
730 * @param[in] session structure
731 * @param[out] sync header
747 DM_ERROR create_syncml_hdr(Session * session, SyncHdr ** pSyncHdr);
750 * @par Description: API to free syncml header
754 * @par Typical use case:
755 * @par Method of function operation:
756 * @par Important notes:
757 * @param[in] sync header
773 void free_synchdr(SyncHdr * syncHdr);
775 #endif /* SA_ELEMENTS_H_ */