📄 jprovoma.c
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* JProvOma.C
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file handles OMA OTA provisioning
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef _JPROVOMA_C
#define _JPROVOMA_C
#include "MMI_features.h"
#if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
#include "stdC.h"
#include "L4Dr1.h"
#include "PixtelDataTypes.h"
#include "l4a.h"
#include "mmi_msg_struct.h"
#include "DebugInitDef.h" /* Debug Info */
#include "wgui_categories_inputsenum.h"
#include "NVRAMEnum.h"
#include "JBrowserMMIGprots.h"
#include "JProvWap.h"
#include "JProvOma.h"
#include "JProfileHandlerDefs.h"
#include "JProfileHandlerTypes.h"
#include "JProfileHandlerProts.h"
#include "jdi_urivalidation.h"
extern BOOL mmi_phb_op_check_valid_number(S8 *number);
extern pBOOL GetUCS2Flag(PS8 buffer);
const characteristic_tag_handler_struct oma_tag_handler_map[PROV_OMA_CHARACTERISTIC_NUM] =
{
"BOOTSTRAP", mmi_prov_oma_handle_bootstrap_tag,
"NAPDEF", mmi_prov_oma_handle_napdef_tag,
"PXLOGICAL", mmi_prov_oma_handle_pxlogical_tag,
// "PXPHYSICAL",mmi_prov_oma_handle_pxphysical_tag,
// "PORT",mmi_prov_oma_handle_port_tag,
"APPLICATION", mmi_prov_oma_handle_application_tag,
// "NAPAUTHINFO",mmi_prov_oma_handle_napauthinfo_tag,
// "PXAUTHINFO",mmi_prov_oma_handle_pxauthinfo_tag,
// "RESOURCE",mmi_prov_oma_handle_resource_tag,
};
const security_parm_handler_struct oma_security_handler_map[PROV_SEC_TYPE_SUPP_NUM] =
{
SEC_NETWPIN, mmi_prov_oma_handle_netwpin,
SEC_USERPIN, mmi_prov_oma_handle_userpin,
SEC_USERNETWPIN, mmi_prov_oma_handle_usernetwpin,
SEC_USERPINMAC, mmi_prov_oma_handle_userpinmac,
};
application_data *g_prov_app_brw_p = NULL;
application_data *g_prov_app_mms_p = NULL;
static prov_logical_proxy_struct *g_prov_proxy_data_p = NULL;
static prov_napdef_struct *g_prov_napdef_data_p = NULL;
static prov_proxy_port_struct prov_proxy_port;
prov_data_account_data_struct *g_prov_dataAccountData_p = NULL;
static U8 *g_prov_imsi_p = NULL;
static U8 *g_prov_MAC_value_p = NULL;
static U8 g_prov_password[30];
static S8 *g_prov_oma_buff_p = NULL;
static U32 g_prov_oma_buff_len;
/*****************************************************************************
* FUNCTION
* mmi_prov_oma_handle_settings
* DESCRIPTION
* It checks if there is security data available in the content type,if yes it handles it
* otherwise the data is stored in the queue
* PARAMETERS
* prov_buffer_p [IN]
* prov_length [IN]
* content_type_p [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_prov_oma_handle_settings(S8 *prov_buffer_p, U32 prov_length, S8 *content_type_p)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
PROV_RETCODE i_ret = PROV_OK;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_prov_oma_buff_p = jdd_MemAlloc(prov_length, 1);
g_prov_oma_buff_len = prov_length;
memcpy(g_prov_oma_buff_p, prov_buffer_p, prov_length);
if (strcmp(content_type_p, APPLICATION_VND_WAP_CONNECTIVITY_WBXML) != 0)
{
i_ret = mmi_prov_extract_security_data(content_type_p, prov_buffer_p, prov_length);
if (i_ret == PROV_OK)
{
mmi_prov_oma_save_received_settings(prov_buffer_p, prov_length);
}
}
else if (strcmp(content_type_p, APPLICATION_VND_WAP_CONNECTIVITY_WBXML) == 0)
{
/* no security avaible ...add to queue */
mmi_prov_oma_save_received_settings(prov_buffer_p, prov_length);
}
}
/*****************************************************************************
* FUNCTION
* mmi_prov_oma_save_received_settings
* DESCRIPTION
* It adds the settings into the queue & checks if the queue size,
* if it is one to show new settings popup
* PARAMETERS
* prov_buff_p [IN]
* prov_buff_len [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_prov_oma_save_received_settings(S8 *prov_buff_p, U32 prov_buff_len)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_prov_add_to_queue(prov_buff_p, prov_buff_len);
//if (g_prov_data_queue_size == 1)
//{
mmi_prov_show_new_settings_popup();
//}
}
/*****************************************************************************
* FUNCTION
* mmi_prov_oma_insert_settings_parm
* DESCRIPTION
* It calls the respective handler for the various OMA provisioning characteristics supported & the One not supported
* all the needed information is extracted
* PARAMETERS
* root_p [IN]
* RETURNS
* PROV_OK
*****************************************************************************/
PROV_RETCODE mmi_prov_oma_insert_settings_parm(TAG *root_p)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
PROV_RETCODE i_ret = PROV_OK;
ATTRIBUTE *attr_p = NULL;
U32 map_array_index;
S8 characteristic_element[PROV_OMA_MIN_SIZE_REQ + 1];
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
root_p = root_p->next;
while (root_p != NULL)
{
attr_p = root_p->attribute_list;
if (strcmp(root_p->name, CHARACTERISTIC) != 0)
{
return PROV_ERR;
}
else
{
for (map_array_index = 0; map_array_index <= PROV_OMA_CHARACTERISTIC_NUM; ++map_array_index)
{
UnicodeToAnsii(characteristic_element, (S8*) attr_p->value);
if (strcmp(characteristic_element, oma_tag_handler_map[map_array_index].characteristic_tags) == 0)
{
oma_tag_handler_map[map_array_index].characteristic_tag_hdlr(&root_p);
break;
}
if (map_array_index == PROV_OMA_CHARACTERISTIC_NUM)
{
mmi_prov_oma_handle_unsupported_tag(&root_p);
/* For Handling characteristics that are not supported */
}
}
if (root_p == NULL || (root_p->attribute_list == NULL && root_p->next == NULL))
{
return i_ret;
}
}
}
return i_ret;
}
/*****************************************************************************
* FUNCTION
* mmi_prov_extract_security_data
* DESCRIPTION
* This will check for the SEC type & will call respective handler for the SEC types
* if error is returned by the SEC handlers Invalid settings popup is shown
* PARAMETERS
* content_type_p [IN]
* prov_buffer_p [IN]
* prov_length [IN]
* RETURNS
* void
*****************************************************************************/
PROV_RETCODE mmi_prov_extract_security_data(S8 *content_type_p, S8 *prov_buffer_p, U32 prov_length)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 shiftlen;
S8 *sec_data;
U32 map_array_index = 0;
PROV_RETCODE i_ret = PROV_OK;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
shiftlen = strlen(APPLICATION_VND_WAP_CONNECTIVITY_WBXML);
sec_data = content_type_p + shiftlen;
if (*sec_data != SEMI_COLAN_SEPARATER)
{
/* No security available */
mmi_prov_oma_save_received_settings(prov_buffer_p, prov_length);
return i_ret;
}
else
{
g_prov_MAC_value_p = jdd_MemAlloc(PROV_OMA_NO_OF_MAC_VALUE_BYTES + 1, 1);
/* memcpy(g_prov_MAC_value_p,,41); */
sec_data += PROV_BYTES_TO_SHIFT_TO_SEC_PARM;
for (; map_array_index < PROV_SEC_TYPE_SUPP_NUM; ++map_array_index)
{
if (mmi_prov_check_if_substring(sec_data, oma_security_handler_map[map_array_index].secId) == 0)
{
/* move to MAC value */
sec_data += PROV_BYTES_TO_SHIFT_TO_MAC_PARM;
memcpy(g_prov_MAC_value_p, sec_data, PROV_OMA_NO_OF_MAC_VALUE_BYTES + 1);
i_ret = (oma_security_handler_map[map_array_index].sec_hdlr) (content_type_p, prov_buffer_p);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -