JProvNE.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:39k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * JProvNE.C
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file intends for nokiaericsson OTA settings.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  * removed!
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  *
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  *
  77.  *------------------------------------------------------------------------------
  78.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  79.  *============================================================================
  80.  ****************************************************************************/
  81. #ifndef _JPROVNE_C
  82. #define _JPROVNE_C
  83. #include "MMI_features.h"
  84. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  85. #include "stdC.h"
  86. #include "L4Dr1.h"
  87. #include "PixtelDataTypes.h"
  88. #include "JProvWap.h"
  89. #include "JProvNE.h"
  90. #include "JProfileHandlerTypes.h"
  91. #include "JBrowserMMIDefs.h"
  92. #include "JBrowserMMIProts.h"
  93. #include "JBrowserMMIGprots.h"
  94. extern pBOOL GetUCS2Flag(PS8 buffer);
  95. extern BOOL mmi_phb_op_check_valid_number(S8 *number);
  96. extern PROV_RETCODE mmi_brw_add_prov_bookmark(U8 *, U8 *);
  97. const characteristic_tag_handler_struct NE_tag_handler_map[PROV_NE_CHARACTERISTIC_NUM] = 
  98. {
  99.     "ADDRESS", mmi_prov_NE_handle_address_tag,
  100.     "URL", mmi_prov_NE_handle_url_tag,
  101.     "NAME", mmi_prov_NE_handle_name_tag,
  102.     "BOOKMARK", mmi_prov_NE_handle_bookmark_tag,
  103.     "MMSURL", mmi_prov_NE_handle_mmsurl_tag,
  104.     "ID", mmi_prov_NE_handle_id_tag
  105. };
  106. /*****************************************************************************
  107.  * FUNCTION
  108.  *  mmi_prov_NE_handle_settings
  109.  * DESCRIPTION
  110.  *  Add's the prov. into the queue & if the queue size is 1 show new settings popup
  111.  * PARAMETERS
  112.  *  prov_buffer_p       [IN]        Prov. data buffer
  113.  *  prov_length         [IN]        
  114.  *  provLength(?)       [IN]        Buff length
  115.  * RETURNS
  116.  *  void
  117.  *****************************************************************************/
  118. void mmi_prov_NE_handle_settings(S8 *prov_buffer_p, U32 prov_length)
  119. {
  120.     /*----------------------------------------------------------------*/
  121.     /* Local Variables                                                */
  122.     /*----------------------------------------------------------------*/
  123.     /*----------------------------------------------------------------*/
  124.     /* Code Body                                                      */
  125.     /*----------------------------------------------------------------*/
  126.     mmi_prov_add_to_queue(prov_buffer_p, prov_length);
  127.  //   if (g_prov_data_queue_size == 1)
  128.   //  {
  129.         mmi_prov_show_new_settings_popup();
  130.   //  }
  131. }
  132. /*****************************************************************************
  133.  * FUNCTION
  134.  *  mmi_prov_NE_insert_settings_parm
  135.  * DESCRIPTION
  136.  *  This API check out for the xml tags one by one and calls the respective handlers for the various characteristcs
  137.  *  tags encountered
  138.  * PARAMETERS
  139.  *  root_p      [IN]        Root tag
  140.  * RETURNS
  141.  *  PROV_RETCODE
  142.  *****************************************************************************/
  143. PROV_RETCODE mmi_prov_NE_insert_settings_parm(TAG *root_p)
  144. {
  145.     /*----------------------------------------------------------------*/
  146.     /* Local Variables                                                */
  147.     /*----------------------------------------------------------------*/
  148.     PROV_RETCODE i_ret = PROV_OK;
  149.     ATTRIBUTE *attr_p = NULL;
  150.     U32 map_array_index;
  151.     S8 characteristic_element[PROV_MIN_SIZE_REQ + 1];
  152.     /*----------------------------------------------------------------*/
  153.     /* Code Body                                                      */
  154.     /*----------------------------------------------------------------*/
  155.     root_p = root_p->next;
  156.     while (root_p->next != NULL || root_p->attribute_list != NULL)
  157.     {
  158.         attr_p = root_p->attribute_list;
  159.         if (strcmp(root_p->name, CHARACTERISTIC) != 0)
  160.         {
  161.             return PROV_ERR;
  162.         }
  163.         else
  164.         {
  165.             for (map_array_index = 0; map_array_index < PROV_NE_CHARACTERISTIC_NUM; ++map_array_index)
  166.             {
  167.                 UnicodeToAnsii(characteristic_element, (S8*) attr_p->value);
  168.                 if (strcmp(characteristic_element, NE_tag_handler_map[map_array_index].characteristic_tags) == 0)
  169.                 {
  170.                     i_ret = NE_tag_handler_map[map_array_index].characteristic_tag_hdlr(&root_p);
  171.                     if (i_ret == PROV_ERR)
  172.                     {
  173.                         return i_ret;
  174.                     }
  175.                     break;
  176.                 }
  177.             }
  178.             if (root_p == NULL)
  179.             {
  180.                 return i_ret;
  181.             }
  182.         }
  183.     }
  184.     return i_ret;
  185. }
  186. /*****************************************************************************
  187.  * FUNCTION
  188.  *  mmi_prov_NE_handle_address_tag
  189.  * DESCRIPTION
  190.  *  ADDRESS characteristic tag obtained in the NE OTA settings is handled
  191.  * PARAMETERS
  192.  *  nextroot_p      [IN]        INOUT
  193.  * RETURNS
  194.  *  PROV_RETCODE
  195.  *****************************************************************************/
  196. PROV_RETCODE mmi_prov_NE_handle_address_tag(TAG **nextroot_p)
  197. {
  198.     /*----------------------------------------------------------------*/
  199.     /* Local Variables                                                */
  200.     /*----------------------------------------------------------------*/
  201.     PROV_RETCODE i_ret = PROV_OK;
  202.     ATTRIBUTE *attr_p = NULL;
  203.     TAG *root_p;
  204.     S8 parm_element[PROV_MIN_SIZE_REQ + 1];
  205.     /*----------------------------------------------------------------*/
  206.     /* Code Body                                                      */
  207.     /*----------------------------------------------------------------*/
  208.     root_p = *nextroot_p;
  209.     root_p = root_p->next;
  210.     attr_p = root_p->attribute_list;
  211.     while (root_p != NULL)
  212.     {
  213.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  214.         {
  215.             *nextroot_p = root_p;
  216.             return i_ret;
  217.         }
  218.         else if (strcmp(root_p->name, PARM) == 0)
  219.         {
  220.             if (strcmp(attr_p->name, NAME) == 0)
  221.             {
  222.                 UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  223.                 if (strcmp(parm_element, BEARER) == 0)
  224.                 {
  225.                     attr_p = attr_p->next;
  226.                     if (strcmp(attr_p->name, VALUE) == 0)
  227.                     {
  228.                         UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  229.                         if (strcmp(parm_element, GPRS) == 0)
  230.                         {
  231.                             g_prov_bearer = PROV_GPRS_BEARER;
  232.                         }
  233.                         else if (strcmp(parm_element, GSMCSD) == 0)
  234.                         {
  235.                             g_prov_bearer = PROV_CSD_BEARER;
  236. if(g_prov_set_csd_req_p)
  237. {
  238. g_prov_set_csd_req_p->rate = CSD_PROF_RATE_9600;/*Default Value*///added by tk
  239.  }
  240.                         }
  241.                     }
  242.                 }
  243.                 else if (strcmp(parm_element, PROXY) == 0)
  244.                 {
  245.                     attr_p = attr_p->next;
  246.                     mmi_prov_handle_proxy_ip(attr_p);
  247.                 }
  248.                 else if (strcmp(parm_element, PROXY_AUTHNAME) == 0)
  249.                 {
  250.                     attr_p = attr_p->next;
  251.                     mmi_prov_NE_handle_proxy_authname(attr_p);
  252.                 }
  253.                 else if (strcmp(parm_element, PROXY_AUTHSECRET) == 0)
  254.                 {
  255.                     attr_p = attr_p->next;
  256.                     mmi_prov_NE_handle_proxy_authsecret(attr_p);
  257.                 }
  258.                 else if (strcmp(parm_element, PROXY_LOGINTYPE) == 0)
  259.                 {
  260.                     attr_p = attr_p->next;
  261.                 }
  262.                 else if (strcmp(parm_element, CSD_DIALSTRING) == 0)
  263.                 {
  264.                     attr_p = attr_p->next;
  265.                     if (g_prov_bearer == PROV_CSD_BEARER)
  266.                     {
  267.                         mmi_prov_NE_handle_csd_dialstring(attr_p);
  268.                     }
  269.                 }
  270.                 else if (strcmp(parm_element, PPP_AUTHTYPE) == 0)
  271.                 {
  272.                     attr_p = attr_p->next;
  273.                     mmi_prov_handle_nap_auth_type(attr_p);
  274.                 }
  275.                 else if (strcmp(parm_element, PPP_AUTHNAME) == 0)
  276.                 {
  277.                     attr_p = attr_p->next;
  278.                     mmi_prov_handle_nap_auth_name(attr_p);
  279.                 }
  280.                 else if (strcmp(parm_element, PPP_AUTHSECRET) == 0)
  281.                 {
  282.                     attr_p = attr_p->next;
  283.                     mmi_prov_handle_nap_auth_pw(attr_p);
  284.                 }
  285.                 else if (strcmp(parm_element, GPRS_ACCESSPOINTNAME) == 0)
  286.                 {
  287.                     attr_p = attr_p->next;
  288.                     if (g_prov_bearer == PROV_GPRS_BEARER)
  289.                     {
  290.                         mmi_prov_NE_handle_gprs_apn(attr_p);
  291.                     }
  292.                 }
  293.                 else if (strcmp(parm_element, PORT) == 0)
  294.                 {
  295.                     attr_p = attr_p->next;
  296.                     if (strcmp(attr_p->name, VALUE) == 0)
  297.                     {
  298.                         U32 proxy_port = 0;
  299.                         UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  300.                         proxy_port = atoi(parm_element);
  301.                         if (proxy_port < PH_USHORT_MAX)
  302.                         {
  303.                             g_ph_wap_profile_p->proxy_port = proxy_port;
  304.                             g_ph_mms_profile_p->proxy_port = proxy_port;
  305.                         }
  306.                         else if (proxy_port >= PH_USHORT_MAX)
  307.                         {
  308.                             g_ph_wap_profile_p->proxy_port = 0x00;
  309.                             g_ph_mms_profile_p->proxy_port = 0x00;
  310.                         }
  311.                         if (strcmp(parm_element, "9201") == 0)
  312.                         {
  313.                             g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  314.                             g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  315.                         }
  316.                         else if (strcmp(parm_element, "9203") == 0)
  317.                         {
  318.                             g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED_SECURE;
  319.                             g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED_SECURE;
  320.                         }
  321.                         else if ((strcmp(parm_element, "9200") == 0) || (strcmp(parm_element, "9202") == 0))
  322.                         {
  323.                             return PROV_ERR;
  324.                         }
  325.                         else
  326.                         {
  327.                             g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_HTTP;
  328.                             g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_HTTP;
  329.                         }
  330.                     }
  331.                 }
  332.                 else if (strcmp(parm_element, CSD_CALLSPEED) == 0)
  333.                 {
  334.                     attr_p = attr_p->next;
  335.                     if (g_prov_bearer == PROV_CSD_BEARER)
  336.                     {
  337.                         mmi_prov_NE_handle_csd_callspeed(attr_p);
  338.                     }
  339.                 }
  340.                 else if (strcmp(parm_element, CSD_CALLTYPE) == 0)
  341.                 {
  342.                     attr_p = attr_p->next;
  343.                     if (g_prov_bearer == PROV_CSD_BEARER)
  344.                     {
  345.                         mmi_prov_NE_handle_csd_calltype(attr_p);
  346.                     }
  347.                 }
  348.                 else if (strcmp(parm_element, ISP_NAME) == 0)
  349.                 {
  350.                     attr_p = attr_p->next;
  351.                     mmi_prov_handle_profile_name(attr_p);
  352.                 }
  353.             }
  354.         }
  355.         root_p = root_p->next;
  356.         if (root_p != NULL)
  357.         {
  358.             attr_p = root_p->attribute_list;
  359.         }
  360.         else
  361.         {
  362.             *nextroot_p = root_p;
  363.             return i_ret;
  364.         }
  365.     }
  366.     return i_ret;
  367. }
  368. /*****************************************************************************
  369.  * FUNCTION
  370.  *  mmi_prov_NE_handle_url_tag
  371.  * DESCRIPTION
  372.  *  URL characteristic tag obtained in the NE OTA settings is handled
  373.  * PARAMETERS
  374.  *  nextroot_p      [IN]        INOUT
  375.  * RETURNS
  376.  *  void
  377.  *****************************************************************************/
  378. PROV_RETCODE mmi_prov_NE_handle_url_tag(TAG **nextroot_p)
  379. {
  380.     /*----------------------------------------------------------------*/
  381.     /* Local Variables                                                */
  382.     /*----------------------------------------------------------------*/
  383.     PROV_RETCODE i_ret = PROV_OK;
  384.     ATTRIBUTE *attr_p = NULL;
  385.     TAG *root_p;
  386.     /*----------------------------------------------------------------*/
  387.     /* Code Body                                                      */
  388.     /*----------------------------------------------------------------*/
  389.     root_p = *nextroot_p;
  390.     attr_p = root_p->attribute_list;
  391.     while (root_p != NULL)
  392.     {
  393.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  394.         {
  395.             if (strcmp(attr_p->name, TYPE) == 0)
  396.             {
  397.                 attr_p = attr_p->next;
  398.                 mmi_prov_handle_homepage_url(attr_p);
  399.             }
  400.         }
  401.         root_p = root_p->next;
  402.         if (root_p != NULL)
  403.         {
  404.             attr_p = root_p->attribute_list;
  405.             *nextroot_p = root_p;
  406.             return i_ret;
  407.         }
  408.         else
  409.         {
  410.             *nextroot_p = root_p;
  411.             return i_ret;
  412.         }
  413.     }
  414.     return i_ret;
  415. }
  416. /*****************************************************************************
  417.  * FUNCTION
  418.  *  mmi_prov_NE_handle_name_tag
  419.  * DESCRIPTION
  420.  *  NAME characteristic tag obtained in the NE OTA settings is handled
  421.  * PARAMETERS
  422.  *  nextroot_p      [IN]        INOUT
  423.  * RETURNS
  424.  *  void
  425.  *****************************************************************************/
  426. PROV_RETCODE mmi_prov_NE_handle_name_tag(TAG **nextroot_p)
  427. {
  428.     /*----------------------------------------------------------------*/
  429.     /* Local Variables                                                */
  430.     /*----------------------------------------------------------------*/
  431.     PROV_RETCODE i_ret = PROV_OK;
  432.     ATTRIBUTE *attr_p = NULL;
  433.     TAG *root_p;
  434.     S8 parm_element[PROV_PROFILE_PROFILE_NAME_LEN + 1];
  435.     /*----------------------------------------------------------------*/
  436.     /* Code Body                                                      */
  437.     /*----------------------------------------------------------------*/
  438.     root_p = *nextroot_p;
  439.     root_p = root_p->next;
  440.     attr_p = root_p->attribute_list;
  441.     while (root_p != NULL)
  442.     {
  443.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  444.         {
  445.             *nextroot_p = root_p;
  446.             return i_ret;
  447.         }
  448.         else if (strcmp(root_p->name, PARM) == 0)
  449.         {
  450.             if (strcmp(attr_p->name, NAME) == 0)
  451.             {
  452.                 UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  453.                 if (strcmp(parm_element, NAME_PARM) == 0)
  454.                 {
  455.                     attr_p = attr_p->next;
  456.                     mmi_prov_handle_profile_name(attr_p);
  457.                 }
  458.             }
  459.         }
  460.         root_p = root_p->next;
  461.         if (root_p != NULL)
  462.         {
  463.             attr_p = root_p->attribute_list;
  464.         }
  465.         else
  466.         {
  467.             *nextroot_p = root_p;
  468.             return i_ret;
  469.         }
  470.     }
  471.     return i_ret;
  472. }
  473. /*****************************************************************************
  474.  * FUNCTION
  475.  *  mmi_prov_NE_handle_bookmark_tag
  476.  * DESCRIPTION
  477.  *  BOOKMARK characteristic tag obtained in the NE OTA settings is handled
  478.  * PARAMETERS
  479.  *  nextroot_p      [IN]        INOUT
  480.  * RETURNS
  481.  *  PROV_RETCODE
  482.  *****************************************************************************/
  483. PROV_RETCODE mmi_prov_NE_handle_bookmark_tag(TAG **nextroot_p)
  484. {
  485.     /*----------------------------------------------------------------*/
  486.     /* Local Variables                                                */
  487.     /*----------------------------------------------------------------*/
  488.     PROV_RETCODE i_ret = PROV_OK;
  489.     ATTRIBUTE *attr_p = NULL;
  490.     TAG *root_p;
  491.     S8 parm_element[PROV_MIN_SIZE_REQ + 1];
  492.     U8 bkm_title_p[PROV_BKM_TITLE_LEN * ENCODING_LENGTH] = {0, };
  493.     U8 bkm_url_p[PROV_BKM_URL_LEN * ENCODING_LENGTH] = {0, };
  494.     U32 valid_bookmark = 0;
  495.     U32 len = 0;
  496.     /*----------------------------------------------------------------*/
  497.     /* Code Body                                                      */
  498.     /*----------------------------------------------------------------*/
  499.     /* to handle the case when only bookmarks are received */
  500.     if (g_prov_bearer == PROV_INVALID_BEARER)
  501.     {
  502.         g_prov_setting_type |= PROV_BOOKMARK_SETTINGS;
  503.     }
  504.     root_p = *nextroot_p;
  505.     root_p = root_p->next;
  506.     attr_p = root_p->attribute_list;
  507.     while (root_p != NULL)
  508.     {
  509.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  510.         {
  511.             *nextroot_p = root_p;
  512.             if (valid_bookmark)
  513.             {
  514.                 i_ret = mmi_brw_add_prov_bookmark(bkm_title_p, bkm_url_p);
  515.             }
  516.             return i_ret;
  517.         }
  518.         else if (strcmp(root_p->name, PARM) == 0)
  519.         {
  520.             if (strcmp(attr_p->name, NAME) == 0)
  521.             {
  522.                 UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  523.                 if (strcmp(parm_element, NAME_PARM) == 0)
  524.                 {
  525.                     attr_p = attr_p->next;
  526.                     if (strcmp(attr_p->name, VALUE) == 0)
  527.                     {
  528.                         len = UCS2Strlen((S8*) attr_p->value);
  529.                         if (len >= PROV_BKM_TITLE_LEN)
  530.                         {
  531.                             len = PROV_BKM_TITLE_LEN - 1;
  532.                         }
  533.                         UCS2Strncpy((S8*) bkm_title_p, (S8*) attr_p->value, len);
  534.                     }
  535.                 }
  536.                 else if (strcmp(parm_element, URL) == 0)
  537.                 {
  538.                     attr_p = attr_p->next;
  539.                     if (strcmp(attr_p->name, VALUE) == 0)
  540.                     {
  541.                         len = UCS2Strlen((S8*) attr_p->value);
  542.                         if (len >= PROV_BKM_URL_LEN)
  543.                         {
  544.                             len = PROV_BKM_URL_LEN - 1;
  545.                         }
  546.                         UCS2Strncpy((S8*) bkm_url_p, (S8*) attr_p->value, len);
  547.                         valid_bookmark = 0x01;
  548.                     }
  549.                 }
  550.             }
  551.         }
  552.         root_p = root_p->next;
  553.         if (root_p != NULL)
  554.         {
  555.             attr_p = root_p->attribute_list;
  556.             if (attr_p == NULL && root_p->name == NULL)
  557.             {
  558.                 if (valid_bookmark)
  559.                 {
  560.                     i_ret = mmi_brw_add_prov_bookmark(bkm_title_p, bkm_url_p);
  561.                 }
  562.                 *nextroot_p = root_p;
  563.                 return i_ret;
  564.             }
  565.         }
  566.         else
  567.         {
  568.             *nextroot_p = root_p;
  569.             if (valid_bookmark)
  570.             {
  571.                 i_ret = mmi_brw_add_prov_bookmark(bkm_title_p, bkm_url_p);
  572.             }
  573.             return i_ret;
  574.         }
  575.     }
  576.     if (valid_bookmark)
  577.     {
  578.         i_ret = mmi_brw_add_prov_bookmark(bkm_title_p, bkm_url_p);
  579.     }
  580.     return i_ret;
  581. }
  582. /*****************************************************************************
  583.  * FUNCTION
  584.  *  mmi_prov_NE_handle_mmsurl_tag
  585.  * DESCRIPTION
  586.  *  MMSCURL characteristic tag obtained in the NE OTA settings is handled
  587.  * PARAMETERS
  588.  *  nextroot_p      [IN]        INOUT
  589.  * RETURNS
  590.  *  PROV_RETCODE
  591.  *****************************************************************************/
  592. PROV_RETCODE mmi_prov_NE_handle_mmsurl_tag(TAG **nextroot_p)
  593. {
  594.     /*----------------------------------------------------------------*/
  595.     /* Local Variables                                                */
  596.     /*----------------------------------------------------------------*/
  597.     PROV_RETCODE i_ret = PROV_OK;
  598.     ATTRIBUTE *attr_p = NULL;
  599.     TAG *root_p;
  600.     /*----------------------------------------------------------------*/
  601.     /* Code Body                                                      */
  602.     /*----------------------------------------------------------------*/
  603.     root_p = *nextroot_p;
  604.     attr_p = root_p->attribute_list;
  605.     while (root_p != NULL)
  606.     {
  607.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  608.         {
  609.             if (strcmp(attr_p->name, TYPE) == 0)
  610.             {
  611.                 attr_p = attr_p->next;
  612.                 mmi_prov_handle_mmsc_url(attr_p);
  613.                 g_prov_setting_type |= PROV_MMS_SETTINGS;
  614.                 g_prov_setting_type &= ~PROV_BRS_SETTINGS;
  615.             }
  616.         }
  617.         root_p = root_p->next;
  618.         if (root_p != NULL)
  619.         {
  620.             attr_p = root_p->attribute_list;
  621.             *nextroot_p = root_p;
  622.             return i_ret;
  623.         }
  624.         else
  625.         {
  626.             *nextroot_p = root_p;
  627.             return i_ret;
  628.         }
  629.     }
  630.     return i_ret;
  631. }
  632. /*****************************************************************************
  633.  * FUNCTION
  634.  *  mmi_prov_NE_handle_id_tag
  635.  * DESCRIPTION
  636.  *  ID characteristic tag obtained in the NE OTA settings is handled
  637.  * PARAMETERS
  638.  *  nextroot_p      [IN]        INOUT
  639.  * RETURNS
  640.  *  PROV_RETCODE
  641.  *****************************************************************************/
  642. PROV_RETCODE mmi_prov_NE_handle_id_tag(TAG **nextroot_p)
  643. {
  644.     /*----------------------------------------------------------------*/
  645.     /* Local Variables                                                */
  646.     /*----------------------------------------------------------------*/
  647.     PROV_RETCODE i_ret = PROV_OK;
  648.     ATTRIBUTE *attr_p = NULL;
  649.     TAG *root_p;
  650.     S8 parm_element[PROV_MIN_SIZE_REQ + 1];
  651.     /*----------------------------------------------------------------*/
  652.     /* Code Body                                                      */
  653.     /*----------------------------------------------------------------*/
  654.     root_p = *nextroot_p;
  655.     root_p = root_p->next;
  656.     attr_p = root_p->attribute_list;
  657.     while (root_p != NULL)
  658.     {
  659.         if (strcmp(root_p->name, CHARACTERISTIC) == 0)
  660.         {
  661.             *nextroot_p = root_p;
  662.             return i_ret;
  663.         }
  664.         else if (strcmp(root_p->name, PARM) == 0)
  665.         {
  666.             if (strcmp(attr_p->name, NAME) == 0)
  667.             {
  668.                 UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  669.                 if (strcmp(parm_element, NAME_PARM) == 0)
  670.                 {
  671.                     attr_p = attr_p->next;
  672.                     if (strcmp(attr_p->name, VALUE) == 0)
  673.                     {
  674.                         UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  675.                         /* Note : dara check if we need to support this */
  676.                     }
  677.                 }
  678.             }
  679.         }
  680.         root_p = root_p->next;
  681.         if (root_p != NULL)
  682.         {
  683.             attr_p = root_p->attribute_list;
  684.         }
  685.         else
  686.         {
  687.             *nextroot_p = root_p;
  688.             return i_ret;
  689.         }
  690.     }
  691.     return i_ret;
  692. }
  693. /*****************************************************************************
  694.  * FUNCTION
  695.  *  mmi_prov_NE_handle_csd_calltype
  696.  * DESCRIPTION
  697.  *  This function handles CSD calll type parm received in the Nokia settings
  698.  * PARAMETERS
  699.  *  attr_p      [IN]        
  700.  * RETURNS
  701.  *  void
  702.  *****************************************************************************/
  703. void mmi_prov_NE_handle_csd_calltype(ATTRIBUTE *attr_p)
  704. {
  705.     /*----------------------------------------------------------------*/
  706.     /* Local Variables                                                */
  707.     /*----------------------------------------------------------------*/
  708.     S8 parm_element[PROV_MIN_SIZE_REQ + 1];
  709.     /*----------------------------------------------------------------*/
  710.     /* Code Body                                                      */
  711.     /*----------------------------------------------------------------*/
  712.     if (strcmp(attr_p->name, VALUE) == 0)
  713.     {
  714.         UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  715.         if (strcmp(parm_element, ANALOGUE) == 0)
  716.         {
  717.             g_prov_set_csd_req_p->type = CSMCC_ITC_3_1_K_AUDIO;
  718.         }
  719.         else if (strcmp(parm_element, "ISDN") == 0)
  720.         {
  721.             g_prov_set_csd_req_p->type = CSMCC_ITC_UDI;
  722.         }
  723.         else
  724.         {
  725.             g_prov_set_csd_req_p->type = CSMCC_ITC_3_1_K_AUDIO;
  726.         }
  727.     }
  728. }
  729. /*****************************************************************************
  730.  * FUNCTION
  731.  *  mmi_prov_NE_handle_csd_callspeed
  732.  * DESCRIPTION
  733.  *  This function handles CSD call speed parameter received in the OMA settings
  734.  * PARAMETERS
  735.  *  attr_p      [IN]        
  736.  * RETURNS
  737.  *  void
  738.  *****************************************************************************/
  739. void mmi_prov_NE_handle_csd_callspeed(ATTRIBUTE *attr_p)
  740. {
  741.     /*----------------------------------------------------------------*/
  742.     /* Local Variables                                                */
  743.     /*----------------------------------------------------------------*/
  744.     S8 parm_element[PROV_MIN_SIZE_REQ + 1];
  745.     /*----------------------------------------------------------------*/
  746.     /* Code Body                                                      */
  747.     /*----------------------------------------------------------------*/
  748.     if (strcmp(attr_p->name, VALUE) == 0)
  749.     {
  750.         UnicodeToAnsii(parm_element, (S8*) attr_p->value);
  751.         if (strcmp(parm_element, AUTO) == 0 || strcmp(parm_element, "9600") == 0)
  752.         {
  753.             g_prov_set_csd_req_p->rate = CSD_PROF_RATE_9600;
  754.         }
  755.         else if (strcmp(parm_element, "4800") == 0)
  756.         {
  757.             g_prov_set_csd_req_p->rate = CSD_PROF_RATE_4800;
  758.         }
  759.         else if (strcmp(parm_element, "14400") == 0)
  760.         {
  761.             g_prov_set_csd_req_p->rate = CSD_PROF_RATE_14400;
  762.         }
  763.         else
  764.         {
  765.             g_prov_set_csd_req_p->rate = CSD_PROF_RATE_9600;
  766.         }
  767.     }
  768. }
  769. /*****************************************************************************
  770.  * FUNCTION
  771.  *  mmi_prov_NE_handle_proxy_authname
  772.  * DESCRIPTION
  773.  *  This function handles CSD call speed parameter received in the OMA settings
  774.  * PARAMETERS
  775.  *  attr_p      [IN]        
  776.  * RETURNS
  777.  *  void
  778.  *****************************************************************************/
  779. void mmi_prov_NE_handle_proxy_authname(ATTRIBUTE *attr_p)
  780. {
  781.     /*----------------------------------------------------------------*/
  782.     /* Local Variables                                                */
  783.     /*----------------------------------------------------------------*/
  784.     U32 len;
  785.     /*----------------------------------------------------------------*/
  786.     /* Code Body                                                      */
  787.     /*----------------------------------------------------------------*/
  788.     if (strcmp(attr_p->name, VALUE) == 0)
  789.     {
  790.         len = UCS2Strlen((S8*) attr_p->value);
  791.         if (len >= PROV_PROFILE_USERNAME_LEN)
  792.         {
  793.             len = PROV_PROFILE_USERNAME_LEN - 1;
  794.         }
  795.         if (GetUCS2Flag((PS8) attr_p->value))
  796.         {
  797.             memset(g_ph_wap_profile_p->username, 0, PROV_PROFILE_USERNAME_LEN);
  798.             memset(g_ph_mms_profile_p->username, 0, PROV_PROFILE_USERNAME_LEN);
  799.         }
  800.         UnicodeNToAnsii((S8*) g_ph_wap_profile_p->username, (S8*) attr_p->value, len * ENCODING_LENGTH);
  801.         g_ph_wap_profile_p->username[len] = '';
  802.         UnicodeNToAnsii((S8*) g_ph_mms_profile_p->username, (S8*) attr_p->value, len * ENCODING_LENGTH);
  803.         g_ph_mms_profile_p->username[len] = '';
  804.     }
  805. }
  806. /*****************************************************************************
  807.  * FUNCTION
  808.  *  mmi_prov_NE_handle_proxy_authsecret
  809.  * DESCRIPTION
  810.  *  This function handles CSD call speed parameter received in the OMA settings
  811.  * PARAMETERS
  812.  *  attr_p      [IN]        
  813.  * RETURNS
  814.  *  void
  815.  *****************************************************************************/
  816. void mmi_prov_NE_handle_proxy_authsecret(ATTRIBUTE *attr_p)
  817. {
  818.     /*----------------------------------------------------------------*/
  819.     /* Local Variables                                                */
  820.     /*----------------------------------------------------------------*/
  821.     U32 len;
  822.     /*----------------------------------------------------------------*/
  823.     /* Code Body                                                      */
  824.     /*----------------------------------------------------------------*/
  825.     if (strcmp(attr_p->name, VALUE) == 0)
  826.     {
  827.         len = UCS2Strlen((S8*) attr_p->value);
  828.         if (len >= PROV_PROFILE_PASSWORD_LEN)
  829.         {
  830.             len = PROV_PROFILE_PASSWORD_LEN - 1;
  831.         }
  832.         if (GetUCS2Flag((PS8) attr_p->value))
  833.         {
  834.             memset(g_ph_wap_profile_p->password, 0, PROV_PROFILE_PASSWORD_LEN);
  835.             memset(g_ph_mms_profile_p->password, 0, PROV_PROFILE_PASSWORD_LEN);
  836.         }
  837.         UnicodeNToAnsii((S8*) g_ph_wap_profile_p->password, (S8*) attr_p->value, len * ENCODING_LENGTH);
  838.         g_ph_wap_profile_p->password[len] = '';
  839.         UnicodeNToAnsii((S8*) g_ph_mms_profile_p->password, (S8*) attr_p->value, len * ENCODING_LENGTH);
  840.         g_ph_mms_profile_p->password[len] = '';
  841.     }
  842. }
  843. /*****************************************************************************
  844.  * FUNCTION
  845.  *  mmi_prov_NE_handle_csd_dialstring
  846.  * DESCRIPTION
  847.  *  This function handles CSD dail string parameter received in the settings
  848.  * PARAMETERS
  849.  *  attr_p      [IN]        
  850.  * RETURNS
  851.  *  void
  852.  *****************************************************************************/
  853. void mmi_prov_NE_handle_csd_dialstring(ATTRIBUTE *attr_p)
  854. {
  855.     /*----------------------------------------------------------------*/
  856.     /* Local Variables                                                */
  857.     /*----------------------------------------------------------------*/
  858.     U32 len;
  859.     /*----------------------------------------------------------------*/
  860.     /* Code Body                                                      */
  861.     /*----------------------------------------------------------------*/
  862.     if (strcmp(attr_p->name, VALUE) == 0)
  863.     {
  864.         len = UCS2Strlen((S8*) attr_p->value);
  865.         if (g_prov_set_csd_req_p != NULL)
  866.         {
  867.             if (len >= PROV_MAX_DIAL_NUM_LEN)
  868.             {
  869.                 len = PROV_MAX_DIAL_NUM_LEN - 1;
  870.             }
  871.             if (mmi_phb_op_check_valid_number((S8*) attr_p->value))
  872.             {
  873.                 UnicodeNToAnsii((S8*) g_prov_set_csd_req_p->dest.number, (S8*) attr_p->value, len * ENCODING_LENGTH);
  874.                 g_prov_set_csd_req_p->dest.number[len] = '';
  875.                 g_prov_set_csd_req_p->dest.type = CSMCC_DEFAULT_ADDR_TYPE;
  876.             }
  877.             else
  878.             {
  879.                 memset(g_prov_set_csd_req_p->dest.number, 0, MAX_DIAL_NUM_LEN);
  880.                 g_prov_set_csd_req_p->dest.type = CSMCC_DEFAULT_ADDR_TYPE;
  881.             }
  882.         }
  883.     }
  884. }
  885. /*****************************************************************************
  886.  * FUNCTION
  887.  *  mmi_prov_NE_handle_gprs_apn
  888.  * DESCRIPTION
  889.  *  This function handles GPRS APN parameter received for the GPRS bearer in the settings
  890.  * PARAMETERS
  891.  *  attr_p      [IN]        
  892.  * RETURNS
  893.  *  void
  894.  *****************************************************************************/
  895. void mmi_prov_NE_handle_gprs_apn(ATTRIBUTE *attr_p)
  896. {
  897.     /*----------------------------------------------------------------*/
  898.     /* Local Variables                                                */
  899.     /*----------------------------------------------------------------*/
  900.     U32 len;
  901.     /*----------------------------------------------------------------*/
  902.     /* Code Body                                                      */
  903.     /*----------------------------------------------------------------*/
  904.     if (strcmp(attr_p->name, VALUE) == 0)
  905.     {
  906.         len = UCS2Strlen((S8*) attr_p->value);
  907.     #ifdef __GPRS_MODE__
  908.         if (g_prov_set_gprs_req_p != NULL)
  909.         {
  910.             if (len >= PROV_MAX_GPRS_MMI_APN_LEN)
  911.             {
  912.                 len = PROV_MAX_GPRS_MMI_APN_LEN - 1;
  913.             }
  914.             g_prov_set_gprs_req_p->gprs_account.apn_length = len;
  915.             UnicodeNToAnsii(
  916.                 (S8*) g_prov_set_gprs_req_p->gprs_account.apn,
  917.                 (S8*) attr_p->value,
  918.                 len * ENCODING_LENGTH);
  919.             g_prov_set_gprs_req_p->gprs_account.apn[len] = '';
  920.         }
  921.     #endif /* __GPRS_MODE__ */ 
  922.     }
  923. }
  924. /*****************************************************************************
  925.  * FUNCTION
  926.  *  mmi_prov_convert_ip_string_to_array
  927.  * DESCRIPTION
  928.  *  This converts an IP string into an array
  929.  * PARAMETERS
  930.  *  parm_element_p      [IN]        
  931.  *  proxy_ip_p          [?]         INOUT
  932.  * RETURNS
  933.  *  U8
  934.  *****************************************************************************/
  935. U8 mmi_prov_convert_ip_string_to_array(S8 *parm_element_p, U8 *proxy_ip_p)
  936. {
  937.     /*----------------------------------------------------------------*/
  938.     /* Local Variables                                                */
  939.     /*----------------------------------------------------------------*/
  940.     S8 proxy[MAX_PART_IP_ADDRESS];
  941.     U32 i, j;
  942.     U32 ip_part;
  943.     /*----------------------------------------------------------------*/
  944.     /* Code Body                                                      */
  945.     /*----------------------------------------------------------------*/
  946.     if (!mmi_brw_check_ip(parm_element_p))
  947.     {
  948.         return PROV_ERR;
  949.     }
  950.     if ((*parm_element_p) < '0' || (*parm_element_p) > '9')
  951.     {
  952.         return PROV_ERR;
  953.     }
  954.     for (j = 0; j < MAX_PART_IP_ADDRESS; ++j)
  955.     {
  956.         for (i = 0; (i < 3) && (strlen(parm_element_p));)
  957.         {
  958.             if (*parm_element_p == '.')
  959.             {
  960.                 break;
  961.             }
  962.             if ((*parm_element_p) >= '0' && (*parm_element_p) <= '9')
  963.             {
  964.                 proxy[i] = *parm_element_p++;
  965.                 i++;
  966.             }
  967.             else
  968.             {
  969.                 return PROV_ERR;
  970.             }
  971.         }
  972.         proxy[i] = '';
  973.         ip_part = (U32) atoi(proxy);
  974.         if (ip_part > PROV_IP_PART_MAX_VALUE)
  975.         {
  976.             ip_part = PROV_IP_PART_MAX_VALUE;
  977.         }
  978.         proxy_ip_p[j] = (U8) ip_part;
  979.         ++parm_element_p;
  980.     }
  981.     return PROV_OK;
  982. }
  983. /* temp function shall be removed once jattayu provides */
  984. /*****************************************************************************
  985.  * FUNCTION
  986.  *  mmi_prov_NE_handle_WSP_headers
  987.  * DESCRIPTION
  988.  *  
  989.  * PARAMETERS
  990.  *  prov_buffer_p       [IN]        
  991.  *  provLength          [?]         
  992.  * RETURNS
  993.  *  void
  994.  *****************************************************************************/
  995. void mmi_prov_NE_handle_WSP_headers(U8 **prov_buffer_p, U32 *provLength)
  996. {
  997.     /*----------------------------------------------------------------*/
  998.     /* Local Variables                                                */
  999.     /*----------------------------------------------------------------*/
  1000.     U8 buffLen;
  1001.     U8 *tempBuffer = NULL;
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Code Body                                                      */
  1004.     /*----------------------------------------------------------------*/
  1005.     tempBuffer = *prov_buffer_p;
  1006.     if (tempBuffer[1] == WSP_PUSH_HEADER)
  1007.     {
  1008.         buffLen = tempBuffer[2];
  1009.         tempBuffer += 3;
  1010.         *provLength -= 3;
  1011.         tempBuffer += buffLen;
  1012.         *provLength -= buffLen;
  1013.         memcpy(*prov_buffer_p, tempBuffer, (*provLength));
  1014.     }
  1015. }
  1016. #endif /* defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT))) */ 
  1017. #endif /* _JPROVNE_C */