int_32 Shell_SNMPd(int_32 argc, char_ptr argv[] ) { uint_32 result; boolean print_usage, shorthelp = FALSE; int_32 return_code = SHELL_EXIT_SUCCESS; print_usage = Shell_check_help_request(argc, argv, &shorthelp ); if (!print_usage) { if (argc == 2) { if (strcmp(argv[1], "start") == 0) { result = SNMP_init("SNMP_agent", SHELL_SNMP_PRIO, SHELL_SNMP_STACK ); if (result == 0) { printf("SNMP Agent Started.\n"); /* Install some MIBs for the SNMP agent */ MIB1213_init(); MIBMQX_init(); } else { printf("Unable to start SNMP Agent, error = 0x%x\n",result); return_code = SHELL_EXIT_ERROR; } } else if (strcmp(argv[1], "stop") == 0) { result = SNMP_stop(); if (result == 0) { printf("SNMP Agent Stopped.\n"); } else { printf("Unable to stop SNMP Agent, error = 0x%x\n",result); return_code = SHELL_EXIT_ERROR; } } else { printf("Error, %s invoked with incorrect option\n", argv[0]); print_usage = TRUE; } } else { printf("Error, %s invoked with incorrect number of arguments\n", argv[0]); print_usage = TRUE; } } if (print_usage) { if (shorthelp) { printf("%s [start|stop]\n", argv[0]); } else { printf("Usage: %s [start|stop]\n",argv[0]); } } return return_code; } /* Endbody */
/******************************************************************************************** * InitApp * purpose : Initialize the test application * This includes parts as RTP/RTCP support, etc. * input : none * output : none * return : Non-negative value on success * Negative value on failure ********************************************************************************************/ int InitApp(void) { /* Initialize security (does nothing if not security enabled) */ SEC_init(hApp); /* Initialize MIB support */ SNMP_init(); memset(&NumAllocations, 0, sizeof(NumAllocations)); memset(&SizeAllocations, 0, sizeof(SizeAllocations)); TclExecute("test:updateGui"); return 0; }