⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jnw_http.c

📁 java 1.1 gemini 08_16
💻 C
📖 第 1 页 / 共 5 页
字号:
    /*----------------------------------------------------------------*/
    if (channelType == J2ME_HTTP_WPS_CHANNEL_HTTP)
    {
        if (j2me_http_current_req_id == 200)
        {
            j2me_http_current_req_id = 2;
        }
        else
        {
            j2me_http_current_req_id = j2me_http_current_req_id + 2;
        }

        CurrReqId = (int)j2me_http_current_req_id;
    }
    else
    {   /* channelType == J2ME_HTTP_WPS_CHANNEL_HTTPS */
        if (j2me_https_current_req_id == 199)
        {
            j2me_https_current_req_id = 1;
        }
        else
        {
            j2me_https_current_req_id = j2me_https_current_req_id + 2;
        }
        CurrReqId = (int)j2me_https_current_req_id;
    }

    return CurrReqId;
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_get_status
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
int jnw_http_get_status()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int status = (int)j2me_http_wps_native_data.status;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return status;
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_check_more
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jnw_http_check_more()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    kal_bool more = j2me_http_wps_native_data.more_data;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return more;
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_get_reply_header_length
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
int jnw_http_get_reply_header_length()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int headerLength = (int)j2me_http_wps_native_data.reply_header_len;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return headerLength;
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_get_reply_header
 * DESCRIPTION
 *  
 * PARAMETERS
 *  header      [?]     
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jnw_http_get_reply_header(char *header)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    char *reply_header = header;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (j2me_http_wps_native_data.reply_header)
    {

        memcpy(reply_header, j2me_http_wps_native_data.reply_header, j2me_http_wps_native_data.reply_header_len);

        jvm_free(j2me_http_wps_native_data.reply_header);
        j2me_http_wps_native_data.reply_header = NULL;

        return KAL_TRUE;
    }
    else
    {
        return KAL_FALSE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_get_reply_segment_length
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
int jnw_http_get_reply_segment_length()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int segLength = (int)j2me_http_wps_native_data.reply_segment_len;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return segLength;
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_get_reply_segment
 * DESCRIPTION
 *  
 * PARAMETERS
 *  seg     [?]     
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jnw_http_get_reply_segment(char *seg)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    char *reply_segment = seg;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (j2me_http_wps_native_data.reply_segment)
    {

        memcpy(reply_segment, j2me_http_wps_native_data.reply_segment, j2me_http_wps_native_data.reply_segment_len);

        jvm_free(j2me_http_wps_native_data.reply_segment);
        j2me_http_wps_native_data.reply_segment = NULL;

        return KAL_TRUE;
    }
    else
    {
        return KAL_FALSE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_open_connection_by_WAP_default_setting
 * DESCRIPTION
 *  
 * PARAMETERS
 *  channelType     [IN]        
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jnw_http_open_connection_by_wap_default_setting(int channelType)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int channel_type = channelType;
    wps_set_channel_req_struct *set_channel_req;
    kal_int8 ap_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    auto_return_for_auth = KAL_TRUE;
    
    if (channel_type == J2ME_HTTP_WPS_CHANNEL_HTTP)
    {
        if (j2me_http_channel_id >= 0)
        {
            jui_widget_show_connect_icon();
            j2me_http_ref_count++;
            kal_trace(TRACE_GROUP_3, FUNC_J2ME_HTTP_HTTPSETCHANNEL_1, j2me_http_channel_id, j2me_http_ref_count);
            return KAL_FALSE;
        }
    }
    else
    {   /* channel_type == J2ME_HTTP_WPS_CHANNEL_HTTPS */
        if (j2me_https_channel_id >= 0)
        {
            jui_widget_show_connect_icon();
            j2me_https_ref_count++;
            kal_trace(TRACE_GROUP_3, FUNC_J2ME_HTTP_HTTPSETCHANNEL_2, j2me_https_channel_id, j2me_https_ref_count);
            return KAL_FALSE;
        }
    }

    /* Update wap profile ID */
    j2me_http_get_wap_bra_profile();

    ap_id = jam_get_app_id();
    set_channel_req = (wps_set_channel_req_struct*) construct_local_para(sizeof(wps_set_channel_req_struct), TD_CTRL);

    set_channel_req->use_default = KAL_TRUE;
    set_channel_req->username[0] = 0;
    set_channel_req->password[0] = 0;
    set_channel_req->server_auth_password[0] = 0;
    set_channel_req->server_auth_username[0] = 0;
    set_channel_req->app_id = ap_id;
    
#ifdef __GEMINI__
    set_channel_req->net_id = 0;
    if (wap_bra_prof.sim_id == WAP_SIM_ID_SIM2)
    {
        set_channel_req->net_id = 
            cbm_encode_data_account_id(set_channel_req->net_id,
                                   ALWAYS_ASK_SIM_INFO_SIM2, 
                                   ap_id, 0);
    }
    else
    {
        set_channel_req->net_id =
        cbm_encode_data_account_id(set_channel_req->net_id,
                                   ALWAYS_ASK_SIM_INFO_SIM1, 
                                   ap_id, KAL_FALSE);
    }
#else  /* __GEMINI__ */
    set_channel_req->net_id = 0;
    set_channel_req->net_id = 
        cbm_encode_data_account_id(set_channel_req->net_id,
                               ALWAYS_ASK_SIM_INFO_DEFAULT, 
                               ap_id, KAL_FALSE);
#endif /* !__GEMINI__ */

    if (channel_type == J2ME_HTTP_WPS_CHANNEL_HTTP)
    {
        j2me_http_channel_set_pending = KAL_TRUE;
    }

    J2ME_http_send_ilm(set_channel_req, NULL, MSG_ID_WPS_SET_CHANNEL_REQ, MOD_WPS);

    return KAL_TRUE;

}


/*****************************************************************************
 * FUNCTION
 *  jnw_http_open_connection
 * DESCRIPTION
 *  
 * PARAMETERS
 *  channelType     [IN]        
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jnw_http_open_connection(int channelType)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int channel_type = channelType;
    wps_set_channel_req_struct *set_channel_req;
    int i = 0;
    kal_int8 ap_id = 0;
#ifdef __GEMINI__
    kal_uint8 sim_id = 0;
#endif

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    auto_return_for_auth = KAL_TRUE;
    if (channel_type == J2ME_HTTP_WPS_CHANNEL_HTTP)
    {
        if (j2me_http_channel_id >= 0)
        {
            jui_widget_show_connect_icon();
            j2me_http_ref_count++;
            kal_trace(TRACE_GROUP_3, FUNC_J2ME_HTTP_HTTPSETCHANNEL_1, j2me_http_channel_id, j2me_http_ref_count);
            return KAL_FALSE;
        }
    }
    else
    {   /* channel_type == J2ME_HTTP_WPS_CHANNEL_HTTPS */
        if (j2me_https_channel_id >= 0)
        {
            jui_widget_show_connect_icon();
            j2me_https_ref_count++;
            kal_trace(TRACE_GROUP_3, FUNC_J2ME_HTTP_HTTPSETCHANNEL_2, j2me_https_channel_id, j2me_https_ref_count);
            return KAL_FALSE;
        }
    }
    
    ap_id = jam_get_app_id();
