⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 neuro_e.c

📁 嵌入式RMON,RMON为Remote monitor的缩写,基于SNMP为网络提供主动监控及错误告警,智能交换路由必备协议
💻 C
字号:
/* Beholder RMON ethernet network monitor,Copyright (C) 1993 DNPAP group *//* See file COPYING 'GNU General Public Licence' for copyright details   */#include <dnpap.h>#include <stdarg.h>#include <message.h>#include <string.h>#include "neuro_d.h"#include "neuro_e.h"static CHAR MODULE[] =	"neuroError";int tracing_ =		1;int debugging_ =	1;static CHAR* NeuronErrorMsgs[NEURO_LASTERR-NEURO_ERROFFSET+1];static CHAR* SetNeuronErrorMsg(LONG code, CHAR* msg);CHAR* NeuronErrorMsg(LONG code){	return NeuronErrorMsgs[code-NEURO_ERROFFSET];}CHAR* SetNeuronErrorMsg(LONG code, CHAR* msg){	NeuronErrorMsgs[code-NEURO_ERROFFSET] = MALLOC(strlen(msg)+1);	if (NeuronErrorMsgs[code-NEURO_ERROFFSET] != NULL)		strcpy(NeuronErrorMsgs[code-NEURO_ERROFFSET], msg);        return NeuronErrorMsgs[code-NEURO_ERROFFSET];}BOOLEAN NeuroErrorInit(VOID){    SetNeuronErrorMsg(NEURO_TRACE, 			"trace code");    SetNeuronErrorMsg(NEURO_NETNULL, 		"no network defined");	SetNeuronErrorMsg(NEURO_LINDEX, 		"layer index out of range");    SetNeuronErrorMsg(NEURO_NINDEX, 		"neuron index out of range");    SetNeuronErrorMsg(NEURO_WINDEX, 		"weight index out of range");    SetNeuronErrorMsg(NEURO_SMALL, 			"neural network is too small");    SetNeuronErrorMsg(NEUROC_ALLOCATE, 		"can not allocate memory");    SetNeuronErrorMsg(NEUROC_TIMERREG, 		"can not register a timer");	SetNeuronErrorMsg(NEURO_NOSTATUS, 		"collector status can't be retrieved");    SetNeuronErrorMsg(NEURO_CALCERR, 		"net calculation error");    SetNeuronErrorMsg(NEURO_NOINPUT, 		"no input data");    SetNeuronErrorMsg(NEURO_NORESULT, 		"no results available");	SetNeuronErrorMsg(NEURO_NOTARGET, 		"target not specified");    SetNeuronErrorMsg(NEURO_WRONGTYPE, 		"MIB variable has wrong type");    SetNeuronErrorMsg(NEURO_DATASRC, 		"error checking datasources");    SetNeuronErrorMsg(NEURO_ALLOCATE, 		"can not allocate memory");    SetNeuronErrorMsg(NEURO_TIMERREG, 		"can not register a timer");    SetNeuronErrorMsg(NEURO_ERRINIT, 		"failed initializing error message system");    SetNeuronErrorMsg(NEURO_CONFIGINIT, 	"error initializing configuration");    SetNeuronErrorMsg(NEURO_MCREATE, 		"can not create new collector");    SetNeuronErrorMsg(NEURO_MOWNER, 		"can not set owner");	SetNeuronErrorMsg(NEURO_MNRLAYERS, 		"can not set number of layers");	SetNeuronErrorMsg(NEURO_MNRNEURONS, 	"number of neurons missing from config files");	SetNeuronErrorMsg(NEURO_MLRATE, 		"can not set learning rate");	SetNeuronErrorMsg(NEURO_MMOMENTUM, 		"can not set momentum");	SetNeuronErrorMsg(NEURO_MSETNEURONS, 	"can not set number of neurons");	SetNeuronErrorMsg(NEURO_MSTART, 		"can not start collector ");	SetNeuronErrorMsg(NEURO_INVDATASRC, 	"datasource has wrong type");	SetNeuronErrorMsg(NEURO_NOSUCHDATASRC, 	"datasource not available");	SetNeuronErrorMsg(NEURO_MDATASRCNAME, 	"datasource missing from config files");	SetNeuronErrorMsg(NEURO_MSETDATASRC, 	"can not set datasource");	SetNeuronErrorMsg(NEURO_MDATASRCMAX, 	"datasource maximum value missing from config files");	SetNeuronErrorMsg(NEURO_MDATASRCMIN, 	"datasource minimum value missing from config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCMAX, "can not set maximum value of datasource");	SetNeuronErrorMsg(NEURO_MSETDATASRCMIN, "can not set minimum value of datasource");	SetNeuronErrorMsg(NEURO_MDATASRCAVERAGEMETHOD, 		"datasource averaging method missing from config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCAVERAGEMETHOD, 	"can not set averaging method of datasource");	SetNeuronErrorMsg(NEURO_MDATASRCSTEPS, 				"number of averaging steps not specified in config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCSTEPS, 			"can not set number of averaging steps");	SetNeuronErrorMsg(NEURO_MDATASRCTRAP, 				"flag for sending datasource traps not specified in config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCTRAP, 			"can not set datasource trap flag");	SetNeuronErrorMsg(NEURO_MDATASRCCHECK, 				"flag for checking datasources not specified in config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCCHECK, 			"can not set datasource check flag");	SetNeuronErrorMsg(NEURO_MDATASRCTHRESHOLDVALUE, 	"datasource threshold value not specified in config files");	SetNeuronErrorMsg(NEURO_MSETDATASRCTHRESHOLDVALUE, 	"can not set datasource threshold value");	SetNeuronErrorMsg(NEURO_THRESHOLD, 		"threshold check failed");	SetNeuronErrorMsg(NEURO_NOBATCH, 		"no batch allocated");	SetNeuronErrorMsg(NEURO_CREATE, 		"collector created");	SetNeuronErrorMsg(NEURO_ACTIVE, 		"collector active");	SetNeuronErrorMsg(NEURO_DESTROY, 		"collector destroyed");	SetNeuronErrorMsg(NEURO_LASTERR, 		"last error message");	return TRUE; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -