📄 mmsacon.c
字号:
(*menu_set_fun) (); }/************************************************************************//************************************************************************//* do_concl *//* create and send a conclude request. *//************************************************************************/ST_VOID do_concl (ST_VOID) {#if MMS_CONCLUDE_EN & REQ_ENST_INT chan; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } if (!mp_conclude (chan)) print_req_error (); (*menu_set_fun) ();#endif }/************************************************************************//* do_abort *//* create and send an abort request. *//************************************************************************/ST_VOID do_abort (ST_VOID) {ST_INT chan;/* need to find out what channel the user wants to abort */ printf ("\n Enter the Channel # to use : "); if (!intget (&chan)) { (*menu_set_fun) (); return; } if (chan >= max_mms_chan || chan < 0) /* if not legal channel */ { key_err ("Illegal Channel Number"); (*menu_set_fun) (); return; } mp_abort (chan,1); ms_clr_rem_fctrl (chan); /* release all remote file control for */ /* this channel */ ms_clr_locl_fctrl (chan); /* release all local file control for */ /* this channel, and close files. */ (*menu_set_fun) (); }/************************************************************************//* Function Add a new P-Context *//************************************************************************/ST_VOID do_add_context (ST_VOID) {#ifdef MAP30_ACSEMMS_OBJ_ID obj;ST_INT i;ST_UINT mask; printf ("\n Create new P-Context : \n"); for (i = 0; i < MAX_OBJID_COMPONENTS; ++i) { printf (" Enter Obj ID component %d : ",i); if (!intget ((ST_INT *) &obj.comps[i])) break; } obj.num_comps = i; if (!i) /* if none entered, exit */ { (*menu_set_fun) (); return; } printf ("\n About to create P-Context, Object Id components are :"); for (i = 0; i < obj.num_comps; ++i) printf ("\n Component %d : %d ",i, obj.comps[i]); if (!ask ("\n Is it Ok to add Obj Id (y,n) (default = y) :",1)) { (*menu_set_fun) (); return; } if (mask = mllp_add_p_context (&obj)) printf ("\n Context added OK, mask = %04x (hex)",mask); else { printf ("\n ERROR : Context not added"); print_req_error (); } wait_key (); (*menu_set_fun) ();#endif }/************************************************************************//* Function to set the current AP context *//************************************************************************/ST_VOID do_set_ap_context (ST_VOID) {ST_UINT APcontext; printf ("\n Set AP Context (current == %d). Allowed LLP Types are :", mllp_ap_context_sel); printf ("\n ISO MMS IS : %d",SM_ISO_MMS_IS_AP_CTXT); printf ("\n ISO MMS DIS : %d",SM_ISO_MMS_AP_CTXT); printf ("\n MAP MMS DIS : %d",SM_MAP_MMS_AP_CTXT); printf ("\n PRIVATE : %d",SM_PRIVATE_AP_CTXT); printf ("\n Enter AP Context : "); if (intget ((ST_INT *) &APcontext)) mllp_ap_context_sel = APcontext; (*menu_set_fun) (); }/************************************************************************//* Function to set the current context for MMS PDU's *//************************************************************************/ST_VOID do_set_context (ST_VOID) {ST_INT i; printf ("\n Set P-Contexts for all Channels \n"); for (i = 0; i < max_mms_chan; ++i) { printf (" Enter Chan %d P-Context (%04x) : ",i,P_context_sel[i]); hexget ((ST_INT *) &P_context_sel[i]); } (*menu_set_fun) (); }/************************************************************************//* do_cancel *//* create and send a cancel request. *//************************************************************************/ST_VOID do_cancel (ST_VOID) {#if MMS_CANCEL_EN & REQ_ENMMSREQ_PEND *conf_ptr;ST_INT chan,i,len;ST_UINT32 invoke;ST_CHAR tmp[50]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } invoke = 1; /* build the cancel request */ printf (" Enter the Invoke ID to be Cancelled : "); SAVESCR; entry1(50,tmp); len = strlen (tmp); /* check for numeric string */ for (i = 0; i <= len && len && (isdigit (tmp[i]) || tmp[i] == '-'); ++i) ; if (i && (i == len)) invoke = (ST_UINT32) atol (tmp); if ((conf_ptr = _ms_match_response (invoke)) == NULL) { printf (" \n ERROR : Request not sent. No such Invoke Id."); wait_msg (""); (*menu_set_fun) (); return; } _ms_req_unlink_conf (conf_ptr); /* return request to */ _ms_req_put_pend (conf_ptr); /* pending list */ if (conf_ptr -> chan != chan) { printf (" \n ERROR : Request not sent. Incorrect channel."); wait_msg (""); (*menu_set_fun) (); return; } if (!mp_cancel (conf_ptr)) print_req_error (); (*menu_set_fun) ();#endif }/************************************************************************//* do_set_llp_type *//************************************************************************/#ifdef PRIVATE_COMMST_VOID do_set_llp_type (ST_VOID) {ST_INT chan;ST_INT llp_type; printf ("\n Enter Channel : "); intget (&chan); if (chan >= max_mms_chan || chan < 0) { (*menu_set_fun) (); return; } printf ("\n Allowed LLP Types are : "); printf ("\n MMS ACSE : %d",ACSE30_LLP); printf ("\n PRIVATE ACSE : %d",ACSE30_PRIVATE_LLP); printf ("\n Enter LLP Type for Channel %d : ",chan); intget (&llp_type); if (llp_type == ACSE30_PRIVATE_LLP || llp_type == ACSE30_LLP) mms_chan_info[chan].ctxt.llp_type = llp_type; (*menu_set_fun) (); }#endif/************************************************************************//* do_mchan *//* Display general information about a MMS channel. This includes *//* the connected/available status, and if connected, negiotiated param. *//************************************************************************/ST_VOID do_mchan (ST_VOID) {static ST_INT chan = 0;MCHANINFO *info;ST_INT active_chans;ST_INT idle_chans;ST_INT listening_chans;ST_INT other_state_chans; printf ("\n Enter Channel to examine : "); intget (&chan); if (chan >= max_mms_chan || chan < 0) { (*menu_set_fun) (); return; } info = &mms_chan_info[chan]; CLEARSCR; printf ("\n\n CHANNEL %d LLP Type is : ",chan); switch (info->ctxt.llp_type) { case ACSE30_LLP : printf ("ACSE30_LLP"); break; case ACSE30_PRIVATE_LLP : printf ("ACSE30_PRIVATE_LLP"); break; case LLC30_PRIVATE_LLP : printf ("LLC30_PRIVATE_LLP"); break; case LLC30_AO_LLP : printf ("LLC30_AO_LLP"); break; case LLC30_AL_LLP : printf ("LLC30_AL_LLP"); break; case LLC30_UNKNOWN_LLP : printf ("LLC30_UNKNOWN_LLP"); break; } if (info->ctxt.llp_type == ACSE30_PRIVATE_LLP || info->ctxt.llp_type == LLC30_PRIVATE_LLP) { wait_msg (""); /* that's all for private channels */ (*menu_set_fun) (); return; } printf ("\n CHANNEL %d STATE : %08lx", chan,info->ctxt.chan_state); if (!info->ctxt.chan_state) printf ("\n\tIDLE"); if (info->ctxt.chan_state & M_LISTEN) printf ("\n\tLISTEN"); if (info->ctxt.chan_state & M_STOPPING_LISTEN) printf ("\n\tSTOPPING_LISTEN"); if (info->ctxt.chan_state & M_REPOST_LISTEN) printf ("\n\tREPOST_LISTEN"); if (info->ctxt.chan_state & M_ASS_REQ_PEND) printf ("\n\tASS_REQ_PEND"); if (info->ctxt.chan_state & M_ASS_IND_RCVD) printf ("\n\tASS_IND_RCVD"); if (info->ctxt.chan_state & M_ASS_RESP_PEND) printf ("\n\tASS_RESP_PEND"); if (info->ctxt.chan_state & M_NEG_ASS_RESP_PEND) printf ("\n\tNEG_ASS_RESP_PEND"); if (info->ctxt.chan_state & M_ASSOCIATED) printf ("\n\tASSOCIATED"); if (info->ctxt.chan_state & M_INIT_REQ_PEND) printf ("\n\tINIT_REQ_PEND"); if (info->ctxt.chan_state & M_INIT_REQ_WAIT) printf ("\n\tINIT_REQ_WAIT"); if (info->ctxt.chan_state & M_INIT_URESP_WAIT) printf ("\n\tINIT_URESP_WAIT"); if (info->ctxt.chan_state & M_INIT_RESP_PEND) printf ("\n\tINIT_RESP_PEND"); if (info->ctxt.chan_state & M_ACTIVE) printf ("\n\tACTIVE"); if (info->ctxt.chan_state & M_CONCL_REQ_PEND) printf ("\n\tCONCL_REQ_PEND"); if (info->ctxt.chan_state & M_CONCL_URESP_WAIT) printf ("\n\tCONCL_URESP_WAIT"); if (info->ctxt.chan_state & M_REL_IND_WAIT) printf ("\n\tREL_IND_WAIT"); if (info->ctxt.chan_state & M_REL_IND_RCVD) printf ("\n\tREL_IND_RCVD"); if (info->ctxt.chan_state & M_REL_REQ_PEND) printf ("\n\tREL_REQ_PEND"); if (info->ctxt.chan_state & M_REL_RESP_PEND) printf ("\n\tREL_RESP_PEND"); if (info->ctxt.chan_state & M_ABORT_REQ_PEND) printf ("\n\tABORT_REQ_PEND"); if (info->ctxt.chan_state & M_ABORT_IND_RCVD) printf ("\n\tABORT_IND_RCVD"); printf ("\n\n Local AR Title : %s",info->ctxt.locl_ar); printf ("\n Partner AR Title : %s",info->ctxt.rem_ar); printf ("\n Contexts in use : %04x",info->ctxt.contexts); printf ("\n Transmit Requests Outstanding : %d",info->ctxt.xmit_pend); printf ("\n\n\t Version in use : %d ",info->version); printf ("\n\t Max Segment Size : %ld",info->segsize); printf ("\n\t Max Outstanding Requests : %d",info->maxpend_req); printf ("\n\t Max Outstanding Indications : %d",info->maxpend_ind); printf ("\n\t File Block Size : %d",info->file_blk_size); printf ("\n Parameter Support : "); list_bytes (info->param_supp, 2); printf ("\n Requester Services : "); list_bytes ((info->service_req),11); printf ("\n Responder Services : "); list_bytes ((info->service_resp),11); active_chans = 0; idle_chans = 0; listening_chans = 0; other_state_chans = 0; for (chan=0; chan < max_mms_chan; chan++) { if (mms_chan_info[chan].ctxt.chan_state == M_ACTIVE) { active_chans++; } if (mms_chan_info[chan].ctxt.chan_state == M_IDLE) { idle_chans++; } if (mms_chan_info[chan].ctxt.chan_state == M_LISTEN) { listening_chans++; } if ((mms_chan_info[chan].ctxt.chan_state != M_ACTIVE) && (mms_chan_info[chan].ctxt.chan_state != M_IDLE) && (mms_chan_info[chan].ctxt.chan_state != M_LISTEN)) { other_state_chans++; } } printf ("\n\n max_mms_chan(%d) active(%d) idle(%d) listening(%d) other(%d)", max_mms_chan, active_chans, idle_chans, listening_chans, other_state_chans ); wait_msg (""); (*menu_set_fun) (); }/************************************************************************//* do_init_rel *//* do_init_abort *//* This function performs continous initiate/release (abort) cycles. *//************************************************************************/static ST_LONG init_count;ST_VOID do_init_rel (ST_VOID) { init_rel_abort (0); }ST_VOID do_init_abort (ST_VOID) { init_rel_abort (1); }static ST_VOID init_rel_abort (ST_BOOLEAN abort_flag) {ST_CHAR title[180];ST_INT chan;time_t start_time;ST_INT wait_count; init_count = 0;/* find a channel to use for association *//* need to find one that is not associated, or with pending association */ printf ("\n\n Enter the Channel to use for association : "); if (!intget (&chan)) { (*menu_set_fun)(); return; }/* chan has the channel to use, now get the entity to talk to. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -