📄 mmsavar.c
字号:
{ (*menu_set_fun) (); return; } nxt_buf = source_buf; printf ("\n Enter type of Variable Access Attribute :\n "); printf (" (0:Name, 1:Address)"); printf ("\n Enter Choice (default = 0) : "); num = GETVAR_NAME; intget (&num); if (num != GETVAR_NAME && num != GETVAR_ADDR) num = GETVAR_NAME; info.req_tag = num; if (info.req_tag == GETVAR_NAME) /* object name request */ { printf ("\n For Named Variable :"); data_entered = get_objname (&info.name); } else /* address request */ { printf ("\n For MMS Address :\n"); data_entered = get_address (&info.address); } if (data_entered && !mp_getvar (chan, &info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_getvar (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) ();#endif }/************************************************************************//* do_defvar *//* send define variable name *//************************************************************************/#define ASN1BUF_LEN 40ST_UCHAR *ms_mk_named_type_asn1 (OBJECT_NAME *type, ST_INT buflen, ST_UCHAR *buffer, ST_INT *asn1len);ST_VOID do_defvar (ST_VOID) {#if MMS_DEFVAR_EN & REQ_ENDEFVAR_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered;ST_INT len;OBJECT_NAME type;ST_UCHAR asn1buf[ASN1BUF_LEN]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } nxt_buf = source_buf; printf ("\n Enter Variable Name :"); data_entered = get_objname (&info.name); if (data_entered) data_entered = get_address (&info.address); if (data_entered) { info.type_spec_pres = SD_FALSE; if (ask ("\n Do you want to use existing Named Type (y,n) (default = y) : ", SD_TRUE)) { printf ("\n Select Type : "); if (get_objname (&type)) { info.type_spec.data = ms_mk_named_type_asn1 (&type, ASN1BUF_LEN,asn1buf,&info.type_spec.len); info.type_spec_pres = SD_TRUE; if (!ms_find_named_type_obj (&type,chan)) printf ("\n NOTE : Local Type Not Found"); } } else { info.type_spec.data = (ST_UCHAR *)nxt_buf; if (len = get_var_data ("ASN.1 Type Specification", info.type_spec.data)) { info.type_spec_pres = SD_TRUE; info.type_spec.len = len; nxt_buf += len; } } } if (data_entered && !mp_defvar (chan, &info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_defvar (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) (); /* all done */#endif }/************************************************************************//* do_delvar *//* create and send a delete variable name request. *//************************************************************************/ST_VOID do_delvar (ST_VOID) {#if MMS_DELVAR_EN & REQ_ENDELVAR_REQ_INFO *info;ST_INT chan;ST_INT num;ST_BOOLEAN done;ST_BOOLEAN data_entered;ST_CHAR temp [256];OBJECT_NAME *obj_ptr; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } info = (DELVAR_REQ_INFO *) dest_buffer; nxt_buf = source_buf; printf ("\n Enter the Scope of Variable Access :"); printf ("\n (0:Specific, 1:AA-Specific, 2:Domain, 3:VMD) :"); printf ("\n Enter choice (default = 0) : "); num = DELVAR_SPEC; intget (&num); if (num != DELVAR_SPEC && num != DELVAR_AA && num != DELVAR_DOM && num != DELVAR_VMD) { num = DELVAR_SPEC; } info->scope = num; done = SD_FALSE; info->vnames_pres = SD_FALSE; info->num_of_vnames = 0; obj_ptr = (OBJECT_NAME *) (info + 1); printf ("\nEnter List of Names : (O)"); while (!done) { data_entered = get_objname (obj_ptr); if (data_entered) { info->vnames_pres = SD_TRUE; info->num_of_vnames++; obj_ptr++; } else done = SD_TRUE; } printf (" Enter Domain Name : (O) "); if (strget (temp)) { info->dname_pres = SD_TRUE; temp [MAX_IDENT_LEN] = '\x00'; strcpy (info->dname,temp); } else info->dname_pres = SD_FALSE; if (!mp_delvar (chan, info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_delvar (chan, info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) (); /* all done */#endif }/************************************************************************//************************************************************************//* do_defscat *//* create and send a define scattered access request. *//************************************************************************/ST_VOID do_defscat (ST_VOID) {#if MMS_DEFSCAT_EN & REQ_ENDEFSCAT_REQ_INFO info;ST_INT chan;ST_INT len;ST_BOOLEAN data_entered; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } nxt_buf = source_buf; data_entered = get_objname (&info.sa_name); if (data_entered) { info.sa_descr.data = (ST_UCHAR *)nxt_buf; if (len = get_var_data ("Scattered Access", info.sa_descr.data)) { info.sa_descr.len = len; nxt_buf += len; } else data_entered = SD_FALSE; } if (data_entered && !mp_defscat (chan, &info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_defscat (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) ();#endif }/************************************************************************//* do_getscat *//* create and send a get scattered access attributes request. *//************************************************************************/ST_VOID do_getscat (ST_VOID) {#if MMS_GETSCAT_EN & REQ_ENGETSCAT_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf ("\n Enter Scattered Access Name : "); data_entered = get_objname (&info.sa_name); if (data_entered && !mp_getscat (chan, &info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_getscat (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) ();#endif }/************************************************************************//* do_defvlist *//* create and send a define named variable list request. *//************************************************************************/ST_VOID do_defvlist (ST_VOID) {#if MMS_DEFVLIST_EN & REQ_ENDEFVLIST_REQ_INFO *info;VARIABLE_LIST *vl_ptr;ST_INT chan;ST_BOOLEAN data_entered; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } info = (DEFVLIST_REQ_INFO *) dest_buffer; nxt_buf = source_buf; data_entered = get_objname (&info->vl_name); if (data_entered) { vl_ptr = (VARIABLE_LIST *) (info + 1); get_var_list (vl_ptr, &info->num_of_variables,SD_TRUE); } if (data_entered && !mp_defvlist (chan, info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_defvlist (chan, info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) ();#endif }/************************************************************************//* do_getvlist *//* create and send a get named variable list attributes request. *//************************************************************************/ST_VOID do_getvlist (ST_VOID) {#if MMS_GETVLIST_EN & REQ_ENGETVLIST_REQ_INFO info;ST_INT chan;ST_BOOLEAN data_entered; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_objname (&info.vl_name); if (data_entered && !mp_getvlist (chan, &info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_getvlist (chan, &info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) ();#endif }/************************************************************************//* do_delvlist *//* create and send a delete named variable list request. *//************************************************************************/ST_VOID do_delvlist (ST_VOID) {#if MMS_DELVLIST_EN & REQ_ENDELVLIST_REQ_INFO *info;ST_INT chan;ST_INT num;ST_BOOLEAN done;ST_BOOLEAN data_entered;ST_CHAR temp [256];OBJECT_NAME *obj_ptr; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } info = (DELVLIST_REQ_INFO *) dest_buffer; printf ("\n (0:Specific, 1:AA-Specific, 2:Domain, 3:VMD)"); printf ("\n Enter Scope of Delete (default = 0) :\n"); num = DELVAR_SPEC; intget (&num); if (num != DELVL_SPEC && num != DELVL_AA && num != DELVL_DOM && num != DELVL_VMD) { num = DELVAR_SPEC; } info->scope = num; done = SD_FALSE; info->vnames_pres = SD_FALSE; info->num_of_vnames = 0; obj_ptr = (OBJECT_NAME *) (info + 1); printf (" Enter List of Names : (O) "); while (!done) { data_entered = get_objname (obj_ptr); if (data_entered) { info->vnames_pres = SD_TRUE; info->num_of_vnames++; obj_ptr++; } else done = SD_TRUE; } printf (" Enter Domain Name : (O) "); if (strget (temp)) { info->dname_pres = SD_TRUE; temp [MAX_IDENT_LEN] = '\x00'; strcpy (info->dname,temp); } else info->dname_pres = SD_FALSE; if (!mp_delvlist (chan, info)) print_req_error (); else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; /* we already sent 1 */ while (rep_count < num_reps) /* if enough done - */ { if (!mp_delvlist (chan, info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } (*menu_set_fun) (); /* all done */#endif }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -