wsp_push_client_states.def
上传用户:gzpyjq
上传日期:2013-01-31
资源大小:1852k
文件大小:3k
源码类别:

手机WAP编程

开发平台:

WINDOWS

  1. /*
  2.  * wsp_push_client_states.def: Macros defining wsp push client state table 
  3.  * rows.
  4.  * See documentation for guidance how to use and update these.
  5.  * 1 means an unconditional action, {} an ignored event.
  6.  *
  7.  * By Aarno Syv鋘en for Wapit Ltd.
  8.  */
  9. PUSH_CLIENT_STATE_NAME(PUSH_CLIENT_NULL_STATE)
  10. PUSH_CLIENT_STATE_NAME(PUSH_CLIENT_RECEIVING)
  11. ROW(PUSH_CLIENT_NULL_STATE,
  12.     TR_Invoke_Ind,
  13.     e->u.TR_Invoke_Ind.tcl == 1 && pdu->type == ConfirmedPush,
  14.     {
  15.      Octstr *push_body;
  16.      List *push_headers;
  17.      if (pdu->u.ConfirmedPush.headers_len > 0) 
  18.  push_headers = wsp_headers_unpack(pdu->u.ConfirmedPush.headers, 0);
  19.      else  
  20.  push_headers = NULL;    
  21.      http_remove_hop_headers(push_headers);
  22.      http_header_pack(push_headers);
  23.      gw_assert(push_headers);
  24.      cpm->push_headers = http_header_duplicate(push_headers);
  25.      push_body = octstr_duplicate(pdu->u.ConfirmedPush.data);
  26.      http_destroy_headers(push_headers);
  27. /*
  28.  * For debugging: just tell about the push OTA event, and destroy it here - 
  29.  * handle_event does not do it.
  30.  */
  31.      indicate_confirmedpush(cpm, push_body);
  32.      octstr_destroy(push_body);
  33. /*
  34.  * For debugging: create S_ConfirmedPush_Res by ourselves and send it to 
  35.  * ourselves.
  36.  */
  37.     response_confirmedpush(cpm);
  38.     },
  39.     PUSH_CLIENT_RECEIVING)
  40. ROW(PUSH_CLIENT_RECEIVING,
  41.     S_ConfirmedPush_Res,
  42.     1,
  43.     {
  44.      response_responder_invoke(cpm);
  45.     },
  46.     PUSH_CLIENT_NULL_STATE)
  47. ROW(PUSH_CLIENT_RECEIVING,
  48.     S_PushAbort_Req,
  49.     1,
  50.     {
  51.      send_abort_to_responder(cpm, e->u.S_PushAbort_Req.reason);
  52.      indicate_pushabort(cpm, e->u.S_PushAbort_Req.reason);
  53.     },
  54.     PUSH_CLIENT_NULL_STATE)
  55. ROW(PUSH_CLIENT_RECEIVING,
  56.     Abort_Event,
  57.     1,
  58.     {
  59.      send_abort_to_responder(cpm, e->u.S_PushAbort_Req.reason);
  60.      indicate_pushabort(cpm, WSP_ABORT_USERREQ);
  61.     },
  62.     PUSH_CLIENT_NULL_STATE)
  63. ROW(PUSH_CLIENT_RECEIVING,
  64.     TR_Abort_Ind,
  65.     e->u.TR_Abort_Ind.abort_code == WSP_ABORT_DISCONNECT,
  66.     {
  67.      WAPEvent *wsp_event;
  68.      wsp_event = wap_event_create(Disconnect_Event);
  69.      wsp_event->u.Disconnect_Event.session_handle = cpm->client_push_id;
  70.      list_append(push_client_queue, wsp_event);
  71.     },
  72.     PUSH_CLIENT_NULL_STATE)
  73. ROW(PUSH_CLIENT_RECEIVING,
  74.     TR_Abort_Ind,
  75.     e->u.TR_Abort_Ind.abort_code == WSP_ABORT_SUSPEND,
  76.     {
  77.      WAPEvent *wsp_event;
  78.      wsp_event = wap_event_create(Suspend_Event);
  79.      wsp_event->u.Suspend_Event.session_handle = cpm->client_push_id;
  80.      list_append(push_client_queue, wsp_event);
  81.     },
  82.     PUSH_CLIENT_NULL_STATE)
  83. ROW(PUSH_CLIENT_RECEIVING,
  84.     TR_Abort_Ind,
  85.     e->u.TR_Abort_Ind.abort_code != WSP_ABORT_DISCONNECT &&
  86.     e->u.TR_Abort_Ind.abort_code != WSP_ABORT_SUSPEND,
  87.     {
  88.      indicate_pushabort(cpm, e->u.S_PushAbort_Req.reason);
  89.     },
  90.     PUSH_CLIENT_NULL_STATE)
  91. #undef PUSH_CLIENT_STATE_NAME
  92. #undef ROW