📄 mmsafil.c
字号:
(*menu_set_fun) ();#endif }/************************************************************************//* do_fclose *//* create and send a file close request *//************************************************************************/ST_VOID do_fclose (ST_VOID) {#if MMS_MV_FCLOSE_EN & REQ_ENST_INT chan;ST_BOOLEAN data_entered;ST_INT refnum; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf ("\n Enter Remote File Reference Number : (R) "); if (data_entered = intget (&refnum)) { if (m_rem_fctrl_info.stat [refnum] != 2) { wait_msg ("Remote File NOT open "); (*menu_set_fun) (); return; } } if (data_entered) { if (!(mv_fclose (chan,refnum))) print_req_error (); } else wait_msg ("\n Must Enter All Required Information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_frename *//* create and send a file rename request *//************************************************************************/ST_VOID do_frename (ST_VOID) {#if MMS_FRENAME_EN & REQ_ENST_INT chan;ST_INT data_entered;FRENAME_REQ_INFO *req_info;ST_CHAR *fname_str;FILE_NAME *fname_idx; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } req_info = (FRENAME_REQ_INFO *) (dest_buffer); /* use 3 - 5K for file names */ fname_str = (dest_buffer + 2048); printf ("\n Enter Current File Name : \n"); fname_idx = (FILE_NAME *)(req_info + 1); data_entered = get_fname_list (fname_idx, 1024, &req_info -> num_of_cur_fname, fname_str); if (data_entered) { printf ("\n Enter New File Name : \n"); fname_idx += req_info -> num_of_cur_fname; fname_str = (dest_buffer + 3072); data_entered = get_fname_list (fname_idx, 1024, &req_info -> num_of_new_fname, fname_str); } if (data_entered) { if (!mp_frename (chan,req_info)) print_req_error (); } else wait_msg ("\n Must Enter All Required Information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_fdelete *//* create and send a file delete request *//************************************************************************/ST_VOID do_fdelete (ST_VOID) {#if MMS_FDELETE_EN & REQ_ENST_INT chan;ST_INT data_entered;FDELETE_REQ_INFO *req_info;ST_CHAR *fname_str; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } req_info = (FDELETE_REQ_INFO *) (dest_buffer); /* use 3 - 4K for file names */ fname_str = (dest_buffer + 2048); data_entered = get_fname_list ((FILE_NAME *)(req_info + 1), 1024, &req_info -> num_of_fname, fname_str); if (data_entered) { if (!mp_fdelete (chan,req_info)) print_req_error (); } else wait_msg ("\n Must Enter All Required Information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_fdir *//* create and send a file directory request *//************************************************************************/ST_VOID do_fdir (ST_VOID) {#if MMS_FDIR_EN & REQ_ENST_INT chan;FDIR_REQ_INFO *req_info;ST_CHAR *fname_str;ST_INT data_entered;FILE_NAME *fname_idx; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } req_info = (FDIR_REQ_INFO *) (dest_buffer); /* use 3 - 5K for file names */ fname_str = (dest_buffer + 2048); printf (" Enter File Specification : \n"); fname_idx = (FILE_NAME *)(req_info + 1); data_entered = get_fname_list (fname_idx, 1024, &req_info -> num_of_fs_fname, fname_str); if (data_entered) req_info->filespec_pres = 1; /* file spec was entered */ else req_info->filespec_pres = 0; /* no file spec was entered */ printf (" Enter Continue After Name : \n"); fname_idx += req_info -> num_of_fs_fname; fname_str = (dest_buffer + 3072); data_entered = get_fname_list (fname_idx, 1024, &req_info -> num_of_ca_fname, fname_str); if (data_entered) req_info->cont_after_pres = 1; /* continue after was entered */ else req_info->cont_after_pres = 0; /* no continue after entered */ if (!(mp_fdir (chan,req_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_fdir (chan, req_info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } (*menu_set_fun) ();#endif }/************************************************************************//* do_disp_loc_files *//* Function to display local files that are opened over the network *//************************************************************************/ST_VOID do_disp_loc_files (ST_VOID) {FCTRL_INFO *finfo;register i; CLEARSCR; printf ("\n\n %d Local Files opened over network : ",m_loc_files_open); printf ("\n\n Filename Channel"); for (i = 0; i < max_loc_open; ++i) { if (m_local_fctrl_info.stat[i]) { finfo = m_local_fctrl_info.finfo[i]; printf ("\n%-32s %-2d", finfo->path, finfo->chan); } } wait_msg ("\n\n Hit any key to continue "); (*menu_set_fun) (); }/************************************************************************//* do_disp_rem_files *//* Function to display remote files that have been opened by this node *//************************************************************************/ST_VOID do_disp_rem_files (ST_VOID) {FCTRL_INFO *finfo;register i; CLEARSCR; printf ("\n\n %d Remote Files opened by this node : ",m_rem_files_open); printf ("\n\n Ref # Filename Channel FRSMID Size"); for (i = 0; i < max_rem_open; ++i) { if (m_rem_fctrl_info.stat[i]) { finfo = m_rem_fctrl_info.finfo[i]; printf ("\n %-2d %-32s %2d %3ld %6ld",i, finfo->path, finfo->chan, finfo->frsmid, finfo->fsize); } } wait_msg ("\n\n Hit any key to continue "); (*menu_set_fun) (); }/************************************************************************//* get_asn1_app_ref *//* Function to get ApplicationReference data from the user and return *//* the ASN.1 encoded form. *//************************************************************************/ST_UCHAR *get_asn1_app_ref (ST_INT *asn1_len, ST_UCHAR *build_buf_ptr, ST_INT build_buf_len) {APP_REF dest_ptr;ST_UCHAR *asn1_ptr = NULL; get_app_ref (&dest_ptr); ms_appref_to_asn1(&dest_ptr, build_buf_ptr, build_buf_len, &asn1_ptr, asn1_len); return (asn1_ptr); }/************************************************************************//* get_app_ref *//* Function to get ApplicationReference data from the user. *//************************************************************************/ST_VOID get_app_ref (APP_REF *dest_ptr) {ST_BOOLEAN data_entered = SD_TRUE;ST_INT i = 0;ST_LONG val; dest_ptr->form = APP_REF_FORM2; dest_ptr->ap_title.form_2.num_comps = 0; dest_ptr->ap_title_pres = SD_FALSE; while ((i < MAX_OBJID_COMPONENTS) && (data_entered)) { printf (" Enter AP-Title Component : (O)"); if (data_entered = (ST_BOOLEAN) intget ((ST_INT *) &(dest_ptr->ap_title.form_2.comps[i]))) { i++; dest_ptr->ap_title.form_2.num_comps++; } } if (dest_ptr->ap_title.form_2.num_comps) dest_ptr->ap_title_pres = SD_TRUE; printf (" Enter AP-Invocation-Id : (O)"); dest_ptr->ap_invoke_pres = (ST_BOOLEAN) longget (&val); if (dest_ptr->ap_invoke_pres) dest_ptr->ap_invoke = (ST_INT32) val; printf (" Enter AE-Qualifier : (O)"); dest_ptr->ae_qual_pres = (ST_BOOLEAN) longget (&val); if (dest_ptr->ae_qual_pres) dest_ptr->ae_qual.form_2 = (ST_INT32) val; printf (" Enter AE-Invocation-Id : (O)"); dest_ptr->ae_invoke_pres = (ST_BOOLEAN) longget (&val); if (dest_ptr->ae_invoke_pres) dest_ptr->ae_invoke = (ST_INT32) val; }/************************************************************************//* print_asn1_app_ref *//* Function to convert ApplicationReference ASN.1 encoded data into an *//* intermediately printable form. *//************************************************************************/ST_VOID print_asn1_app_ref (ST_UCHAR *buf_ptr, ST_INT buf_len) {APP_REF ar_ref; ms_asn1_to_appref (&ar_ref, buf_ptr, buf_len); print_app_ref (&ar_ref); }/************************************************************************//* print_app_ref *//* Function to convert ApplicationReference ASN.1 encoded data into an *//* intermediately printable form. *//************************************************************************/ST_VOID print_app_ref (APP_REF *app_ref_ptr) {ST_INT i; printf ("\n Number of AP-Title Components: %d", app_ref_ptr->ap_title.form_2.num_comps); for (i=0; i < app_ref_ptr->ap_title.form_2.num_comps; i++) { printf ("\n AP-Title comp[%d] is: %d",i,app_ref_ptr->ap_title.form_2.comps[i]); } printf ("\n AP-Invocation-Id: "); if (app_ref_ptr->ap_invoke_pres) printf ("%ld",app_ref_ptr->ap_invoke); else printf ("Not present"); printf ("\n AE-Qualifier: "); if (app_ref_ptr->ae_qual_pres) printf ("%ld",app_ref_ptr->ae_qual.form_2); else printf ("Not present"); printf ("\n AE-Invoke-Id: "); if (app_ref_ptr->ae_invoke_pres) printf ("%ld",app_ref_ptr->ae_invoke); else printf ("Not present"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -