📄 mmsamisc.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 2001, All Rights Reserved. *//* *//* MODULE NAME : mmsamisc.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains functions to perform miscellaneous MMS *//* services. These functions are called from the mainloop *//* (check_key). *//* *//* NOTE: All code related to parsing 'mms_log.cfg' is surrounded *//* by the constant 'CFG_FILE_LOGGING'. *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 11/29/01 EJV 15 Del code for old LATT, XENIX, ultrix, RMX86. *//* 10/05/01 EJV 14 Repl old MEMCHK_xxx_PRINT with MEM_LOG_xxx *//* 09/19/00 EJV 13 Deleted code in cont_serve resetting *//* rep_count to 1 after 25000 repetitions. *//* 10/02/98 EJV 12 Corrected getting SUILLogmask. *//* 06/19/98 EJV 11 Made static proto for m_readLogCfg. *//* 06/12/98 RKR 10 Added m_mem_debug *//* 05/04/98 IKE 09 Fixed the ms /transaction bug in DOS *//* 05/27/98 IKE 08 Removed data conversion warnings when *//* compiling in DOS platform *//* 04/03/98 RKR 07 moved strnicmp to cfg_util *//* 11/05/97 DSF 06 Added support for SYSTIME_EN *//* 10/23/97 RKR 05 Fixed the elapsed version of TimeEnable *//* 10/13/97 JRB 04 Add smp_debug_sel settings. *//* Use ipc_debug_sel instead of logMask6. *//* Fix LEAN_T/REDUCED_STACK includes. *//* 09/26/97 DSF 03 Added ACSE_ABORT_PRINT *//* 06/20/97 MDE 02 Use new ASN1 logging select defines *//* 05/27/97 DSF 01 Added IPC logging capabilities *//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#include <stdarg.h>#if (SYSTEM_SEL & (MSOFT | OS2))#ifndef __OS2__#include <dos.h>#endif#ifdef __OS2__#include <stdarg.h>#endif#include <conio.h>#include <process.h>#endif#if (SYSTEM_SEL & (OPEN_VMS))#include <descrip.h>#include <lib$routines.h>ST_INT kbhit ();ST_CHAR getkch ();ST_INT strcmpi (ST_CHAR*, ST_CHAR*); /* we made up a strcmpi of our own */#endif#include "mms_usr.h" /* to access MMS fucntions, variables */#include "mms_pevn.h" /* to access modifiers */#include "mmsop_en.h"#include "asn1defs.h" /* to access ASN.1 variables */#include "mem_chk.h"#include "userdefs.h"#include "gvaldefs.h"#include "fkeydefs.h" /* Function key handling */#include "scrndefs.h"#include "slog.h"#include "cfg_util.h"#if (defined (LEAN_T) || defined (REDUCED_STACK))#include "acse2usr.h"#include "tp4api.h"#include "clnp_usr.h"#include "smp_usr.h"#if defined (_WIN32)#include "rli_ipc.h"#endif /* _WIN32 */#endif /* (LEAN_T || REDUCED_STACK) */#ifdef PSOS_SYSTEM/* Need a definition for this function, */int strnicmp (char *,char *,int);#endif#ifdef CFG_FILE_LOGGING/* Control bit set/clear macros */#define M_SET_CTRL(a) {sLogCtrl->logCtrl |= (a);}#define M_CLR_CTRL(a) {sLogCtrl->logCtrl &= ~(a);}#define M_SET_FILE_CTRL(a) {sLogCtrl->fc.ctrl |= (a);}#define M_CLR_FILE_CTRL(a) {sLogCtrl->fc.ctrl &= ~(a);}#define M_SET_MEM_CTRL(a) {sLogCtrl->mc.ctrl |= (a);}#define M_CLR_MEM_CTRL(a) {sLogCtrl->mc.ctrl &= ~(a);}static ST_BOOLEAN user_file_log_en_flg; /* SD_TRUE if user set FileLogEn in cfg file */static ST_BOOLEAN user_mem_log_en_flg; /* SD_TRUE if user set MemLogEn in cfg file */ST_VOID m_set_parser_logging (ST_CHAR *log_filename);ST_CHAR log_file_name[ 100 ];ST_CHAR logmem_file_name[ 100 ];/*----- Internal functions prototypes for handling state tables -----*/ ST_VOID cfg_mlog_begin (ST_VOID);ST_VOID cfg_mlog_lc_begin (ST_VOID);ST_VOID cfg_mlog_lc_file_log_en (ST_VOID);ST_VOID cfg_mlog_lc_mem_log_en (ST_VOID);#ifdef LOG_IPC_SUPPORTST_VOID cfg_mlog_lc_ipc_log_en (ST_VOID);#endifST_VOID cfg_mlog_lc_hard_flush (ST_VOID);ST_VOID cfg_mlog_lc_no_append (ST_VOID);ST_VOID cfg_mlog_lc_no_msg_header (ST_VOID);ST_VOID cfg_mlog_lc_no_wipe (ST_VOID);ST_VOID cfg_mlog_lc_no_wrap (ST_VOID);ST_VOID cfg_mlog_lc_setbuf (ST_VOID);ST_VOID cfg_mlog_lc_end (ST_VOID);ST_VOID cfg_mlog_lm_memerr_log (ST_VOID);ST_VOID cfg_mlog_lm_calloc_log (ST_VOID);ST_VOID cfg_mlog_lm_malloc_log (ST_VOID);ST_VOID cfg_mlog_lm_realloc_log (ST_VOID);ST_VOID cfg_mlog_lm_free_log (ST_VOID);ST_VOID cfg_mic_m_mem_debug (ST_VOID);ST_VOID cfg_mic_m_fill_en (ST_VOID); ST_VOID cfg_mic_m_heap_check_enable (ST_VOID);ST_VOID cfg_mic_m_check_list_enable (ST_VOID);ST_VOID cfg_mic_m_find_node_enable (ST_VOID); ST_VOID cfg_mic_m_track_prev_free (ST_VOID); extern ST_BOOLEAN m_track_prev_free; /* so secret it's not in any header file*/ST_VOID cfg_mic_list_debug_sel (ST_VOID); ST_VOID cfg_mic_m_no_realloc_smaller (ST_VOID); ST_VOID cfg_mlog_asn1_log_dec (ST_VOID); ST_VOID cfg_mlog_asn1_log_enc (ST_VOID); ST_VOID cfg_mlog_asn1_log_err (ST_VOID); ST_VOID cfg_mlog_asn1_log_nerr (ST_VOID); ST_VOID cfg_mlog_mms_log_dec (ST_VOID); ST_VOID cfg_mlog_mms_log_enc (ST_VOID); ST_VOID cfg_mlog_mms_log_acse (ST_VOID); ST_VOID cfg_mlog_mms_log_llc (ST_VOID); ST_VOID cfg_mlog_mms_log_ique (ST_VOID); ST_VOID cfg_mlog_mms_log_rque (ST_VOID); ST_VOID cfg_mlog_mms_log_ind (ST_VOID); ST_VOID cfg_mlog_mms_log_conf (ST_VOID); ST_VOID cfg_mlog_mms_log_vm (ST_VOID); ST_VOID cfg_mlog_mms_log_data (ST_VOID); ST_VOID cfg_mlog_mms_log_err (ST_VOID); ST_VOID cfg_mlog_mms_log_nerr (ST_VOID); ST_VOID cfg_mlog_mms_log_pdu (ST_VOID); ST_VOID cfg_mlog_mms_log_config (ST_VOID); ST_VOID cfg_mlog_mms_log_rt (ST_VOID); ST_VOID cfg_mlog_mms_log_rtaa (ST_VOID); ST_VOID cfg_mlog_mms_log_aa (ST_VOID); ST_VOID cfg_mlog_mms_log_req (ST_VOID); ST_VOID cfg_mlog_mms_log_resp (ST_VOID); ST_VOID cfg_mlog_mmsconf_print (ST_VOID); ST_VOID cfg_mlog_mmsind_print (ST_VOID); ST_VOID cfg_mlog_acse_ind_print (ST_VOID); ST_VOID cfg_mlog_acse_cnf_print (ST_VOID); ST_VOID cfg_mlog_acse_err_print (ST_VOID); ST_VOID cfg_mlog_acse_nerr_print (ST_VOID); ST_VOID cfg_mlog_acse_abort_print (ST_VOID); ST_VOID cfg_mlog_acse_dec_print (ST_VOID); ST_VOID cfg_mlog_osak_print (ST_VOID); ST_VOID cfg_mlog_osak_deb (ST_VOID); ST_VOID cfg_mlog_acse_log_dec (ST_VOID);ST_VOID cfg_mlog_acse_log_enc (ST_VOID);ST_VOID cfg_mlog_tp4_log_flowdown (ST_VOID);ST_VOID cfg_mlog_tp4_log_flowup (ST_VOID);ST_VOID cfg_mlog_clnp_log_nerr (ST_VOID);ST_VOID cfg_mlog_clnp_log_req (ST_VOID);ST_VOID cfg_mlog_clnp_log_ind (ST_VOID);ST_VOID cfg_mlog_clnp_log_enc_dec (ST_VOID);ST_VOID cfg_mlog_clnp_log_llc_enc_dec (ST_VOID);ST_VOID cfg_mlog_clsns_log_req (ST_VOID);ST_VOID cfg_mlog_clsns_log_ind (ST_VOID);ST_VOID cfg_mlog_ipc_log_flow (ST_VOID);ST_VOID cfg_mlog_ipc_log_nerr (ST_VOID);ST_VOID cfg_mlog_smp_log_req (ST_VOID);ST_VOID cfg_mlog_smp_log_ind (ST_VOID);ST_VOID cfg_mlog_lm_end (ST_VOID);ST_VOID cfg_mlog_time_enable (ST_VOID);ST_VOID cfg_mlog_log_file_size (ST_VOID);ST_VOID cfg_mlog_log_file_name (ST_VOID);ST_VOID cfg_mlog_log_mem_items (ST_VOID);ST_VOID cfg_mlog_dump_file_name (ST_VOID);ST_VOID cfg_mlog_mem_auto_dump (ST_VOID);#ifdef LOG_IPC_SUPPORTST_VOID cfg_mlog_ip_addr (ST_VOID);ST_VOID cfg_mlog_identifier (ST_VOID);#endifST_VOID cfg_mlog_end (ST_VOID);static ST_VOID m_readLogCfg (ST_CHAR * logging_control_filename, LOG_CTRL *lc);/************************************************************************//* Uncomment this define to compile in a bunch of printf statments *//* that show up when a keyword is encountered *//*#define S_TABLE_DEBUG*/struct cfg_kw_el mlog_base_kwtbl[] = { {"%LogBegin", cfg_mlog_begin, NULL }, { NULL, NULL, NULL} };struct cfg_kw_el mlog_log_mask_kwtbl[] = { /* Memory use logging */ {"MEM_LOG_ERR", cfg_mlog_lm_memerr_log, NULL }, {"MEM_LOG_CALLOC", cfg_mlog_lm_calloc_log, NULL }, {"MEM_LOG_MALLOC", cfg_mlog_lm_malloc_log, NULL }, {"MEM_LOG_REALLOC", cfg_mlog_lm_realloc_log, NULL }, {"MEM_LOG_FREE", cfg_mlog_lm_free_log, NULL }, /* Integrity checking on buffers */ {"m_mem_debug", cfg_mic_m_mem_debug, NULL }, {"m_fill_en", cfg_mic_m_fill_en, NULL }, {"m_heap_check_enable", cfg_mic_m_heap_check_enable, NULL }, {"m_check_list_enable", cfg_mic_m_check_list_enable, NULL }, {"m_find_node_enable", cfg_mic_m_find_node_enable, NULL }, {"m_track_prev_free", cfg_mic_m_track_prev_free, NULL }, {"list_debug_sel", cfg_mic_list_debug_sel, NULL }, {"m_no_realloc_smaller", cfg_mic_m_no_realloc_smaller, NULL }, /* ASN.1 Log masks */ {"ASN1_LOG_DEC", cfg_mlog_asn1_log_dec, NULL }, {"ASN1_LOG_ENC", cfg_mlog_asn1_log_enc, NULL }, {"ASN1_LOG_ERR", cfg_mlog_asn1_log_err, NULL }, {"ASN1_LOG_NERR", cfg_mlog_asn1_log_nerr, NULL }, /* MMS Demo Log masks */ {"MMS_LOG_DEC", cfg_mlog_mms_log_dec, NULL }, {"MMS_LOG_ENC", cfg_mlog_mms_log_enc, NULL }, {"MMS_LOG_ACSE", cfg_mlog_mms_log_acse, NULL }, {"MMS_LOG_LLC", cfg_mlog_mms_log_llc, NULL }, {"MMS_LOG_IQUE", cfg_mlog_mms_log_ique, NULL }, {"MMS_LOG_RQUE", cfg_mlog_mms_log_rque, NULL }, {"MMS_LOG_IND", cfg_mlog_mms_log_ind, NULL }, {"MMS_LOG_CONF", cfg_mlog_mms_log_conf, NULL }, {"MMS_LOG_REQ", cfg_mlog_mms_log_req, NULL }, {"MMS_LOG_RESP", cfg_mlog_mms_log_resp, NULL }, {"MMS_LOG_VM", cfg_mlog_mms_log_vm, NULL }, {"MMS_LOG_DATA", cfg_mlog_mms_log_data, NULL }, {"MMS_LOG_ERR", cfg_mlog_mms_log_err, NULL }, {"MMS_LOG_NERR", cfg_mlog_mms_log_nerr, NULL }, {"MMS_LOG_PDU", cfg_mlog_mms_log_pdu, NULL }, {"MMS_LOG_CONFIG", cfg_mlog_mms_log_config, NULL }, {"MMS_LOG_RT", cfg_mlog_mms_log_rt, NULL }, {"MMS_LOG_RTAA", cfg_mlog_mms_log_rtaa, NULL }, {"MMS_LOG_AA", cfg_mlog_mms_log_aa, NULL }, {"MMS_LOG_USR_CONF", cfg_mlog_mmsconf_print, NULL }, {"MMSCONF_PRINT", cfg_mlog_mmsconf_print, NULL }, {"MMS_LOG_USR_IND", cfg_mlog_mmsind_print, NULL }, {"MMSIND_PRINT", cfg_mlog_mmsind_print, NULL }, /* SUIC log masks */ {"ACSE_IND_PRINT", cfg_mlog_acse_ind_print, NULL }, {"ACSE_CNF_PRINT", cfg_mlog_acse_cnf_print, NULL }, {"ACSE_ERR_PRINT", cfg_mlog_acse_err_print, NULL }, {"ACSE_NERR_PRINT", cfg_mlog_acse_nerr_print, NULL }, {"ACSE_ABORT_PRINT", cfg_mlog_acse_abort_print, NULL }, {"ACSE_DEC_PRINT", cfg_mlog_acse_dec_print, NULL }, /* DECnet/OSI SUIC needs extra help!! */ {"OSAK_PRINT", cfg_mlog_osak_print, NULL }, {"OSAK_DEB", cfg_mlog_osak_deb, NULL }, {"ACSE_LOG_DEC", cfg_mlog_acse_log_dec, NULL }, {"ACSE_LOG_ENC", cfg_mlog_acse_log_enc, NULL }, {"TP4_LOG_FLOWDOWN", cfg_mlog_tp4_log_flowdown, NULL }, {"TP4_LOG_FLOWUP", cfg_mlog_tp4_log_flowup, NULL }, {"IPC_LOG_FLOW", cfg_mlog_ipc_log_flow, NULL }, {"IPC_LOG_NERR", cfg_mlog_ipc_log_nerr, NULL }, {"SMP_LOG_REQ", cfg_mlog_smp_log_req, NULL }, {"SMP_LOG_IND", cfg_mlog_smp_log_ind, NULL }, {"CLNP_LOG_NERR", cfg_mlog_clnp_log_nerr, NULL }, {"CLNP_LOG_REQ", cfg_mlog_clnp_log_req, NULL }, {"CLNP_LOG_IND", cfg_mlog_clnp_log_ind, NULL }, {"CLNP_LOG_ENC_DEC", cfg_mlog_clnp_log_enc_dec, NULL }, {"CLNP_LOG_LLC_ENC_DEC", cfg_mlog_clnp_log_llc_enc_dec, NULL }, {"CLSNS_LOG_REQ", cfg_mlog_clsns_log_req, NULL }, {"CLSNS_LOG_IND", cfg_mlog_clsns_log_ind, NULL }, {"FileLogEn", cfg_mlog_lc_file_log_en, NULL }, {"MemLogEn", cfg_mlog_lc_mem_log_en, NULL },#ifdef LOG_IPC_SUPPORT {"IpcLogEn", cfg_mlog_lc_ipc_log_en, NULL },#endif /* Misc. Control Flags */ {"TimeEnable", cfg_mlog_time_enable, NULL }, {"HardFlush", cfg_mlog_lc_hard_flush, NULL }, {"NoAppend", cfg_mlog_lc_no_append, NULL }, {"NoMsgheader", cfg_mlog_lc_no_msg_header, NULL }, {"NoWipe", cfg_mlog_lc_no_wipe, NULL }, {"NoWrap", cfg_mlog_lc_no_wrap, NULL }, {"Setbuf", cfg_mlog_lc_setbuf, NULL },#ifdef LOG_IPC_SUPPORT {"IpAddr", cfg_mlog_ip_addr, NULL }, {"Identifier", cfg_mlog_identifier, NULL },#endif /* Log File Attributes */ {"LogFileSize", cfg_mlog_log_file_size, NULL }, {"LogFileName", cfg_mlog_log_file_name, NULL }, /* Memory Resident Logging Attributes */ {"LogMemItems", cfg_mlog_log_mem_items, NULL }, {"DumpFileName", cfg_mlog_dump_file_name, NULL }, {"MemAutoDump", cfg_mlog_mem_auto_dump, NULL }, {"%LogEnd", cfg_mlog_end, NULL}, { NULL, NULL, NULL} };#endif /* CFG_FILE_LOGGING */#ifdef MAP30_ACSE#include "suicacse.h" /* if not OPP, use SUIC include file */#endif/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//* This MMS-EASE internal variable can be set SD_TRUE in order to validate *//* and log internal MMS-EASE queue activity */extern ST_BOOLEAN m_que_validate;/************************************************************************/ST_VOID screenLogFun (LOG_CTRL *lc, ST_INT logType, ST_CHAR *sourceFile, ST_INT lineNum, ST_INT bufLen, ST_CHAR *buf);#if (SYSTEM_SEL & (OPEN_VMS))ST_INT strnicmp (ST_CHAR *,ST_CHAR *,ST_INT);#endif/************************************************************************//* print_req_error *//************************************************************************/ST_VOID print_req_error (ST_VOID) { print_perror_wait (mms_op_err,"\n ERROR : request not sent : "); }#ifdef __OS2__ST_VOID print_perror_wait (ST_INT code,ST_CHAR *str,...) { va_list ap; va_start (ap,str); vprintf (str,ap); ms_perror (code); wait_key (); va_end (ap); }#elseST_VOID print_perror_wait (ST_INT code, ST_CHAR *format, ...) {va_list ap;ST_CHAR buf[200]; va_start (ap,format); vsprintf (buf, format, ap); va_end (ap);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -