Tizen 2.0 Release
[framework/system/oma-dm-agent.git] / include / serviceadapter / sa_elements.h
1 /*
2  * oma-dm-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #ifndef SA_ELEMENTS_H_
19 #define SA_ELEMENTS_H_
20
21 /*dm-agent*/
22 #include "common/dm_error.h"
23 #include "serviceadapter/sa_define.h"
24
25 /**
26  * @par Description: API to create hmac
27  *
28  *
29  * @par Purpose:
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
36  *
37  *
38  * @return                              DM_OK on success
39  *                                                      DM_ERROR on fail
40  *
41  * @par Errors:
42  *
43  * @pre None.
44  * @post
45  * @see
46  * @remarks None.
47  *
48  * @par Sample Code:
49  * @code
50  * @endcode
51  */
52 DM_ERROR create_hmac(char *auth_name, char *auth_type, char *mac, Session ** session);
53
54 /**
55  * @par Description: API to create location
56  *
57  *
58  * @par Purpose:
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
65  *
66  *
67  * @return                              DM_OK on success
68  *                                                      DM_ERROR on fail
69  *
70  * @par Errors:
71  *
72  * @pre None.
73  * @post
74  * @see
75  * @remarks None.
76  *
77  * @par Sample Code:
78  * @code
79  * @endcode
80  */
81 DM_ERROR create_location(const char *locURI, const char *locName, Location ** pLocation);
82
83 /**
84  * @par Description: API to duplicate location
85  *
86  *
87  * @par Purpose:
88  * @par Typical use case:
89  * @par Method of function operation:
90  * @par Important notes:
91  * @param[out]          location structure
92  *
93  *
94  * @return                              location structure
95  *
96  *
97  * @par Errors:
98  *
99  * @pre None.
100  * @post
101  * @see
102  * @remarks None.
103  *
104  * @par Sample Code:
105  * @code
106  * @endcode
107  */
108 Location *dup_location(Location * pLocation);
109
110 /**
111  * @par Description: API to get location name
112  *
113  *
114  * @par Purpose:
115  * @par Typical use case:
116  * @par Method of function operation:
117  * @par Important notes:
118  * @param[out]          location structure
119  *
120  *
121  * @return                              location name
122  *
123  *
124  * @par Errors:
125  *
126  * @pre None.
127  * @post
128  * @see
129  * @remarks None.
130  *
131  * @par Sample Code:
132  * @code
133  * @endcode
134  */
135 char *get_location_locname(Location * location);
136
137 /**
138  * @par Description: API to get location uri
139  *
140  *
141  * @par Purpose:
142  * @par Typical use case:
143  * @par Method of function operation:
144  * @par Important notes:
145  * @param[out]          location structure
146  *
147  *
148  * @return                              location uri
149  *
150  *
151  * @par Errors:
152  *
153  * @pre None.
154  * @post
155  * @see
156  * @remarks None.
157  *
158  * @par Sample Code:
159  * @code
160  * @endcode
161  */
162 char *get_location_locuri(Location * location);
163
164 /**
165  * @par Description: API to free location
166  *
167  *
168  * @par Purpose:
169  * @par Typical use case:
170  * @par Method of function operation:
171  * @par Important notes:
172  * @param[in]           location structure
173  *
174  *
175  * @return
176  *
177  *
178  * @par Errors:
179  *
180  * @pre None.
181  * @post
182  * @see
183  * @remarks None.
184  *
185  * @par Sample Code:
186  * @code
187  * @endcode
188  */
189 void free_location(Location * loc);
190
191 /**
192  * @par Description: API to free cred
193  *
194  *
195  * @par Purpose:
196  * @par Typical use case:
197  * @par Method of function operation:
198  * @par Important notes:
199  * @param[out]          cred structure
200  *
201  *
202  * @return
203  *
204  *
205  * @par Errors:
206  *
207  * @pre None.
208  * @post
209  * @see
210  * @remarks None.
211  *
212  * @par Sample Code:
213  * @code
214  * @endcode
215  */
216 void free_cred(Cred * cred);
217
218 /**
219  * @par Description: API to create auth cred
220  *
221  *
222  * @par Purpose:
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
231  *
232  *
233  * @return
234  *
235  *
236  * @par Errors:
237  *
238  * @pre None.
239  * @post
240  * @see
241  * @remarks None.
242  *
243  * @par Sample Code:
244  * @code
245  * @endcode
246  */
247 DM_ERROR create_auth_cred(char *userName, char *pwd, AuthType authType, FormatType formatType, char *data, Cred ** cred);
248
249 /**
250  * @par Description: API to create cred with data
251  *
252  *
253  * @par Purpose:
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
259  *
260  *
261  * @return                              Cred structure
262  *
263  *
264  * @par Errors:
265  *
266  * @pre None.
267  * @post
268  * @see
269  * @remarks None.
270  *
271  * @par Sample Code:
272  * @code
273  * @endcode
274  */
275 Cred *create_credwithdata(AuthType authType, char *data);
276
277 /**
278  * @par Description: API to set cred format type
279  *
280  *
281  * @par Purpose:
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
287  *
288  *
289  * @return
290  *
291  *
292  * @par Errors:
293  *
294  * @pre None.
295  * @post
296  * @see
297  * @remarks None.
298  *
299  * @par Sample Code:
300  * @code
301  * @endcode
302  */
303 void set_credformattype(Cred * cred, FormatType formatType);
304
305 /**
306  * @par Description: API to check server cred
307  *
308  *
309  * @par Purpose:
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
315  *
316  *
317  * @return                              DM_OK on success
318  *                                                      DM_ERROR  on fial
319  *
320  * @par Errors:
321  *
322  * @pre None.
323  * @post
324  * @see
325  * @remarks None.
326  *
327  * @par Sample Code:
328  * @code
329  * @endcode
330  */
331 DM_ERROR check_server_cred(Cred * hdrCred, Session * session);  // Cred *sessionCred);
332
333 /**
334  * @par Description: API to create challenge
335  *
336  *
337  * @par Purpose:
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
345  *
346  *
347  * @return                              DM_OK on success
348  *                                                      DM_ERROR  on fial
349  *
350  * @par Errors:
351  *
352  * @pre None.
353  * @post
354  * @see
355  * @remarks None.
356  *
357  * @par Sample Code:
358  * @code
359  * @endcode
360  */
361 DM_ERROR create_chal(FormatType format, AuthType type, char *nextnonce, Chal ** pChal);
362
363 /**
364  * @par Description: API to free challenge
365  *
366  *
367  * @par Purpose:
368  * @par Typical use case:
369  * @par Method of function operation:
370  * @par Important notes:
371  * @param[in]           challenge structure
372  *
373  *
374  * @return
375  *
376  *
377  * @par Errors:
378  *
379  * @pre None.
380  * @post
381  * @see
382  * @remarks None.
383  *
384  * @par Sample Code:
385  * @code
386  * @endcode
387  */
388 void free_chal(Chal * pChal);
389
390 /**
391  * @par Description: API to duplicate chalenge
392  *
393  *
394  * @par Purpose:
395  * @par Typical use case:
396  * @par Method of function operation:
397  * @par Important notes:
398  * @param[in]           challenge structure
399  *
400  *
401  * @return                              challenge structure
402  *
403  *
404  * @par Errors:
405  *
406  * @pre None.
407  * @post
408  * @see
409  * @remarks None.
410  *
411  * @par Sample Code:
412  * @code
413  * @endcode
414  */
415 Chal *dup_chal(Chal * pChal);
416
417 /**
418  * @par Description: API to free challenge
419  *
420  *
421  * @par Purpose:
422  * @par Typical use case:
423  * @par Method of function operation:
424  * @par Important notes:
425  * @param[in]           challenge structure
426  *
427  *
428  * @return
429  *
430  *
431  * @par Errors:
432  *
433  * @pre None.
434  * @post
435  * @see
436  * @remarks None.
437  *
438  * @par Sample Code:
439  * @code
440  * @endcode
441  */
442 void free_hmac(Hmac * hmac);
443
444 /**
445  * @par Description: API to convert to string to auth type
446  *
447  *
448  * @par Purpose:
449  * @par Typical use case:
450  * @par Method of function operation:
451  * @par Important notes:
452  * @param[in]           string type, auth type
453  *
454  *
455  * @return                              AuthType
456  *
457  *
458  * @par Errors:
459  *
460  * @pre None.
461  * @post
462  * @see
463  * @remarks None.
464  *
465  * @par Sample Code:
466  * @code
467  * @endcode
468  */
469 AuthType converttoauthtype(char *authType);
470
471 /**
472  * @par Description: API to convert to string to format type
473  *
474  *
475  * @par Purpose:
476  * @par Typical use case:
477  * @par Method of function operation:
478  * @par Important notes:
479  * @param[in]           string type, format type
480  *
481  *
482  * @return                              FormatType
483  *
484  *
485  * @par Errors:
486  *
487  * @pre None.
488  * @post
489  * @see
490  * @remarks None.
491  *
492  * @par Sample Code:
493  * @code
494  * @endcode
495  */
496 FormatType converttoformattype(char *formatType);
497
498 /**
499  * @par Description: API to construct item
500  *
501  *
502  * @par Purpose:
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
514  *
515  * @return                              DM_OK on success
516  *                                                      DM_ERROR on fail
517  *
518  * @par Errors:
519  *
520  * @pre None.
521  * @post
522  * @see
523  * @remarks None.
524  *
525  * @par Sample Code:
526  * @code
527  * @endcode
528  */
529 DM_ERROR construct_Item(char *sourceUrl, const char *format, const char *contenttype, const char *data, unsigned int size, int moreData, Item ** pItem);
530
531 /**
532  * @par Description: API to construct item
533  *
534  *
535  * @par Purpose:
536  * @par Typical use case:
537  * @par Method of function operation:
538  * @par Important notes:
539  *
540  * @return                              item structure
541  *
542  *
543  * @par Errors:
544  *
545  * @pre None.
546  * @post
547  * @see
548  * @remarks None.
549  *
550  * @par Sample Code:
551  * @code
552  * @endcode
553  */
554 Item *create_Item();
555
556 /**
557  * @par Description: API to construct item
558  *
559  *
560  * @par Purpose:
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
567  *
568  * @return                              DM_OK on success
569  *                                                      DM_ERROR on fail
570  *
571  *
572  * @par Errors:
573  *
574  * @pre None.
575  * @post
576  * @see
577  * @remarks None.
578  *
579  * @par Sample Code:
580  * @code
581  * @endcode
582  */
583 DM_ERROR create_item_data(char *data, unsigned int size, Item ** pItem);
584
585 /**
586  * @par Description: API to set item target uri
587  *
588  *
589  * @par Purpose:
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
595  *
596  * @return
597  *
598  *
599  * @par Errors:
600  *
601  * @pre None.
602  * @post
603  * @see
604  * @remarks None.
605  *
606  * @par Sample Code:
607  * @code
608  * @endcode
609  */
610 void set_itemtarget(Item * item, Location * target);
611
612 /**
613  * @par Description: API to set item source uri
614  *
615  *
616  * @par Purpose:
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
622  *
623  * @return
624  *
625  *
626  * @par Errors:
627  *
628  * @pre None.
629  * @post
630  * @see
631  * @remarks None.
632  *
633  * @par Sample Code:
634  * @code
635  * @endcode
636  */
637 void set_itemsource(Item * item, Location * source);
638
639 /**
640  * @par Description: API to free item
641  *
642  *
643  * @par Purpose:
644  * @par Typical use case:
645  * @par Method of function operation:
646  * @par Important notes:
647  *      @param[in]              item structure
648  *
649  * @return
650  *
651  *
652  * @par Errors:
653  *
654  * @pre None.
655  * @post
656  * @see
657  * @remarks None.
658  *
659  * @par Sample Code:
660  * @code
661  * @endcode
662  */
663 void free_Item(Item * item);
664
665 /**
666  * @par Description: API to create syncml
667  *
668  *
669  * @par Purpose:
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
678  *
679  * @return                              DM_OK on success
680  *                                              DM_ERROR on fail
681  *
682  *
683  * @par Errors:
684  *
685  * @pre None.
686  * @post
687  * @see
688  * @remarks None.
689  *
690  * @par Sample Code:
691  * @code
692  * @endcode
693  */
694 DM_ERROR create_syncml(SyncHdr * syncHdr, GList * status, GList * commands, int isFinal, SyncML ** pSyncML);
695
696 /**
697  * @par Description: API to free syncml
698  *
699  *
700  * @par Purpose:
701  * @par Typical use case:
702  * @par Method of function operation:
703  * @par Important notes:
704  *      @param[in]              syncml structure
705  *
706  * @return
707  *
708  *
709  * @par Errors:
710  *
711  * @pre None.
712  * @post
713  * @see
714  * @remarks None.
715  *
716  * @par Sample Code:
717  * @code
718  * @endcode
719  */
720 void free_syncml(SyncML * syncML);
721
722 /**
723  * @par Description: API to create syncml header
724  *
725  *
726  * @par Purpose:
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
732  *
733  * @return
734  *
735  *
736  * @par Errors:
737  *
738  * @pre None.
739  * @post
740  * @see
741  * @remarks None.
742  *
743  * @par Sample Code:
744  * @code
745  * @endcode
746  */
747 DM_ERROR create_syncml_hdr(Session * session, SyncHdr ** pSyncHdr);
748
749 /**
750  * @par Description: API to free syncml header
751  *
752  *
753  * @par Purpose:
754  * @par Typical use case:
755  * @par Method of function operation:
756  * @par Important notes:
757  *      @param[in]              sync header
758  *
759  * @return
760  *
761  *
762  * @par Errors:
763  *
764  * @pre None.
765  * @post
766  * @see
767  * @remarks None.
768  *
769  * @par Sample Code:
770  * @code
771  * @endcode
772  */
773 void free_synchdr(SyncHdr * syncHdr);
774
775 #endif                          /* SA_ELEMENTS_H_ */