📄 mmsapp.c
字号:
}#ifdef USE_MLOG m_mlog_install ();#endif#ifdef UCA_SMP smp_init ();#endif load_local_titles (GET_CHANNEL_CONFIG); listen_sel = (ST_INT *)calloc (max_mms_chan,sizeof (ST_INT)); if (!listen_sel) { wait_msg ("MEMORY ALLOCATION ERROR, HIT ^c"); return (SD_FAILURE); } set_suic_param ();#ifdef USE_MRA mra_mode = BEST_FIT_MODE; init_mem_region (NULL,0L,32); init_mem_region (NULL,0L,32);#endif#ifdef VM_ULDL uldl_ctrl_tbl = chk_calloc (max_mms_chan, sizeof (ULDL_CTRL));#endif#if !(SYSTEM_SEL & (OS2)) init_event_handling (); /* Must be BEFORE strt_MMS. */#endif /* !OS2 */#ifdef X500_SUPPORT if (ask ("\n Set User ID for X.500 access (N) ? ", SD_FALSE)) { printf (" Enter DN: "); strget (x500_userid.name); printf (" Enter Password: "); if (strget (x500_userid.passwd)) x500_userid.passwd_pres = SD_TRUE; else x500_userid.passwd_pres = SD_FALSE; mds_set_def_userid (&x500_userid); }#endif#ifdef LDAP_SUPPORT if (ask ("\n Set User ID for LDAP access (N) ? ", SD_FALSE)) { printf (" Enter DN: "); strget (ldap_userid.name); printf (" Enter Password: "); if (strget (ldap_userid.passwd)) ldap_userid.passwd_pres = SD_TRUE; else ldap_userid.passwd_pres = SD_FALSE; ldap_set_def_userid (&ldap_userid); }#endif m_version = 1; /* Use MMS IS */ mllp_ap_context_sel = SM_ISO_MMS_IS_AP_CTXT; if (ret = strt_MMS ()) { printf ("\n MMS failed to start err: "); ms_perror (ret); /* display a desc. of the error */ goto EXIT_MAIN; /* must reset terminal, etc. before exiting. */ }#if (SYSTEM_SEL & (OS2)) init_event_handling (); /* Must be after strt_MMS. */#endif /* OS2 */ set_user_data (); /* allocate large user data elements */ load_local_titles (GET_TITLE_CONFIG);#if MMS_VA_EN/** Now register local variables that are to be accessable over the *//* network. Before we do this, need to write standard types to the VMD */ set_user_doms (); /* make domains */ set_user_pis (); /* make program invocations *//* We want to allow 'natural' access to data, rather than packed *//* This needs to be done prior to adding any types. */ m_data_algn_tbl = m_def_data_algn_tbl; set_user_types (); /* create types */ set_user_vars (); /* create variables */ load_variables (); /* load types and variables from file */ ms_sort_unnamed_vars(); /*ms_log_unnamed_vars();*/#endif set_main (); /* Write the main screen, funct ptrs */ doit = 1; while (doit) { menu_service (); /* Service keyboard/MMS until exit from menu */ if (!doit) break; /* doit may be set to 0 in other functions */ CLEARSCR; if (ask ("\n\n\n Really want to exit ? ",0)) doit = 0; else { if (ask ("\n Modify Print Levels ? ",0)) do_debugset (); else set_main (); } } CLEARSCR; if (ret = end_MMS ()) /* Shut Down MMS-EASE */ { printf ("\n MMS failed to stop err: "); ms_perror (ret); /* display a desc. of the error */ }EXIT_MAIN: dyn_mem_ptr_status (); /* log the list of pointers */#if (SYSTEM_SEL & (QNX_C86)) term_rest (option_save);#endif#if (SYSTEM_SEL & (OPEN_VMS | SYS_BSD | OS2 | SYSVXWORKS | SYS_5)) term_rest ();#endif#if defined (_WIN32) term_rest ();#endif#ifdef VXWORKS ioTaskStdSet (0,0,0); ioTaskStdSet (0,1,1); ioTaskStdSet (0,2,2); close (vxfd);#endif return (0); }#if (SYSTEM_SEL & (SYS_5))/************************************************************************//************************************************************************//* sigfun *//* This functions catches a signal and restores terminfo. *//************************************************************************/void sigfun (int sig){ doit = 0; /* Note: On DEC UNIX as of V7.06 MMS-EASE applications are thread */ /* safe. The DEC UNIX manual advises that mutex semaphore */ /* functions (pthread_...) should not be called from a signal */ /* handler. For this reason end_MMS() can not be called from */ /* this function. */}/************************************************************************//* sigbus *//* This functions catches bus errors which on a risk (sparcstation) are *//* caused by alignment problems on an assignment. *//************************************************************************/void sigbus (int sig){ doit = 0; printf ("\nmmsapp: bus error caught by sigbus handler\n"); /* Note: On DEC UNIX as of V7.06 MMS-EASE applications are thread */ /* safe. The DEC UNIX manual advises that mutex semaphore */ /* functions (pthread_...) should not be called from a signal */ /* handler. For this reason end_MMS() can not be called from */ /* this function. */}#endif/************************************************************************//* set_null_menu *//************************************************************************/ST_VOID set_null_menu (ST_VOID) { CLEARSCR; print_demo (); }/************************************************************************//* set_suic_param *//* Function to set up any SUIC specific parameters. *//* These parameters may differ depending on the OS and board used. *//************************************************************************/ST_VOID set_suic_param (ST_VOID) {extern ST_INT m_num_mac_rx;/* Select the number of channels to be used by MMS-EASE */ CLEARSCR; print_demo (); printf ("\n\n MMS DEMONSTRATION APPLICATION SETUP "); if (!quiet) {#if (SYSTEM_SEL & (OPEN_VMS)) if ((use_events = ask ("\n\n Use Event Mechanism (Y) ? ",SD_TRUE)))#else if ((use_events = ask ("\n\n Use Event Mechanism (N) ? ",SD_FALSE)))#endif u_mms_event_notify = event_service;#if defined (MAP30_ACSE) printf (" Number of receives per channel (%d)", m_num_mac_rx); intget (&m_num_mac_rx); mllp_mult_ctxt_allowed = ask (" Allow multiple active P-Context's (N) ?",0);#endif }#if defined (MAP30_LLC) if (max_mms_chan < l_num_chans) l_num_chans = max_mms_chan; set_suic_param_llc ();#endif /* The variable s_max_pipe_size along with s_chk_sys_resource() */ /* allows to impose flow control when writing to the stack's pipe. */ /* It is initialized to min supported atomic message size: PIPE_BUF. */ /* On some systems (__alpha, sun) the size can be increased. */#if defined(__alpha) && !defined(__VMS) s_max_pipe_size = 50000; /* Max is 64 KB */#endif /* __alpha */ }/************************************************************************//* set_main *//* function to set up the main screen and function key table *//************************************************************************/ST_VOID set_main (ST_VOID) { CLEARSCR; print_demo (); printf ("\n\n"); printf ("\t SELECT DESIRED MMS COMMUNICATION ACTIVITY\n\n"); printf ("\t %c1 - CONTEXT MANAGEMENT\n",c); printf ("\t %c2 - VMD SUPPORT\n",c); printf ("\t %c3 - DOMAIN MANAGEMENT OPERATIONS\n",c); printf ("\t %c4 - PROGRAM INVOCATION MANAGEMENT\n",c); printf ("\t %c5 - VARIABLE ACCESS\n",c); printf ("\t %c6 - FILE OPERATIONS\n",c);#ifdef PRIVATE_COMM printf ("\t %c7 - PRIVATE COMMUNICATIONS\n",c);#endif printf ("\t %c9 - MORE !!\n",c); printf ("\t %s - EXIT MMSEASE DEMO\n",str); flush_keys (); fun_null (); funct_1 = do_ctx_ops; funct_2 = do_vmd_ops; funct_3 = do_dom_ops; funct_4 = do_prg_ops; funct_5 = do_var_ops; funct_6 = do_fil_ops;#ifdef PRIVATE_COMM funct_7 = do_private;#endif funct_9 = do_more_ops; menu_set_fun = set_main; /* used to reset the menu */ }/************************************************************************//* do_more_ops *//* This functions executes the second main menu operations. *//************************************************************************/ST_VOID do_more_ops (ST_VOID) { set_more (); menu_service (); /* Service keyboard/MMS until exit from menu */ set_main (); }/************************************************************************//* set_more *//* function to set up the second screen and function key table *//************************************************************************/ST_VOID set_more (ST_VOID) { CLEARSCR; print_demo (); printf ("\n\n"); printf ("\t SELECT DESIRED MMS COMMUNICATION ACTIVITY\n\n"); printf ("\t %c1 - SEMAPHORE MANAGEMENT OPERATIONS\n",c); printf ("\t %c2 - OPERATOR COMMUNICATION OPERATIONS\n",c); printf ("\t %c3 - EVENT MANAGEMENT OPERATIONS\n",c); printf ("\t %c4 - JOURNAL MANAGEMENT OPERATIONS\n",c); printf ("\t %c5 - MISCELLANEOUS\n",c);#if defined(UCA_SMP) printf ("\t %c6 - UCA TIME SYNCHRONIZATION\n",c);#endif /* UCA_SMP */ printf ("\t %s - RETURN TO MAIN MENU\n",str); flush_keys (); fun_null (); funct_1 = do_sem_ops; funct_2 = do_ocs_ops; funct_3 = do_evn_ops; funct_4 = do_jou_ops; funct_5 = do_misc;#if defined(UCA_SMP) funct_6 = do_uca_timesync;#endif /* UCA_SMP */ menu_set_fun = set_more; /* used to reset the menu */ }/************************************************************************//* do_ctx_ops *//* This functions executes the context management menu *//************************************************************************/ST_VOID do_ctx_ops (ST_VOID) { set_ctx (); menu_service (); /* Service keyboard/MMS until exit from menu */ set_main (); }/************************************************************************//* set_ctx *//* function to set up the context management screen and function key *//* table *//************************************************************************/ST_VOID set_ctx (ST_VOID) { CLEARSCR; print_demo (); printf ("\n\n"); printf ("\t SELECT DESIRED MMS COMMUNICATION ACTIVITY\n\n"); printf ("\t %c1 - INITIATE\n",c); printf ("\t %c2 - CONCLUDE\n",c); printf ("\t %c3 - ABORT\n",c); printf ("\t %c4 - INITIATE / RELEASE TEST\n",c); printf ("\t %c5 - INITIATE / ABORT TEST\n",c); printf ("\t %c6 - DISPLAY MMS CHANNEL INFO\n",c); printf ("\t %c7 - MORE CONNECTION ORIENTED FUNCTIONS\n",c); printf ("\t %c8 - AUTO CONNECT\n",c); printf ("\t %c9 - AUTO DISCONNECT\n",c); printf ("\t %s - RETURN TO MAIN MENU\n",str); flush_keys (); fun_null (); funct_1 = do_init; funct_2 = do_concl; funct_3 = do_abort; funct_4 = do_init_rel; funct_5 = do_init_abort; funct_6 = do_mchan; funct_7 = do_ctx2; funct_8 = do_auto_conn; funct_9 = do_auto_disc; menu_set_fun = set_ctx; /* used to reset the menu */ }/************************************************************************//* do_ctx_ops *//* This functions executes the context management menu *//************************************************************************/ST_VOID do_ctx2 (ST_VOID) { set_ctx2 (); menu_service (); /* Service keyboard/MMS until exit from menu */ set_ctx (); }/************************************************************************//* set_ctx2 *//************************************************************************/ST_VOID set_ctx2 (ST_VOID) { CLEARSCR; print_demo (); printf ("\n\n"); printf ("\t SELECT DESIRED MMS COMMUNICATION ACTIVITY\n\n"); printf ("\t %c1 - START ASSOCIATE LISTEN\n",c); printf ("\t %c2 - STOP ASSOCIATE LISTEN\n",c); printf ("\t %c3 - CANCEL\n",c); printf ("\t %c4 - SELECT P-CONTEXT\n",c); printf ("\t %c5 - ADD P-CONTEXT\n",c); printf ("\t %c6 - SET AP CONTEXT\n",c);#ifdef PRIVATE_COMM printf ("\t %c7 - SET LLP TYPE\n",c);#endif printf ("\t %s - EXIT THIS MENU\n",str); flush_keys (); fun_null (); funct_1 = do_listen; funct_2 = do_stop_listen; funct_3 = do_cancel; funct_4 = do_set_context; funct_5 = do_add_context; funct_6 = do_set_ap_context;#ifdef PRIVATE_COMM funct_7 = do_set_llp_type;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -