mmsadom.c

来自「ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包」· C语言 代码 · 共 1,485 行 · 第 1/3 页

C
1,485
字号
          *cap_ptr = cap_str;          cap_ptr++;          cap_str += strlen (cap_str) + 1;          }        else          {          done = SD_TRUE;          wait_msg ("\n Capabilities List too long, last string was lost :");          }        }      else        done = SD_TRUE;      }    }  if (data_entered)    {    if (ask (" Enter whether domain is sharable (y,n) (default = n) :",0))      info->sharable = SD_TRUE;    else      info->sharable = SD_FALSE;    }  if (data_entered)    {			/* continue the file names where the list of	*/    			/* capabilities left off			*/    data_entered = get_fname_list ((FILE_NAME *) cap_ptr,                                   1024,                	           &info -> num_of_fname,		                   cap_str);    }		      if (data_entered)    {		        if (!mp_rddwn (chan,info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -	*/      {      if (start_cont ())		/* wait for 1st to complete	*/        return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/        {        if (! mp_rddwn (chan, info))          break;	num_outstanding++;        if (cont_serve ())		/* if user hit a key		*/          return;        }      cont_done ();			/* display results		*/      }    }  else    wait_msg ("\n Must enter all required information ");  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_rdupl					*//* create and send a request domain upload request.			*//************************************************************************/ST_VOID do_rdupl (ST_VOID)  {#if MMS_RDUPL_EN & REQ_ENRDUPL_REQ_INFO *info;ST_INT data_entered;ST_INT chan;ST_CHAR	temp[256];ST_CHAR	*fname_str;  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }  info	  = (RDUPL_REQ_INFO *) (dest_buffer);/* we use 3 - 4K for file name strings					*/  fname_str = (dest_buffer + 2048);	  printf (" Enter Domain Name : (R) ");  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (info->dname,temp);    }  if (data_entered)    {    data_entered = get_fname_list ((FILE_NAME *)(info + 1),                                   1024,                	           &info -> num_of_fname,		                   fname_str);    }  if (data_entered)    {    if (!mp_rdupl (chan,info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -	*/      {      if (start_cont ())		/* wait for 1st to complete	*/        return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/        {        if (! mp_rdupl (chan, info))          break;	num_outstanding++;        if (cont_serve ())		/* if user hit a key		*/          return;        }      cont_done ();			/* display results		*/      }    }  else    wait_msg ("\n Must enter all required information ");  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_loaddom					*//* create and send a load domain content.				*//************************************************************************/ST_VOID do_loaddom (ST_VOID)  {#if MMS_LOAD_DOM_EN & REQ_ENLOADDOM_REQ_INFO *info;ST_CHAR	**cap_ptr;ST_CHAR	*cap_str;ST_INT data_entered;ST_INT chan;ST_INT tot_len;ST_BOOLEAN done;ST_CHAR	temp[90];ST_UCHAR    apref[256];  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }	/* use first 2K of user 'dest_buffer' for request structure     */  info	  = (LOADDOM_REQ_INFO *) (dest_buffer);  cap_ptr = (ST_CHAR **) (info + 1);	/* use 3 - 10K for the capability data strings and file names	*/  cap_str = (dest_buffer + 2048);  printf (" Enter Domain Name : (R) ");  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (info->dname,temp);    }     if (data_entered)    {    tot_len = 0;    info->num_of_capab	= 0;    done = SD_FALSE;    while (!done)      {      printf (" Enter Capability String : (O) ");      if (strget (temp))	{	if ((tot_len += strlen (temp) + 1) < 7168)	  {	  info->num_of_capab++; 	/* increment # of capabilities	*/	  strcpy (cap_str, temp);	  *cap_ptr = cap_str;	  cap_ptr++;	  cap_str += strlen (cap_str) + 1;	  }	else	  {	  done = SD_TRUE;	  wait_msg ("\n Capabilities List too long, last string was lost. ");	  }	}      else	done = SD_TRUE;			/* set exit condition		*/      }    if (ask ("\n Enter whether domain is sharable (y,n) (default = y) : ",1))      info->sharable = SD_TRUE;    else      info->sharable = SD_FALSE;    data_entered = get_fname_list ((FILE_NAME *) cap_ptr,                                   1024,                  	           &info -> num_of_fname,  		                   cap_str);    if (data_entered)      {      if (info->third_pty_pres = (ST_BOOLEAN) ask ("\n Enter whether to send Third Party (y,n) (default = n) :",0))        {        info->third_pty = get_asn1_app_ref (&(info->third_pty_len), apref,        				   sizeof (apref));        }      }    }  /* end-if data_entered */  if (data_entered)    {    if (!mp_loaddom (chan,info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -		*/      {      if (start_cont ())		/* wait for 1st to complete		*/	return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/	{	if (!mp_loaddom (chan, info))	  break;	num_outstanding++;	if (cont_serve ())			/* if user hit a key		*/	  return;	}      cont_done ();			/* display results		*/      }    }  else    {    wait_msg ("\n Must enter all required information ");    }  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_storedom					*//* create and send a store domain content.				*//************************************************************************/ST_VOID do_storedom (ST_VOID)  {#if MMS_STR_DOM_EN & REQ_ENSTOREDOM_REQ_INFO  *info;ST_INT data_entered;ST_INT chan;ST_CHAR	temp[256];ST_UCHAR	apref[256];ST_CHAR	*fname_str;  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }  info	  = (STOREDOM_REQ_INFO *) (dest_buffer);  fname_str = (dest_buffer + 2048);  printf (" Enter Domain Name : (R) ");  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (info->dname,temp);    }  if (data_entered)    {        data_entered = get_fname_list ((FILE_NAME *) (info + 1),                                   1024,                	           &info -> num_of_fname,		                   fname_str);    if (data_entered)      {      if (info->third_pty_pres = (ST_BOOLEAN) ask ("\n Enter whether to send Third Party (y,n) (default = n) :",0))        {        info->third_pty = get_asn1_app_ref (&(info->third_pty_len), apref,      				   sizeof (apref));        }      }    }  if (data_entered)    {    if (!mp_storedom (chan,info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -	*/      {      if (start_cont ())		/* wait for 1st to complete	*/	return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/	{	if (!mp_storedom (chan, info))	  break;	num_outstanding++;	if (cont_serve ())		/* if user hit a key		*/	  return;	}      cont_done ();			/* display results		*/      }    }  else    wait_msg ("\n Must enter all required information ");  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_deldom					*//* create and send a delete domain request.				*//************************************************************************/ST_VOID do_deldom (ST_VOID)  {#if MMS_DEL_DOM_EN & REQ_ENDELDOM_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered;ST_CHAR	temp[256];  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }  printf (" Enter Domain Name : (R) ");  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (info.dname,temp);    }  if (data_entered)    {    if (!mp_deldom (chan,&info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -	*/      {      if (start_cont ())		/* wait for 1st to complete	*/	return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/	{	if (!mp_deldom (chan, &info))	  break;	num_outstanding++;	if (cont_serve ())		/* if user hit a key		*/	  return;	}      cont_done ();			/* display results		*/      }    }  else    wait_msg (" Must enter all Required Information ");  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_getdom					*//* create and send a get domain attribute request.			*//************************************************************************/ST_VOID do_getdom (ST_VOID)  {#if MMS_GET_DOM_EN & REQ_ENGETDOM_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered;ST_CHAR	temp[256];  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }  printf (" Enter Domain Name : (R) ");  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (info.dname,temp);    }  if (data_entered)    {    if (!mp_getdom (chan,&info))      print_req_error ();    if (num_reps)			/* if this an auto repeat -	*/      {      if (start_cont ())		/* wait for 1st to complete	*/	return;      num_outstanding = 1;      while (rep_count < num_reps)	/* if enough done -		*/	{	if (!mp_getdom (chan, &info))	  break;	num_outstanding++;	if (cont_serve ())		/* if user hit a key		*/	  return;	}      cont_done ();			/* display results		*/      }    }  else    wait_msg ("Must enter all Required Information ");  (*menu_set_fun) ();#endif  }/************************************************************************//*			do_add_named_dom				*//* Ask the user for and add a named domain to the virtual machine DB.	*//************************************************************************/ST_VOID do_add_named_dom (ST_VOID)  {#if MMS_NAMED_DOM_ENNAMED_DOM_CTRL *dom_ptr;ST_CHAR	pro;ST_BOOLEAN data_entered;ST_CHAR	temp[256];ST_INT chan;INITDOWN_REQ_INFO *dom_info;ST_CHAR	**list_ptr;ST_CHAR	*capab_str_ptr;  if (!get_chan (&chan))    {    (*menu_set_fun) ();    return;    }  printf (" Enter Named Domain to add: (R) ");  dom_info = (INITDOWN_REQ_INFO *)dest_buffer;  if (data_entered = strget (temp))    {    temp[MAX_IDENT_LEN] = '\x00';    strcpy (dom_info->dname,temp);    }  if (data_entered)    {    pro = (ST_CHAR) ask (" Is domain protected (y,n) (default = n) :",0);    }  if (data_entered)      {      list_ptr = (ST_CHAR **)(dom_info + 1);	/* ptrs start after struct */      capab_str_ptr = dest_buffer + 2048;		/* allow over a K for ptrs */      data_entered = SD_TRUE;      dom_info->num_of_capab = 0;      while (data_entered)        {        printf (" Enter Capability String : (O)");        if (data_entered = strget (capab_str_ptr))          {          *list_ptr = capab_str_ptr;          list_ptr++;          capab_str_ptr += strlen (capab_str_ptr) + 1;          dom_info->num_of_capab++;          }        }             if ((dom_ptr = ms_add_named_domain (dom_info, pro))        	!= NULL)        printf ("\n '%s' was added.", dom_info->dname);      else        printf ("\n '%s' was not added.", dom_info->dname);      wait_msg ("");      }  else

⌨️ 快捷键说明

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