00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 STATE_NAME(NULL_SESSION)
00070 STATE_NAME(CONNECTING)
00071 STATE_NAME(TERMINATING)
00072 STATE_NAME(CONNECTING_2)
00073 STATE_NAME(CONNECTED)
00074 STATE_NAME(SUSPENDED)
00075 STATE_NAME(RESUMING)
00076 STATE_NAME(RESUMING_2)
00077
00078 ROW(NULL_SESSION,
00079 TR_Invoke_Ind,
00080 e->tcl == 2 && pdu->type == Connect,
00081 {
00082 WAPEvent *new_event;
00083 WAPEvent *wtp_event;
00084
00085
00086 wtp_event = wap_event_create(TR_Invoke_Res);
00087 wtp_event->u.TR_Invoke_Res.handle = e->handle;
00088 dispatch_to_wtp_resp(wtp_event);
00089
00090
00091
00092
00093
00094 sm->session_id = next_wsp_session_id();
00095
00096 if (pdu->u.Connect.capabilities_len > 0) {
00097 unsigned long sdu;
00098 sm->request_caps = wsp_cap_unpack_list(
00099 pdu->u.Connect.capabilities);
00100 if (wsp_cap_get_client_sdu(sm->request_caps,&sdu)) {
00101 sm->client_SDU_size = sdu;
00102 }
00103 } else {
00104 sm->request_caps = gwlist_create();
00105 }
00106
00107 if (pdu->u.Connect.headers_len > 0) {
00108 List *hdrs;
00109 Octstr *encoding;
00110
00111 hdrs = wsp_headers_unpack(pdu->u.Connect.headers, 0);
00112 http_header_pack(hdrs);
00113 gw_assert(sm->http_headers == NULL);
00114 sm->http_headers = hdrs;
00115
00116
00117
00118
00119
00120 encoding = http_header_value(sm->http_headers, octstr_imm("Encoding-Version"));
00121 if (encoding != NULL) {
00122 debug("wsp",0,"WSP: Session machine: Encoding-Version: %s",
00123 octstr_get_cstr(encoding));
00124 sm->encoding_version = wsp_encoding_string_to_version(encoding);
00125 } else {
00126
00127
00128
00129
00130 sm->encoding_version = WSP_1_2;
00131 }
00132 octstr_destroy(encoding);
00133 }
00134
00135
00136 new_event = wap_event_create(S_Connect_Ind);
00137 new_event->u.S_Connect_Ind.addr_tuple =
00138 wap_addr_tuple_duplicate(e->addr_tuple);
00139 new_event->u.S_Connect_Ind.client_headers =
00140 http_header_duplicate(sm->http_headers);
00141 new_event->u.S_Connect_Ind.requested_capabilities =
00142 wsp_cap_duplicate_list(sm->request_caps);
00143 new_event->u.S_Connect_Ind.session_id = sm->session_id;
00144 dispatch_to_appl(new_event);
00145 },
00146 CONNECTING)
00147
00148
00149 ROW(CONNECTING,
00150 S_Connect_Res,
00151 1,
00152 {
00153 WAPEvent *wtp_event;
00154 Octstr *ospdu;
00155
00156 sm->reply_caps = wsp_cap_duplicate_list(
00157 e->negotiated_capabilities);
00158
00159
00160 disconnect_other_sessions(sm);
00161
00162
00163
00164
00165
00166 ospdu = make_connectreply_pdu(sm);
00167
00168 wtp_event = wap_event_create(TR_Result_Req);
00169 wtp_event->u.TR_Result_Req.user_data = ospdu;
00170 wtp_event->u.TR_Result_Req.handle = sm->connect_handle;
00171 dispatch_to_wtp_resp(wtp_event);
00172
00173
00174 release_holding_methods(sm);
00175 },
00176 CONNECTING_2)
00177
00178
00179
00180
00181
00182
00183 ROW(CONNECTING,
00184 Disconnect_Event,
00185 1,
00186 {
00187
00188 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00189
00190
00191 abort_methods(sm, WSP_ABORT_DISCONNECT);
00192
00193
00194 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00195 },
00196 NULL_SESSION)
00197
00198 ROW(CONNECTING,
00199 Suspend_Event,
00200 1,
00201 {
00202
00203 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00204
00205
00206 abort_methods(sm, WSP_ABORT_DISCONNECT);
00207
00208
00209 indicate_disconnect(sm, WSP_ABORT_SUSPEND);
00210 },
00211 NULL_SESSION)
00212
00213 ROW(CONNECTING,
00214 TR_Invoke_Ind,
00215 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
00216 {
00217 WSPMethodMachine *msm;
00218
00219
00220 msm = method_machine_create(sm, e->handle);
00221
00222
00223 handle_method_event(sm, msm, current_event, pdu);
00224 },
00225 CONNECTING)
00226
00227 ROW(CONNECTING,
00228 TR_Invoke_Ind,
00229 e->tcl == 2 && pdu->type == Resume,
00230 {
00231
00232 send_abort(WSP_ABORT_DISCONNECT, e->handle);
00233 },
00234 CONNECTING)
00235
00236 ROW(CONNECTING,
00237 TR_Abort_Ind,
00238 e->handle == sm->connect_handle,
00239 {
00240
00241 abort_methods(sm, WSP_ABORT_DISCONNECT);
00242
00243
00244 indicate_disconnect(sm, e->abort_code);
00245 },
00246 NULL_SESSION)
00247
00248 ROW(CONNECTING,
00249 TR_Abort_Ind,
00250 e->handle != sm->connect_handle,
00251 {
00252 WSPMethodMachine *msm;
00253
00254
00255 msm = find_method_machine(sm, e->handle);
00256 handle_method_event(sm, msm, current_event, pdu);
00257 },
00258 CONNECTING)
00259
00260 ROW(TERMINATING,
00261 Disconnect_Event,
00262 1,
00263 {
00264
00265 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00266 },
00267 NULL_SESSION)
00268
00269 ROW(TERMINATING,
00270 Suspend_Event,
00271 1,
00272 {
00273
00274 send_abort(WSP_ABORT_SUSPEND, sm->connect_handle);
00275 },
00276 NULL_SESSION)
00277
00278 ROW(TERMINATING,
00279 TR_Result_Cnf,
00280 1,
00281 {
00282
00283 },
00284 NULL_SESSION)
00285
00286 ROW(TERMINATING,
00287 TR_Abort_Ind,
00288 1,
00289 {
00290
00291 },
00292 NULL_SESSION)
00293
00294
00295
00296 ROW(CONNECTING_2,
00297 Disconnect_Event,
00298 1,
00299 {
00300
00301 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00302
00303
00304 abort_methods(sm, WSP_ABORT_DISCONNECT);
00305
00306
00307 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00308 },
00309 NULL_SESSION)
00310
00311 ROW(CONNECTING_2,
00312 S_MethodInvoke_Res,
00313 1,
00314 {
00315 WSPMethodMachine *msm;
00316
00317
00318 msm = find_method_machine(sm, e->server_transaction_id);
00319 handle_method_event(sm, msm, current_event, pdu);
00320 },
00321 CONNECTING_2)
00322
00323 ROW(CONNECTING_2,
00324 S_MethodResult_Req,
00325 1,
00326 {
00327 WSPMethodMachine *msm;
00328
00329
00330 msm = find_method_machine(sm, e->server_transaction_id);
00331 handle_method_event(sm, msm, current_event, pdu);
00332 },
00333 CONNECTING_2)
00334
00335 ROW(CONNECTING_2,
00336 S_Push_Req,
00337 1,
00338 {
00339 WSP_PDU *pdu;
00340
00341 pdu = make_push_pdu(current_event);
00342 send_invoke(sm, pdu, current_event, TRANSACTION_CLASS_0);
00343 },
00344 CONNECTING_2)
00345
00346 ROW(CONNECTING_2,
00347 S_ConfirmedPush_Req,
00348 1,
00349 {
00350
00351 WSPPushMachine *spm;
00352
00353 spm = push_machine_create(sm, e->server_push_id);
00354 handle_push_event(sm, spm, current_event);
00355 },
00356 CONNECTING_2)
00357
00358 ROW(CONNECTING_2,
00359 Suspend_Event,
00360 !resume_enabled,
00361 {
00362
00363
00364
00365 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00366
00367
00368 abort_methods(sm, WSP_ABORT_DISCONNECT);
00369
00370
00371 indicate_disconnect(sm, WSP_ABORT_SUSPEND);
00372 },
00373 NULL_SESSION)
00374
00375 ROW(CONNECTING_2,
00376 Suspend_Event,
00377 resume_enabled,
00378 {
00379
00380
00381
00382 send_abort(WSP_ABORT_SUSPEND, sm->connect_handle);
00383
00384
00385 abort_methods(sm, WSP_ABORT_SUSPEND);
00386
00387
00388 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00389 },
00390 SUSPENDED)
00391
00392 ROW(CONNECTING_2,
00393 TR_Invoke_Ind,
00394 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
00395 {
00396 WSPMethodMachine *msm;
00397 WAPEvent *new_event;
00398
00399
00400 msm = method_machine_create(sm, e->handle);
00401
00402
00403 handle_method_event(sm, msm, current_event, pdu);
00404
00405
00406 new_event = wap_event_create(Release_Event);
00407 handle_method_event(sm, msm, new_event, NULL);
00408 wap_event_destroy(new_event);
00409 },
00410 CONNECTING_2)
00411
00412 ROW(CONNECTING_2,
00413 TR_Invoke_Ind,
00414 e->tcl == 2 && pdu->type == Resume && !resume_enabled,
00415 {
00416
00417
00418
00419 send_abort(WSP_ABORT_DISCONNECT, e->handle);
00420 },
00421 CONNECTING_2)
00422
00423 ROW(CONNECTING_2,
00424 TR_Invoke_Ind,
00425 e->tcl == 2 && pdu->type == Resume && resume_enabled,
00426 {
00427
00428
00429 WAPEvent *wtp_event;
00430 List *new_headers;
00431
00432
00433 wtp_event = wap_event_create(TR_Invoke_Res);
00434 wtp_event->u.TR_Invoke_Res.handle = e->handle;
00435 dispatch_to_wtp_resp(wtp_event);
00436
00437
00438 send_abort(WSP_ABORT_RESUME, sm->connect_handle);
00439
00440
00441 abort_methods(sm, WSP_ABORT_RESUME);
00442
00443
00444 indicate_suspend(sm, WSP_ABORT_RESUME);
00445
00446
00447 new_headers = unpack_new_headers(sm, pdu->u.Resume.headers);
00448 indicate_resume(sm, e->addr_tuple, new_headers);
00449 http_destroy_headers(new_headers);
00450
00451 sm->resume_handle = e->handle;
00452 },
00453 RESUMING)
00454
00455 ROW(CONNECTING_2,
00456 TR_Invoke_Ind,
00457 e->tcl == 0 && pdu->type == Disconnect,
00458 {
00459
00460 send_abort(WSP_ABORT_DISCONNECT, sm->connect_handle);
00461
00462
00463 abort_methods(sm, WSP_ABORT_DISCONNECT);
00464
00465
00466 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00467 },
00468 NULL_SESSION)
00469
00470 ROW(CONNECTING_2,
00471 TR_Invoke_Ind,
00472 e->tcl == 0 && pdu->type == Suspend && resume_enabled,
00473 {
00474
00475
00476
00477 send_abort(WSP_ABORT_SUSPEND, sm->connect_handle);
00478
00479
00480 abort_methods(sm, WSP_ABORT_SUSPEND);
00481
00482
00483 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00484 },
00485 SUSPENDED)
00486
00487 ROW(CONNECTING_2,
00488 TR_Invoke_Cnf,
00489 1,
00490 {
00491
00492 WSPPushMachine *spm;
00493
00494 spm = find_push_machine(sm, e->handle);
00495 handle_push_event(sm, spm, current_event);
00496 },
00497 CONNECTING_2)
00498
00499 ROW(CONNECTING_2,
00500 TR_Result_Cnf,
00501 e->handle == sm->connect_handle,
00502 {
00503 },
00504 CONNECTED)
00505
00506 ROW(CONNECTING_2,
00507 TR_Result_Cnf,
00508 e->handle != sm->connect_handle,
00509 {
00510 WSPMethodMachine *msm;
00511
00512
00513 msm = find_method_machine(sm, e->handle);
00514 handle_method_event(sm, msm, current_event, pdu);
00515 },
00516 CONNECTING_2)
00517
00518 ROW(CONNECTING_2,
00519 TR_Abort_Ind,
00520 e->handle == sm->connect_handle,
00521 {
00522
00523 abort_methods(sm, WSP_ABORT_DISCONNECT);
00524
00525
00526 indicate_disconnect(sm, e->abort_code);
00527 },
00528 NULL_SESSION)
00529
00530
00531
00532
00533
00534 ROW(CONNECTING_2,
00535 TR_Abort_Ind,
00536 e->handle != sm->connect_handle && e->ir_flag == RESPONDER_INDICATION,
00537 {
00538 WSPMethodMachine *msm;
00539
00540
00541 msm = find_method_machine(sm, e->handle);
00542 handle_method_event(sm, msm, current_event, pdu);
00543 },
00544 CONNECTING_2)
00545
00546 ROW(CONNECTING_2,
00547 TR_Abort_Ind,
00548 e->handle != sm->connect_handle && e->ir_flag == INITIATOR_INDICATION,
00549 {
00550 WSPPushMachine *m;
00551
00552
00553 m = find_push_machine(sm, e->handle);
00554 handle_push_event(sm, m, current_event);
00555 },
00556 CONNECTING_2)
00557
00558
00559
00560 ROW(CONNECTED,
00561 Disconnect_Event,
00562 1,
00563 {
00564
00565 abort_methods(sm, WSP_ABORT_DISCONNECT);
00566
00567
00568 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00569 },
00570 NULL_SESSION)
00571
00572 ROW(CONNECTED,
00573 S_MethodInvoke_Res,
00574 1,
00575 {
00576 WSPMethodMachine *msm;
00577
00578
00579 msm = find_method_machine(sm, e->server_transaction_id);
00580 handle_method_event(sm, msm, current_event, pdu);
00581 },
00582 CONNECTED)
00583
00584 ROW(CONNECTED,
00585 S_MethodResult_Req,
00586 1,
00587 {
00588 WSPMethodMachine *msm;
00589
00590
00591 msm = find_method_machine(sm, e->server_transaction_id);
00592 handle_method_event(sm, msm, current_event, pdu);
00593 },
00594 CONNECTED)
00595
00596 ROW(CONNECTED,
00597 S_Push_Req,
00598 1,
00599 {
00600 WSP_PDU *pdu;
00601
00602 pdu = make_push_pdu(current_event);
00603 send_invoke(sm, pdu, current_event, TRANSACTION_CLASS_0);
00604 },
00605 CONNECTED)
00606
00607 ROW(CONNECTED,
00608 S_ConfirmedPush_Req,
00609 1,
00610 {
00611
00612 WSPPushMachine *spm;
00613
00614 spm = push_machine_create(sm, e->server_push_id);
00615 handle_push_event(sm, spm, current_event);
00616 },
00617 CONNECTED)
00618
00619 ROW(CONNECTED,
00620 Suspend_Event,
00621 !resume_enabled,
00622 {
00623
00624
00625
00626 abort_methods(sm, WSP_ABORT_SUSPEND);
00627
00628
00629 indicate_disconnect(sm, WSP_ABORT_SUSPEND);
00630 },
00631 NULL_SESSION)
00632
00633 ROW(CONNECTED,
00634 Suspend_Event,
00635 resume_enabled,
00636 {
00637
00638
00639
00640 abort_methods(sm, WSP_ABORT_SUSPEND);
00641
00642
00643 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00644 },
00645 SUSPENDED)
00646
00647 ROW(CONNECTED,
00648 TR_Invoke_Ind,
00649 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
00650 {
00651 WSPMethodMachine *msm;
00652 WAPEvent *new_event;
00653
00654
00655 msm = method_machine_create(sm, e->handle);
00656
00657
00658 handle_method_event(sm, msm, current_event, pdu);
00659
00660
00661 new_event = wap_event_create(Release_Event);
00662 handle_method_event(sm, msm, new_event, NULL);
00663 wap_event_destroy(new_event);
00664 },
00665 CONNECTED)
00666
00667 ROW(CONNECTED,
00668 TR_Invoke_Ind,
00669 e->tcl == 2 && pdu->type == Resume && !resume_enabled,
00670 {
00671
00672
00673
00674 send_abort(WSP_ABORT_DISCONNECT, e->handle);
00675 },
00676 CONNECTED)
00677
00678 ROW(CONNECTED,
00679 TR_Invoke_Ind,
00680 e->tcl == 2 && pdu->type == Resume && resume_enabled,
00681 {
00682
00683
00684 WAPEvent *wtp_event;
00685 List *new_headers;
00686
00687
00688 wtp_event = wap_event_create(TR_Invoke_Res);
00689 wtp_event->u.TR_Invoke_Res.handle = e->handle;
00690 dispatch_to_wtp_resp(wtp_event);
00691
00692
00693 abort_methods(sm, WSP_ABORT_RESUME);
00694
00695
00696 indicate_suspend(sm, WSP_ABORT_RESUME);
00697
00698
00699 new_headers = unpack_new_headers(sm, pdu->u.Resume.headers);
00700 indicate_resume(sm, e->addr_tuple, new_headers);
00701 http_destroy_headers(new_headers);
00702
00703 sm->resume_handle = e->handle;
00704 },
00705 RESUMING)
00706
00707 ROW(CONNECTED,
00708 TR_Invoke_Ind,
00709 e->tcl == 0 && pdu->type == Disconnect,
00710 {
00711
00712 abort_methods(sm, WSP_ABORT_DISCONNECT);
00713
00714
00715 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00716 },
00717 NULL_SESSION)
00718
00719 ROW(CONNECTED,
00720 TR_Invoke_Ind,
00721 e->tcl == 0 && pdu->type == Suspend && resume_enabled,
00722 {
00723
00724 abort_methods(sm, WSP_ABORT_SUSPEND);
00725
00726
00727 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00728 },
00729 SUSPENDED)
00730
00731 ROW(CONNECTED,
00732 TR_Invoke_Cnf,
00733 1,
00734 {
00735
00736 WSPPushMachine *spm;
00737
00738 spm = find_push_machine(sm, e->handle);
00739 handle_push_event(sm, spm, current_event);
00740 },
00741 CONNECTED)
00742
00743 ROW(CONNECTED,
00744 TR_Result_Cnf,
00745 e->handle != sm->connect_handle,
00746 {
00747 WSPMethodMachine *msm;
00748
00749
00750 msm = find_method_machine(sm, e->handle);
00751 handle_method_event(sm, msm, current_event, pdu);
00752 },
00753 CONNECTED)
00754
00755
00756
00757
00758
00759 ROW(CONNECTED,
00760 TR_Abort_Ind,
00761 e->handle != sm->connect_handle && e->ir_flag == RESPONDER_INDICATION,
00762 {
00763 WSPMethodMachine *msm;
00764
00765
00766 msm = find_method_machine(sm, e->handle);
00767 handle_method_event(sm, msm, current_event, pdu);
00768 },
00769 CONNECTED)
00770
00771 ROW(CONNECTED,
00772 TR_Abort_Ind,
00773 e->handle != sm->connect_handle && e->ir_flag == INITIATOR_INDICATION,
00774 {
00775 WSPPushMachine *m;
00776
00777
00778 m = find_push_machine(sm, e->handle);
00779 handle_push_event(sm, m, current_event);
00780 },
00781 CONNECTED)
00782
00783
00784
00785 ROW(SUSPENDED,
00786 Disconnect_Event,
00787 1,
00788 {
00789
00790 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00791 },
00792 NULL_SESSION)
00793
00794 ROW(SUSPENDED,
00795 TR_Invoke_Ind,
00796 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
00797 {
00798
00799 send_abort(WSP_ABORT_SUSPEND, e->handle);
00800 },
00801 SUSPENDED)
00802
00803 ROW(SUSPENDED,
00804 TR_Invoke_Ind,
00805 e->tcl == 2 && pdu->type == Resume,
00806 {
00807 WAPEvent *wtp_event;
00808 List *new_headers;
00809
00810
00811 wtp_event = wap_event_create(TR_Invoke_Res);
00812 wtp_event->u.TR_Invoke_Res.handle = e->handle;
00813 dispatch_to_wtp_resp(wtp_event);
00814
00815
00816 new_headers = unpack_new_headers(sm, pdu->u.Resume.headers);
00817 indicate_resume(sm, e->addr_tuple, new_headers);
00818 http_destroy_headers(new_headers);
00819
00820
00821 sm->resume_handle = e->handle;
00822 },
00823 RESUMING)
00824
00825 ROW(SUSPENDED,
00826 TR_Invoke_Ind,
00827 e->tcl == 0 && pdu->type == Disconnect,
00828 {
00829
00830 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00831 },
00832 NULL_SESSION)
00833
00834
00835
00836 ROW(RESUMING,
00837 Disconnect_Event,
00838 1,
00839 {
00840
00841 send_abort(WSP_ABORT_DISCONNECT, sm->resume_handle);
00842
00843
00844 abort_methods(sm, WSP_ABORT_DISCONNECT);
00845
00846
00847 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00848 },
00849 NULL_SESSION)
00850
00851 ROW(RESUMING,
00852 S_Resume_Res,
00853 1,
00854 {
00855 WAPEvent *wtp_event;
00856 Octstr *ospdu;
00857
00858
00859 disconnect_other_sessions(sm);
00860
00861
00862
00863
00864
00865 if (e->server_headers == NULL)
00866 e->server_headers = http_create_empty_headers();
00867
00868 ospdu = make_resume_reply_pdu(sm, e->server_headers);
00869 wtp_event = wap_event_create(TR_Result_Req);
00870 wtp_event->u.TR_Result_Req.user_data = ospdu;
00871 wtp_event->u.TR_Result_Req.handle = sm->resume_handle;
00872 dispatch_to_wtp_resp(wtp_event);
00873
00874
00875 release_holding_methods(sm);
00876 },
00877 RESUMING_2)
00878
00879 ROW(RESUMING,
00880 Suspend_Event,
00881 1,
00882 {
00883
00884 send_abort(WSP_ABORT_SUSPEND, sm->resume_handle);
00885
00886
00887 abort_methods(sm, WSP_ABORT_SUSPEND);
00888
00889
00890 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00891 },
00892 SUSPENDED)
00893
00894 ROW(RESUMING,
00895 TR_Invoke_Ind,
00896 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
00897 {
00898
00899 WSPMethodMachine *msm;
00900 msm = method_machine_create(sm, e->handle);
00901 handle_method_event(sm, msm, current_event, pdu);
00902 },
00903 RESUMING)
00904
00905 ROW(RESUMING,
00906 TR_Invoke_Ind,
00907 e->tcl == 2 && pdu->type == Resume,
00908 {
00909 WAPEvent *wtp_event;
00910 List *new_headers;
00911
00912
00913 wtp_event = wap_event_create(TR_Invoke_Res);
00914 wtp_event->u.TR_Invoke_Res.handle = e->handle;
00915 dispatch_to_wtp_resp(wtp_event);
00916
00917
00918 send_abort(WSP_ABORT_RESUME, sm->resume_handle);
00919
00920
00921 abort_methods(sm, WSP_ABORT_RESUME);
00922
00923
00924 indicate_suspend(sm, WSP_ABORT_RESUME);
00925
00926
00927 new_headers = unpack_new_headers(sm, pdu->u.Resume.headers);
00928 indicate_resume(sm, e->addr_tuple, new_headers);
00929 http_destroy_headers(new_headers);
00930
00931
00932 sm->resume_handle = e->handle;
00933 },
00934 RESUMING)
00935
00936 ROW(RESUMING,
00937 TR_Invoke_Ind,
00938 e->tcl == 0 && pdu->type == Suspend,
00939 {
00940
00941 send_abort(WSP_ABORT_SUSPEND, sm->resume_handle);
00942
00943
00944 abort_methods(sm, WSP_ABORT_SUSPEND);
00945
00946
00947 indicate_suspend(sm, WSP_ABORT_SUSPEND);
00948 },
00949 SUSPENDED)
00950
00951 ROW(RESUMING,
00952 TR_Invoke_Ind,
00953 e->tcl == 0 && pdu->type == Disconnect,
00954 {
00955
00956 send_abort(WSP_ABORT_DISCONNECT, sm->resume_handle);
00957
00958
00959 abort_methods(sm, WSP_ABORT_DISCONNECT);
00960
00961
00962 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00963 },
00964 NULL_SESSION)
00965
00966 ROW(RESUMING,
00967 TR_Abort_Ind,
00968 e->handle == sm->resume_handle,
00969 {
00970
00971 abort_methods(sm, WSP_ABORT_SUSPEND);
00972
00973
00974 indicate_suspend(sm, e->abort_code);
00975 },
00976 SUSPENDED)
00977
00978
00979
00980 ROW(RESUMING_2,
00981 Disconnect_Event,
00982 1,
00983 {
00984
00985 send_abort(WSP_ABORT_DISCONNECT, sm->resume_handle);
00986
00987
00988 abort_methods(sm, WSP_ABORT_DISCONNECT);
00989
00990
00991 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
00992 },
00993 NULL_SESSION)
00994
00995 ROW(RESUMING_2,
00996 S_MethodInvoke_Res,
00997 1,
00998 {
00999 WSPMethodMachine *msm;
01000
01001
01002 msm = find_method_machine(sm, e->server_transaction_id);
01003 handle_method_event(sm, msm, current_event, pdu);
01004 },
01005 RESUMING_2)
01006
01007 ROW(RESUMING_2,
01008 S_MethodResult_Req,
01009 1,
01010 {
01011 WSPMethodMachine *msm;
01012
01013
01014 msm = find_method_machine(sm, e->server_transaction_id);
01015 handle_method_event(sm, msm, current_event, pdu);
01016 },
01017 RESUMING_2)
01018
01019 ROW(RESUMING_2,
01020 S_Push_Req,
01021 1,
01022 {
01023 WSP_PDU *pdu;
01024
01025 pdu = make_push_pdu(current_event);
01026 send_invoke(sm, pdu, current_event, TRANSACTION_CLASS_0);
01027 },
01028 RESUMING_2)
01029
01030 ROW(RESUMING_2,
01031 S_ConfirmedPush_Req,
01032 1,
01033 {
01034
01035 WSPPushMachine *spm;
01036
01037 spm = push_machine_create(sm, e->server_push_id);
01038 handle_push_event(sm, spm, current_event);
01039 },
01040 RESUMING_2)
01041
01042 ROW(RESUMING_2,
01043 Suspend_Event,
01044 1,
01045 {
01046
01047 send_abort(WSP_ABORT_SUSPEND, sm->resume_handle);
01048
01049
01050 abort_methods(sm, WSP_ABORT_SUSPEND);
01051
01052
01053 indicate_suspend(sm, WSP_ABORT_SUSPEND);
01054 },
01055 SUSPENDED)
01056
01057 ROW(RESUMING_2,
01058 TR_Invoke_Ind,
01059 e->tcl == 2 && (pdu->type == Get || pdu->type == Post),
01060 {
01061 WSPMethodMachine *msm;
01062 WAPEvent *new_event;
01063
01064
01065 msm = method_machine_create(sm, e->handle);
01066 handle_method_event(sm, msm, current_event, pdu);
01067
01068
01069 new_event = wap_event_create(Release_Event);
01070 handle_method_event(sm, msm, new_event, NULL);
01071 wap_event_destroy(new_event);
01072 },
01073 RESUMING_2)
01074
01075 ROW(RESUMING_2,
01076 TR_Invoke_Ind,
01077 e->tcl == 2 && pdu->type == Resume,
01078 {
01079 WAPEvent *wtp_event;
01080 List *new_headers;
01081
01082
01083 wtp_event = wap_event_create(TR_Invoke_Res);
01084 wtp_event->u.TR_Invoke_Res.handle = e->handle;
01085 dispatch_to_wtp_resp(wtp_event);
01086
01087
01088 send_abort(WSP_ABORT_RESUME, sm->resume_handle);
01089
01090
01091 abort_methods(sm, WSP_ABORT_RESUME);
01092
01093
01094 indicate_suspend(sm, WSP_ABORT_RESUME);
01095
01096
01097 new_headers = unpack_new_headers(sm, pdu->u.Resume.headers);
01098 indicate_resume(sm, e->addr_tuple, new_headers);
01099 http_destroy_headers(new_headers);
01100
01101
01102 sm->resume_handle = e->handle;
01103 },
01104 RESUMING)
01105
01106 ROW(RESUMING_2,
01107 TR_Invoke_Ind,
01108 e->tcl == 0 && pdu->type == Suspend,
01109 {
01110
01111 send_abort(WSP_ABORT_SUSPEND, sm->resume_handle);
01112
01113
01114 abort_methods(sm, WSP_ABORT_SUSPEND);
01115
01116
01117 indicate_suspend(sm, WSP_ABORT_SUSPEND);
01118 },
01119 SUSPENDED)
01120
01121 ROW(RESUMING_2,
01122 TR_Invoke_Ind,
01123 e->tcl == 0 && pdu->type == Disconnect,
01124 {
01125
01126 send_abort(WSP_ABORT_DISCONNECT, sm->resume_handle);
01127
01128
01129 abort_methods(sm, WSP_ABORT_DISCONNECT);
01130
01131
01132 indicate_disconnect(sm, WSP_ABORT_DISCONNECT);
01133 },
01134 NULL_SESSION)
01135
01136 ROW(RESUMING_2,
01137 TR_Invoke_Cnf,
01138 1,
01139 {
01140
01141 WSPPushMachine *spm;
01142
01143 spm = find_push_machine(sm, e->handle);
01144 handle_push_event(sm, spm, current_event);
01145 },
01146 RESUMING_2)
01147
01148 ROW(RESUMING_2,
01149 TR_Result_Cnf,
01150 e->handle == sm->resume_handle,
01151 {
01152 },
01153 CONNECTED)
01154
01155 ROW(RESUMING_2,
01156 TR_Result_Cnf,
01157 e->handle != sm->resume_handle,
01158 {
01159 WSPMethodMachine *msm;
01160
01161
01162 msm = find_method_machine(sm, e->handle);
01163 handle_method_event(sm, msm, current_event, pdu);
01164 },
01165 RESUMING_2)
01166
01167 ROW(RESUMING_2,
01168 TR_Abort_Ind,
01169 e->handle == sm->resume_handle,
01170 {
01171
01172 abort_methods(sm, WSP_ABORT_SUSPEND);
01173
01174
01175 indicate_suspend(sm, e->abort_code);
01176 },
01177 SUSPENDED)
01178
01179
01180
01181
01182
01183 ROW(RESUMING_2,
01184 TR_Abort_Ind,
01185 e->handle != sm->resume_handle && e->ir_flag == RESPONDER_INDICATION,
01186 {
01187 WSPMethodMachine *msm;
01188
01189
01190 msm = find_method_machine(sm, e->handle);
01191 handle_method_event(sm, msm, current_event, pdu);
01192 },
01193 RESUMING_2)
01194
01195 ROW(CONNECTING_2,
01196 TR_Abort_Ind,
01197 e->handle != sm->connect_handle && e->ir_flag == INITIATOR_INDICATION,
01198 {
01199 WSPPushMachine *m;
01200
01201
01202 m = find_push_machine(sm, e->handle);
01203 handle_push_event(sm, m, current_event);
01204 },
01205 CONNECTING_2)
01206
01207 #undef ROW
01208 #undef STATE_NAME
01209
01210
01211
01212
01213
See file LICENSE for details about the license agreement for using,
modifying, copying or deriving work from this software.