#ifdef __GEMINI__
    sim_id = jam_get_sim_id();
#endif
    set_channel_req = (wps_set_channel_req_struct*) construct_local_para(sizeof(wps_set_channel_req_struct), TD_CTRL);

    set_channel_req->username[0] = 0;
    set_channel_req->password[0] = 0;
    set_channel_req->server_auth_password[0] = 0;
    set_channel_req->server_auth_username[0] = 0;
    set_channel_req->app_id = ap_id;
    
    if (jam_get_wap_prof_id() == 0xFF)
    {
        set_channel_req->net_id = 0;
        set_channel_req->use_default = KAL_TRUE;
    }
    else
    {
        set_channel_req->use_default = KAL_FALSE;

        if (wap_prof.conn_type == WAP_PROF_CONN_TYPE_HTTP)
        {
            set_channel_req->conn_type = WPS_CONN_TYPE_HTTP;
        }
        else if (wap_prof.conn_type == WAP_PROF_CONN_TYPE_WSP_CO)
        {
            set_channel_req->conn_type = WPS_CONN_TYPE_WSP_CO;
        }
        else if (wap_prof.conn_type == WAP_PROF_CONN_TYPE_WSP_CL)
        {
            set_channel_req->conn_type = WPS_CONN_TYPE_WSP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -