mmsadom.c
来自「ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包」· C语言 代码 · 共 1,485 行 · 第 1/3 页
C
1,485 行
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 1997, All Rights Reserved. *//* *//* MODULE NAME : mmsadom.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains functions to initiate the MMS domain *//* management services. These functions are called from the *//* mainloop (check_key). *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 05/27/98 IKE 04 Removed data conversion warnings when *//* compiling in DOS platform *//* 02/05/98 EJV 03 The #... must be at the beginning of line. *//* 10/20/97 DSF 02 No more M_USE_BSEARCH *//* 06/03/97 RKR 01 Changed do_list_named_dom *//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//*************************************************************************/#include "glbtypes.h"#include "sysincs.h"#include "mms_usr.h"#include "mms_pdom.h"#include "mms_vdom.h"#include "mms_vvmd.h"#include "mmsop_en.h"#include "userdefs.h"#include "fkeydefs.h"#include "gvaldefs.h"#include "scrndefs.h"static ST_CHAR *load_data_ptr;static ST_INT load_data_len;/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//************************************************************************//* do_initdown *//* create and send an initiate download sequence request. *//************************************************************************/ST_VOID do_initdown (ST_VOID) {#if MMS_INIT_DWN_EN & REQ_ENINITDOWN_REQ_INFO *info;ST_CHAR **cap_ptr;ST_CHAR *cap_str;ST_INT chan;ST_INT tot_len;ST_BOOLEAN done;ST_BOOLEAN data_entered;ST_CHAR temp[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } /* use first 2K of user 'dest_buffer' for request structure */ info = (INITDOWN_REQ_INFO *) (dest_buffer); cap_ptr = (ST_CHAR **) (info + 1); /* use 3 - 10K for the output data strings */ 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) < 8192) { 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; } if (ask ("\n Enter whether domain is sharable (y=TRUE, n=FALSE) (default = y) : ",1)) info->sharable = SD_TRUE; else info->sharable = SD_FALSE; if (!mp_initdown (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_initdown (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_download *//* create and send a download segment request. *//************************************************************************/ST_VOID do_download (ST_VOID) {#if MMS_DWN_LOAD_EN & REQ_ENDOWNLOAD_REQ_INFO info;ST_CHAR temp [100];ST_BOOLEAN data_entered;ST_INT chan; 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_download (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_download (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_termdown *//* create and send a terminate download sequence request. *//************************************************************************/ST_CHAR er_descr[] = "ED";ST_UCHAR ssi_data[] = {1,2};ST_VOID do_termdown (ST_VOID) {#if MMS_TERM_DWN_EN & REQ_ENTERMDOWN_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered;ST_CHAR temp [100];ERR_INFO err; 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) { info.discarded = (ST_BOOLEAN) ask (" Did you discard a partially downloaded domain (y,n) (default = n) :",0); if (info.discarded) { if (mms_chan_info[chan].version) /* IS */ { info.err = &err; err.eclass = 0; /* make VMD STATE error */ err.code = 3; /* make DOMAIN TRANSFER error */ if (ask (" Do you want to send additional Error Info (y,n) (default = n) : ",0)) { err.adtnl.info_pres = SD_TRUE; err.adtnl.code_pres = SD_TRUE; err.adtnl.code = 1234567L; err.adtnl.descr_pres = SD_TRUE; err.adtnl.descr = er_descr; err.adtnl.ssi_pres = SD_TRUE; err.adtnl.service = 2; err.adtnl.ss_error_val = 2; } else { err.adtnl.info_pres = SD_FALSE; err.adtnl.mod_pos_pres = SD_FALSE; } } /* MMS IS */ } /* discarded */ if (!mp_termdown (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_termdown (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_initupl *//* create and send an initiate upload sequence request. *//************************************************************************/ST_VOID do_initupl (ST_VOID) {#if MMS_INIT_UPL_EN & REQ_ENINITUPL_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_initupl (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_initupl (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_upload *//* create and send an upload segment request. *//************************************************************************/ST_VOID do_upload (ST_VOID) {#if MMS_UP_LOAD_EN & REQ_ENUPLOAD_REQ_INFO info;ST_INT chan;ST_LONG num; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf (" Enter Upload State Machine Id (default = 0) :"); if (longget (&num)) info.ulsmid = (ST_INT32) num; else info.ulsmid = 0; if (!mp_upload (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_upload (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } (*menu_set_fun) ();#endif }/************************************************************************//* do_termupl *//* create and send a terminate upload sequence request. *//************************************************************************/ST_VOID do_termupl (ST_VOID) {#if MMS_TERM_UPL_EN & REQ_ENTERMUPL_REQ_INFO info;ST_INT chan;ST_LONG num; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf (" Enter Upload State Machine Id (default = 0) : "); if (longget (&num)) info.ulsmid = (ST_INT32) num; else info.ulsmid = 0; if (!mp_termupl (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_termupl (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } (*menu_set_fun) ();#endif }/************************************************************************//* do_rddwn *//* create and send a request domain download request. *//************************************************************************/ST_VOID do_rddwn (ST_VOID) {#if MMS_RDDWN_EN & REQ_ENRDDWN_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[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } /* use first 2K of user 'dest_buffer' for request structure */ info = (RDDWN_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);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?