diff options
Diffstat (limited to 'src/agent/framework/san-parser/pm_sanparser.c')
-rwxr-xr-x | src/agent/framework/san-parser/pm_sanparser.c | 633 |
1 files changed, 633 insertions, 0 deletions
diff --git a/src/agent/framework/san-parser/pm_sanparser.c b/src/agent/framework/san-parser/pm_sanparser.c new file mode 100755 index 0000000..bbb21e7 --- /dev/null +++ b/src/agent/framework/san-parser/pm_sanparser.c @@ -0,0 +1,633 @@ +/* + * 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. + */ + +/** + * @PM_SanParser.c + * @version 0.1 + * @brief This file is the source file of implementation of San Parser + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <inttypes.h> +#include <glib.h> + +#include <sync_agent.h> + +#include "wbxml/wbxml.h" +#include "wbxml/wbxml_tree.h" +#include "framework/san-parser/pm_sanparser.h" + +#ifndef OMADS_AGENT_LOG +#undef LOG_TAG +#define LOG_TAG "OMA_DS_COMMON" +#endif + +static san_content_type_s contentTypeSupported[] = { + {0x00, NULL}, + {0x03, "text/plain"}, + {0x06, "text/x-vcalendar"}, + {0x07, "text/x-vcard"}, + {0x0305, "text/calendar"}, + {0x0306, "application/vnd.omads-email+xml"}, + {0x0307, "application/vnd.omads-file+xml"}, + {0x0308, "application/vnd.omads-folder+xml"}, + {0x0309, "text/vcard"} +}; + +san_package_s *san_package_12_parser(const char *msg_body, unsigned int msg_size) +{ + _EXTERN_FUNC_ENTER; + + unsigned int idLength = (uint8_t) msg_body[23]; + retvm_if(msg_size < (25 + idLength), NULL, "[sanPackage12Parser] SAN package size is smaller than its minimal size specified in the spec, related to [Header] part."); + + san_package_s *san = (san_package_s *) calloc(1, sizeof(san_package_s)); + retvm_if(san == NULL, NULL, "[sanPackage12Parser] SAN package memory allocation fail. [Container]"); + + /* MSG BODY WITHOUT DIGEST */ + san->msg_body_without_digest = (char *)calloc(msg_size - 16, sizeof(char)); + if (san->msg_body_without_digest == NULL) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package memory allocation fail. [Msg body]"); + goto error; + } + memcpy(san->msg_body_without_digest, msg_body + 16, msg_size - 16); + san->msg_body_without_digest_length = msg_size - 16; + + /* DIGEST */ + san->digest = (char *)calloc(16, sizeof(char)); + if (san->digest == NULL) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package memory allocation fail. [Digest]"); + goto error; + } + memcpy(san->digest, msg_body, 16); + + /* VERSION */ + unsigned int version = ((uint8_t) msg_body[16]) << 2; + version = version | ((uint8_t) msg_body[17]) >> 6; + + if (version != 12) { + _DEBUG_ERROR("[sanPackage12Parser] Not supported SAN version %d.", version); + goto error; + } + san->version = version; + + /* UI MODE */ + san->ui_mode = (((uint8_t) msg_body[17]) & 0x30) >> 4; + + /* INITIATOR */ + san->initiator = (((uint8_t) msg_body[17]) & 0x08) >> 3; + + /* SESSION ID */ +/*san->sessionID = ((uint8_t)msgBody[21]) << 8; + san->sessionID = san->sessionID | (uint8_t)msgBody[22];*/ + san->session_id = atoi(g_strdup_printf("%02X%02X", msg_body[21], msg_body[22])); + _DEBUG_INFO("session id : %d \n", san->session_id); + + /* SERVER ID */ + if (idLength) { + san->server_id = (char *)calloc(idLength + 1, sizeof(char)); + if (san->server_id == NULL) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package memory allocation fail. [Server ID]"); + goto error; + } + memcpy(san->server_id, msg_body + 24, idLength); + } + + san->cnt_sync_alerts = ((uint8_t) msg_body[24 + idLength]) >> 4; + + if (san->cnt_sync_alerts == 0) { + if (msg_size > 24 + idLength + 1) { + _DEBUG_INFO("[sanPackage12Parser] There are remaining bytes at the end of the package. (w/o alerts info)"); + } + + /* If number of sync alerts equals 0, should sync all data store in the client */ + _EXTERN_FUNC_EXIT; + return san; + } + + san->sync_alerts = (san_sync_alert_s *) calloc(san->cnt_sync_alerts, sizeof(san_sync_alert_s)); + if (san->sync_alerts == NULL) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package memory allocation fail. [syncAlerts]"); + goto error; + } + + msg_body += 25 + idLength; + unsigned int alertLength = 25 + idLength; + unsigned int i; + + for (i = 0; i < san->cnt_sync_alerts; i++) { + + idLength = (uint8_t) msg_body[4]; + if (msg_size < (alertLength + 5 + idLength)) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package size is smaller than"); + _DEBUG_ERROR("[sanPackage12Parser] its minimal size specified in the spec, related to [Alerts] part."); + goto error; + } + alertLength = alertLength + 5 + idLength; + + /* SYNC TYPE */ + san_sync_type_e alert_type = (((uint8_t) msg_body[0]) >> 4) + 200; + if (alert_type < 206 || alert_type > 210) { + _DEBUG_ERROR("[sanPackage12Parser] SAN doesn't support the sync type %d.", alert_type); + goto error; + } + + unsigned int contentType = ((uint8_t) msg_body[1]) << 16; + contentType = contentType | ((uint8_t) msg_body[2]) << 8; + contentType = contentType | ((uint8_t) msg_body[3]); + + /* CONTENT TYPE */ + char *alert_ct = NULL; + + int j; + int cnt = (int)sizeof(contentTypeSupported) / sizeof(san_content_type_s); + bool isContentSupported = false; + + for (j = 0; j < cnt; j++) { + if (contentType == contentTypeSupported[j].type) { + alert_ct = contentTypeSupported[j].strType; + isContentSupported = true; + break; + } + } + + if (!isContentSupported) { + _DEBUG_ERROR("[sanPackage12Parser] SAN doesn't support the content type %d.", contentType); + goto error; + } + + /* SERVER URI */ + char *alert_uri = NULL; + + if (idLength) { + alert_uri = (char *)calloc(idLength + 1, sizeof(char)); + if (alert_uri == NULL) { + _DEBUG_ERROR("[sanPackage12Parser] SAN package memory allocation fail. [Server URI]"); + goto error; + } + memcpy(alert_uri, msg_body + 5, idLength); + } + msg_body += 5 + idLength; + + san->sync_alerts[i].sync_type = alert_type; + san->sync_alerts[i].content_type = alert_ct; + san->sync_alerts[i].server_uri = alert_uri; + + } + + if (msg_size > alertLength) { + _DEBUG_INFO("[sanPackage12Parser] There are remaining bytes at the end of the package. (with alerts info)"); + } + + _EXTERN_FUNC_EXIT; + return san; + + error: + + sanPackageParserFree(san); + + _EXTERN_FUNC_EXIT; + return NULL; + +} + +san_package_s *san_package_11_parser(const char *msg_body, unsigned int msg_size) +{ + _EXTERN_FUNC_ENTER; + + san_package_s *san = (san_package_s *) calloc(1, sizeof(san_package_s)); + if (san == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [Container]"); + + _EXTERN_FUNC_EXIT; + return NULL; + } + + WBXMLTree *wbxml_tree = NULL; + WBXMLError wbxml_err = wbxml_tree_from_wbxml((unsigned char *)msg_body, msg_size, WBXML_LANG_UNKNOWN, WBXML_CHARSET_UNKNOWN, &wbxml_tree); + + if (wbxml_err != WBXML_OK) { + _DEBUG_ERROR("[sanPackage11Parser] Libwbxml2 failed to parse WBXML STREAM to WBXML TREE, error code : %s", wbxml_errors_string(wbxml_err)); + goto error; + } + + WBXMLTreeNode *synchdr_node; + if ((synchdr_node = wbxml_tree_node_elt_get_from_name(wbxml_tree->root, "SyncHdr", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [SyncHdr]"); + goto error; + } + WBXMLTreeNode *child_node = NULL; + const char *child_node_name = NULL; + + for (child_node = synchdr_node->children; child_node != NULL; child_node = child_node->next) { + child_node_name = (const char *)wbxml_tag_get_xml_name(child_node->name); + + if ((strcmp(child_node_name, "VerDTD") == 0) || (strcmp(child_node_name, "VerProto") == 0)) { + char *version = NULL; + if (child_node->children != NULL && child_node->children->type == WBXML_TREE_TEXT_NODE && child_node->children->content != NULL) { + + version = (char *)wbxml_buffer_get_cstr(child_node->children->content); + + if (strcmp(version, "1.1") && strcmp(version, "SyncML/1.1")) { + _DEBUG_ERROR("[sanPackage11Parser] Not supported SAN version %s.", version); + goto error; + } + san->version = 11; + } + } else if (strcmp(child_node_name, "SessionID") == 0) { + char *sessionID = NULL; + if (child_node->children != NULL && child_node->children->type == WBXML_TREE_TEXT_NODE && child_node->children->content != NULL) { + + sessionID = (char *)wbxml_buffer_get_cstr(child_node->children->content); + + if (sessionID == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL sessionID detected. sessionID MUST NOT be NULL."); + goto error; + } + san->session_id = atoi(sessionID); + } + } else if (strcmp(child_node_name, "Source") == 0) { + char *serverID = NULL; + unsigned serverIDlen = 0; + WBXMLTreeNode *serverid_node; + if ((serverid_node = wbxml_tree_node_elt_get_from_name(child_node, "LocURI", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [LocURI]"); + goto error; + } + + if (serverid_node->children != NULL && serverid_node->children->type == WBXML_TREE_TEXT_NODE && serverid_node->children->content != NULL) { + + serverID = (char *)wbxml_buffer_get_cstr(serverid_node->children->content); + serverIDlen = wbxml_buffer_len(serverid_node->children->content); + if (serverID == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL serverID detected. serverID MUST NOT be NULL."); + goto error; + } + + san->server_id = (char *)calloc(serverIDlen, sizeof(char)); + if (san->server_id == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [Server ID]"); + goto error; + } + memcpy(san->server_id, serverID, serverIDlen); + } + } else if (strcmp(child_node_name, "Cred") == 0) { + + san->cred = (san_cred_s *) calloc(1, sizeof(san_cred_s)); + if (san->cred == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [cred]"); + goto error; + } + + char *credFormat = NULL; + unsigned credFormatLen = 0; + WBXMLTreeNode *credformat_node; + if ((credformat_node = wbxml_tree_node_elt_get_from_name(child_node, "Format", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [Format]"); + goto error; + } + + if (credformat_node->children != NULL && credformat_node->children->type == WBXML_TREE_TEXT_NODE && credformat_node->children->content != NULL) { + + credFormat = (char *)wbxml_buffer_get_cstr(credformat_node->children->content); + credFormatLen = wbxml_buffer_len(credformat_node->children->content); + if (credFormat == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL credFormat detected. credFormat MUST NOT be NULL."); + goto error; + } + + san->cred->cred_format = (char *)calloc(credFormatLen, sizeof(char)); + if (san->cred->cred_format == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [credFormat]"); + goto error; + } + memcpy(san->cred->cred_format, credFormat, credFormatLen); + } + + char *credAuth = NULL; + unsigned credAuthLen = 0; + WBXMLTreeNode *credauth_node; + if ((credauth_node = wbxml_tree_node_elt_get_from_name(child_node, "Type", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [Type]"); + goto error; + } + + if (credauth_node->children != NULL && credauth_node->children->type == WBXML_TREE_TEXT_NODE && credauth_node->children->content != NULL) { + + credAuth = (char *)wbxml_buffer_get_cstr(credauth_node->children->content); + credAuthLen = wbxml_buffer_len(credauth_node->children->content); + if (credAuth == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL credAuth detected. credAuth MUST NOT be NULL."); + goto error; + } + + san->cred->cred_auth = (char *)calloc(credAuthLen, sizeof(char)); + if (san->cred->cred_auth == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [credAuth]"); + goto error; + } + memcpy(san->cred->cred_auth, credAuth, credAuthLen); + } + + char *credData = NULL; + unsigned credDataLen = 0; + WBXMLTreeNode *creddata_node; + if ((creddata_node = wbxml_tree_node_elt_get_from_name(child_node, "Data", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [Data]"); + goto error; + } + + if (creddata_node->children != NULL && creddata_node->children->type == WBXML_TREE_TEXT_NODE && creddata_node->children->content != NULL) { + + credData = (char *)wbxml_buffer_get_cstr(creddata_node->children->content); + credDataLen = wbxml_buffer_len(creddata_node->children->content); + if (credData == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL credData detected. credData MUST NOT be NULL."); + goto error; + } + + san->cred->cred_data = (char *)calloc(credDataLen, sizeof(char)); + if (san->cred->cred_data == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [credData]"); + goto error; + } + memcpy(san->cred->cred_data, credData, credDataLen); + } + + } + + } + + WBXMLTreeNode *syncbody_node; + if ((syncbody_node = wbxml_tree_node_elt_get_from_name(wbxml_tree->root, "SyncBody", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [SyncBody]"); + goto error; + } + + WBXMLList *alertnode_list = wbxml_tree_node_get_all_children(syncbody_node); + unsigned int alertnode_list_len = wbxml_list_len(alertnode_list); + + child_node = (WBXMLTreeNode *) wbxml_list_get(alertnode_list, alertnode_list_len - 1); + child_node_name = (const char *)wbxml_tag_get_xml_name(child_node->name); + if (strcmp(child_node_name, "Final") == 0) + san->cnt_sync_alerts = alertnode_list_len - 1; + + if (san->cnt_sync_alerts == 0) { + /* If number of sync alerts equals 0, should sync all data store in the client */ + return san; + } else { + san->sync_alerts = (san_sync_alert_s *) calloc(san->cnt_sync_alerts, sizeof(san_sync_alert_s)); + if (san->sync_alerts == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [syncAlerts]"); + goto error; + } + + unsigned int indexNode; + for (indexNode = 0; indexNode < san->cnt_sync_alerts; indexNode++) { + + WBXMLTreeNode *alert_node = (WBXMLTreeNode *) wbxml_list_get(alertnode_list, indexNode); + + char *alertData = NULL; + WBXMLTreeNode *alertdata_node; + if ((alertdata_node = wbxml_tree_node_elt_get_from_name(alert_node, "Data", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [Data]"); + goto error; + } + + if (alertdata_node->children != NULL && alertdata_node->children->type == WBXML_TREE_TEXT_NODE && alertdata_node->children->content != NULL) { + + alertData = (char *)wbxml_buffer_get_cstr(alertdata_node->children->content); + if (alertData == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL alertData detected. alertData MUST NOT be NULL."); + goto error; + } + + if (atoi(alertData) < 206 || atoi(alertData) > 210) { + _DEBUG_ERROR("[sanPackage11Parser] SAN doesn't support the sync type %d.", atoi(alertData)); + goto error; + } + + san->sync_alerts[indexNode].sync_type = atoi(alertData); + } + + char *alertURI = NULL; + unsigned alertURIlen = 0; + WBXMLTreeNode *alerturi_node; + if ((alerturi_node = wbxml_tree_node_elt_get_from_name(alert_node, "LocURI", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [LocURI]"); + goto error; + } + + if (alerturi_node->children != NULL && alerturi_node->children->type == WBXML_TREE_TEXT_NODE && alerturi_node->children->content != NULL) { + + alertURI = (char *)wbxml_buffer_get_cstr(alerturi_node->children->content); + alertURIlen = wbxml_buffer_len(alerturi_node->children->content); + if (alertURI == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL alertURI detected. alertURI MUST NOT be NULL."); + goto error; + } + + san->sync_alerts[indexNode].server_uri = (char *)calloc(alertURIlen, sizeof(char)); + if (san->sync_alerts[indexNode].server_uri == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] SAN package memory allocation fail. [serverURI]"); + goto error; + } + memcpy(san->sync_alerts[indexNode].server_uri, alertURI, alertURIlen); + } + + char *alertContentType = NULL; + unsigned alertContentTypeLen = 0; + WBXMLTreeNode *alertcontenttype_node; + if ((alertcontenttype_node = wbxml_tree_node_elt_get_from_name(alert_node, "Type", TRUE)) == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL from wbxml_tree_node_elt_get_from_name. [Type]"); + goto error; + } + + if (alertcontenttype_node->children != NULL && alertcontenttype_node->children->type == WBXML_TREE_TEXT_NODE && alertcontenttype_node->children->content != NULL) { + + alertContentType = (char *)wbxml_buffer_get_cstr(alertcontenttype_node->children->content); + alertContentTypeLen = wbxml_buffer_len(alertcontenttype_node->children->content); + + if (alertContentType == NULL) { + _DEBUG_ERROR("[sanPackage11Parser] NULL alertContentType detected. alertContentType MUST NOT be NULL."); + goto error; + } + + int j; + int cnt = (int)sizeof(contentTypeSupported) / sizeof(san_content_type_s); + bool isContentSupported = false; + + for (j = 0; j < cnt; j++) { + if (contentTypeSupported[j].strType == NULL) + continue; + if (strcmp(alertContentType, contentTypeSupported[j].strType) == 0) { + san->sync_alerts[indexNode].content_type = contentTypeSupported[j].strType; + isContentSupported = true; + break; + } + } + + if (!isContentSupported) { + _DEBUG_ERROR("[sanPackage11Parser] SAN doesn't support the content type %s.", alertContentType); + goto error; + } + } + } + } + + wbxml_tree_destroy(wbxml_tree); + + _EXTERN_FUNC_EXIT; + return san; + + error: + + sanPackageParserFree(san); + + _EXTERN_FUNC_EXIT; + return NULL; + +} + +void sanPackageParserFree(void *point) +{ + _EXTERN_FUNC_ENTER; + + san_package_s *san = (san_package_s *) point; + if (san != NULL) { + if (san->msg_body_without_digest != NULL) + free(san->msg_body_without_digest); + if (san->digest != NULL) + free(san->digest); + if (san->cred != NULL) { + if (san->cred->cred_format != NULL) + free(san->cred->cred_format); + if (san->cred->cred_auth != NULL) + free(san->cred->cred_auth); + if (san->cred->cred_data != NULL) + free(san->cred->cred_data); + free(san->cred); + } + if (san->server_id != NULL) + free(san->server_id); + if (san->sync_alerts != NULL) { + int i; + for (i = 0; i < san->cnt_sync_alerts; i++) { + if (san->sync_alerts[i].server_uri != NULL) { + free(san->sync_alerts[i].server_uri); + } + } + free(san->sync_alerts); + } + free(san); + } + + _EXTERN_FUNC_EXIT; +} + +void sanPrintMsg(san_package_s * san) +{ + _EXTERN_FUNC_ENTER; + + int i; + + _DEBUG_INFO("Printing SAN package ============================\n\n"); + + _DEBUG_INFO("MsgBody without Digest :\n\t"); + for (i = 0; i < san->msg_body_without_digest_length; i++) { + _DEBUG_INFO("%02x ", san->msg_body_without_digest[i]); + if ((i + 1) % 16 == 0) + _DEBUG_INFO("\n\t"); + } + _DEBUG_INFO("\n"); + + _DEBUG_INFO("Digest : %s\n", san->digest); + if (san->cred != NULL) { + if (san->cred->cred_format != NULL) + _DEBUG_INFO("Cred Format : %s\n", san->cred->cred_format); + if (san->cred->cred_auth != NULL) + _DEBUG_INFO("Cred Type : %s\n", san->cred->cred_auth); + if (san->cred->cred_data != NULL) + _DEBUG_INFO("Cred Data : %s\n", san->cred->cred_data); + } + _DEBUG_INFO("Version : %d\n", san->version); + _DEBUG_INFO("UI mode : %d\n", san->ui_mode); + _DEBUG_INFO("Initiator : %d\n", san->initiator); + _DEBUG_INFO("Session ID : %u\n", san->session_id); + _DEBUG_INFO("Server ID : %s\n", san->server_id); + _DEBUG_INFO("No. of Sync : %u\n", san->cnt_sync_alerts); + + for (i = 0; i < san->cnt_sync_alerts; i++) { + _DEBUG_INFO("\n\t=== Sync No. %d ============\n", i + 1); + _DEBUG_INFO("\tSync type : %d\n", san->sync_alerts[i].sync_type); + _DEBUG_INFO("\tContent type : %s\n", san->sync_alerts[i].content_type); + _DEBUG_INFO("\tServer URI : %s\n", san->sync_alerts[i].server_uri); + }; + + _EXTERN_FUNC_EXIT; +} + +int parse_ip_push_msg(char *data, san_package_s ** san_package, char **id) +{ + _EXTERN_FUNC_ENTER; + + retvm_if(data == NULL, 0, "data is NULL"); + + char *pay = NULL; + char *body = NULL; + char *decoded_body = NULL; + unsigned int decoded_size; + + *id = strtok(data, "|"); + pay = strtok(NULL, "|"); + body = strtok(NULL, "|"); + + _DEBUG_INFO("id = %s", *id); + _DEBUG_INFO("pay = %s", pay); + _DEBUG_INFO("after = %s", body); + + decoded_body = (char *)g_base64_decode(body, &decoded_size); + + _DEBUG_INFO("decoded_body = %s", decoded_body); + _DEBUG_INFO("decoded_size = %d", decoded_size); + + *san_package = san_package_12_parser(decoded_body, decoded_size); + + if ((*san_package) != NULL) { + _DEBUG_INFO("serverId = %s", (*san_package)->server_id); + _DEBUG_INFO("sessionID = %d", (*san_package)->session_id); + _DEBUG_INFO("cntSyncAlerts = %d", (*san_package)->cnt_sync_alerts); + int i; + for (i = 0; i < (*san_package)->cnt_sync_alerts; i++) { + _DEBUG_INFO("syncAlerts = %d", (*san_package)->sync_alerts[i].sync_type); + } + } else { + _DEBUG_ERROR("pSanPackage is NULL"); + goto error; + } + + _EXTERN_FUNC_EXIT; + return 1; + + error: + + _EXTERN_FUNC_EXIT; + return 0; +} |