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

📄 mmsacon.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//*   (c) Copyright Systems Integration Specialists Company, Inc.,	*//*      	  1986 - 2002, All Rights Reserved.		        *//*									*//* MODULE NAME : mmsacon.c						*//* PRODUCT(S)  : MMSEASE						*//*									*//* MODULE DESCRIPTION : 						*//*	This module contains functions to initiate the MMS context	*//*	management services.  These functions are called from the	*//*	mainloop (check_key).						*//*									*//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE :				*//*									*//* MODIFICATION LOG :							*//*  Date     Who   Rev			Comments			*//* --------  ---  ------   -------------------------------------------	*//* 08/21/02  EJV     13    Init key_hit = 0				*//* 07/23/02  EJV     12    Corrected connect prompt.			*//* 12/14/01  EJV     11    Del code for unsupported platforms & hardware*//* 12/10/01  EJV     10    init_rel_abort, wait_time: corrected code	*//*			     when time delay entered.			*//* 11/29/01  EJV     09    Del code for old LATT, XENIX, ultrix, RMX86.	*//* 09/09/98  RKR     08    Added summary statistics to do_mchan		*//* 08/19/98  EJV     07    Added __hpux to pipe flow control code.	*//* 08/03/98  EJV     06    Corrected printf, check also for M_LISTEN	*//*			   state, check for pipe full in do_auto_disc.	*//* 07/24/98  EJV     05    Corrected printf in do_auto_disc.		*//* 07/21/98  EJV     04    Added do_auto_disc.				*//* 06/22/98  JRB     03    Check for ">=" max_mms_chan instead of ">".	*//* 05/27/98  IKE     02    Removed data conversion warnings when 	*//* 			   compiling in DOS platform			*//* 10/22/97  RKR     01    changed calls of mv_initiate to mv_init	*//* 04/15/97  DSF   7.00    MMSEASE 7.0 release. See MODL70.DOC for	*//*			   history.					*//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#ifndef PSOS_SYSTEM#include <string.h>#endif#if	(SYSTEM_SEL & (MSOFT | OS2))#include <ctype.h>#include <conio.h>#endif#if	(SYSTEM_SEL & ( SYS_5 | SYS_BSD | OPEN_VMS | QNX_C86))#include <ctype.h>#endif#if (SYSTEM_SEL & (OPEN_VMS))ST_INT kbhit ();#endif#include "mms_vprg.h"#include "mms_pdom.h"#include "mms_vdom.h"#include "mms_usr.h"#include "mms_pcon.h"#include "mms_vcon.h"#include "mms_pfil.h"#include "mms_vfil.h"#include "mms_llp.h"#include "mmsop_en.h"#include "userdefs.h"#include "mem_chk.h"#ifdef PRIVATE_COMM#include "privuser.h"#endif#include "suicacse.h"#include "fkeydefs.h"#include "gvaldefs.h"#include "scrndefs.h"#if defined (_WIN32)#include <windows.h>#endif#ifdef PSOS_SYSTEM#include <ctype.h>extern char *dib_file_data[];extern char *cfg_file_data[];extern char *var_file_data[];#endifST_VOID get_board_spec_param (ST_CHAR *line);ST_RET _ms_req_unlink_conf (MMSREQ_PEND *req);ST_VOID _ms_req_put_pend (MMSREQ_PEND *req);static ST_VOID init_rel_abort (ST_BOOLEAN abort_flag);ST_VOID wait_time (ST_INT sec);ST_VOID init_init_info (ST_INT chan, INIT_INFO *i_info);ST_VOID init_cs_init_info (ST_INT chan, CS_INIT_INFO *i_info);MMSREQ_PEND *_ms_match_response (ST_UINT32 id); /* internal MMS-EASE function	*//************************************************************************//* For debug version, use a static pointer to avoid duplication of 	*//* __FILE__ strings.							*//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//* Function to post a listen						*//************************************************************************/ST_VOID do_listen (ST_VOID)  {ST_INT chan;ST_UINT i;  printf ("\n Enter the channel # to use : ");  if (!intget (&chan))    {    (*menu_set_fun) ();    return;    }  if (chan < 0 || chan >= max_mms_chan)    {    printf ("\n Invalid Channel Number");    wait_msg (" Hit any key to continue ... ");    (*menu_set_fun) ();    return;    }  if (i = mllp_ass_listen (chan))    print_perror_wait (i,"\nPost Listen not passed to ACSE : ");  (*menu_set_fun) ();  }/************************************************************************//* Function to cancel a listen						*//************************************************************************/ST_VOID do_stop_listen (ST_VOID)  {ST_INT chan;ST_INT i;  printf ("\n Enter the Channel # to use : ");  if (!intget (&chan))    {    (*menu_set_fun) ();    return;    }  if (chan < 0 || chan >= max_mms_chan)    {    printf ("\n Invalid Channel Number");    wait_msg (" Hit any key to continue ... ");    (*menu_set_fun) ();    return;    }  if (i = mllp_stop_ass_listen (chan))    print_perror_wait (i,"\nCancel Listen not passed to ACSE : ");  (*menu_set_fun) ();  }/************************************************************************//*			do_init 					*//* create and send an initiate request. 				*//************************************************************************/ST_VOID do_init (ST_VOID)  {#if MMS_INIT_EN & REQ_ENST_CHAR title[180];ST_INT chan;  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 */    {    wait_msg ("Illegal Channel Number");    (*menu_set_fun) ();    return;    }  printf (" Enter the AR Name to connect to : ");  if (!strget (title))    {    (*menu_set_fun) ();    return;    }/* We now have all information required to establish an association	*/  if (!mv_init (chan,title))    print_req_error ();  (*menu_set_fun) ();#endif  }/************************************************************************//************************************************************************/ST_UCHAR cs_init_detail[] = {0x81,0x01,0x78};ST_VOID init_init_info (ST_INT chan, INIT_INFO *i_info)  {MCHANINFO *chaninfo;/* move the preferred param for this channel into the req info struct	*/  chaninfo = &mms_chan_info[chan];  chaninfo->segsize = mms_max_msgsize;	/* Re-init segsize	*/  i_info->max_segsize_pres = SD_TRUE;  i_info->max_segsize = chaninfo->segsize;/* maxreq_calling is number of indications the caller is willing to 	*//* have oustanding (transaction objects), so mapping when we call looks *//* like :								*//*		max_req_calling -> maxpend_ind				*//*		max_req_called  -> maxpend_req				*/  i_info->maxreq_calling = chaninfo->maxpend_ind;  i_info->maxreq_called = chaninfo->maxpend_req;  i_info->max_nest_pres = SD_TRUE;  i_info->max_nest = chaninfo->max_nest;  i_info->mms_detail_pres = SD_TRUE;  i_info->version =  chaninfo->version;  memcpy ((ST_CHAR *)i_info->param_supp, (ST_CHAR *)chaninfo->param_supp, 2);  memcpy ((ST_CHAR *)i_info->serv_supp, (ST_CHAR *)chaninfo->service_resp,11);  i_info->mms_p_context_pres = SD_TRUE;  i_info->num_cs_init = 0;  }ST_VOID init_cs_init_info (ST_INT chan, CS_INIT_INFO *i_info)  {MCHANINFO *chaninfo;/* move the preferred param for this channel into the req info struct	*/  chaninfo = &mms_chan_info[chan];  i_info->local_detail_pres = SD_TRUE;  i_info->local_detail = chaninfo->segsize;/* maxreq_calling is number of indications the caller is willing to 	*//* have oustanding (transaction objects), so mapping when we call looks *//* like :								*//*		max_req_calling -> maxpend_ind				*//*		max_req_called  -> maxpend_req				*/  i_info->maxreq_calling = chaninfo->maxpend_ind;  i_info->maxreq_called = chaninfo->maxpend_req;  i_info->max_nest_pres = SD_TRUE;  i_info->max_nest = chaninfo->max_nest;  printf ("\n Enter P-Context for this CS (hex) : ");  i_info->p_context = 0;  hexget ((ST_INT *) &i_info->p_context);  i_info->init_detail_len = sizeof (cs_init_detail);  i_info->init_detail = cs_init_detail;  }/************************************************************************//*                      do_auto_conn                                    *//* create and send an initiate request.                                 *//************************************************************************/ST_VOID do_auto_conn (ST_VOID)  {ST_CHAR title[180];ST_INT chan;ST_INT base_chan;ST_INT i;ST_INT key_hit = 0;#if defined (_WIN32)ST_UINT	sleep_time;#endif#if MMS_INIT_EN & REQ_EN  printf ("\n Enter the # of channels to connect : ");  if (!intget (&chan))    {    (*menu_set_fun) ();    return;    }  printf (" Enter the base channel : ");  if (!intget (&base_chan))    {    (*menu_set_fun) ();    return;    }  if ((chan + base_chan) > max_mms_chan ||       base_chan < 0) 	        /* if not legal channel */    {    wait_msg ("Illegal channel number");    (*menu_set_fun) ();    return;    }  printf (" Enter the Application Reference Name to connect to : ");  if (!strget (title))    {    (*menu_set_fun) ();    return;    }#if defined (_WIN32)  sleep_time=100;  printf (" Enter number of ms to sleep between Initiates (default = %ld) :",	   sleep_time);  longget (&sleep_time);#endif/* We now have all information required to establish an association     *//* Establish all of them                                                */  for (i = base_chan; i < (chan + base_chan); i++)     {    if (!mv_init (i ,title))      print_req_error ();    else       {#if defined (_WIN32)      Sleep (sleep_time);#endif      printf ("\n Connecting channel %d", i);      while (mms_chan_info[i].ctxt.chan_state != M_ACTIVE &&             !(key_hit = kbhit ()))         {        mms_comm_service ();        }      if (key_hit)			/* jump out of the outer loop	*/        break;      }    } /* endfor */  (*menu_set_fun) ();#endif  }/************************************************************************//************************************************************************//*			do_auto_disc					*//* conclude/abort on specified channels					*//************************************************************************/ST_VOID do_auto_disc (ST_VOID)  {ST_INT     chan, base_chan, i;ST_BOOLEAN use_abort;ST_INT     key_hit = 0;/* need to find out what channels the user wants to disconnect		*/  printf ("\n Enter the # of channels to disconnect : ");  if (!intget (&chan))    {    (*menu_set_fun) ();    return;    }  printf (" Enter the base channel : ");  if (!intget (&base_chan))    {    (*menu_set_fun) ();    return;    }  if ((chan + base_chan) > max_mms_chan ||       base_chan < 0) 	        /* if not legal channel */    {    wait_msg ("Illegal channel number");    (*menu_set_fun) ();    return;    }  use_abort = ask (" Use Abort to Disconnect (N) ? ",SD_FALSE);  for (i = base_chan; i < (chan + base_chan); i++)     {    if (use_abort)      {      printf ("\n Aborting channel %d", i);#if defined(_AIX) || (defined(__alpha) && !defined(__VMS)) || defined(sun) || \    defined(__hpux)      /* Check if the stack's pipe has required space free.		*/      while (s_chk_sys_resource (S_REQTYPE_U_ABORT) == SD_FAILURE)        {        printf("$");		/* print someting to see pipe full	*/        mms_comm_service ();	/* in meantime service our pipe		*/        }#endif      mp_abort (i,1);      ms_clr_rem_fctrl (i);	/* release all remote file control for	*/				/* this channel 			*/      ms_clr_locl_fctrl (i);	/* release all local file control for	*/				/* this channel, and close files.	*/      }    else      {#if MMS_CONCLUDE_EN & REQ_EN      printf ("\n Concluding on channel %d", i);      if (!mp_conclude (i))        print_req_error ();#endif      }    while (mms_chan_info[i].ctxt.chan_state != M_IDLE &&           mms_chan_info[i].ctxt.chan_state != M_LISTEN &&           !(key_hit = kbhit ()))       {      mms_comm_service ();      }    if (key_hit)			/* jump out of the outer loop	*/      break;    }

⌨️ 快捷键说明

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