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

📄 mmsacon.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Need both process and instance. 					*/  printf (" Enter the AR Name to connect to : ");  if (!strget (title))    {    (*menu_set_fun)();    return;    }  wait_count = 0;  printf (" Enter Delay Time between connections (default = 0 sec) : ");  intget (&wait_count);/* We now have all information required to establish an association	*//* Just call the function to establish associations			*/  flush_keys ();  while (!kbhit ())    {    wait_time (wait_count);    init_count++;RETRY :    if (!mv_init (chan,title))      {      print_perror_wait (mms_op_err,"\n INIT ERROR : Request not sent. ");      (*menu_set_fun)();      return;      }    time (&start_time);    while (!(mms_chan_info[chan].ctxt.chan_state & M_ACTIVE))     {     mms_comm_service ();     if (time (NULL) - start_time > 3000L || kbhit ())         {       wait_msg (" Association Request Timeout ");       (*menu_set_fun)();       return;       }     if (mms_chan_info[chan].ctxt.chan_state == M_IDLE)	{	printf ("\n Retrying ..");	goto RETRY;        }      }    if (abort_flag)      mp_abort (chan,1);    else      {      if (!mp_conclude (chan))        {        print_perror_wait (mms_op_err,"\n CONCL ERROR : Request not sent. ");        (*menu_set_fun)();        return;        }      }    ms_comm_serve ();	/* call once because abort doesn't wake us up	*/    time (&start_time);    while (mms_chan_info[chan].ctxt.chan_state != M_IDLE)      {      ms_comm_serve ();      if (time (NULL) - start_time > 3000L || kbhit ())          {        wait_msg (" Conclude Timeout ");        (*menu_set_fun)();        return;        }      }    BOTTOMSCR;    printf ("\n %ld",init_count);    }  printf ("\n Total Initiates : %ld",init_count);  wait_msg ("");  (*menu_set_fun)();  }ST_VOID wait_time (ST_INT sec)  {time_t start_time;  time (&start_time);  while ((time (NULL) - start_time < sec) && !kbhit ())    {    /* process network events while waiting for sec interval to elapse	*/    /* function will sleep for number of sec if no events are present	*/    wait_any_event (sec*1000);    }  }/************************************************************************//*			load_local_titles				*//************************************************************************/ST_VOID load_local_titles (ST_INT mode)    {register i;FILE	*file_ptr;ST_CHAR line[200];ST_INT ret,done;ST_RET err = 0;ST_INT section, new_section;ST_INT chan;ST_INT acse_base;ST_INT acse_num;ST_INT llc_base;ST_INT llc_num;ST_INT llp_type;ST_CHAR *chan_ptr;ST_INT chan_beg;ST_INT chan_end;ST_INT chan_index;ST_CHAR *stop_str;#if (defined (MAP30_ACSE) && defined (MAP30_LLC))ST_CHAR buf[100];#endif#ifdef PSOS_SYSTEMST_INT LineNumber = 0;#endif  printf ("\n\n LOADING PARAMETERS FROM CONFIGURATION FILE : \n");  acse_base = 0;  acse_num = 0;  llc_base = 0;  llc_num = 0;#ifdef PSOS_SYSTEM  printf ("Reading CFG data from memory \n");#else  if (!(file_ptr = fopen (MMSDEMO_CFG_FILE,"r")))    {    wait_msg ("MMS DEMO PARAMETER FILE NOT FOUND (mmsdemo.cfg)");    return;    }#endif  done = 0;  err = 0;  while (!done && !err)    {   #ifdef PSOS_SYSTEM  memset (line,0,199);  memcpy (line, cfg_file_data[LineNumber],strlen (cfg_file_data[LineNumber]));  ++LineNumber;  #else    if (!(fgets (line,199,file_ptr)))      {      done = 1;      break;      }#endif    if (line[0] == '#')      {      line[2] = 0;      section = atoi (&line[1]);      new_section = 1;      }    else      {      /* Scan out to the end of the line */      for (i = 0 ; i < 64; ++i)        {        if ((line[i] == '\n') || (line[i] == ' '))           break;	}	      /* Check to make sure that this is the end of the line */	      if ((line[i] == '\n') || (line[i] == ' '))        {        line[i] = 0;	}      else        {        err = 1;        break;        }	#ifdef PSOS_SYSTEM      if (section == 5)        {	done = 1;        continue;	}#endif      if (section == 1 && mode != GET_CHANNEL_CONFIG)        continue;      if (section != 1 && mode != GET_TITLE_CONFIG)        continue;      switch (section)        {        case 1 :		/* channel configuration		*/	  if (!strncmp ("TOTAL_CHAN=",line,11))            {            max_mms_chan = atoi (&line[11]);	    printf ("\n Total number of MMS Channels = %d",max_mms_chan);            acse_num = max_mms_chan;            llc_num = max_mms_chan;            }	  if (!strncmp ("ACSE_BASE=",line,10))            {            acse_base = atoi (&line[10]);	    printf ("\n ACSE Base Channel = %d",acse_base);            }	  if (!strncmp ("NUM_ACSE=",line,9))            {            acse_num = atoi (&line[9]);	    printf ("\n Number ACSE Channels = %d",acse_num);            }	  if (!strncmp ("LLC_BASE=",line,9))            {            llc_base = atoi (&line[9]);	    printf ("\n LLC Base Channel = %d",llc_base);            }	  if (!strncmp ("NUM_LLC=",line,8))            {            llc_num = atoi (&line[8]);	    printf ("\n Number LLC Channels = %d",llc_num);            }	  if (!strncmp ("MAX_MSG_SIZE=",line,13))            {            mms_max_msgsize = atoi (&line[13]);	    printf ("\n Max MMS Message Size = %d",mms_max_msgsize);            }	  if (!strncmp ("MAX_NUM_VARS=",line,13))            {            max_mmsease_vars = atoi (&line[13]);	    printf ("\n Max number of Variables = %d", max_mmsease_vars);            }	  if (!strncmp ("MAX_NUM_NVLISTS=",line,16))            {            max_mmsease_nvlists = atoi (&line[16]);	    printf ("\n Max number of NVLists = %d", max_mmsease_nvlists);            }	  if (!strncmp ("MAX_NUM_TYPES=",line,14))            {            max_mmsease_types = atoi (&line[14]);	    printf ("\n Max Types = %d", max_mmsease_types);            }	  if (!strncmp ("MAX_NUM_PIS=",line,12))            {            max_mmsease_pis = atoi (&line[12]);			    printf ("\n Max number of ProgramInvocations = %d", max_mmsease_pis);            }	  if (!strncmp ("MAX_NUM_DOMS=",line,13))            {            max_mmsease_doms = atoi (&line[13]);			    printf ("\n Max number of Domains = %d", max_mmsease_doms);            }	  get_board_spec_param (line);	/* check for board specific 	*/        break;        case 2 :		/* AR names to activate			*/#if (defined (MAP30_ACSE) && defined (MAP30_LLC))          sprintf (buf, "\n Is '%s' an ACSE AR Name (vs. LLC) (Y) ? ",                line);          if (ask (buf, SD_TRUE))            llp_type = ACSE30_LLP;          else            llp_type = LLC30_LLP;#elif defined (MAP30_ACSE)          llp_type = ACSE30_LLP;#else          llp_type = LLC30_LLP;#endif                       printf ("\n ACTIVATE : %s, (LLP Type is %s)",              line, llp_type == LLC30_LLP ? "LLC30_LLP" : "ACSE30_LLP");          if (ret = mllp_act_arname (line,llp_type))            print_perror_wait (ret,"\n ACTIVATE ERROR : ");        break;        case 3 :		/* AR names to be registered 		*/          if (new_section)            {              chan = 0;            new_section = 0;            }          chan_ptr = strrchr (line, '[');          if (chan_ptr != NULL)            {            while (!((*chan_ptr != ' ')&&(*chan_ptr != '\t')&&(*chan_ptr != '[')))              chan_ptr++;            chan_beg = (ST_INT) strtoul (chan_ptr, &stop_str, 10);            chan_ptr = strrchr (chan_ptr, '-');            if (chan_ptr != NULL)              {              while (!((*chan_ptr != ' ')&&(*chan_ptr != '\t')&&(*chan_ptr != '-')))                chan_ptr++;              chan_end = (ST_INT) strtoul (chan_ptr, &stop_str, 10);              chan_ptr = strrchr (line, '[');              *chan_ptr = 0;              for (chan_index = chan_beg; chan_index <= chan_end; chan_index++)                {                if (chan_index < max_mms_chan)                  {                  printf ("\n REGISTER CHAN %d: %s",chan_index,line);                  if (ret = mllp_reg_ar_name (chan_index,line))                    print_perror_wait (ret,"\n REGISTER ERROR : ");                  }                else                  err = 1;                }              chan = chan_index;              }            }          else            {            if (chan < max_mms_chan)              {    	    printf ("\n REGISTER CHAN %d: %s",chan,line);              if (ret = mllp_reg_ar_name (chan,line))                print_perror_wait (ret,"\n REGISTER ERROR : ");              chan++;              }            else	      err = 1;            }        break;        case 4 :				/* called channels	*/          chan_ptr = strrchr (line, '[');          if (chan_ptr != NULL)            {            while (!((*chan_ptr != ' ')&&(*chan_ptr != '\t')&&(*chan_ptr != '[')))              chan_ptr++;            chan_beg = (ST_INT) strtoul (chan_ptr, &stop_str, 10);            chan_ptr = strrchr (chan_ptr, '-');            if (chan_ptr != NULL)              {              while (!((*chan_ptr != ' ')&&(*chan_ptr != '\t')&&(*chan_ptr != '-')))                chan_ptr++;              chan_end = (ST_INT) strtoul (chan_ptr, &stop_str, 10);              chan_ptr = strrchr (line, '[');              *chan_ptr = 0;              for (chan_index = chan_beg; chan_index <= chan_end; chan_index++)                {                if (chan_index < max_mms_chan)                  {                  listen_sel[chan_index] = 1;	/* set flag		*/                  printf ("\n Listen Chan %d",chan_index);                  if (ret = mllp_ass_listen (chan_index))                    print_perror_wait (ret,"\n Channel %d Listen Error : %d", chan_index, ret);                  }                else                  err = 1;                }              chan = chan_index;              }            }          else            {            chan = atoi (line);            if (chan >= 0 && chan < max_mms_chan)              {              listen_sel[chan] = 1;		/* set flag		*/    	      printf ("\n Listen Chan %d",chan);              if (ret = mllp_ass_listen (chan))                print_perror_wait (ret,"\n Channel %d Listen Error : %d",chan,ret);              chan++;              }            else              err = 1;            }        break;        default :        break;	        }  /* Switch of section */      }  /* if line[0] == '#' */     } /* While !done and !err */  if (err)    wait_msg ("\nFILE ERROR DETECTED");#ifndef PSOS_SYSTEM  fclose (file_ptr);#endif  if (mode == GET_CHANNEL_CONFIG)    {#if defined (MAP30_ACSE)    if (mllp_set_chan_limits (ACSE30_LLP, acse_base, acse_num))      printf ("\n Channel Limit Error .. ACSE channels");#endif#if defined (MAP30_LLC)    if (mllp_set_chan_limits (LLC30_LLP, llc_base, llc_num))      printf ("\n Channel Limit Error .. LLC channels");#endif    }  }/************************************************************************//*			 get_board_spec_param 				*//************************************************************************//* Given a character buffer, extract any board specific parameters	*/ST_VOID get_board_spec_param (ST_CHAR *line)  {#ifdef MARBEN  if (!strncmp ("TCP_IDLE_TIME=",line,14))    s_idle_time = atoi (&line[14]);   if (!strncmp ("TCPIP_SUPPORT=",line,14))    s_tcp_support = (ST_BOOLEAN) atoi (&line[14]);   if (!strncmp ("ACTIVATE_TYPE=",line,14))    s_activate_type = atoi (&line[14]); #endif 	/* MARBEN	*/  }

⌨️ 快捷键说明

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