📄 mmsamisc.c
字号:
printf (buf); ms_perror (code); wait_key (); }#endif/************************************************************************//* do_sys_com *//* function to invoke a system command *//************************************************************************/ST_VOID do_sys_com (ST_VOID) {#if !defined (_WINDOWS)ST_CHAR command [255];#if (SYSTEM_SEL & (OPEN_VMS))struct dsc$descriptor_s command_string;#endif CLEARSCR; printf (" Enter system command : "); if (strget (command)) {#if (SYSTEM_SEL & (OPEN_VMS)) command_string.dsc$b_dtype = DSC$K_DTYPE_T; command_string.dsc$b_class = DSC$K_CLASS_S; command_string.dsc$w_length = strlen (command); command_string.dsc$a_pointer = command; lib$spawn (&command_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);#else#ifndef PSOS_SYSTEM if (system (command)) perror (" Could Not Execute Command : ");#else perror (" Cannot do a system command in PSOS");#endif#endif wait_msg (" Hit Any Key to Return to MAIN MENU "); } (*menu_set_fun) ();#endif }/************************************************************************//* do_debugset *//* function to change the selected debug levels *//************************************************************************/ST_VOID do_debugset (ST_VOID) { CLEARSCR; printf ("\n MMS-EASE Demo Logging - \n"); get_ldebug (&mms_debug_sel,MMS_LOG_USR_IND,"Indication (user)"); get_ldebug (&mms_debug_sel,MMS_LOG_USR_CONF,"Confirm (user)"); get_ldebug (&mms_debug_sel,MMS_LOG_PDU,"MMS PDU");#ifdef MAP30_ACSE get_ldebug (&mms_debug_sel,MMS_LOG_ACSE,"ACSE Interface");#endif#ifdef MAP30_LLC get_ldebug (&mms_debug_sel,MMS_LOG_LLC,"LLC Interface");#endif get_ldebug (&mms_debug_sel,MMS_LOG_ENC,"MMS ENCODE"); get_ldebug (&mms_debug_sel,MMS_LOG_DEC,"MMS DECODE"); get_debug (&asn1_debug_sel,ASN1_LOG_ENC,"ASN.1 ENCODE"); get_debug (&asn1_debug_sel,ASN1_LOG_DEC,"ASN.1 DECODE"); m_que_validate = ask (" Validate MMS-EASE internal queues (N) ? ",SD_FALSE); if (m_que_validate) { get_ldebug (&mms_debug_sel,MMS_LOG_IQUE,"Indication Que"); get_ldebug (&mms_debug_sel,MMS_LOG_RQUE,"Request Que"); } get_ldebug (&mms_debug_sel,MMS_LOG_AA,"Alternate Access"); get_ldebug (&mms_debug_sel,MMS_LOG_RT,"Runtime Type"); get_ldebug (&mms_debug_sel,MMS_LOG_RTAA,"Runtime AA Type");#ifdef USE_MLOG get_ldebug (&mms_debug_sel,MMS_LOG_REQ,"MMS Requests"); get_ldebug (&mms_debug_sel,MMS_LOG_IND,"MMS Indications"); get_ldebug (&mms_debug_sel,MMS_LOG_RESP,"MMS Responses"); get_ldebug (&mms_debug_sel,MMS_LOG_CONF,"MMS Confirms");#endif get_debug ((ST_UINT *) &chk_debug_en,MEM_LOG_ERR,"MEMCHK ERRORS"); get_debug ((ST_UINT *) &chk_debug_en,MEM_LOG_MALLOC | MEM_LOG_CALLOC | MEM_LOG_REALLOC | MEM_LOG_FREE, "ALL MEMCHK TRANSACTIONS");#if (defined (MAP30_ACSE) && !defined (NOSUIC)) get_debug (&s_debug_sel,ACSE_IND_PRINT,"SUIC Transaction RX"); get_debug (&s_debug_sel,ACSE_CNF_PRINT,"SUIC Transaction TX"); get_debug (&s_debug_sel,ACSE_DEC_PRINT,"SUIC ACSE DECODE");#endif #ifdef REQUIRE_S_LOG printf ("\n"); if (ask (" Send MMS-EASE Internal Logging to Screen (N) ? ",SD_FALSE)) slog_dyn_log_fun = screenLogFun; else slog_dyn_log_fun = NULL; if (ask (" Close Log File (N) ? ",SD_FALSE)) MLOG_CLOSE_FILE (); if (sLogCtrl != NULL) { if (sLogCtrl->logCtrl & LOG_FILE_EN) { if (ask (" Stop File Logging (N) ? ",SD_FALSE)) MLOG_STOP_FILE_LOGGING (); } else { if (ask (" Start File Logging (N) ? ",SD_FALSE)) MLOG_START_FILE_LOGGING (); } } if (sLogCtrl->logCtrl & LOG_MEM_EN) { if (ask (" Dump Memory Log (N) ? ",SD_FALSE)) MLOG_DUMP_MEM_LOG (); }#endif m_heap_check_enable = ask ("\n Enable memory heap check (N) ? ",SD_FALSE); m_check_list_enable = ask (" Enable memory list check (N) ? ",SD_FALSE); (*menu_set_fun)(); }/************************************************************************//* get_debug *//************************************************************************/ST_VOID get_debug (ST_UINT *sel_ptr, ST_UINT mask, ST_CHAR *text) {ST_CHAR buf[100];ST_CHAR q[20]; sprintf (buf," Enable %s Debug Print \0",text); if (*sel_ptr & mask) strcat (buf,"(now ON) ?"); else strcat (buf,"(now OFF) ?"); printf ("%s",buf); if (strget (q)) { if (q[0] == 'y' || q[0] == 'Y') *sel_ptr |= mask; else *sel_ptr &= ~mask; } }/************************************************************************//* get_ldebug *//************************************************************************/ST_VOID get_ldebug (ST_ULONG *sel_ptr, ST_ULONG mask, ST_CHAR *text) {ST_CHAR buf[100];ST_CHAR q[20]; sprintf (buf," Enable %s Debug Print \0",text); if (*sel_ptr & mask) strcat (buf,"(now ON) ?"); else strcat (buf,"(now OFF) ?"); printf ("%s",buf); if (strget (q)) { if (q[0] == 'y' || q[0] == 'Y') *sel_ptr |= mask; else *sel_ptr &= ~mask; } }/************************************************************************//* screenLogFun *//************************************************************************/#ifdef REQUIRE_S_LOGST_VOID screenLogFun (LOG_CTRL *lc, ST_INT logType, ST_CHAR *sourceFile, ST_INT lineNum, ST_INT bufLen, ST_CHAR *buf) { switch (logType) { case SLOG_DYN_PAUSE : wait_key (); break; case SLOG_DYN_LF : printf ("\n %s", buf); break; case SLOG_DYN_CLRSCR : CLEARSCR; break; default: printf ("\n %s", buf); break; } }#endif#ifdef REQUIRE_S_LOG/************************************************************************//* m_read_log_cfg *//************************************************************************/ST_VOID mem_chk_error_detected (ST_VOID);ST_RET m_set_log_cfg (ST_CHAR *fname) {register i;FILE *file_ptr;ST_CHAR line[200];ST_CHAR buf[200];ST_INT done;ST_INT err;ST_INT val;ST_CHAR *str;LOG_CTRL *lc;ST_CHAR *fileName;/* trap mem_chk errors */ mem_chk_err = mem_chk_error_detected;/* Initialize the logging for MMS-EASE */ lc = sLogCtrl;/* Set the flags that should normally be turned on */ lc->mc.ctrl = MEM_CTRL_MSG_HDR_EN; lc->fc.ctrl = (FIL_CTRL_WIPE_EN | FIL_CTRL_WRAP_EN | FIL_CTRL_MSG_HDR_EN); mms_debug_sel |= (MMS_LOG_USR_CONF | MMS_LOG_USR_IND);/* If no file is present, use defaults */ if (!(file_ptr = fopen (fname,"r"))) {/* Use File logging */ lc->logCtrl = LOG_FILE_EN;/* Use time/date time log */ lc->logCtrl |= (LOG_TIMEDATE_EN | LOG_TIME_EN);/* File Logging Control defaults */ lc->fc.fileName = "mms.log"; lc->fc.maxSize = 250000L; lc->fc.ctrl = (FIL_CTRL_WIPE_EN | FIL_CTRL_WRAP_EN | FIL_CTRL_MSG_HDR_EN); return (SD_FALSE); /* Indicate that no config file exists */ } done = SD_FALSE; err = SD_FALSE; while (!done && !err) { if (!(fgets (line,199,file_ptr))) { done = SD_TRUE; break; } if (line[0] == '#' || line[0] == '\n') continue; else {/* Got a line to look at - start by getting rid of the '\n' */ for (i = 0 ; i < 64; ++i) { if (line[i] == '\n') { line[i] = 0; break; } }/* Now just read the parameters */ str = "FileLogEn"; i = strlen (str); if (!strnicmp (str,line,i)) lc->logCtrl |= LOG_FILE_EN; str = "MemLogEn"; i = strlen (str); if (!strnicmp (str,line,i)) lc->logCtrl |= LOG_MEM_EN; str = "TimeEnable="; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%d",&val); if (val == 1) { lc->logCtrl |= LOG_TIMEDATE_EN; lc->logCtrl |= LOG_TIME_EN; } else if (val == 2) { lc->logCtrl |= LOG_DIFFTIME_EN; lc->logCtrl &= ~LOG_TIMEDATE_EN; lc->logCtrl |= LOG_TIME_EN; } else if (val == 3) { lc->logCtrl |= LOG_SYSTIME_EN; lc->logCtrl &= ~LOG_TIMEDATE_EN; lc->logCtrl |= LOG_TIME_EN; } } str = "NoMsgHeader"; i = strlen (str); if (!strnicmp (str,line,i)) { lc->fc.ctrl &= ~FIL_CTRL_MSG_HDR_EN; /* No header wanted */ lc->mc.ctrl &= ~MEM_CTRL_MSG_HDR_EN; }/* Log Masks */ str = "MMSLogmask=0x"; i = strlen (str); if (!strnicmp (str,line,i)) sscanf (&line[i], "%lx",&mms_debug_sel);#if !defined (NOSUIC) && defined (MAP30_ACSE) str = "SUICLogmask=0x"; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%x",&val); s_debug_sel = (ST_UINT)val; }#endif#if !defined (NOSUIC) && defined (MAP30_LLC) str = "SUILLogmask=0x"; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%x",&val); l_debug_sel = (ST_LONG)val; }#endif str = "ASN1Logmask=0x"; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%x",&val); asn1_debug_sel = (ST_UINT)val; } str = "MEMLogmask=0x"; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%x",&val); chk_debug_en = (ST_INT)val; } str = "MemListCheck"; i = strlen (str); if (!strnicmp (str,line,i)) m_check_list_enable = SD_TRUE; str = "MemFill"; i = strlen (str); if (!strnicmp (str,line,i)) m_fill_en = SD_TRUE;/* ********* FILE LOGGING CONTROL */ str = "LogFileSize="; i = strlen (str); if (!strnicmp (str,line,i)) sscanf (&line[i], "%ld",&lc->fc.maxSize); str = "LogFileName="; i = strlen (str); if (!strnicmp (str,line,i)) { sscanf (&line[i], "%s",buf); fileName = chk_malloc (strlen (buf) + 1); strcpy (fileName, buf); lc->fc.fileName = fileName; } str = "NoAppend"; i = strlen (str);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -