diff options
Diffstat (limited to 'include/service-adapter')
-rwxr-xr-x | include/service-adapter/network-binder/na_binder.h | 85 | ||||
-rwxr-xr-x | include/service-adapter/protocol-binder/oma_ds_protocol_binder.h | 314 | ||||
-rwxr-xr-x | include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h | 188 | ||||
-rwxr-xr-x | include/service-adapter/sa_command.h | 866 | ||||
-rwxr-xr-x | include/service-adapter/sa_command_internal.h | 102 | ||||
-rwxr-xr-x | include/service-adapter/sa_common_interface.h | 285 | ||||
-rwxr-xr-x | include/service-adapter/sa_define.h | 159 | ||||
-rwxr-xr-x | include/service-adapter/sa_devinf.h | 134 | ||||
-rwxr-xr-x | include/service-adapter/sa_devinf_internal.h | 118 | ||||
-rwxr-xr-x | include/service-adapter/sa_elements.h | 893 | ||||
-rwxr-xr-x | include/service-adapter/sa_elements_internal.h | 102 | ||||
-rwxr-xr-x | include/service-adapter/sa_error.h | 124 | ||||
-rwxr-xr-x | include/service-adapter/sa_session.h | 277 | ||||
-rwxr-xr-x | include/service-adapter/sa_session_internal.h | 83 | ||||
-rwxr-xr-x | include/service-adapter/sa_util.h | 94 |
15 files changed, 3824 insertions, 0 deletions
diff --git a/include/service-adapter/network-binder/na_binder.h b/include/service-adapter/network-binder/na_binder.h new file mode 100755 index 0000000..a229bd2 --- /dev/null +++ b/include/service-adapter/network-binder/na_binder.h @@ -0,0 +1,85 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @NA_Binder.h + * @version 0.1 + * @brief This file is the header file of interface of NA Binder + */ + +#ifndef NA_BINDER_H_ +#define NA_BINDER_H_ + +#include <sync_agent.h> +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to header binding for HTTP protocol + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, access type(http, obex...) + * @param[in] string type, target uri + * @param[in] boolean type, xml or wbxml + * @param[out] GList type, list of header info + * + * @return 1 on success + * 0 on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int na_http_header_binder(char *acc_type, char *loc_uri, bool is_xml, char *jsession_id, GList ** list); + +/** + * @par Description: API to free sync_agent_na_common_header_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_na_common_header_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_header_info(sync_agent_na_common_header_info_s * common_header_info); + +#endif /* NA_BINDER_H_ */ diff --git a/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h b/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h new file mode 100755 index 0000000..ab25ad2 --- /dev/null +++ b/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h @@ -0,0 +1,314 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @oma_ds_protocol_binder.h + * @version 0.1 + * @brief This file is the header file of interface of protocol binder + */ + +#ifndef OMA_DS_PROTOCOL_BINDER_H_ +#define OMA_DS_PROTOCOL_BINDER_H_ + +#include <sync_agent.h> +#include "service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h" + +/** + * @par Description: API to Initialize protocol binder function set + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_error_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e init_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s ** binder_function_set); + +/** + * @par Description: API to free sync_agent_pb_protocol_binder_function_set_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s * binder_function_set); + +/** + * @par Description: API to Initialize protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[in] enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13) + * @param[in] boolean type, whether encode xml header or not + * @param[in] boolean type, whether use string table or not + * @param[in] boolean type, whether protocol is anonymous or not + * @param[in] boolean type, whether use flow mode or not + * @param[in] boolean type, whether use textual public id or not + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_protocol_binder_info_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_protocol_binder_info_s *oma_ds_1_2_binder_init(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e enc, bool encode_xml_header, + bool use_strtbl, bool produce_anonymous, bool use_flow_mode, bool text_public_id, sync_agent_pb_protocol_binder_function_set_s * binder_function_set); + +/** + * @par Description: API to append specific element to WBXML tree + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[in] enum type, protocol element + * @param[in] content(structure to append) + * @param[out] + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_append(sync_agent_pb_protocol_binder_info_s * binder, oma_ds_protocol_element_e protocol_element, Content_Ptr content); + +/** + * @par Description: API to terminate sync_agent_pb_protocol_binder_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void oma_ds_1_2_binder_terminate(sync_agent_pb_protocol_binder_info_s * binder); + +/** + * @par Description: API to get stream + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] string type, stream from WBXML tree + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_stream(sync_agent_pb_protocol_binder_info_s * binder, char **byte_stream, unsigned int *byte_stream_size); + +/** + * @par Description: API to get stream size + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_stream_size(sync_agent_pb_protocol_binder_info_s * binder, unsigned int *byte_stream_size); + +/** + * @par Description: API to get encoding type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_encoding(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e * enc); + +/** + * @par Description: API to Initialize reverse protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, WBXML stream to parse + * @param[in] unsigned int type, size of stream + * @param[in] enum type, decoding(SYNC_AGENT_PB_DECODING_XML, SYNC_AGENT_PB_DECODING_WBXML) + * @param[in] user data + * @param[out] sync_agent_pb_protocol_binder_reverse_info_s structure + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e reverse_oma_ds_1_2_binder_init(char *byte_stream, + unsigned int byte_stream_len, sync_agent_pb_decoding_e dec, sync_agent_pb_protocol_binder_function_set_s * binder_function_set, void *user_data, sync_agent_pb_protocol_binder_reverse_info_s ** binder); + +/** + * @par Description: API to parse and get next contents + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_reverse_info_s structure + * @param[out] protocol element + * @param[out] string type, protocol element + * @param[out] parsed contents(defined structure) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e reverse_oma_ds_1_2_binder_next(sync_agent_pb_protocol_binder_reverse_info_s * binder, Protocol_Element * protocol_element, char **protocol_element_name, Content_Ptr * content); + +#endif /* OMA_DS_PROTOCOL_BINDER_H_ */ diff --git a/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h b/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h new file mode 100755 index 0000000..a74bde5 --- /dev/null +++ b/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h @@ -0,0 +1,188 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @oma_ds_protocol_binder_definition.h + * @version 0.1 + * @brief This file is the header file for protocol binder definition + */ + +#ifndef OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ +#define OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ + +#define SYNC_AGENT_INIT_ESTIMATE_DOC_SIZE 20 + +/* SyncML */ +#define ELEMENT_SYNCML "SyncML" + +/* SyncHdr */ +#define ELEMENT_SYNCHDR "SyncHdr" +#define ELEMENT_VERDTD "VerDTD" +#define ELEMENT_VERDRD_10 "1.0" +#define ELEMENT_VERDRD_11 "1.1" +#define ELEMENT_VERDRD_12 "1.2" +#define ELEMENT_VERPROTO "VerProto" +#define ELEMENT_VERPROTO_10 "SyncML/1.0" +#define ELEMENT_VERPROTO_11 "SyncML/1.1" +#define ELEMENT_VERPROTO_12 "SyncML/1.2" +#define ELEMENT_SESSIONID "SessionID" +#define ELEMENT_MSGID "MsgID" +#define ELEMENT_RESPURI "RespURI" +#define ELEMENT_NORESP "NoResp" +#define ELEMENT_CRED "Cred" + +/* SyncBody */ +#define ELEMENT_SYNCBODY "SyncBody" +#define ELEMENT_CMD "Cmd" +#define ELEMENT_ADD "Add" +#define ELEMENT_REPLACE "Replace" +#define ELEMENT_ALERT "Alert" +#define ELEMENT_SYNC "Sync" +#define ELEMENT_PUT "Put" +#define ELEMENT_REPLACE "Replace" +#define ELEMENT_DELETE "Delete" +#define ELEMENT_MAP "Map" +#define ELEMENT_GET "Get" +#define ELEMENT_RESULTS "Results" +#define ELEMENT_STATUS "Status" +#define ELEMENT_CMDID "CmdID" +#define ELEMENT_ITEM "Item" +#define ELEMENT_NUMBEROFCHANGES "NumberOfChanges" +#define ELEMENT_MSGREF "MsgRef" +#define ELEMENT_CMDREF "CmdRef" +#define ELEMENT_TARGETREF "TargetRef" +#define ELEMENT_SOURCEREF "SourceRef" +#define ELEMENT_MAPITEM "MapItem" +#define ELEMENT_MOREDATA "MoreData" +#define ELEMENT_TARGET "Target" +#define ELEMENT_SOURCE "Source" +#define ELEMENT_LOCURI "LocURI" +#define ELEMENT_LOCNAME "LocName" +#define ELEMENT_CHAL "Chal" +#define ELEMENT_B64 "b64" +#define ELEMENT_DATA "Data" + +/* DevInf */ +#define ELEMENT_DEVINF "DevInf" +#define ELEMENT_MAN "Man" +#define ELEMENT_MOD "Mod" +#define ELEMENT_OEM "OEM" +#define ELEMENT_FWV "FwV" +#define ELEMENT_SWV "SwV" +#define ELEMENT_HWV "HwV" +#define ELEMENT_DEVID "DevID" +#define ELEMENT_DEVTYP "DevTyp" +#define ELEMENT_PAGER "Pager" +#define ELEMENT_HANDHELD "handheld" +#define ELEMENT_PDA "pda" +#define ELEMENT_PHONE "phone" +#define ELEMENT_SMARTPHONE "smartphone" +#define ELEMENT_SERVER "server" +#define ELEMENT_WORKSTATION "workstation" +#define ELEMENT_UTC "UTC" +#define ELEMENT_SUPPORTLARGEOBJS "SupportLargeObjs" +#define ELEMENT_SUPPORTNUMBEROFCHANGES "SupportNumberOfChanges" +#define ELEMENT_DATASTORE "DataStore" +#define ELEMENT_DISPLAYNAME "DisplayName" +#define ELEMENT_MAXGUIDSIZE "MaxGUIDSize" +#define ELEMENT_RX_PREF "Rx-Pref" +#define ELEMENT_RX "Rx" +#define ELEMENT_TX_PREF "Tx-Pref" +#define ELEMENT_TX "Tx" +#define ELEMENT_CTCAP "CTCap" +#define ELEMENT_CTTYPE "CTType" +#define ELEMENT_VERCT "VerCT" +#define ELEMENT_FIELDLEVEL "FieldLevel" +#define ELEMENT_PROPERTY "Property" +#define ELEMENT_PROPNAME "PropName" +#define ELEMENT_DATATYPE "DataType" +#define ELEMENT_MAXOCCUR "MaxOccur" +#define ELEMENT_MAXSIZE "MaxSize" +#define ELEMENT_NOTRUNCATE "NoTruncate" +#define ELEMENT_VALENUM "ValEnum" +#define ELEMENT_DISPLAYNAME "DisplayName" +#define ELEMENT_PROPPARAM "PropParam" +#define ELEMENT_PARAMNAME "ParamName" +#define ELEMENT_DSMEM "DSMem" +#define ELEMENT_SHAREDMEM "SharedMem" +#define ELEMENT_MAXMEM "MaxMem" +#define ELEMENT_MAXID "MaxID" +#define ELEMENT_SUPPORTHIERARCHICALSYNC "SupportHierarchicalSync" +#define ELEMENT_SYNCCAP "SyncCap" +#define ELEMENT_SYNCTYPE "SyncType" +#define ELEMENT_SYNCTYPE_1 "1" +#define ELEMENT_SYNCTYPE_2 "2" +#define ELEMENT_SYNCTYPE_3 "3" +#define ELEMENT_SYNCTYPE_4 "4" +#define ELEMENT_SYNCTYPE_5 "5" +#define ELEMENT_SYNCTYPE_6 "6" +#define ELEMENT_SYNCTYPE_7 "7" +#define ELEMENT_FILTER_RX "Filter-Rx" +#define ELEMENT_FILTERCAP "FilterCap" + +/* MetInf */ +#define ELEMENT_META "Meta" +#define ELEMENT_FORMAT "Format" +#define ELEMENT_NEXTNONCE "NextNonce" +#define ELEMENT_TYPE "Type" +#define ELEMENT_SIZE "Size" +#define ELEMENT_MAXMSGSIZE "MaxMsgSize" +#define ELEMENT_MAXOBJSIZE "MaxObjSize" +#define ELEMENT_ANCHOR "Anchor" +#define ELEMENT_LAST "Last" +#define ELEMENT_NEXT "Next" +#define ELEMENT_MEM "Mem" +#define ELEMENT_SHAREDMEM "SharedMem" +#define ELEMENT_FREEMEM "FreeMem" +#define ELEMENT_FREEID "FreeID" + +typedef enum { + PE_UNDEF = 0, + PE_ERROR, + PE_ADD, + PE_ALERT, + PE_ATOMIC_START, + PE_ATOMIC_END, + PE_COPY, + PE_DELETE, + PE_EXEC, + PE_GET, + PE_MAP, + PE_PUT_START, + PE_PUT_END, + PE_RESULTS_START, + PE_RESULTS_END, + PE_SEARCH, + PE_SEQUENCE_START, + PE_SEQUENCE_END, + PE_STATUS, + PE_SYNC_START, + PE_SYNC_END, + PE_REPLACE, + PE_HEADER, + PE_PUT_GET, + PE_CMD_GROUP, + PE_GENERIC, + PE_FINAL, + PE_DEVINF, + PE_SYNCML_START, + PE_SYNCML_END, + PE_BODY_START, + PE_BODY_END +} oma_ds_protocol_element_e; + +#endif /* OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ */ diff --git a/include/service-adapter/sa_command.h b/include/service-adapter/sa_command.h new file mode 100755 index 0000000..7ded49f --- /dev/null +++ b/include/service-adapter/sa_command.h @@ -0,0 +1,866 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Commandl.h + * @version 0.1 + * @brief This file is the header file of interface of Command structure + */ + +#ifndef SA_COMMAND_H_ +#define SA_COMMAND_H_ + +#include "service-adapter/sa_define.h" +#include "common/common_define.h" + +/** + * @par Description: API to create alert command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, sync type + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[in] Cred structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_alert_command(session_s * session, alert_type_e sync_type, location_s * source, location_s * target, char *last_anchor, char *next_anchor, cred_s * cred, command_s ** command); + +/** + * @par Description: API to create get command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about target info) + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_get_command(session_s * session, location_s * target, const char *content_type, command_s ** command); + +/** + * @par Description: API to create put command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_put_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_results_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_start_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to create sync end command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_end_command(command_s ** command); + +/** + * @par Description: API to create add command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, moreData(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_add_command(session_s * session, change_type_e type, char *luid, const char *content_type, char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create replace command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, more_data(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_replace_command(session_s * session, change_type_e type, char *luid, const char *content_type, const char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create delete command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_delete_command(session_s * session, change_type_e type, char *luid, const char *content_type, command_s ** command); + +/** + * @par Description: API to create map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_map_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to free list of command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_commands(GList * commands); + +/** + * @par Description: API to free command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_command(command_s * command); + +/** + * @par Description: API to increase reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e increase_command_ref_count(command_s * command); + +/** + * @par Description: API to decrease reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e decrease_command_ref_count(command_s * command); + +/** + * @par Description: API to set msgRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int type, msg reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_msg_ref(command_s * command, unsigned int msg_ref); + +/** + * @par Description: API to set cmdRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int, cmd reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_cmd_ref(command_s * command, unsigned int cmd_ref); + +/** + * @par Description: API to set targetRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] location_s structure(target info) + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_target_ref(command_s * command, location_s * location); + +/** + * @par Description: API to set number_of_changes in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] unsigned int type, number of changes + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_number_of_changes(command_s * command, unsigned int number_of_changes); + +/** + * @par Description: API to set Mem structure in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] mem_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_mem(command_s * command, mem_s * mem); + +/** + * @par Description: API to set item in map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] item_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_map_command_item(command_s * mapCommand, item_s * temp); + +/** + * @par Description: API to create status command with locatiion structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] data (status code) + * @param[in] command_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status_location(session_s * session, oma_status_type_e data, command_s * command, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to create create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, data (status code) + * @param[in] command_s structure + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status(session_s * session, oma_status_type_e data, command_s * command, command_type_e type, status_s ** status); + +/** + * @par Description: API to create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, data (status code) + * @param[in] unsigned int type, cmd ID + * @param[in] unsigned int type, cmd reference + * @param[in] unsigned int type, msg reference + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_status(oma_status_type_e data, unsigned int cmd_id, unsigned int cmd_ref, unsigned int msg_ref, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to free list of Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_statuses(GList * status); + +/** + * @par Description: API to free Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_status(status_s * status); + +/** + * @par Description: API to get status code from Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return OMA_StatusType type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +oma_status_type_e get_status_code(status_s * status); + +/** + * @par Description: API to convert to command type from char* + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] char* (Alert, Sync, Put, SyncHdr, Add, Replace, Map, Delete, Results, Get) + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type(char *type); + +/** + * @par Description: API to convert to change type from command type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, command_type_e + * @param[out] + * + * @return change_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +change_type_e convert_change_type_command_type(command_type_e type); + +/** + * @par Description: API to convert to command type from change type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, change_type_e + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type_change_type(change_type_e type); + +/* unused function + * keep for in case + */ +/* +ChangeType convertToChangeType(unsigned int type); +char *convertFromCommandType(CommandType type); +*/ + +#endif /* SA_COMMAND_H_ */ diff --git a/include/service-adapter/sa_command_internal.h b/include/service-adapter/sa_command_internal.h new file mode 100755 index 0000000..707d2e9 --- /dev/null +++ b/include/service-adapter/sa_command_internal.h @@ -0,0 +1,102 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Command_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * Command (Alert, Results, Sync, Put, Get, Map, Add, Replace, Delete) + * Status + */ + +#ifndef SA_COMMAND_INTERNAL_H_ +#define SA_COMMAND_INTERNAL_H_ + +#include "service-adapter/sa_define.h" +#include "common/common_define.h" + +typedef struct { + alert_type_e type; + anchor_s *anchor; + char *content_type; + unsigned int max_obj_size; +} command_alert_private_s; + +typedef struct { + unsigned int num_changed; + int max_obj_size; + int has_num_changed; + mem_s *mem; +} command_sync_private_s; + +typedef struct { + char *type; + item_s *item; +} command_access_private_s; + +typedef struct { + GList *items; + change_type_e type; +} command_change_private_s; + +typedef struct { + GList *items; +} command_map_private_s; + +typedef struct { + unsigned int msg_ref; + unsigned int cmd_ref; + location_s *target_ref; + char *type; + item_s *item; +} command_results_private_s; + +typedef union { + command_alert_private_s alert; + command_sync_private_s sync; + command_access_private_s access; /*put or get */ + command_change_private_s change; + command_map_private_s map; + command_results_private_s results; +} command_private_u; + +struct command { + int ref_count; + command_type_e type; + unsigned int cmd_id; + unsigned int msg_id; + command_private_u private; + location_s *source; + location_s *target; + cred_s *cred; + int no_resp; +}; + +struct status { + unsigned int cmd_id; + unsigned int msg_ref; + unsigned int cmd_ref; + command_type_e type; + char *data; + location_s *source_ref; + location_s *target_ref; + cred_s *cred; + chal_s *chal; + item_s *item; +}; + +#endif /* SA_COMMAND_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_common_interface.h b/include/service-adapter/sa_common_interface.h new file mode 100755 index 0000000..56d95aa --- /dev/null +++ b/include/service-adapter/sa_common_interface.h @@ -0,0 +1,285 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Common_Interface.h + * @version 0.1 + * @brief This file is the header file of interface of SA + * called by SE + */ + +#ifndef SA_COMMON_INTERFACE_H_ +#define SA_COMMON_INTERFACE_H_ + +/** + * @par Description: API to process pre-action that has to be befor sync service + * + * Exchage Pkg1 and Pkg2 with server + * Get Device Information + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * @param[in] int type, account id + * @param[in] string type, session id + * @param[in] int type, whether server is fmm server for calllog or not + * @param[out] pre_sync_return_obj_s structure(result from pkg2) + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int pre_sync(int transport_type, int account_id, char *session_id, int server_flag, void **pre_sync_return_obj); + +/** + * @par Description: API to generate protocol specific msg + * + * Generate MSg which be considered maxMsgSize and maxObjSize + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_obj_s structure + * @param[in] int type, whether server is fmm server for calllog or not + * @param[out] msg + * @param[out] msg size + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int generate_msg(void **sync_obj, int server_flag, char **msg, unsigned int *msg_size); + +/** + * @par Description: API to exchange protocol specific msg with server + * + * Exchange protocol specific msg(request and response) using header binding information with server + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport protocol type(http, obex etc) + * @param[in] string type, msg to send + * @param[in] unsigned int type, msg size + * @param[out] string type, receive msg + * @param[out] unsigned int type, receive msg size + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int exchange_msg(int transport_type, char *send_msg, unsigned int send_msg_length, char **recv_msg, unsigned int *recv_msg_length); + +/** + * @par Description: API to process response msg from server + * + * Process response msg from server and convert to obj that return to Service Engine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, recive msg from server + * @param[in] unsigned int type, receive msg size + * @param[in] int type, whether or not to end in pkg4 + * @param[out] sync_return_obj_s structure + * @param[out] int type, flag for finsih sync session + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int process_recv_msg(char *recv_msg, unsigned int recv_msg_length, int only_from_client, void **sync_return_obj, int *is_finish); + +/** + * @par Description: API to free session_s structure and close connection + * + * This API for case that error or cancel occur in ServiceEngine so need to clean up resource which using in ServiceAdapter + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void clean_up_sa(); + +/** + * @par Description: API to process auto configure function + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, server ip + * @param[in] string type, id + * @param[in] string type, password + * @param[out] GList type, list of auto configure results + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int auto_configure(char *addr, char *id, char *password, GList ** congifure); + +/** + * @par Description: API to check cancel status + * + * Cancel flag is set and if engine is going to process pkg 5 & 6 + * keep going until finish sync session + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return 1 means Do cancel + * 0 means Do not cancel + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int check_cancel_status(); + +/** + * @par Description: API to suspend current sync session + * + * Send alert 224 to server and status if there are + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * @param[in] int type, account id + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int suspend_sync(int transport_type, int account_id, int server_flag); + +/** + * @par Description: API to cancel connection during sync session + * + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int cancel_connection_sync_request(int transport_type); + +#endif /* SA_COMMON_INTERFACE_H_ */ diff --git a/include/service-adapter/sa_define.h b/include/service-adapter/sa_define.h new file mode 100755 index 0000000..254e6ce --- /dev/null +++ b/include/service-adapter/sa_define.h @@ -0,0 +1,159 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Define.h + * @version 0.1 + * @brief This file is the header file of defined structure and enumeration used in SA + */ + +#ifndef SA_DEFINE_H_ +#define SA_DEFINE_H_ + +#include <malloc.h> +#include <glib.h> +#include <assert.h> +#include <string.h> +#include <stdbool.h> + +#include "service-adapter/sa_error.h" + +#define DEFINE_PROTOCOL_TYPE "OMA_DS" + +#define ELEMENT_DEVINF_10 "./devinf10" +#define ELEMENT_DEVINF_11 "./devinf11" +#define ELEMENT_DEVINF_12 "./devinf12" + +#define ELEMENT_DEVINF_XML "application/vnd.syncml-devinf+xml" +#define ELEMENT_DEVINF_WBXML "application/vnd.syncml-devinf+wbxml" +#define ELEMENT_WBXML "application/vnd.syncml+wbxml" +#define ELEMENT_XML "application/vnd.syncml+xml" + +#define ELEMENT_AUTH_BASIC "syncml:auth-basic" +#define ELEMENT_AUTH_MD5 "syncml:auth-md5" +#define ELEMENT_FORMAT_BASE64 "b64" + +#define OMA_DS_HTTP_DEFAULT_CLIENT_MAX_MSG_SIZE 1024*12 +#define OMA_DS_HTTP_DEFAULT_CLIENT_MAX_OBJ_SIZE 1024*1024 + +/*#define OMA_DS_HTTP_DEFAULT_SERVER_MAX_MSG_SIZE 61440*/ +#define OMA_DS_HTTP_DEFAULT_SERVER_MAX_MSG_SIZE 1024*5 + +typedef struct item item_s; +typedef struct status status_s; +typedef struct command command_s; +typedef struct anchor anchor_s; +typedef struct location location_s; +typedef struct cred cred_s; +typedef struct syncml syncml_s; +typedef struct sync_hdr sync_hdr_s; +typedef struct chal chal_s; +typedef struct devinf devinf_s; +typedef struct devinf_datastore devinf_datastore_s; +typedef struct devinf_content_type devinf_content_type_s; +typedef struct devinf_ct_cap devinf_ct_cap_s; +typedef struct devinf_property devinf_property_s; +typedef struct devinf_prop_param devinf_prop_param_s; +typedef struct filter_cap filter_cap_s; +typedef struct session session_s; +typedef struct command_status command_status_s; +typedef struct mem mem_s; + +typedef enum { + VERSION_UNKNOWN = 0, + VERSION_10 = 1, + VERSION_11 = 2, + VERSION_12 = 3 +} protocol_version_e; + +typedef enum { + PROTOCOL_TYPE_UNKNOWN = 0, + PROTOCOL_TYPE_DS = 1, +} protocol_type_e; + +typedef enum { + COMMAND_TYPE_UNKNOWN = 0, + COMMAND_TYPE_ALERT = 1, + COMMAND_TYPE_SYNC_START = 2, + COMMAND_TYPE_SYNC_END = 3, + COMMAND_TYPE_PUT = 4, + COMMAND_TYPE_HEADER = 5, + COMMAND_TYPE_ADD = 6, + COMMAND_TYPE_REPLACE = 7, + COMMAND_TYPE_DELETE = 8, + COMMAND_TYPE_MAP = 9, + COMMAND_TYPE_GET = 10, + COMMAND_TYPE_RESULTS = 11 +} command_type_e; + +typedef enum { + AUTH_TYPE_UNKNOWN = 0, + AUTH_TYPE_BASIC = 1, + AUTH_TYPE_MD5 = 2 +} auth_type_e; + +typedef enum { + FORMAT_TYPE_UNKNOWN = 0, + FORMAT_TYPE_BASE64 = 1 +} format_type_e; + +typedef enum { + DEVINF_VERSION_UNKNOWN = 0, + DEVINF_VERSION_10 = 1, + DEVINF_VERSION_11 = 2, + DEVINF_VERSION_12 = 3 +} devinf_version_e; + +typedef enum { + DEVINF_DEVTYPE_UNKNOWN, + DEVINF_DEVTYPE_PAGER, + DEVINF_DEVTYPE_HANDHELD, + DEVINF_DEVTYPE_PDA, + DEVINF_DEVTYPE_PHONE, + DEVINF_DEVTYPE_SMARTPHONE, + DEVINF_DEVTYPE_SERVER, + DEVINF_DEVTYPE_WORKSTATION +} devinf_devtyp_e; + +typedef enum { + DEVINF_SYNCTYPE_UNKNOWN = 0, + DEVINF_SYNCTYPE_TWO_WAY = 1, + DEVINF_SYNCTYPE_SLOW_SYNC = 1 << 1, + DEVINF_SYNCTYPE_ONE_WAY_FROM_CLIENT = 1 << 2, + DEVINF_SYNCTYPE_REFRESH_FROM_CLIENT = 1 << 3, + DEVINF_SYNCTYPE_ONE_WAY_FROM_SERVER = 1 << 4, + DEVINF_SYNCTYPE_REFRESH_FROM_SERVER = 1 << 5, + DEVINF_SYNCTYPE_SERVER_ALERTED_SYNC = 1 << 6 +} devinf_sync_cap_e; + +typedef enum { + SYNCML_PKG_1 = 1, + SYNCML_PKG_2 = 2, + SYNCML_PKG_3 = 3, + SYNCML_PKG_4 = 4, + SYNCML_PKG_5 = 5, + SYNCML_PKG_6 = 6, + SYNCML_SUSPEND = 7 +} pkg_status_e; + +typedef enum { + ITEM_UNKNOWN = 0, + ITEM_DATA = 1, + ITEM_DEVINF = 2, +} item_data_type_e; + +#endif /* SA_DEFINE_H_ */ diff --git a/include/service-adapter/sa_devinf.h b/include/service-adapter/sa_devinf.h new file mode 100755 index 0000000..95efc87 --- /dev/null +++ b/include/service-adapter/sa_devinf.h @@ -0,0 +1,134 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_DevInf.h + * @version 0.1 + * @brief This file is the header file of interface of DevInf structure + */ + +#ifndef SA_DEVINF_H_ +#define SA_DEVINF_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create devinf_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[out] devinf_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_devinf(session_s * session, devinf_s ** devinf); + +/** + * @par Description: API to free devinf_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_devinf(devinf_s * devinf); + +/** + * @par Description: API to set sync cap in devinf_datastore_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_datastore_s structure + * @param[in] devinf_sync_cap_e sync type + * @param[in] whether support or not + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_devinf_datastore_sync_cap(devinf_datastore_s * devinf_datastore, devinf_sync_cap_e cap, int supported); + +/** + * @par Description: API to get sync cap from devinf_datastore_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_datastore_s structure + * @param[in] devinf_sync_cap_e sync type + * + * @return True on success + * False on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int get_devinf_datastore_sync_cap(const devinf_datastore_s * devinf_datastore, devinf_sync_cap_e cap); + +/* +DevInfSyncCap convert_devinf_synccap(unsigned int id); +*/ +#endif /* SA_DEVINF_H_ */ diff --git a/include/service-adapter/sa_devinf_internal.h b/include/service-adapter/sa_devinf_internal.h new file mode 100755 index 0000000..f60fd56 --- /dev/null +++ b/include/service-adapter/sa_devinf_internal.h @@ -0,0 +1,118 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_DevInf_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * about device information(DevInf) + */ + +#ifndef SA_DEVINF_INTERNAL_H_ +#define SA_DEVINF_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +#define DEFINE_DEVICE_TYPE_PAGER "pager" +#define DEFINE_DEVICE_TYPE_HANDHELD "handheld" +#define DEFINE_DEVICE_TYPE_PDA "pda" +#define DEFINE_DEVICE_TYPE_PHONE "phone" +#define DEFINE_DEVICE_TYPE_SMARTPHONE "smartphone" +#define DEFINE_DEVICE_TYPE_SERVER "server" +#define DEFINE_DEVICE_TYPE_WORKSTATION "workstation" + +struct devinf { + devinf_version_e version; + + devinf_devtyp_e devtyp; + char *manufacturer; + char *model; + char *oem; + char *software_version; + char *hardware_version; + char *firmware_version; + char *dev_id; + + int supports_utc; + int supports_large_objs; + int supports_number_of_changes; + + GList *datastores; /*containing DevInfDataStore structure */ +}; + +struct devinf_datastore { + int supports_hierarchical_sync; + + char *source_ref; + char *display_name; + unsigned int max_guid_size; + + devinf_content_type_s *rx_pref; + devinf_content_type_s *tx_pref; + + GList *filter_rx; /*need to be considered filter_rx,filterCap */ + GList *filter_cap; + + GList *rx; + GList *tx; + + int shared_mem; + unsigned int max_mem; + unsigned int max_id; + + unsigned int sync_cap; + + GList *ct_caps; /*containing DevInfCTCap structure */ +}; + +struct devinf_content_type { + char *ct_type; + char *verct; +}; + +struct devinf_ct_cap { + devinf_content_type_s *ct; + GList *properties; /*containing DevInfProperty structure */ +}; + +struct devinf_property { + char *prop_name; + char *data_type; + unsigned int max_occur; + unsigned int max_size; +/* unsigned int propSize;*/ + int no_truncate; + char *display_name; + GList *val_enums; /*containing char* */ + GList *prop_params; /*containing DevInfPropParam structure */ +}; + +struct devinf_prop_param { + char *param_name; + char *data_type; + char *display_name; + GList *val_enums; +}; + +struct filter_cap { + char *ct_type; + char *verct; + GList *filter_keyword; + GList *prop_name; +}; + +#endif /* SA_DEVINF_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_elements.h b/include/service-adapter/sa_elements.h new file mode 100755 index 0000000..32b4e41 --- /dev/null +++ b/include/service-adapter/sa_elements.h @@ -0,0 +1,893 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Elements.h + * @version 0.1 + * @brief This file is the header file of interface of elements structure + */ + +#ifndef SA_ELEMENTS_H_ +#define SA_ELEMENTS_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[out] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_anchor(char *last, char *next, anchor_s ** anchor); + +/** + * @par Description: API to set anchor in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_item_anchor(item_s * item, anchor_s * anchor); + +/** + * @par Description: API to set last anchor in anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * @param[in] string type, last anchor + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_last_anchor(anchor_s * anchor, char *lastAnchor); + +/** + * @par Description: API to set next anchor in anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * @param[in] string type, next anchor + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_next_anchor(anchor_s * anchor, char *nextAnchor); + +/** + * @par Description: API to free anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_anchor(anchor_s * anchor); + +/** + * @par Description: API to create location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, location uri + * @param[in] string type, location name + * @param[out] location_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_location(char *loc_uri, char *loc_name, location_s ** location); + +/** + * @par Description: API to duplicate location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +location_s *dup_location(location_s * location); + +/** + * @par Description: API to get location name from location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location name on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_location_loc_name(location_s * location); + +/** + * @par Description: API to get location uri from location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location uri on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_location_loc_uri(location_s * location); + +/** + * @par Description: API to free location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_location(location_s * location); + +/** + * @par Description: API to create cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, ID + * @param[in] string type, password + * @param[in] enum type, authentication type(basic, md5..) + * @param[in] enum type, format type(base64..) + * @param[in] string type, credential + * @param[out] cred_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +/** + * @par Description: API to create cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, authentication type(basic, md5..) + * @param[in] credential + * + * @return cred_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +cred_s *create_cred_with_data(auth_type_e auth_type, char *data); + +/** + * @par Description: API to duplicate cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * + * @return cred_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +cred_s *dup_cred(cred_s * cred); + +/** + * @par Description: API to set format type in cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * @param[in] format type(base64..) + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_cred_format_type(cred_s * cred, format_type_e format_type); + +/** + * @par Description: API to free cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_cred(cred_s * cred); + +/** + * @par Description: API to create syncml_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_hdr_s structure + * @param[in] GList type, list of status_s structure + * @param[in] GList type, list of command_s structure + * @param[in] int type, final flag + * @param[out] syncml_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_syncml(sync_hdr_s * sync_hdr, GList * status, GList * commands, int is_final, syncml_s ** syncml); + +/** + * @par Description: API to free syncml_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] syncml_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_syncml(syncml_s * syncml); + +/** + * @par Description: API to create sync_hdr_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[out] sync_hdr_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_hdr(session_s * session, sync_hdr_s ** sync_hdr); + +/** + * @par Description: API to free SyncHdr structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] SyncHdr structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sync_hdr(sync_hdr_s * sync_hdr); + +/** + * @par Description: API to create item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item(); + +/** + * @par Description: API to create item_s structure using data + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] data + * @param[in] size of data + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item_for_data(const char *data, unsigned int size); + +/** + * @par Description: API to create item_s structure using DevInf + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_s structure + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item_for_devinf(devinf_s * devinf); + +/** + * @par Description: API to set location_s(target) structure in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] location_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_item_target(item_s * item, location_s * target); + +/** + * @par Description: API to set location_s(source) structure in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] location_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_item_source(item_s * item, location_s * source); + +/** + * @par Description: API to free item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_item(item_s * item); + +/** + * @par Description: API to duplicate chal_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] chal_s structure + * @param[out] + * + * @return chal_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +chal_s *dup_chal(chal_s * chal); + +/** + * @par Description: API to free chal_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] chal_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_chal(chal_s * chal); + +/** + * @par Description: API to compare server credential with local credential + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * @param[in] cred_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_AUTH_REJECTED, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e compare_cred(cred_s * hdr_cred, cred_s * session_cred); + +/** + * @par Description: API to convert auth_type_e + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, auth type + * @param[out] + * + * @return AUTH_TYPE_MD5, AUTH_TYPE_BASIC on success + * AUTH_TYPE_UNKNOWN on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +auth_type_e convert_auth_type(char *auth_type); + +/** + * @par Description: API to convert format_type_e + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, format type + * @param[out] + * + * @return FORMAT_TYPE_BASE64 on success + * FORMAT_TYPE_UNKNOWN on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +format_type_e convert_format_type(char *format_type); + +/** + * @par Description: API to create mem_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return mem_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +mem_s *create_mem(); + +/** + * @par Description: API to set shared_mem + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] shared_mem + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_shared_mem(mem_s * mem, int shared_mem); + +/** + * @par Description: API to set free_mem + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] free_mem + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_free_mem(mem_s * mem, unsigned int free_mem); + +/** + * @par Description: API to set free_id + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] free_id + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_free_id(mem_s * mem, unsigned int free_id); + +#endif /* SA_ELEMENTS_H_ */ diff --git a/include/service-adapter/sa_elements_internal.h b/include/service-adapter/sa_elements_internal.h new file mode 100755 index 0000000..842ca1d --- /dev/null +++ b/include/service-adapter/sa_elements_internal.h @@ -0,0 +1,102 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Elements_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * SyncHdr, SyncML, Cred, Chal, Item, Anchor, Location + */ + +#ifndef SA_ELEMENTS_INTERNAL_H_ +#define SA_ELEMENTS_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +typedef union { + char *data; + devinf_s *devinf; +} item_data_u; + +struct mem { + int sharedmem; + unsigned int free_mem; + unsigned int free_id; +}; + +struct chal { + format_type_e format; + auth_type_e type; + char *nonce_plain; + unsigned int nonce_length; + char *nonce_b64; +}; + +struct item { + item_data_type_e data_type; + item_data_u private; + location_s *source; + location_s *target; + anchor_s *anchor; + + unsigned int size; /* for data */ + char *content_type; /* for data */ + int more_data; /* for moredata */ +}; + +struct anchor { + char *last_anchor; /**< Last Anchor*/ + char *next_anchor; /**< Next Anchor*/ +}; + +struct location { + char *loc_uri; + char *loc_name; +}; + +struct cred { + format_type_e format; + auth_type_e type; + char *data; + char *user_name; + char *password; +}; + +struct sync_hdr { + char *session_id; + protocol_version_e version; + protocol_type_e protocol; + location_s *source; + location_s *target; + cred_s *cred; + char *response_uri; + int no_response; + unsigned int message_id; + + /*in meta element */ + unsigned int max_msg_size; + unsigned int max_obj_size; +}; + +struct syncml { + sync_hdr_s *hdr; + GList *status; /**< containing Status struct */ + GList *commands; /**< containing Command struct */ + int final; +}; + +#endif /* SA_ELEMENTS_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_error.h b/include/service-adapter/sa_error.h new file mode 100755 index 0000000..fd9d641 --- /dev/null +++ b/include/service-adapter/sa_error.h @@ -0,0 +1,124 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Error.h + * @version 0.1 + * @brief This file is the header file of Error is defined + */ + +#ifndef SA_ERROR_H_ +#define SA_ERROR_H_ + +typedef enum { + ERROR_UNKNOWN = 0, + + /* Informational */ + IN_PROGRESS = 101, + + /* OK code */ + /** No error */ + NO_ERROR = 200, + /** Requested item was added */ + ITEM_ADDED = 201, + /** Accepted for processing */ + PROCESSING_ACCEPTED = 202, + /** Non-authoritative response */ + NON_AUTHORITATIVE = 203, + /** No content */ + NO_CONTENT = 204, + /** Reset content */ + RESET_CONTENT = 205, + /** Partial content */ + PARTIAL_CONTENT = 206, + /** Conflict resolved with merge */ + CONFLICT_MERGE = 207, + /** Conflict resolved with client win */ + CONFLICT_CLIENT_WIN = 208, + /** Conflict resolved with duplicate */ + CONFLICT_DUPLICATE = 209, + /** Deleted without archiving */ + DELETE_NO_ARCHIVE = 210, + /** Item not deleted (not found) */ + DELETE_NOT_FOUND = 211, + /** Authentication accepted */ + AUTH_ACCEPTED = 212, + /** Chunked item accepted */ + CHUNK_ACCEPTED = 213, + /** Operation cancelled */ + OPERATION_CANCELLED = 214, + /** Not executed */ + NOT_EXECUTED = 215, + /** Atomic rollback ok */ + ATOMIC_ROLLBACK_OK = 216, + + /* Retry error */ + ERROR_MULTIPLE_CHOICES = 300, + ERROR_MOVED_PERMANENTLY = 301, + ERROR_FOUND_RETRY = 302, + ERROR_SEE_OTHER_RETRY = 303, + ERROR_NOT_MODIFIED = 304, + ERROR_USE_PROXY = 305, + + /* Errors */ + ERROR_BAD_REQUEST = 400, /* Bad Request */ + ERROR_AUTH_REJECTED = 401, /* Unauthorized, Invalid Credentials */ + ERROR_PAYMENT_NEEDED = 402, /* Payment need */ + ERROR_FORBIDDEN = 403, /* Forbidden */ + ERROR_NOT_FOUND = 404, /* Not found */ + ERROR_COMMAND_NOT_ALLOWED = 405, /* Command not allowed */ + ERROR_UNSUPPORTED_FEATURE = 406, /* Optional feature unsupported */ + ERROR_AUTH_REQUIRED = 407, /* Authentication required, Missing Credentials */ + ERROR_SIZE_REQUIRED = 411, + ERROR_REQUESTED_SIZE_TOO_BIG = 416, + ERROR_RETRY_LATER = 417, /* Retry later */ + ERROR_ALREADY_EXISTS = 418, /* Put or Add failed because item already exists */ + ERROR_SIZE_MISMATCH = 424, /* Size mismatch */ + + /* Standard errors */ + ERROR_GENERIC = 500, + ERROR_NOT_IMPLEMENTED = 501, + ERROR_SERVICE_UNAVAILABLE = 503, + ERROR_REQUIRE_REFRESH = 508, + ERROR_SERVER_FAILURE = 511, + +} oma_status_type_e; + +typedef enum { + + /* Internal errors - never ever send this via SyncML */ + SA_ERROR_UNKNOWN = 0, + SA_INTERNAL_OK = 1, + SA_INTERNAL_ERROR, + SA_INTERNAL_BINDER_ERROR, + SA_INTERNAL_TIMEOUT, + SA_INTERNAL_NOT_FOUND, + SA_INTERNAL_MISCONFIGURATION, + SA_INTERNAL_NO_MEMORY, + SA_INTERNAL_NOT_DEFINED, + SA_INTERNAL_CONNECTION_ERROR, + SA_INTERNAL_DA_ERROR, + SA_INTERNAL_CANCEL, + SA_INTERNAL_AUTOCONFIG_NOT_SUPPORT_BY_SERVER, + SA_INTERNAL_BUSY_SIGNALING, + SA_INTERNAL_SERVER_FAILURE, + SA_INTERNAL_SERVER_ERROR, + SA_INTERNAL_AUTHENTICATION_ERROR, + SA_INTERNAL_SUSPEND_FAIL, +} sa_error_type_e; + +#endif /* SA_ERROR_H_ */ diff --git a/include/service-adapter/sa_session.h b/include/service-adapter/sa_session.h new file mode 100755 index 0000000..89efe2b --- /dev/null +++ b/include/service-adapter/sa_session.h @@ -0,0 +1,277 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Session.h + * @version 0.1 + * @brief This file is the header file of interface of Session structure + */ + +#ifndef SA_SESSION_H_ +#define SA_SESSION_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create session_s structure + * This API can be used to create session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, protocol version(VERSION_UNKNOWN, VERSION_10, VERSION_11, VERSION_12); + * @param[in] enum type, protocol type(PROTOCOL_TYPE_UNKNOWN , PROTOCOL_TYPE_DS) + * @param[in] int type, account id + * @param[in] int type, session id + * @param[in] string type, source uri(server ip) + * @param[in] string type, target uri(client identifer) + * @param[out] session_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +/** + * @par Description: API to free session_s structure + * This API can be used to free session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_session(session_s * session); + +/** + * @par Description: API to set cred_s structure in session_s structure + * This API can be used to set cred_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] cred_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_session_cred(session_s * session, cred_s * cred); + +/** + * @par Description: API to set devinf_s structure in session_s structure + * This API can be used to set devinf_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] devinf_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_session_devinf(session_s * session, devinf_s * devInf); + +/** + * @par Description: API to create command_status_s structure + * This API can be used to set devinf_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, msg id + * @param[in] unsigned int type, cmd id + * @param[out] command_status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_command_status(unsigned int msg_id, unsigned int cmdID, command_status_s ** command_status); + +/** + * @par Description: API to process sync_hdr_s structure from server + * This API manage responseURI + * set server info in session_s structure + * check header credential + * create Status structure for header + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] sync_hdr_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_header(session_s * session, sync_hdr_s * header); + +/** + * @par Description: API to process list of status_s structure from server + * This API check credential status + * process Status structure for each type + * create AppliedStatus structure for passing to ServiceEngine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] GList type, list of status_s structure + * @param[out] GList type, list of applied_status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_SERVER_FAILURE, ERROR_INTERNAL_BUSY_SIGNALING on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_statuses(session_s * session, GList * receive_status, GList ** return_status); + +/** + * @par Description: API to process list of command_s structure from server + * This API check credential status + * process command_ structure for each type + * create changed_datastore_s structure for passing to ServiceEngine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session structure + * @param[in] GList type, list of command_s structure + * @param[in] whether auto configure or not + * @param[out] GList type, list of changed_datastore_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_commands(session_s * session, GList * receive_command, bool auto_config, GList ** return_datastore); + +/** + * @par Description: API to reset cmd id(1) in session + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void reset_cmd_id_session(session_s * session); + +#endif /* SE_SESSION_H_ */ diff --git a/include/service-adapter/sa_session_internal.h b/include/service-adapter/sa_session_internal.h new file mode 100755 index 0000000..56ff46c --- /dev/null +++ b/include/service-adapter/sa_session_internal.h @@ -0,0 +1,83 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Session_Internal.h + * @version 0.1 + * @brief This file is the header file of session structure is defined + * Session, PendingStatus + */ + +#ifndef SA_SESSION_INTERNAL_H_ +#define SA_SESSION_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +struct session { + protocol_version_e protocol_version; + protocol_type_e protocol_type; + + char *session_id; + unsigned int msg_id; + unsigned int last_recieved_msg_id; + unsigned int cmd_id; + int is_sending_final; + int is_receiving_final; + + GList *status; /*status to return to server */ + GList *temp_status; /*temp status for sync add, replace, delete command(it doesnot have data element value) */ + GList *suspend_status; /* for suspend */ + location_s *target; + location_s *source; + location_s *org_target; + + unsigned int source_max_msg_size; + unsigned int source_max_obj_size; + + unsigned int target_max_msg_size; + unsigned int target_max_obj_size; + + cred_s *cred; /*account info */ + chal_s *chal; /*chal from server */ + + devinf_s *devinf; /*client devinf */ + devinf_s *remote_devinf; /*server devinf */ + + pkg_status_e pkg_status; /*for status */ + + command_s *large_obj_cmd; /*for incomming large Command */ + + GList *map_command; /*containing map command that has sent to server(this is used to for delete map item from mapping table) */ + + GList *alert_command; /*containing alert command that have to send to server */ + + GList *results_command; /*containing results command */ + + command_status_s *large_obj; /*for outgoing large command */ + + int has_opend; + unsigned int naci_session_id; + + int account_id; + char *jsession_id; +}; + +struct command_status { + unsigned int cmd_id; + unsigned int msg_id; +}; +#endif /* SA_SESSION_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_util.h b/include/service-adapter/sa_util.h new file mode 100755 index 0000000..8b07eb7 --- /dev/null +++ b/include/service-adapter/sa_util.h @@ -0,0 +1,94 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Util.h + * @version 0.1 + * @brief This file is the header file of interface for utility function in SA + */ + +#ifndef SA_UTIL_H_ +#define SA_UTIL_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to put command into GList + * This API can be used to put structure into GList + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] GList type, first index of list + * @param[in] GList type, last index of list + * @param[in] void pointer type, structure to put in the list + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void put_into_list(GList ** commands, GList ** commands_last, void *command); + +/** + * @par Description: API to create credential string + * This API can be used to create credential string + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, type of authentication(AUTH_TYPE_BASIC , AUTH_TYPE_MD5...) + * @param[in] string type, id + * @param[in] string type, password + * @param[in] string type, nonce + * @param[in] unsigned int type, size of nonce + * @param[out] string type, credential + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_cred_string(auth_type_e type, const char *user_name, const char *password, const char *nonce, unsigned int nonce_size, char **cred); + +/** + * @brief write xml to file(for debugging) + * @param[in] string to write + * @param[in] path + */ +void set_xml_to_file(char *xml, const char *path); + +#endif /* SA_UTIL_H_ */ |