📄 u_csem.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 1998, All Rights Reserved. *//* *//* MODULE NAME : u_csem.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains user confirm functions. These functions *//* are invoked from 'mms_req_serve' when the response to an *//* outstanding request is received. These functions should check *//* the resp_err member of the request control structure before *//* assuming returned data. *//* *//* NOTES ON REQUEST INFORMATION : *//* In the user application, request information structures may be *//* committed when the request is made (e.g. for error recovery). *//* If so, these information buffers could be freed in the confirm *//* functions. In the sample application, all request information *//* structures are automatic or handled when the request is issued. *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 08/24/98 EJV 02 Cleaned up printf from escape sequences. *//* 06/19/98 EJV 01 Mod u_mp_rspool_conf, eliminate __alpha warn */ /* 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_psem.h"#include "userdefs.h"#include "mmsop_en.h"#include "gvaldefs.h"#include "scrndefs.h"#include "fkeydefs.h"/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//************************************************************************//* SEMAPHORE MANAGEMENT *//************************************************************************//************************************************************************//* MP TAKE CONTROL *//************************************************************************/#if MMS_TAKECTRL_EN & REQ_ENST_VOID u_mp_takectrl_conf (MMSREQ_PEND *req_ptr) {TAKECTRL_RESP_INFO *rsp_ptr; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Take Control "); if (req_ptr->resp_err) list_err_info (req_ptr); else { rsp_ptr = (TAKECTRL_RESP_INFO *) req_ptr->resp_info_ptr; if (rsp_ptr->resp_tag == 1) /* named token */ printf ("\n Named Token : %s", rsp_ptr->named_token); } conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP RELINQUISH CONTROL *//************************************************************************/#if MMS_RELCTRL_EN & REQ_ENST_VOID u_mp_relctrl_conf (MMSREQ_PEND *req_ptr) { if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Relinquish Control "); if (req_ptr->resp_err) list_err_info (req_ptr); conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP REPORT SEMAPHORE STATUS *//************************************************************************/#if MMS_REP_SEMSTAT_EN & REQ_ENST_VOID u_mp_rsstat_conf (MMSREQ_PEND *req_ptr) {RSSTAT_RESP_INFO *rsp_ptr; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Report Semaphore Status "); if (req_ptr->resp_err) list_err_info (req_ptr); else { rsp_ptr = (RSSTAT_RESP_INFO *) req_ptr->resp_info_ptr; printf ("\n MMS Deletable : "); if (rsp_ptr->mms_deletable) printf ("YES"); else printf ("NO"); printf ("\n Semaphore Class : "); if (rsp_ptr->tclass == 0) printf ("Token "); else if (rsp_ptr->tclass == 1) printf ("Pool "); else /* this should never happen */ printf ("Error "); printf ("\n Number of Tokens : %u ", rsp_ptr->num_of_tokens); printf ("\n Number of Owned Tokens : %u ", rsp_ptr->num_of_owned); printf ("\n Number of Hung Tokens : %u ", rsp_ptr->num_of_hung); } conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP REPORT POOL SEMAPHORE STATUS *//************************************************************************/#if MMS_REP_SEMPOOL_EN & REQ_ENST_VOID u_mp_rspool_conf (MMSREQ_PEND *req_ptr) {RSPOOL_RESP_INFO *rsp_ptr;TOKEN_ID *token_ptr;ST_INT ch;ST_INT i;ST_INT line; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Report Pool Semaphore Status "); if (req_ptr->resp_err) list_err_info (req_ptr); else { rsp_ptr = (RSPOOL_RESP_INFO *) req_ptr->resp_info_ptr; token_ptr = (TOKEN_ID *) (rsp_ptr + 1); printf ("\n Number of Named Tokens Returned : %d", rsp_ptr->num_of_tokens); line = 14; for (i = 0; i < rsp_ptr->num_of_tokens; i++, token_ptr++) { switch (token_ptr->token_tag) { case (0) : printf ("\n %3d) Free Token : %s ", i+1, token_ptr->named_token); line++; break; case (1) : printf ("\n %3d) Owned Token : %s ", i+1, token_ptr->named_token); line++; break; case (2) : printf ("\n %3d) Hung Token : %s ", i+1, token_ptr->named_token); line++; break; } if ((line >= 21) && ((i + 1) < rsp_ptr->num_of_tokens)) { printf ("\n\n Press return to continue, x to exit"); ch = get_a_char (); if (ch == 'x' || ch == 'X') i = rsp_ptr->num_of_tokens; /* exit selected */ line = 14; } } if (rsp_ptr->more_follows) printf ("\n More Follows "); else printf ("\n No More Follows "); } conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP REPORT SEMAPHORE ENTRY STATUS *//************************************************************************/#if MMS_REP_SEMENTRY_EN & REQ_ENST_VOID u_mp_rsentry_conf (MMSREQ_PEND *req_ptr) {RSENTRY_RESP_INFO *rsp_ptr;SEMAPHORE_ENTRY *sent_ptr;ST_CHAR ch;ST_INT i; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Report Semaphore Entry Status "); if (req_ptr->resp_err) list_err_info (req_ptr); else { rsp_ptr = (RSENTRY_RESP_INFO *) req_ptr->resp_info_ptr; sent_ptr = (SEMAPHORE_ENTRY *) (rsp_ptr + 1); printf ("\n Number of Semaphore Entries Returned : %d", rsp_ptr->num_of_sent); for (i = 0; i < rsp_ptr->num_of_sent; i++, sent_ptr++) { printf ("\n Semaphore Entry : %d ", i+1); printf ("\n Entry Id : "); list_bytes (sent_ptr->entry_id, sent_ptr->ei_len); printf ("\n Entry Class : %d", sent_ptr->entry_class); printf ("\n Application Reference : "); list_bytes (sent_ptr->app_ref,sent_ptr->app_ref_len); printf ("\n Named Token : "); if (sent_ptr->named_token_pres) printf ("%s ", sent_ptr->named_token); else printf ("Not Present"); printf ("\n Priority : %u", sent_ptr->priority); printf ("\n Remaining Timeout : "); if (sent_ptr->rem_timeout_pres) printf ("%lu", sent_ptr->rem_timeout); else printf ("Not Present"); printf ("\n Abort On Timeout : "); if (sent_ptr->abrt_on_timeout_pres) printf ("%d", sent_ptr->abrt_on_timeout); else printf ("Not Present"); printf ("\n Relinquish if Connection Lost : "); if (sent_ptr->rel_conn_lost) printf ("YES"); else printf ("NO"); if ((i + 1) < rsp_ptr->num_of_sent) { printf ("\n\n Press return to continue, x to exit"); ch = get_a_char (); if (ch == 'x' || ch == 'X') i = rsp_ptr->num_of_sent; /* exit selected */ } } if (rsp_ptr->more_follows) printf ("\n More Follows"); else printf ("\n No More Follows"); } conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP DEFINE SEMAPHORE *//************************************************************************/#if MMS_DEFINE_SEM_EN & REQ_ENST_VOID u_mp_defsem_conf (MMSREQ_PEND *req_ptr) { if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Define Semaphore "); if (req_ptr->resp_err) list_err_info (req_ptr); conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP DELETE SEMAPHORE *//************************************************************************/#if MMS_DELETE_SEM_EN & REQ_ENST_VOID u_mp_delsem_conf (MMSREQ_PEND *req_ptr) { if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Delete Semaphore "); if (req_ptr->resp_err) list_err_info (req_ptr); conf_info_wait (); } /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -