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

📄 wap_udpp.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
+-----------------------------------------------------------------------------
|  File     : wap_udpp.c
+-----------------------------------------------------------------------------
|                 Copyright Condat AG 1999-2000, Berlin
|                 All rights reserved.
|
|                 This file is confidential and a trade secret of Condat AG
|                 The receipt of or possession of this file does not convey
|                 any rights to reproduce or disclose its contents or to
|                 manufacture, use, or sell anything it may describe, in
|                 whole, or in part, without the specific written consent of
|                 Condat AG.
+-----------------------------------------------------------------------------
|  Purpose  : This Modul defines the functions for processing
|             of incomming primitives for the component AUS WAP Browser
|             of the mobile station
|  History   : 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version.
+-----------------------------------------------------------------------------
*/

#ifndef WAP_UDPP_C
#define WAP_UDPP_C
#endif


#define ENTITY_WAP

/*==== INCLUDES ===================================================*/
#if defined (NEW_FRAME)

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include "typedefs.h"
#include "pcm.h"
#include "pconst.cdg"
#include "mconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "cnf_wap.h"
#include "mon_wap.h"
#include "pei.h"
#include "tok.h"
#include "dti.h"      /* functionality of the dti library */

#else

#include <string.h>
#include "stddefs.h"
#include "pconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "custom.h"
#include "gsm.h"
#include "cnf_wap.h"
#include "mon_wap.h"
#include "prim.h"
#include "vsi.h"
#include "pei.h"
#include "tok.h"

#endif

#include "wap.h"
#include "cus_wap.h"
#include "wap_types.h"

#include "capiclnt.h"
#include "aapiudp.h"
#include "capiudp.h"

/*
 * AUS wip malloc
 */



EXTERN VOID* wip_malloc(UINT32 size);
EXTERN VOID wip_free(VOID *mem);



/****                     ***/

/*==== CONST =======================================================*/

/*==== TYPES =======================================================*/

/*==== VAR EXPORT ==================================================*/

/*==== VAR LOCAL ===================================================*/



/*==== FUNCTIONS ===================================================*/


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_UDPP            |
| STATE   : code                       ROUTINE : udp_bind_cnf        |
+--------------------------------------------------------------------+

  PURPOSE : Process primitive UDP_BIND_CNF received from UDP
*/

GLOBAL const void udp_bind_cnf(
                               T_UDP_BIND_CNF *udp_bind_cnf
                              )
{
  int i;
#ifdef TRACE_WAP_UDP
  TRACE_EVENT("udp_bind_cnf()");
#endif

  PACCESS(udp_bind_cnf);

  if ((i = wap_data->last_bind_req) != -1)
  {
     /*wap_data->last_bind_req = -1;  we need last_bind_req this in case of flow==false */
    switch(udp_bind_cnf->err)
    {
      case UDP_BIND_NOERROR:
        wap_data->ports[i].state = WAP_PORT_BOUND;
        wap_data->ports[i].port = udp_bind_cnf->port;
        break;
      case UDP_BIND_PORTINUSE:
      case UDP_BIND_UDPDOWN:
        wap_data->ports[i].state = WAP_PORT_IDLE;
        wap_data->ports[i].port = 0;
        break;
    }
    PFREE(udp_bind_cnf);
  /*
     *  check flow controll
     */
    if (!(wap_data->flow)) {
      wap_data->connection_done=TRUE;
      udp_send_ready();
    }
    else
    {
    wap_data->last_bind_req=-1;
      wap_lib_bind_callback(wap_data->ports[i].id,wap_data->ports[i].channel, wap_data->ports[i].port,
                         udp_bind_cnf->err);
    }
  }
  else
  {
    TRACE_EVENT("unexpected udp_bind_cnf received")
    PFREE(udp_bind_cnf);
  }
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_UDPP            |
| STATE   : code                       ROUTINE : udp_closeport_cnf   |
+--------------------------------------------------------------------+

  PURPOSE : Process primitive UDP_CLOSEPORT_CNF received from UDP
*/

GLOBAL const void  udp_closeport_cnf (
                                       T_UDP_CLOSEPORT_CNF  *udp_closeport_cnf
                                     )
{
  int i;
  UBYTE objectId;
#ifdef TRACE_WAP_UDP
  TRACE_EVENT ("udp_closeport_cnf()");
#endif

  PACCESS (udp_closeport_cnf);

  for (i = 0; i < WAP_MAX_PORTS; i++) {
    if (wap_data->ports[i].state &&
      wap_data->ports[i].state == WAP_PORT_WAIT_CLOSE_CNF)
    {
      wap_data->ports[i].state = WAP_PORT_IDLE;
      wap_data->ports[i].port = 0;
      objectId = wap_data->ports[i].id;
      break;
    }
  }
  wap_lib_closeport_callback(objectId,wap_data->ports[i].channel);
  PFREE (udp_closeport_cnf);
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_UDPP            |
| STATE   : code                       ROUTINE : udp_error_ind       |
+--------------------------------------------------------------------+

  PURPOSE : Process primitive UDP_ERROR_IND received from UDP
*/

GLOBAL const void udp_error_ind (
                                 T_UDP_ERROR_IND *udp_error_ind
                                )
{
#ifdef TRACE_WAP_UDP
  TRACE_EVENT ("udp_error_ind()");
#endif

  PACCESS (udp_error_ind);



  UDPc_errorRequest(udp_error_ind->err_msg, udp_error_ind->dst_port);
  PFREE (udp_error_ind);

  {
    PALLOC(udp_error_res, UDP_ERROR_RES);
    PSENDX(UDP, udp_error_res);
  }
  wap_lib_run_aus_callback();
}



/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_UDPP            |
| STATE   : code                       ROUTINE : udp_shutdown_ind    |
+--------------------------------------------------------------------+

  PURPOSE : Process primitive UDP_SHUTDOWN_IND received from UDP
*/

GLOBAL const void udp_shutdown_ind (
                                     T_UDP_SHUTDOWN_IND   *udp_shutdown_ind
                                   )
{
  int i;
#ifdef TRACE_WAP_UDP
  TRACE_EVENT ("udp_shutdown_ind()");
#endif

  PACCESS (udp_shutdown_ind);

  for (i = 0; i < WAP_MAX_PORTS; i++)
  {
    switch (wap_data->ports[i].state)
    {
      case WAP_PORT_IDLE:
      case WAP_PORT_WAIT_CLOSE_CNF:
        break;
      case WAP_PORT_WAIT_BIND_CNF:
        wap_lib_bind_callback(wap_data->ports[i].id, wap_data->ports[i].channel, 0, UDP_BIND_UDPDOWN);
        break;
      case WAP_PORT_BOUND:

		{
			void W_WAP_MMI_DISCONNECTED_IND (T_WAP_MMI_DISCONNECTED_IND *); /* care about this */

			T_WAP_MMI_DISCONNECTED_IND parameter;

		#ifdef TRACE_WAP_UDP
			  TRACE_EVENT ("CLNTc_closeConnection()");

				{
					char temp[50];
					sprintf(temp,"wap_data->ports[i].id %d", wap_data->ports[i].id);
					TRACE_EVENT(temp);
				}
		#endif

				/* SPR#2138 - SH */
				CLNTc_setDCHIntConfig (wap_data->ports[i].id, wap_data->ports[i].channel, configONLINE,FALSE);

				CLNTc_closeConnection (wap_data->ports[i].id, wap_data->ports[i].channel, FALSE);

				parameter.object_id = wap_data->ports[i].id;
				parameter.channel = wap_data->ports[i].channel;

				W_WAP_MMI_DISCONNECTED_IND(&parameter);
				wap_lib_run_aus_callback();	
		}
       break;
    }
    wap_data->ports[i].state = WAP_PORT_IDLE;
    wap_data->ports[i].port = 0;
  } /* for */
  wap_data->last_bind_req = -1;

  PFREE (udp_shutdown_ind);


  {
    PALLOC(udp_shutdown_res, UDP_SHUTDOWN_RES);
    PSENDX(UDP, udp_shutdown_res);
  }
}

/*
 * signals from dtilib callback function.
 * these signals are to be seen as primitives
 * wrapped by dtilib and therefore are located
 * here
 */

/*

⌨️ 快捷键说明

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