📄 mmsasem.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 1997, All Rights Reserved. *//* *//* MODULE NAME : mmsasem.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains functions to initiate the MMS semaphore *//* management services. These functions are called from the *//* mainloop (check_key). *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#if (SYSTEM_SEL & (MSOFT | OS2))#include <conio.h>#endif#include "mms_usr.h"#include "mms_psem.h"#include "mmsop_en.h"#include "userdefs.h"#include "fkeydefs.h"#include "gvaldefs.h"/************************************************************************/static ST_BOOLEAN get_sem_name (OBJECT_NAME *);/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//* get_sem_name *//* get semaphore name from operator *//************************************************************************/static ST_BOOLEAN get_sem_name (OBJECT_NAME *info) {ST_BOOLEAN data_entered;ST_INT num;ST_CHAR temp[256]; printf (" (0:VMD-Specific, 1:DOM-Specific, 2:AA-Specific)"); printf ("\n Enter Semaphore Type : (default = 0) "); num = 0; intget (&num); if ((num == 0) || (num == 1) || (num == 2)) ; else num = 0; info->object_tag = num; switch (num) { case (0) : printf (" Enter VMD-Specific Name : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info->obj_name.vmd_spec, temp); } break; case (1) : printf (" DOM-Specific Name, Enter Domain Id : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info->domain_id, temp); printf (" Enter Item Id : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info->obj_name.item_id, temp); } } break; case (2) : printf (" Enter AA-Specific Name : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info->obj_name.aa_spec, temp); } break; } return (data_entered); }/************************************************************************//* do_takectrl *//* create and send a take control request *//************************************************************************/ST_VOID do_takectrl (ST_VOID) {#if MMS_TAKECTRL_EN & REQ_ENTAKECTRL_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_LONG lnum;ST_CHAR temp[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { printf (" Enter Named Token : (O) "); if (strget (temp)) { info.named_token_pres = SD_TRUE; temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.named_token,temp); } else info.named_token_pres = SD_FALSE; } if (data_entered) { printf (" Enter Priority Level : (O) "); if (longget (&lnum)) info.priority = (ST_UCHAR) lnum; else info.priority = 64; /* always the default priority */ } if (data_entered) { printf (" Enter Acceptable Delay Time : (O) "); if (longget (&lnum)) { info.acc_delay_pres = SD_TRUE; info.acc_delay = (ST_UINT) lnum; } else info.acc_delay_pres = SD_FALSE; } if (data_entered) { printf (" Enter Control Timeout : (O) "); if (longget (&lnum)) { info.ctrl_timeout_pres = SD_TRUE; info.ctrl_timeout = (ST_UINT) lnum; } else info.ctrl_timeout_pres = SD_FALSE; } if (ask (" Send Abort On Timeout ? ", 0)) { info.abrt_on_timeout_pres = SD_TRUE; if (ask (" Abort On Timeout TRUE ? ",1)) info.abrt_on_timeout = SD_TRUE; else info.abrt_on_timeout = SD_FALSE; } else info.abrt_on_timeout_pres = SD_FALSE; if (data_entered) { if (ask (" Relinquish if Connection Lost (y/n) ? ",1)) info.rel_conn_lost = SD_TRUE; else info.rel_conn_lost = SD_FALSE; } if (data_entered) { if (info.app_preempt_pres = (ST_BOOLEAN) ask ("\n Enter Application to Preempt? (N)",0)) { info.app_preempt = get_asn1_app_ref (&(info.app_len), (ST_UCHAR *)temp, sizeof (temp)); } } if (data_entered) { if (!mp_takectrl (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_takectrl (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_relctrl *//* create and send a relinquish control request *//************************************************************************/ST_VOID do_relctrl (ST_VOID) {#if MMS_RELCTRL_EN & REQ_ENRELCTRL_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_CHAR temp[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { printf (" Enter Named Token : (O) "); if (strget (temp)) { info.named_token_pres = SD_TRUE; temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.named_token,temp); } else info.named_token_pres = SD_FALSE; } if (data_entered) { if (!mp_relctrl (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_relctrl (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_rsstat *//* create and send a report semaphore status request *//************************************************************************/ST_VOID do_rsstat (ST_VOID) {#if MMS_REP_SEMSTAT_EN & REQ_ENRSSTAT_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { if (!mp_rsstat (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_rsstat (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_rspool *//* create and send a report pool semaphore status request *//************************************************************************/ST_VOID do_rspool (ST_VOID) {#if MMS_REP_SEMPOOL_EN & REQ_ENRSPOOL_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_CHAR temp[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { printf (" Enter Name to Start After : (O) "); if (strget (temp)) { info.start_after_pres = SD_TRUE; temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.start_after,temp); } else info.start_after_pres = SD_FALSE; } if (data_entered) { if (!mp_rspool (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_rspool (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_rsentry *//* create and send a report semaphore entry status request *//************************************************************************/ST_VOID do_rsentry (ST_VOID) {#if MMS_REP_SEMENTRY_EN & REQ_ENRSENTRY_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_INT num;ST_UCHAR temp[256]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { printf (" (0:queued, 1:owner, 2:hung)"); printf ("\n Enter Semaphore State : (default = 0) "); num = 0; intget (&num); if ((num == 0) || (num == 1) || (num == 2)) ; else num = 0; info.state = num; } if (data_entered) { if (ask (" Send Enter Entry Id to Start After ? ",0)) { info.start_after_pres = SD_TRUE; info.sa_len = input_hex (temp,200); info.start_after = temp; } else info.start_after_pres = SD_FALSE; } if (data_entered) { if (!mp_rsentry (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_rsentry (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_defsem *//* create and send a define semaphore request *//************************************************************************/ST_VOID do_defsem (ST_VOID) {#if MMS_DEFINE_SEM_EN & REQ_ENDEFSEM_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_INT num; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { printf (" Enter Number of Tokens : (default = 0) "); num = 0; intget (&num); info.num_of_tokens = (ST_UINT) num; } if (data_entered) { if (!mp_defsem (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_defsem (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_delsem *//* create and send a delete semaphore request *//************************************************************************/ST_VOID do_delsem (ST_VOID) {#if MMS_DELETE_SEM_EN & REQ_ENDELSEM_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } data_entered = get_sem_name (&info.sem_name); if (data_entered) { if (!mp_delsem (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_delsem (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 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -