init ems server code
This commit is contained in:
91
src/configMgr/c_program/impmod/Makefile
Normal file
91
src/configMgr/c_program/impmod/Makefile
Normal file
@@ -0,0 +1,91 @@
|
||||
mysqlInclude=/usr/local/mysql/include
|
||||
mysqlInclude.ES=/usr/include/mysql
|
||||
|
||||
mysqlLib=/usr/local/mysql/lib
|
||||
mysqlLib.ES=/usr/lib/mysql
|
||||
|
||||
OBJ =bsscomm.o bss_hb.o nmimp.o nmtypes.o
|
||||
OBJ.ES =bsscomm.o.ES bss_hb.o.ES nmimp.o.ES nmtypes.o.ES
|
||||
|
||||
PROGS1=bsscomm
|
||||
PROGS2=alive
|
||||
|
||||
default: linuxES
|
||||
|
||||
all:
|
||||
@echo " **** Compiling $(PROGS1) and $(PROGS2) ****"
|
||||
@echo "make clean -- Delete the target files"
|
||||
@echo "make linux72 -- Generate target files for Redhat Linux 72"
|
||||
@echo "make linuxES -- Generate target files for Redhat Linux ES"
|
||||
|
||||
linux72: bsscomm alive
|
||||
make alive
|
||||
make bsscomm
|
||||
|
||||
linuxES: bsscomm.ES alive
|
||||
make alive
|
||||
make bsscomm.ES
|
||||
|
||||
bsscomm:${OBJ}
|
||||
@echo Linking $(PROGS1)
|
||||
@gcc -g -W -Wall -o $(PROGS1) ${OBJ} -L$(mysqlLib) -lmariadbclient -lz
|
||||
ar r libimp.a ${OBJ}
|
||||
# cp -f bsscomm ../../../omc83_bin/
|
||||
#cp -f bsscomm /usr/local/omc/bin/
|
||||
|
||||
bsscomm.ES:${OBJ.ES}
|
||||
@echo Linking $(PROGS1)
|
||||
@gcc -g -W -Wall -o $(PROGS1) ${OBJ} -L$(mysqlLib.ES) -lmariadbclient -lz -lm
|
||||
ar r libimp.a ${OBJ}
|
||||
|
||||
installbin: linuxES
|
||||
cp -f $(PROGS1) ../../../../bin/
|
||||
cp -f $(PROGS2) ../../../../bin/
|
||||
|
||||
installomc: linuxES
|
||||
cp -f $(PROGS1) /usr/local/omc/bin/
|
||||
cp -f $(PROGS2) /usr/local/omc/bin/
|
||||
|
||||
installall: installbin installomc
|
||||
|
||||
#imptest.o: imptest.c
|
||||
# gcc -g -O2 -W -Wall -c imptest.c \
|
||||
# -I/usr/local/mysql/include \
|
||||
|
||||
|
||||
bsscomm.o: bsscomm.c nmimp.h nmtypes.h nmstatus.h iwtypes.h
|
||||
gcc -g -W -Wall -c bsscomm.c -I$(mysqlInclude)
|
||||
|
||||
bss_hb.o: bss_hb.c bss_hb.h iwtypes.h bsscomm.h
|
||||
gcc -g -W -Wall -c bss_hb.c -I$(mysqlInclude)
|
||||
|
||||
nmimp.o: nmimp.c nmimp.h iwtypes.h nmstatus.h
|
||||
gcc -g -W -Wall -c nmimp.c
|
||||
|
||||
nmtypes.o: nmtypes.c nmtypes.h iwtypes.h
|
||||
gcc -g -W -Wall -c nmtypes.c
|
||||
|
||||
bsscomm.o.ES: bsscomm.c nmimp.h nmtypes.h nmstatus.h iwtypes.h
|
||||
gcc -g -W -Wall -c bsscomm.c -I$(mysqlInclude.ES)
|
||||
|
||||
bss_hb.o.ES: bss_hb.c bss_hb.h iwtypes.h bsscomm.h
|
||||
gcc -g -W -Wall -c bss_hb.c -I$(mysqlInclude.ES)
|
||||
|
||||
nmimp.o.ES: nmimp.c nmimp.h iwtypes.h nmstatus.h
|
||||
gcc -g -W -Wall -c nmimp.c
|
||||
|
||||
nmtypes.o.ES: nmtypes.c nmtypes.h iwtypes.h
|
||||
gcc -g -W -Wall -c nmtypes.c
|
||||
|
||||
alive: alive.c
|
||||
gcc -g -W -Wall -o alive alive.c
|
||||
#cp -f alive ../../../omc83_bin/
|
||||
#cp -f alive ../../../../bin/
|
||||
# cp -f alive /usr/local/omc/bin/
|
||||
|
||||
clean:
|
||||
rm -rf *.a *.o bsscomm alive
|
||||
|
||||
tags:
|
||||
ctags -R .
|
||||
|
||||
365
src/configMgr/c_program/impmod/alive.c
Normal file
365
src/configMgr/c_program/impmod/alive.c
Normal file
@@ -0,0 +1,365 @@
|
||||
/****************************************************
|
||||
Bsplus monitoring server:
|
||||
Incoming: (bsscomm -> monitor)
|
||||
"16clr 1 172.15.0.3" when server discover error
|
||||
"16add 1 172.15.0.3" for adding new host to array
|
||||
"03rst" to reset the host array
|
||||
"16del 2 172.15.0.3" for deleting
|
||||
Outgoing: (monitor -> bsscomm)
|
||||
"16clr 1 172.15.0.3"
|
||||
"16new 3 173.23.0.3"
|
||||
"03die" to tell BssComm when selection error
|
||||
Testing:
|
||||
Test new connection by "ping -w 2 -i 0.1 -c 5 172.18.0.3"
|
||||
|
||||
****************************************************/
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
#include<sys/time.h>
|
||||
#include<sys/types.h>
|
||||
#include<sys/socket.h>
|
||||
#include<netinet/in.h>
|
||||
#include<unistd.h>
|
||||
#include<errno.h>
|
||||
#include<ctype.h>
|
||||
#include<string.h>
|
||||
#include<time.h>
|
||||
|
||||
#define PORT 5354
|
||||
#define QUEUESIZE 10
|
||||
#define BUFMAX 4096
|
||||
|
||||
#define NO_OF_BSS 256
|
||||
#define IP_LEN 16
|
||||
|
||||
struct connection {
|
||||
char ip[IP_LEN];
|
||||
int bssid;
|
||||
int connected;
|
||||
int no_of_unreachable;
|
||||
};
|
||||
struct connection bsplus[NO_OF_BSS];
|
||||
int nbsplus=0; /* no of element in bsplus array*/
|
||||
int newsock=-1;
|
||||
|
||||
void init_connection(struct connection *conn)
|
||||
{
|
||||
conn->ip[0]='\0';
|
||||
conn->bssid=-1;
|
||||
conn->connected=0;
|
||||
conn->no_of_unreachable=0;
|
||||
}
|
||||
|
||||
int process_outgoing_msg(int socket_fd, char *cmd, int index)
|
||||
{
|
||||
char MsgBuffer[99]="\0";
|
||||
char temp[99]="\0";
|
||||
unsigned int len;
|
||||
|
||||
sprintf(temp, "%s %d %s", cmd, (bsplus[index]).bssid, (bsplus[index]).ip);
|
||||
sprintf(MsgBuffer,"%.2d%s",strlen(temp),temp);
|
||||
|
||||
len = write(socket_fd, MsgBuffer, strlen(MsgBuffer));
|
||||
if ( len != strlen(MsgBuffer) )
|
||||
{
|
||||
fprintf(stderr,"Error !!!");
|
||||
}
|
||||
|
||||
return(len);
|
||||
}
|
||||
|
||||
int process_incoming_msg(char *MsgBuffer)
|
||||
{
|
||||
int i;
|
||||
int bssid;
|
||||
char cmd[4];
|
||||
char ip[IP_LEN]="\0";
|
||||
char buffer[BUFMAX]="\0";
|
||||
int retval=1;
|
||||
char new_str[4]="new";
|
||||
|
||||
//printf("%s\n",MsgBuffer);
|
||||
if(!strncmp(MsgBuffer,"rst",3))
|
||||
{
|
||||
for(i=0;i<NO_OF_BSS;i++)
|
||||
init_connection(&bsplus[i]);
|
||||
nbsplus=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i=sscanf(MsgBuffer,"%s %d %s",cmd,&bssid,ip);
|
||||
//printf("cmd=%s bssid=%d ip=%s i=%d\n",cmd,bssid,ip, i);
|
||||
|
||||
if ( (i!=3 ) || (bssid>=NO_OF_BSS) )
|
||||
return -1;
|
||||
|
||||
if(!strncmp(cmd,"add",3))
|
||||
{
|
||||
(bsplus[nbsplus]).bssid = bssid;
|
||||
strcpy((bsplus[nbsplus]).ip, ip);
|
||||
(bsplus[nbsplus]).connected=0;
|
||||
nbsplus++;
|
||||
|
||||
/* test connectivity immediately */
|
||||
sprintf(buffer,"ping -w 2 -i 0.1 -c 5 %s 2>/dev/null|grep time >>/dev/null",(bsplus[nbsplus-1]).ip);
|
||||
|
||||
retval=system(buffer);
|
||||
if (!retval) /* if ping succ */
|
||||
{
|
||||
process_outgoing_msg(newsock, new_str, nbsplus-1);//send "new"
|
||||
(bsplus[nbsplus-1]).connected = 1;
|
||||
}
|
||||
}
|
||||
else if(!strncmp(cmd,"del",3))
|
||||
{
|
||||
for(i=0;i<nbsplus;i++)
|
||||
{
|
||||
if( (bsplus[i]).bssid == bssid )
|
||||
{
|
||||
nbsplus--;
|
||||
(bsplus[i]).bssid = (bsplus[nbsplus]).bssid;
|
||||
strcpy((bsplus[i]).ip, (bsplus[nbsplus]).ip);
|
||||
(bsplus[i]).connected = (bsplus[nbsplus]).connected;
|
||||
init_connection(&bsplus[nbsplus]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strncmp(cmd,"clr",3))
|
||||
{
|
||||
// find index in bsplus[]
|
||||
for(i=0;i<nbsplus;i++)
|
||||
if( (bsplus[i]).bssid == bssid )
|
||||
break;
|
||||
//process_outgoing_msg(newsock, clr_str, i);
|
||||
(bsplus[i]).connected = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"Undecoded msg: %s\n", MsgBuffer);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char runMode;
|
||||
char buffer[BUFMAX];
|
||||
char msgbuffer[BUFMAX];
|
||||
struct sockaddr_in addr, caddr;
|
||||
int sock;
|
||||
int port,caddrlen;
|
||||
int nread;
|
||||
int msglen;
|
||||
int ret;
|
||||
int i,j=0;
|
||||
time_t last_t=0;
|
||||
time_t curr_t=0;
|
||||
int pingval;
|
||||
int nlast=0;
|
||||
char clr_str[4]="clr";
|
||||
|
||||
struct timeval WaitTime;
|
||||
fd_set readfds;
|
||||
int width;
|
||||
|
||||
/*if (argc == 1)
|
||||
{
|
||||
port=PORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
port=atoi(argv[1]);
|
||||
}*/
|
||||
|
||||
if (argc > 0) {
|
||||
runMode = getopt(argc, argv, "d");
|
||||
switch (runMode) {
|
||||
case 'd':
|
||||
setup_daemon();
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
port=PORT;
|
||||
|
||||
for (i=0;i<NO_OF_BSS;i++)
|
||||
init_connection(&bsplus[i]);
|
||||
|
||||
sock=socket(PF_INET, SOCK_STREAM, 0);
|
||||
/* set family to internet */
|
||||
addr.sin_family=AF_INET;
|
||||
addr.sin_port=htons(port);
|
||||
addr.sin_addr.s_addr=INADDR_ANY;
|
||||
|
||||
if( (bind(sock, (struct sockaddr *) &addr,sizeof(addr))) != 0)
|
||||
{
|
||||
sleep(60);
|
||||
if( (bind(sock, (struct sockaddr *) &addr,sizeof(addr))) != 0)
|
||||
{
|
||||
sprintf(buffer,"Cannot bind to socket %d",port);
|
||||
perror(buffer);
|
||||
fprintf(stderr,"Wait for one minute and try again\n");
|
||||
exit(errno);
|
||||
}
|
||||
}
|
||||
listen(sock, QUEUESIZE);
|
||||
|
||||
newsock=accept(sock, (struct sockaddr*) &caddr, &caddrlen);
|
||||
|
||||
for(;;) {
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
|
||||
if (newsock != -1) {
|
||||
FD_SET(newsock, &readfds);
|
||||
width = newsock + 1;
|
||||
} else {
|
||||
FD_SET(sock, &readfds);
|
||||
width = sock + 1;
|
||||
}
|
||||
|
||||
WaitTime.tv_sec = 3;
|
||||
WaitTime.tv_usec = 0;
|
||||
ret=select(width,(fd_set*) &readfds, (fd_set*)0, (fd_set*)0, &WaitTime);
|
||||
if (ret==-1)
|
||||
{
|
||||
if(newsock != -1)
|
||||
write(newsock,"03die",5);
|
||||
perror("select() error");
|
||||
exit(errno);
|
||||
}
|
||||
if (ret == 0)
|
||||
{
|
||||
/* test BSS connectivity here */
|
||||
time(&last_t);
|
||||
for (;j<nbsplus;j++)
|
||||
{
|
||||
/* keep the poll interval be within 2 seconds */
|
||||
if (curr_t-last_t >= 2L )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(buffer,"ping -w 2 -i 1 -c 1 %s 2>/dev/null|grep time >>/dev/null",(bsplus[j]).ip);
|
||||
pingval=system(buffer);
|
||||
|
||||
if (pingval) /* if ping failed */
|
||||
{
|
||||
(bsplus[j]).no_of_unreachable++;
|
||||
|
||||
/*
|
||||
* Too many ping failure (approx. 60 sec)
|
||||
*/
|
||||
if ( (bsplus[j]).no_of_unreachable > 20 )
|
||||
{
|
||||
process_outgoing_msg(newsock, clr_str, j);
|
||||
(bsplus[j]).connected = 0;
|
||||
}
|
||||
}
|
||||
else /* if ping succ */
|
||||
{
|
||||
(bsplus[j]).no_of_unreachable=0;
|
||||
|
||||
process_outgoing_msg(newsock, "new", j);
|
||||
(bsplus[j]).connected = 1;
|
||||
}
|
||||
time(&curr_t);
|
||||
} /* end_of_for */
|
||||
if (j>=nbsplus)
|
||||
j=0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (FD_ISSET(sock, &readfds))
|
||||
{
|
||||
if (newsock==-1)
|
||||
{
|
||||
newsock=accept(sock, (struct sockaddr*) &caddr, &caddrlen);
|
||||
width = newsock + 1;
|
||||
}
|
||||
}
|
||||
if (FD_ISSET(newsock, &readfds))
|
||||
{
|
||||
nread = read(newsock, msgbuffer+nlast, 2-nlast);
|
||||
|
||||
if (nread<=0) {
|
||||
FD_CLR(newsock, &readfds);
|
||||
|
||||
close(newsock);
|
||||
newsock=-1;
|
||||
width = sock + 1;
|
||||
for (i=0;i<nbsplus;i++)
|
||||
init_connection(&bsplus[i]);
|
||||
nbsplus=0;
|
||||
}
|
||||
else if (nread < 2-nlast) /* Message partly read */
|
||||
{
|
||||
nlast += nread;
|
||||
fprintf(stderr,"Read header failed\n");
|
||||
}
|
||||
else if (nread == 2-nlast)
|
||||
{
|
||||
nlast = 0;
|
||||
if (!isdigit(msgbuffer[0]) || !isdigit(msgbuffer[1]) )
|
||||
continue;
|
||||
|
||||
msgbuffer[2]='\0';
|
||||
msglen=atoi(msgbuffer);
|
||||
nread = read(newsock, msgbuffer, msglen);
|
||||
if ( nread == msglen )
|
||||
{
|
||||
msgbuffer[msglen]='\0';
|
||||
process_incoming_msg(msgbuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"Wrong header length %d\n",msglen);
|
||||
}
|
||||
}
|
||||
else /* Message read error */
|
||||
{
|
||||
fprintf(stderr,"Read header failed\n");
|
||||
}
|
||||
} /* End_of_if (FD_ISSET */
|
||||
} /* End_of_for(;;) */
|
||||
}
|
||||
|
||||
void setup_daemon(void)
|
||||
{
|
||||
/*
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
close(i);
|
||||
}
|
||||
*/
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
perror("setup_daemon(), 1st fork()");
|
||||
exit(2);
|
||||
default:
|
||||
exit(0);
|
||||
case 0:
|
||||
if (setsid() == -1) {
|
||||
perror("setup_daemon(), setsid()");
|
||||
exit(3);
|
||||
}
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
perror("setup_daemon(), 2nd fork()");
|
||||
exit(3);
|
||||
default:
|
||||
exit(0);
|
||||
case 0:
|
||||
umask(0);
|
||||
/* and return with daemon set up */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
500
src/configMgr/c_program/impmod/bss_hb.c
Normal file
500
src/configMgr/c_program/impmod/bss_hb.c
Normal file
@@ -0,0 +1,500 @@
|
||||
/* Title: bss_hb.cpp
|
||||
* Description: init and refresh BSS(BSC+BTS) status.
|
||||
* Author: Steven Wong
|
||||
* Date: 2001/09/24
|
||||
* Modified by: CTC
|
||||
*/
|
||||
|
||||
#include "bss_hb.h"
|
||||
|
||||
/*
|
||||
* UDP socket variable
|
||||
*/
|
||||
#define HEARTBEAT_PORT 4957 //snmp
|
||||
//#define BROADCAST_IP "155.226.202.63"
|
||||
char OMC_0_IP[16];
|
||||
char OMC_1_IP[16];
|
||||
|
||||
MYSQL omcDbConn,*omcDb_sock;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char sqlstring[128];
|
||||
|
||||
static int udp_sockfd;
|
||||
static struct sockaddr_in udp_cli_addr;
|
||||
static struct sockaddr_in udp_serv_addr;
|
||||
|
||||
static BYTE sendbuf[SNMP_MSG_LEN];
|
||||
|
||||
static tHeartbeat bsc_heartbeat[NO_OF_BSS];
|
||||
static tHeartbeat bts_heartbeat[NO_OF_BSS*NO_OF_BTSMgr];
|
||||
|
||||
struct tBssLed bts_led[NO_OF_BSS*NO_OF_BTSMgr];
|
||||
struct tBssLed bsc_led[NO_OF_BSS];
|
||||
|
||||
static char snmphead[SNMP_HEADER_LEN] = {
|
||||
0x30, VAR, /* length 1 (1) */
|
||||
0x02, 0x01, 0x01, 0x04, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,0xa7,
|
||||
VAR, /* length 2 (14) */
|
||||
0x02, 0x01, 0x8e, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x30,
|
||||
VAR, /* length 3 (25) */
|
||||
0x30, VAR, /* length 4 (27) */
|
||||
0x06, OBJID_LEN, /* OBJID_LEN:(29) */
|
||||
0x2b, 0x06, 0x01, 0x04, 0x01,
|
||||
0x8a, 0x5d, 0x01, 0x05, VAR, 0x01,0x00, /* oid offset (39)*/
|
||||
0x04, VAR /* value length(43) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Return the index for LED display.
|
||||
* signal_element is defined according to OMCR_BSSTREE MySQL table
|
||||
* return -1 if error
|
||||
*
|
||||
* LED assignment:
|
||||
* ________________________________________________________________________________________
|
||||
* LED:[0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 |12 |13 |14 |15 ]
|
||||
* BTS --> [IWP|S1E1|TRX2|TRX3|TRX4|TRX5|TRX6|TRX7|TRX8|TRX9 |TRX10 |TRX11|TRX12|TRX13|ABIS | ]
|
||||
* BSC --> [IWP|S1E1|S2E1|S3E1|S4E1|S5E1|S6E1|S7E1|S8E1|S9E1 |S10E1 |S11E1|S12E1|S13E1|S14E1|S15E1]
|
||||
*/
|
||||
int object2LedId(int btsid,int signal_element)
|
||||
{
|
||||
int led_index;
|
||||
|
||||
if (btsid!=99)//BTS
|
||||
{
|
||||
switch (signal_element)
|
||||
{
|
||||
case 0: // IWP
|
||||
led_index = 0;break;
|
||||
case 10: // Slot1 E1
|
||||
led_index = 1;break;
|
||||
case 20: // TRX 2
|
||||
led_index = 2;break;
|
||||
case 30: // TRX 3
|
||||
led_index = 3;break;
|
||||
case 40: // TRX 4
|
||||
led_index = 4;break;
|
||||
case 50: // TRX 5
|
||||
led_index = 5;break;
|
||||
case 60: // TRX 6
|
||||
led_index = 6;break;
|
||||
case 70: // TRX 7
|
||||
led_index = 7;break;
|
||||
case 80: // TRX 8
|
||||
led_index = 8;break;
|
||||
case 90: // TRX 9
|
||||
led_index = 9;break;
|
||||
case 100: // TRX 10
|
||||
led_index = 10;break;
|
||||
case 110: // TRX 11
|
||||
led_index = 11;break;
|
||||
case 120: // TRX 12
|
||||
led_index = 12;break;
|
||||
case 130: // TRX 13
|
||||
led_index = 13;break;
|
||||
case 11: // AbisMgr
|
||||
led_index = 14;break;
|
||||
default:
|
||||
led_index = -1;break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (signal_element)
|
||||
{
|
||||
case 0: // IWP
|
||||
led_index = 0;break;
|
||||
case 10: // Slot1 E1
|
||||
led_index = 1;break;
|
||||
case 20: // Slot2 E1
|
||||
led_index = 2;break;
|
||||
case 30: // Slot3 E1
|
||||
led_index = 3;break;
|
||||
case 40: // Slot4 E1
|
||||
led_index = 4;break;
|
||||
case 50: // Slot5 E1
|
||||
led_index = 5;break;
|
||||
case 60: // Slot6 E1
|
||||
led_index = 6;break;
|
||||
case 70: // Slot7 E1
|
||||
led_index = 7;break;
|
||||
case 80: // Slot8 E1
|
||||
led_index = 8;break;
|
||||
case 90: // Slot9 E1
|
||||
led_index = 9;break;
|
||||
case 100: // Slot10 E1
|
||||
led_index = 10;break;
|
||||
case 110: // Slot11 E1
|
||||
led_index = 11;break;
|
||||
case 120: // Slot12 E1
|
||||
led_index = 12;break;
|
||||
case 130: // Slot13 E1
|
||||
led_index = 13;break;
|
||||
case 140: // Slot14 E1
|
||||
led_index = 14;break;
|
||||
case 150: // Slot15 E1
|
||||
led_index = 15;break;
|
||||
default:
|
||||
led_index = -1;break;
|
||||
}
|
||||
}
|
||||
return led_index;
|
||||
}
|
||||
void initOmcDbConn()
|
||||
{
|
||||
mysql_init(&omcDbConn);
|
||||
omcDb_sock=mysql_real_connect(&omcDbConn,NULL,"application","noitacilpPA#68*","OMC_PUB",0,NULL,0);
|
||||
if (omcDb_sock == 0)
|
||||
exit(6);
|
||||
}
|
||||
|
||||
void initHeartbeatStruct(tHeartbeat *heartbeat)
|
||||
{
|
||||
int i;
|
||||
|
||||
heartbeat->system_id=0;
|
||||
heartbeat->timestamp=0;
|
||||
for (i=0; i<HB_LED_CONTROL_LEN; i++)
|
||||
{
|
||||
heartbeat->led_control[i]=0;
|
||||
}
|
||||
heartbeat->component_id=0;
|
||||
heartbeat->alarmlevel=0;
|
||||
heartbeat->alarmcode=0;
|
||||
heartbeat->reserved=0;
|
||||
for (i=0; i<HB_EXTENDED_LEN; i++)
|
||||
{
|
||||
heartbeat->extended[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//set which was is install and set all is ok
|
||||
void initBssStatusTransmitter(void)
|
||||
{
|
||||
int i,j;
|
||||
int on;
|
||||
bzero((char *) &udp_serv_addr, sizeof(udp_serv_addr));
|
||||
udp_serv_addr.sin_family = AF_INET;
|
||||
//udp_serv_addr.sin_addr.s_addr = inet_addr(BROADCAST_IP);
|
||||
udp_serv_addr.sin_port = htons(HEARTBEAT_PORT);
|
||||
|
||||
|
||||
if ((udp_sockfd = socket (AF_INET, SOCK_DGRAM, 0)) < 0 )
|
||||
{
|
||||
exit (errno);
|
||||
}
|
||||
|
||||
bzero((char *) &udp_cli_addr, sizeof(udp_cli_addr));
|
||||
udp_cli_addr.sin_family = AF_INET;
|
||||
udp_cli_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
udp_cli_addr.sin_port = htons(0);
|
||||
|
||||
if (setsockopt(udp_sockfd, SOL_SOCKET, SO_RCVBUF, sendbuf, SNMP_MSG_LEN) < 0)
|
||||
{
|
||||
perror("setsockopt\n");
|
||||
}
|
||||
on=1;
|
||||
|
||||
if (setsockopt(udp_sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||
{
|
||||
perror("setsockopt\n");
|
||||
}
|
||||
if (fcntl(udp_sockfd, F_SETFL,O_NONBLOCK)<0)
|
||||
{
|
||||
perror("fcntl()\n");
|
||||
}
|
||||
if (setsockopt(udp_sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) < 0)
|
||||
{
|
||||
perror("setsockopt\n");
|
||||
}
|
||||
|
||||
|
||||
if (bind(udp_sockfd, (struct sockaddr *) &udp_cli_addr, sizeof(udp_cli_addr)) < 0)
|
||||
{
|
||||
|
||||
exit (errno);
|
||||
}
|
||||
|
||||
for (i=0; i<NO_OF_BSS; i++)
|
||||
{
|
||||
initHeartbeatStruct(&(bsc_heartbeat[i]));
|
||||
for (j=0; j<NO_OF_BTSMgr; j++)
|
||||
{
|
||||
initHeartbeatStruct(&(bts_heartbeat[NO_OF_BTSMgr*i+j]));
|
||||
}
|
||||
}
|
||||
initOmcDbConn();
|
||||
} //end of function initBscStatus()
|
||||
|
||||
|
||||
/*
|
||||
* 0xFF is group alarm clear (refer to Meng XZ's heartbeat format document
|
||||
*/
|
||||
void format_alarmcode(int *alarmcode)
|
||||
{
|
||||
|
||||
*alarmcode=0; // set it to zero anyway as it is not processed by TS_OMC
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* alarm level = component type + ID
|
||||
* For example: E1port.0.1.1,
|
||||
*
|
||||
* 0x4 -> E1
|
||||
* 0x5 -> TRX
|
||||
* 0x6 -> Clock
|
||||
* 0x7 -> Shelf
|
||||
* 0x8 -> Software
|
||||
* 0x9 -> Environment
|
||||
* 0xa -> Lapd
|
||||
* 0xb -> Bts
|
||||
* 0xc -> Bsc
|
||||
* 0xd -> Aif
|
||||
* 0xe -> Bbu
|
||||
* 0xf -> Rfd
|
||||
*
|
||||
*/
|
||||
void format_alarmlevel(int *alarmlevel)
|
||||
{
|
||||
*alarmlevel=0; // set it to zero anyway as it is not processed by TS_OMC
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void send_heartbeat(int index, struct tBssLed *pbsc_led,struct tBssLed *pbts_led, int component_id, int alarmcode, int alarmlevel,int bsType)
|
||||
{
|
||||
int retval,i,offset;
|
||||
tHeartbeat *pHeartbeat;
|
||||
BYTE *psendbuf;
|
||||
int bts_code;
|
||||
int bsc_code;
|
||||
char tmpHb[256];
|
||||
|
||||
int bssid = index / NO_OF_BTSMgr;
|
||||
int btsid = index % NO_OF_BTSMgr;
|
||||
|
||||
time_t unix_time;
|
||||
|
||||
format_alarmcode(&alarmcode);
|
||||
format_alarmlevel(&alarmlevel);
|
||||
|
||||
sprintf(OMC_0_IP,"");
|
||||
sprintf(OMC_1_IP,"");
|
||||
sprintf(sqlstring, "select sysNo,ip FROM OMC_PUB.sysInfo WHERE sysTypeNo='0'");
|
||||
mysql_query(omcDb_sock, sqlstring);
|
||||
if(mysql_errno(omcDb_sock) > 0)
|
||||
{
|
||||
printf("\n Error number:%d", mysql_errno(omcDb_sock));
|
||||
printf("\n Description: %s", mysql_error(omcDb_sock));
|
||||
exit(16);
|
||||
}
|
||||
|
||||
result = mysql_use_result(omcDb_sock);
|
||||
while((row = mysql_fetch_row(result))){
|
||||
if(atoi(row[0])==0){
|
||||
sprintf(OMC_0_IP,row[1]);
|
||||
}else if(atoi(row[0])==1){
|
||||
sprintf(OMC_1_IP,row[1]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
/*
|
||||
* Insert the length field in SNMP header
|
||||
*/
|
||||
snmphead[LENGTH1] = SNMP_MSG_LEN - LENGTH1 - 1;
|
||||
snmphead[LENGTH2] = SNMP_MSG_LEN - LENGTH2 - 1;
|
||||
snmphead[LENGTH3] = SNMP_MSG_LEN - LENGTH3 - 1;
|
||||
snmphead[LENGTH4] = SNMP_MSG_LEN - LENGTH4 - 1;
|
||||
snmphead[VALUE_LEN] = SNMP_MSG_LEN - VALUE_LEN - 1;
|
||||
|
||||
|
||||
// BSC
|
||||
psendbuf = &sendbuf[0];
|
||||
snmphead[SNMP_OBJID] = BSC_OBJID;
|
||||
pHeartbeat = &(bsc_heartbeat[bssid]);
|
||||
|
||||
unix_time = time((time_t *)0);
|
||||
pHeartbeat->timestamp = ((unix_time & 0xff000000) >> 24)
|
||||
| ((unix_time & 0xff0000) >> 8)
|
||||
| ((unix_time & 0xff00) << 8)
|
||||
| ((unix_time & 0xff) << 24);
|
||||
|
||||
if(pbsc_led->led[0] != 0xf){ //installed
|
||||
|
||||
bsc_code = bssid*256;
|
||||
pHeartbeat->system_id = ((bsc_code & 0xff00) >> 8) | ((bsc_code & 0xff) << 8);
|
||||
|
||||
for(i=0;i<8;i++){
|
||||
pHeartbeat->led_control[i]=((pbsc_led->led[2*i] & 0x0f)<<4) | (pbsc_led->led[2*i+1] & 0x0f);
|
||||
}
|
||||
|
||||
/*
|
||||
pHeartbeat->component_id = component_id;
|
||||
pHeartbeat->alarmlevel = alarmlevel;
|
||||
pHeartbeat->alarmcode = alarmcode;
|
||||
*/
|
||||
|
||||
pHeartbeat->component_id = 0;
|
||||
pHeartbeat->alarmlevel = 0;
|
||||
pHeartbeat->alarmcode = 0;
|
||||
|
||||
/*
|
||||
* Copy message to message buffer
|
||||
*/
|
||||
offset = 0;
|
||||
//memcpy(psendbuf, snmphead, SNMP_HEADER_LEN);//snmp head
|
||||
//offset += SNMP_HEADER_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->system_id,HB_SYSTEM_ID_LEN);//system id
|
||||
offset += HB_SYSTEM_ID_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->timestamp,HB_TIMESTAMP_LEN);//time
|
||||
offset += HB_TIMESTAMP_LEN;
|
||||
memcpy(psendbuf+offset, pHeartbeat->led_control,HB_LED_CONTROL_LEN);//len control
|
||||
offset += HB_LED_CONTROL_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->component_id,HB_COMPONENT_ID_LEN);//component id
|
||||
offset += HB_COMPONENT_ID_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->alarmlevel,HB_ALARMLEVEL_LEN);//alarmlevel
|
||||
offset += HB_ALARMLEVEL_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->alarmcode,HB_ALARMCODE_LEN);//alarmcode
|
||||
offset += HB_ALARMCODE_LEN;
|
||||
memcpy(psendbuf+offset, &pHeartbeat->reserved,HB_RESERVED_LEN);
|
||||
offset += HB_RESERVED_LEN;
|
||||
memcpy(psendbuf+offset, pHeartbeat->extended,HB_EXTENDED_LEN);
|
||||
|
||||
omc_RbcdToAscii(tmpHb, sendbuf, (offset + HB_EXTENDED_LEN)*2);
|
||||
sprintf(sqlstring, "REPLACE INTO sysStat SET sysTypeNo='510',sysNo=%d,subSysNo='0',detailStat='%s',updateTime=CURRENT_TIMESTAMP",
|
||||
bssid,tmpHb);
|
||||
mysql_query(omcDb_sock, sqlstring);
|
||||
/*if(strlen(OMC_0_IP)>0){
|
||||
udp_serv_addr.sin_addr.s_addr = inet_addr(OMC_0_IP);
|
||||
retval = sendto(udp_sockfd, sendbuf, SNMP_MSG_LEN, 0,
|
||||
(const struct sockaddr *)&udp_serv_addr, sizeof(udp_serv_addr));
|
||||
//printf("Bsc heartbeat is sent~~~~~~~~~~~~~~~~\n\n");
|
||||
}
|
||||
|
||||
if(strlen(OMC_1_IP)>0){
|
||||
udp_serv_addr.sin_addr.s_addr = inet_addr(OMC_1_IP);
|
||||
retval = sendto(udp_sockfd, sendbuf, SNMP_MSG_LEN, 0,
|
||||
(const struct sockaddr *)&udp_serv_addr, sizeof(udp_serv_addr));
|
||||
//printf("Bsc_hb LEN=%d:",retval);
|
||||
|
||||
}*/
|
||||
//for ( n=0;n<SNMP_MSG_LEN;n++)
|
||||
// printf("%x ",(int) sendbuf[n]);
|
||||
//printf("\n");
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
perror("BSS <Bsc> heartbeat send fail!\n");
|
||||
}
|
||||
|
||||
}//end of if(installed)
|
||||
|
||||
|
||||
//check the device is BSC+BTS or BS+
|
||||
if(btsid==0&&bsType==0){
|
||||
return;
|
||||
}
|
||||
|
||||
psendbuf = &sendbuf[0];
|
||||
snmphead[SNMP_OBJID] = BTS_OBJID;
|
||||
|
||||
pHeartbeat = &(bts_heartbeat[btsid]);
|
||||
|
||||
//bts_code=bssid*256 + btsid - 1;
|
||||
bts_code=bssid*256 + btsid;
|
||||
pHeartbeat->system_id = ((bts_code & 0xff00) >> 8) | ((bts_code & 0xff) << 8);
|
||||
|
||||
unix_time = time((time_t *)0);
|
||||
pHeartbeat->timestamp = ((unix_time & 0xff000000) >> 24)
|
||||
| ((unix_time & 0xff0000) >> 8)
|
||||
| ((unix_time & 0xff00) << 8)
|
||||
| ((unix_time & 0xff) << 24);
|
||||
for(i=0;i<8;i++){
|
||||
pHeartbeat->led_control[i]=((pbts_led->led[2*i] & 0x0f)<<4) | (pbts_led->led[2*i+1] & 0x0f);
|
||||
}
|
||||
|
||||
/*
|
||||
pHeartbeat->component_id = component_id;
|
||||
pHeartbeat->alarmlevel = alarmlevel;
|
||||
pHeartbeat->alarmcode = alarmcode;
|
||||
*/
|
||||
pHeartbeat->component_id = 0;
|
||||
pHeartbeat->alarmlevel = 0;
|
||||
pHeartbeat->alarmcode = 0;
|
||||
|
||||
/*
|
||||
* Copy message to message buffer
|
||||
*/
|
||||
//memcpy(psendbuf, snmphead, SNMP_HEADER_LEN);
|
||||
//psendbuf += SNMP_HEADER_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->system_id,HB_SYSTEM_ID_LEN);
|
||||
psendbuf += HB_SYSTEM_ID_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->timestamp,HB_TIMESTAMP_LEN);
|
||||
psendbuf += HB_TIMESTAMP_LEN;
|
||||
memcpy(psendbuf, pHeartbeat->led_control,HB_LED_CONTROL_LEN);
|
||||
psendbuf += HB_LED_CONTROL_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->component_id,HB_COMPONENT_ID_LEN);
|
||||
psendbuf += HB_COMPONENT_ID_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->alarmlevel,HB_ALARMLEVEL_LEN);
|
||||
psendbuf += HB_ALARMLEVEL_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->alarmcode,HB_ALARMCODE_LEN);
|
||||
psendbuf += HB_ALARMCODE_LEN;
|
||||
memcpy(psendbuf, &pHeartbeat->reserved,HB_RESERVED_LEN);
|
||||
psendbuf += HB_RESERVED_LEN;
|
||||
memcpy(psendbuf, pHeartbeat->extended,HB_EXTENDED_LEN);
|
||||
|
||||
omc_RbcdToAscii(tmpHb, sendbuf, (psendbuf - sendbuf+ HB_EXTENDED_LEN)*2);
|
||||
sprintf(sqlstring, "REPLACE INTO sysStat SET sysTypeNo='520',sysNo=%d,subSysNo='%d',detailStat='%s',updateTime=CURRENT_TIMESTAMP",
|
||||
bssid,btsid,tmpHb);
|
||||
//printf("sqlstring=%s\n",sqlstring);
|
||||
mysql_query(omcDb_sock, sqlstring);
|
||||
|
||||
/* if(strlen(OMC_0_IP)>0){
|
||||
udp_serv_addr.sin_addr.s_addr = inet_addr(OMC_0_IP);
|
||||
retval = sendto(udp_sockfd, sendbuf, SNMP_MSG_LEN, 0,
|
||||
(const struct sockaddr *)&udp_serv_addr, sizeof(udp_serv_addr));
|
||||
}
|
||||
if(strlen(OMC_1_IP)>0){
|
||||
udp_serv_addr.sin_addr.s_addr = inet_addr(OMC_1_IP);
|
||||
retval = sendto(udp_sockfd, sendbuf, SNMP_MSG_LEN, 0,
|
||||
(const struct sockaddr *)&udp_serv_addr, sizeof(udp_serv_addr));
|
||||
//printf("\33[36m\nBts heartbeat is sent!!!!!!!!!!!!!!!!!!!\n\n");
|
||||
//printf("Bts_hb LEN=%d:",retval);
|
||||
}*/
|
||||
// for (n=0;n<SNMP_MSG_LEN;n++)
|
||||
// printf("%x ",(int) sendbuf[n]);
|
||||
// printf("\n\n");
|
||||
if (retval < 0)
|
||||
{
|
||||
perror("BSS <Bts> heartbeat send fail!\n");
|
||||
}
|
||||
|
||||
}//end of function
|
||||
|
||||
void clearBssStatus(void)
|
||||
{
|
||||
close(udp_sockfd);
|
||||
}
|
||||
|
||||
void omc_RbcdToAscii(char *ascii_buf, const unsigned char *bcd_buf,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
//if(sizeof(*ascii_buf) < len*2){
|
||||
// len = sizeof(*ascii_buf)/2;
|
||||
//}
|
||||
for (i = 0; i < len; i++) {
|
||||
if ((len - i) & 1) {
|
||||
ch = *(bcd_buf++) & 0x0f;
|
||||
} else {
|
||||
//ch = (*bcd_buf & 0xf0) >> 4;
|
||||
ch = *bcd_buf >> 4;
|
||||
}
|
||||
ascii_buf[i] = ch + ((ch > 9) ? 'A' - 10 : '0');
|
||||
}
|
||||
ascii_buf[i] = '\0';
|
||||
}
|
||||
140
src/configMgr/c_program/impmod/bss_hb.h
Normal file
140
src/configMgr/c_program/impmod/bss_hb.h
Normal file
@@ -0,0 +1,140 @@
|
||||
#ifndef __BSS_HB_H__
|
||||
#define __BSS_HB_H__
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "mysql.h"
|
||||
#include "iwtypes.h"
|
||||
#include "includes.h"
|
||||
|
||||
#define BSC_BASE 9*1024
|
||||
#define BTS_BASE 10*1024
|
||||
|
||||
#define BSC_OBJID 0x01
|
||||
#define BTS_OBJID 0x02
|
||||
#define OBJID_LEN 0x0C
|
||||
#define VAR 0xff
|
||||
|
||||
#define SNMP_HEADER_LEN 44
|
||||
|
||||
#define LENGTH1 1
|
||||
#define LENGTH2 14
|
||||
#define LENGTH3 25
|
||||
#define LENGTH4 27
|
||||
#define SNMP_OBJID 39
|
||||
#define VALUE_LEN 43
|
||||
/*
|
||||
* System Type in heartbeat information
|
||||
*/
|
||||
#define BSC 9
|
||||
#define BTS 10
|
||||
|
||||
#define NO_OF_BSS 12
|
||||
#define NO_OF_BTSMgr 13
|
||||
/*
|
||||
* Heartbeat message field length
|
||||
*/
|
||||
#define HB_SYSTEM_ID_LEN 2
|
||||
#define HB_TIMESTAMP_LEN 4
|
||||
#define HB_LED_CONTROL_LEN 8
|
||||
#define HB_COMPONENT_ID_LEN 1
|
||||
#define HB_ALARMLEVEL_LEN 1
|
||||
#define HB_ALARMCODE_LEN 1
|
||||
#define HB_RESERVED_LEN 1
|
||||
#define HB_EXTENDED_LEN 48
|
||||
|
||||
#define HB_BODY_LEN ( HB_SYSTEM_ID_LEN + HB_TIMESTAMP_LEN \
|
||||
+ HB_LED_CONTROL_LEN + HB_COMPONENT_ID_LEN \
|
||||
+ HB_ALARMLEVEL_LEN + HB_ALARMCODE_LEN \
|
||||
+ HB_RESERVED_LEN + HB_EXTENDED_LEN )
|
||||
|
||||
#define SNMP_MSG_LEN (SNMP_HEADER_LEN + HB_BODY_LEN)
|
||||
#define HB_NO_OF_LED HB_LED_CONTROL_LEN * 2
|
||||
|
||||
#define def_sql_length 16384
|
||||
|
||||
/****************************************
|
||||
* BSS LED struct
|
||||
* Max 12 BSC and 12x12 BTS = 156 units
|
||||
****************************************/
|
||||
struct tBssLed
|
||||
{
|
||||
bool presence;
|
||||
int led[HB_NO_OF_LED];
|
||||
int component_id;
|
||||
int alarmcode;
|
||||
int alarmlevel;
|
||||
};
|
||||
//define the structure that store status info
|
||||
typedef struct _tHeartbeat
|
||||
{
|
||||
int system_id; /* 0-512 */
|
||||
time_t timestamp; /* 32-bit timestamp */
|
||||
BYTE led_control[HB_LED_CONTROL_LEN]; /* 16 LED, 4-bit per LED */
|
||||
/* 0 - off */
|
||||
/* 1 - green */
|
||||
/* 2 - red */
|
||||
/* 3 - blue */
|
||||
/* 4 - yellow */
|
||||
/* 5 - ambra */
|
||||
/* 6 - white */
|
||||
/* 7 - not in use */
|
||||
int component_id;
|
||||
int alarmlevel;
|
||||
int alarmcode;
|
||||
int reserved;
|
||||
BYTE extended[HB_EXTENDED_LEN]; /* application defined */
|
||||
} tHeartbeat;
|
||||
|
||||
/*
|
||||
* index = BSSID * NO_OF_BTSMgr + BTSMGR_ID
|
||||
* e.g. BSC01 -> system_id = 13
|
||||
* BTS3 of BSC01 -> system_id = 1*13+3 = 16
|
||||
*
|
||||
* Heartbeat format:
|
||||
*
|
||||
* byte 0-1: system id
|
||||
* 0 :000-003 OMC
|
||||
* 4 :004-007 HLR
|
||||
* 8 :008-00B PPS
|
||||
* 12 :00C-00F CDR
|
||||
* 16 :010-013 SMS
|
||||
* ... ... ...
|
||||
* 100:064-077 VPS
|
||||
* 120:078-0B7 CSU
|
||||
* 184:0B8-0CF BSC
|
||||
* 208:0D0-1EF BTS
|
||||
*
|
||||
* byte 2-5: timestamp (4 bytes)
|
||||
* byte 6-13: 16 led code
|
||||
* bit 3: 1=continuous, 0=blinking
|
||||
* bit 2-0: 0=off,1=green,2=yellow,3=red,4=blue,5=umbra,6=white,7=not in use
|
||||
* byte 14: Component ID (need further defined)
|
||||
* byte 15: alarm level (00 normal, 01 critical, 02 major)
|
||||
* byte 16: alarm code
|
||||
* 0 normal, 1-255 alarmcode,
|
||||
* 254(0FEH) reserved for device timeout
|
||||
* 255(0FFH) group alarm clear
|
||||
* byte 17: reserved
|
||||
* byte 18-65: extended status (not used by BSS OMC)
|
||||
*/
|
||||
#define LED_OFF (0x8)
|
||||
#define LED_GREEN (0x8 | 1)
|
||||
#define LED_YELLOW (0x8 | 2)
|
||||
#define LED_RED (0x8 | 3)
|
||||
#define LED_BLUE (0x8 | 4)
|
||||
#define LED_UMBRA (0x8 | 5)
|
||||
#define LED_WHITE (0x8 | 6)
|
||||
#define LED_NOT_IN_USE (0x8 | 7)
|
||||
|
||||
extern void initBssStatusTransmitter(void);
|
||||
extern void updateBssStatus(MYSQL *mysql_sock, int led_num, int color_ctrl);
|
||||
extern void send_heartbeat(int index, struct tBssLed *pbsc_led,struct tBssLed *pbts_led, int component_id, int alarmcode, int alarmlevel,int bsType);
|
||||
extern void clearBssStatus(void);
|
||||
extern int object2LedId(int btsid,int signal_element);
|
||||
extern struct tBssLed bts_led[NO_OF_BSS*NO_OF_BTSMgr];
|
||||
extern struct tBssLed bsc_led[NO_OF_BSS];
|
||||
|
||||
#endif /* __BSS_HB_H__ */
|
||||
4618
src/configMgr/c_program/impmod/bsscomm.c
Normal file
4618
src/configMgr/c_program/impmod/bsscomm.c
Normal file
File diff suppressed because it is too large
Load Diff
358
src/configMgr/c_program/impmod/bsscomm.h
Normal file
358
src/configMgr/c_program/impmod/bsscomm.h
Normal file
@@ -0,0 +1,358 @@
|
||||
#ifndef BSSCOMM__H
|
||||
#define BSSCOMM__H
|
||||
/*******************************************************************
|
||||
|
||||
Usage: Interwave network Management Protocol(IMP) interface for BSS OMC
|
||||
|
||||
Interface function:
|
||||
{1}imp_init() -> init IMP interface for BSS OMC
|
||||
Step 0: init MySQL database (BssOmcDb)
|
||||
->connectDB();
|
||||
->initOMCR_COMMANDTable();
|
||||
->GetBssMaxConfigFromDB();
|
||||
->GetAllTableName();
|
||||
Step 1: init ImpConn structure
|
||||
Step 2: set CmdBuffer[CMD_BUFFER_SIZE] structure is available
|
||||
Step 3: get bssid,ip from MySQL database which has been added by BSS OMC operator
|
||||
->SELECT bssid,ip,name,uploaded FROM OMCR_BSSTABLE WHERE ip<>'';
|
||||
->AddImpConn(): put pBssConn->(bssid,ip..) to bsplus_down[]
|
||||
Step 4: Synchronize the OMCR_BSSTREE.MaxSeverity with OMCR_ALARMEVENT at startup
|
||||
->syncBssTreeAlarm()
|
||||
Step 5: init BssStatus Transmitter
|
||||
->initBssStatusTransmitter():check BSS OMC(hb_port.4957) is ok and initHeartbeatStruct()
|
||||
|
||||
{2}imp_timer()-> Call ImpConnMultiplexer() to Maintain a IMP connection with all the manageable iwbox
|
||||
Part 0: connect with BSS
|
||||
Part 1: if BSS start ,upload from BSS
|
||||
Part 2: if receive no event,
|
||||
->retrieveCmdFromDatabase()
|
||||
->ProcessUserCommand(tImpConn *pBssConn, char *pCommandString, u32 TransId)
|
||||
->DispatchNmiCommand(pBssConn):Send 1 command to each BSS in one cycle if queue is not empty
|
||||
Part 3: if receive imp message,
|
||||
Step 0: Copy previous buffer content into present buffer
|
||||
Step 1: Read IMP Length Header
|
||||
Step 2: Read the remaining IMP message
|
||||
Step 3: Whole message has been read
|
||||
Step 4: Process imp message
|
||||
State 1:(if event)ProcessEventMsg(),according eventname
|
||||
"FailureReport" ->update_alarmevent_table
|
||||
"BtsMeasurements" ->update_BtsMeas_table
|
||||
"tstComplete" ->update_bootup_time
|
||||
"CardCreated" ->update_cardcreated_event
|
||||
"TrxCreated" ->update_trxcreated_event
|
||||
"Cser"or"ACN" ->update_networkevent_table
|
||||
State 2: Decode IMP Response Message,according OperatorCode
|
||||
Create or Delete ->ProcessCreateDeleteBody ->requestObjCfg
|
||||
Contents ->ProcessContentsBody
|
||||
Set or Get ->ProcessSetGetBody ->updateBssCfg
|
||||
Action ->ProcessActionBody
|
||||
Bsplus monitoring server:
|
||||
--------- ---------
|
||||
| bsscomm | | monitor |
|
||||
--------- ---------
|
||||
add
|
||||
tell monitor program according to the bsplus ip ping
|
||||
the bsplus ip/bssid list ---------------> Test connection with BSS ------------> BSS
|
||||
|
||||
new
|
||||
Calling:restoreBssConn()
|
||||
Try to restore connection <--------------- if ping successful
|
||||
If reconnect,put the
|
||||
connection in bsplus[]
|
||||
|
||||
clr
|
||||
Calling:ClearBssConn() <--------------- if ping fail(fail count >20)
|
||||
TCP connnection lost
|
||||
Move bsplus[i] to bsplus_down[]
|
||||
|
||||
|
||||
Code file list:
|
||||
|
||||
bsscomm.c,bsscomm.h: IMP(interWave Network Mannagement) interface for BSS OMC
|
||||
nmimp.c ,nmimp.h : Methods for IMP data marshaling/unmarshaling.
|
||||
nmtypes.c,nmtypes.h: Definitions of fundamental data types.
|
||||
bss_hb.c ,bss_hb.h : init and refresh BSS(BSC+BTS) status.
|
||||
alive.c monitoring the connection between Bsscomm and BSS
|
||||
|
||||
Author:XChen
|
||||
Date: 2006-09-20
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include "unistd.h"
|
||||
#include <errno.h>
|
||||
/*
|
||||
* Include ModImp header files here
|
||||
*/
|
||||
#include "iwtypes.h"
|
||||
#include "nmtypes.h"
|
||||
#include "nmstatus.h"
|
||||
#include "nmimp.h"
|
||||
/*
|
||||
* For ImpConnMultiplexer
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#include <netdb.h>
|
||||
#include <time.h>
|
||||
/*
|
||||
* Max 12 BSC and 12x12 BTS
|
||||
*/
|
||||
#define NO_OF_BSS 12
|
||||
#define NO_OF_BTSMgr 13
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
#include "mysql.h"
|
||||
#define DB "BssOmcDb"
|
||||
#define USERNAME "application"
|
||||
#define PASSWD "noitacilpPA#68*"
|
||||
#define SQLSTRING_LEN 16384 // 16384 = 2^14
|
||||
|
||||
MYSQL mysql,*mysql_sock;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
//MYSQL_FIELD *field;
|
||||
char sqlstring[SQLSTRING_LEN];
|
||||
|
||||
/*
|
||||
* Store the name of MYSQL tablename at program startup
|
||||
*/
|
||||
#define MAX_NUM_OF_SQL_TABLE 100
|
||||
int num_of_mysql_table;
|
||||
char **mysql_tables;
|
||||
|
||||
#define NMIPORT 2112
|
||||
#define BUFMAX 4096
|
||||
#define MSG_BODY_SIZE 1024
|
||||
#define SILENT_CODE ((u32)0x0)
|
||||
#define WAIT_TIME 120
|
||||
#define MEASUREMENT_INTERVAL 15
|
||||
//#define BSSVERSION "iw06_00.028"
|
||||
/*
|
||||
* For BSS momitor
|
||||
*/
|
||||
#define MONITOR_PORT 5354
|
||||
int monitor_fd=-1;
|
||||
|
||||
#define TIME_LEN 9
|
||||
|
||||
#define ADD 1
|
||||
#define DEL 2
|
||||
#define CLR 3
|
||||
/*
|
||||
* For processing user command
|
||||
*/
|
||||
#define READ_CMD 0
|
||||
#define READ_OBJECT 1
|
||||
#define READ_PARMS 2
|
||||
#define READ_END 3
|
||||
|
||||
#define BSSERROR (-1)
|
||||
#define ACTION 0
|
||||
#define CONTENTS 1
|
||||
#define CREATE 2
|
||||
#define DELETE 3
|
||||
#define GET 4
|
||||
#define OID 5
|
||||
#define SET 6
|
||||
#define NEWBSS 7
|
||||
#define DROPBSS 8
|
||||
#define UPLOAD 9
|
||||
/*
|
||||
* For alarm management
|
||||
*/
|
||||
#define SV_CEASED 0
|
||||
#define SV_CRITICAL 1
|
||||
#define SV_MAJOR 2
|
||||
#define SV_MINOR 3
|
||||
#define SV_WARNING 4
|
||||
#define SV_INDETERMINATE 5
|
||||
#define MAXSEVERITY SV_MAJOR // The maxseverity in number of concern
|
||||
// You have to update alarmevent.php accordingly
|
||||
#define HEARTBEAT_INTERVAL 10L
|
||||
#define SELECT_INTERVAL 2L
|
||||
/*
|
||||
* keep track the command status after PHP put the command on DB
|
||||
*/
|
||||
#define CMD_NEW 255
|
||||
#define CMD_READ_FROM_DB 254
|
||||
#define CMD_END 0
|
||||
|
||||
#define CONNECTED_STATE_MAX 255
|
||||
|
||||
#define GET_READ_ATTRIB 1
|
||||
#define GET_ATTRIB_END 2
|
||||
|
||||
#define SET_READ_ATTRIB 1
|
||||
#define SET_READ_INT 2
|
||||
#define SET_READ_STRING 3
|
||||
#define SET_READ_INTARRAY 4
|
||||
#define SET_COMMAND_END 5
|
||||
#define SET_ATTRIB_END 6
|
||||
#define SET_INT_END 7
|
||||
#define SET_STRING_END 8
|
||||
#define SET_INTARRAY_END 9
|
||||
|
||||
#define BSSID_EXIST 1
|
||||
#define BSSID_TOO_BIG 2
|
||||
#define IP_EXIST 3
|
||||
|
||||
#define READ_BSSID 1
|
||||
#define READ_BSSID_END 2
|
||||
#define READ_IP 3
|
||||
#define READ_IP_END 4
|
||||
|
||||
#define ObjectIdMaxLevel 6
|
||||
/*
|
||||
* ImpConn structure definition
|
||||
* This stores the IMP connection from BSS
|
||||
*/
|
||||
struct ImpConn {
|
||||
int bssid; // initialize to -1
|
||||
char ip[16]; // initialize to 0.0.0.0
|
||||
char bssname[80]; // initialize to BSS_<bssid>
|
||||
int port; // initialize to -1
|
||||
int sockfd; // initialize to -1
|
||||
u32 SeqNum; // initialize to 0
|
||||
tOid TheOid; // initialize to OID_INIT
|
||||
tCID TheCid; // initialize to NM_CLASS_UNDEFINED
|
||||
struct queue *pCmdQ; // initialize to NULL
|
||||
struct queue *pCmdQEnd; // initialize to NULL
|
||||
int uploaded; // initialize to 0, already uploaded when = 1
|
||||
int connected;
|
||||
int download_in_progress; // initialize to 0, connected when >= 1
|
||||
int last_Total; // no of bytes read so far for an IMP packet
|
||||
u8 lastMsgRecvBuffer[IMP_MAX_HDR_LENGTH + MSG_BODY_SIZE];
|
||||
u32 bootupTime; // initialize to 0L
|
||||
u32 last_TransId; // TransId of the command in processing
|
||||
// initialize to 0 (=not in processing)
|
||||
int upload_in_progress; // initialize to 0
|
||||
int current_upload_level; // initialize to 1
|
||||
u32 upload_TransId;
|
||||
time_t last_connected_abnormal;
|
||||
time_t this_connected_abnormal;
|
||||
};
|
||||
typedef struct ImpConn tImpConn;
|
||||
|
||||
tImpConn *BssConn;
|
||||
tImpConn **bsplus;
|
||||
tImpConn **bsplus_down;
|
||||
/*
|
||||
* ImpEvent structure definition
|
||||
* This stores the IMP event from BSS
|
||||
*/
|
||||
#define EVENTINFO_ARRAY_SIZE 512
|
||||
#define MAX_OBJECTID_LEN 40
|
||||
struct ImpEvent {
|
||||
char eventname[40];
|
||||
char objectid[MAX_OBJECTID_LEN];
|
||||
char classname[40];
|
||||
char eventtime[25];
|
||||
unsigned long eventsecond; /* no of sec from 1 Jan 1970*/
|
||||
unsigned long globaleventnumber;
|
||||
unsigned int eventcause;
|
||||
char alarmlevel[10];
|
||||
char eventinfo[EVENTINFO_ARRAY_SIZE][512]; /* Array of Evt Msg Body */
|
||||
int eventinfosize; /* Array size */
|
||||
int eventtype;
|
||||
int severity;
|
||||
};
|
||||
typedef struct ImpEvent tImpEvent;
|
||||
tImpEvent BssEvent;
|
||||
/*
|
||||
* Use link list to maintain the queue of commands for each IMP connection
|
||||
* A shared buffer(array) is used to store the commands to different BSS
|
||||
* The command buffer is indexed from 0 to CMD_BUFFER_SIZE-1
|
||||
* CmdBufferPtr points to the first available command buffer
|
||||
*/
|
||||
#define CMD_BUFFER_SIZE 16000
|
||||
#define CMD_BUFFER_FULL (-1)
|
||||
#define CMD_SIZE 2048
|
||||
|
||||
struct queue { // A FIFO Queue
|
||||
char command[CMD_SIZE];
|
||||
struct queue *nextcmd;
|
||||
u32 TransId;
|
||||
bool available;
|
||||
};
|
||||
struct queue CmdBuffer[CMD_BUFFER_SIZE];
|
||||
int CmdBufferPtr=0;
|
||||
/*
|
||||
* Function declaration
|
||||
*/
|
||||
//init imp structure
|
||||
void initImpConn(tImpConn * pBssConn);
|
||||
void initImpEvent(tImpEvent *pBssEvent);
|
||||
void AddImpConn(int bssid, char *ipaddr, char *bssname, int uploaded);
|
||||
//init Bss MySQL database
|
||||
void connectDB();
|
||||
void initOMCR_COMMANDTable();
|
||||
void GetAllTableName();
|
||||
void GetBssMaxConfigFromDB();
|
||||
void syncBssTimeWithOMC(tImpConn *pBssConn, time_t tloc);
|
||||
void syncBssTreeAlarm();
|
||||
//connection management
|
||||
void restoreBssConn(int bssid, char *ip);
|
||||
void discBssConn(int bssid, char *ip, fd_set *readfds);
|
||||
void clearBssConn(tImpConn *pBssConn,fd_set *readfds);
|
||||
int connectIwBox(char *target, int port);
|
||||
|
||||
void stopIwBoxMonitor();
|
||||
void startIwBoxMonitor(char *hostname, int port);
|
||||
void InformIwBoxMonitor(tImpConn *pBssConn, int action);
|
||||
void GetMonitorResult(char *buffer, fd_set *readfds);
|
||||
|
||||
//get command
|
||||
void addCmd2Queue(tImpConn *pBssConn,char *nmicommand,long SeqNum);
|
||||
void retrieveCmdFromDatabase();
|
||||
bool FindAvailCmdBufferPtr();
|
||||
void DispatchNmiCommand(tImpConn *pBssConn);
|
||||
//process command and encode imp message
|
||||
int OidCommand(tImpConn * pBssConn,char *pImpCmdContName, u32 *pImpCmdIndex, ix ImpCmdIndexCount, u32 TransId);
|
||||
int GetCommand(tImpConn * pBssConn, char *pImpCmd, u32 TransId);
|
||||
int SetCommand(tImpConn * pBssConn, char *pImpCmd, u32 TransId);
|
||||
int ActionCommand(tImpConn *pBssConn, char *pImpCmdContName, u32 *pImpCmdIndex,ix ImpCmdIndexCount, u32 TransId);
|
||||
int CreateCommand(tImpConn * pBssConn, char *pImpCmdContName,u32 * pImpCmdIndex, u32 TransId);
|
||||
int DeleteCommand(tImpConn * pBssConn, char *pImpCmdContName,u32 * pImpCmdIndex, u32 TransId);
|
||||
int ContentsCommand(tImpConn *pBssConn, u32 TransId);
|
||||
int AddDropBsplusCommand(char *pImpCmd, int action, u32 TransId);//Calling NewBsplus,DropBsplus
|
||||
|
||||
int ProcessCommandString(char *pCommandString,char *pObjName, u32 *pParameter, int *count);//Calling CommandType
|
||||
int ProcessUserCommand(tImpConn *pBssConn, char *pCommandString, u32 TransId);
|
||||
//decode imp message
|
||||
unsigned int imp_response(tImpConn *pBssConn, tIMPHDR *pHeader,char *response);
|
||||
|
||||
static void ProcessContentsBody(u8** ppBuf, char *response);
|
||||
static void ProcessSetGetBody(tImpConn *pBssConn, u8** ppBuf, char *response,u16 *responsecode, bool HasStatus);
|
||||
static void ProcessActionBody(tImpConn *pBssConn, u8** ppBuf,char *response);
|
||||
static void ProcessCreateDeleteBody(u8** ppBuf,char *strValue, u16 *intValue);
|
||||
static void ProcessEventBody(tImpConn *pBssConn, u8** ppBuf,tImpEvent *pBssEvent);
|
||||
bool ProcessEventMsg(tImpConn *pBssConn, u8* pMsg, tImpEvent *pBssEvent);
|
||||
bool ProcessMessage(tImpConn *pBssConn, u8* pMsg, tIMPHDR *pHeader, fd_set *readfds);
|
||||
bool CheckForMessages(tImpConn *pBssConn, tIMPHDR *pHeader, fd_set *readfds, time_t last_heartbeat_time);
|
||||
|
||||
//according to imp response,update bss database
|
||||
unsigned int update_bsstable_status(tImpConn *pBssConn);
|
||||
unsigned int update_command_status(int resultcode, char *result,int responsecode, char *response, u32 TransId);
|
||||
unsigned int update_BtsMeas_table(char *buffer, tImpConn *pBssConn,tImpEvent *pBssEvent, long *cellid);
|
||||
unsigned int update_alarmevent_table(char *buffer, tImpConn *pBssConn, tImpEvent *pBssEvent, fd_set *readfds);
|
||||
unsigned int update_acn_cser_event(char *buffer, tImpConn *pBssConn,tImpEvent *pBssEvent);
|
||||
unsigned int update_cardcreated_event(tImpConn *pBssConn, tImpEvent *pBssEvent);
|
||||
unsigned int update_trxcreated_event(tImpConn *pBssConn, tImpEvent *pBssEvent);
|
||||
unsigned int update_networkevent_table(char *buffer, tImpConn *pBssConn,tImpEvent *pBssEvent);
|
||||
void update_bootup_time(tImpConn *pBssConn, tImpEvent *pBssEvent);
|
||||
|
||||
int requestObjCfg(tImpConn *pBssConn, char *objectid,int objectidLevel);
|
||||
int requestBssCfg(tImpConn *pBssConn);
|
||||
int requestBtsCfg(tImpConn *pBssConn, char *btsmgrid);
|
||||
int updateBssCfg(tImpConn *pBssConn, tIMPHDR *pHeader, char *response);
|
||||
int checkBsType(int bssid);
|
||||
//unsigned int generateBtsStatReport();
|
||||
#endif /*BSSCOMM__H */
|
||||
90
src/configMgr/c_program/impmod/includes.h
Normal file
90
src/configMgr/c_program/impmod/includes.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Include all header files needed by shared memory project.
|
||||
* Created by Huang QL, 2315/12/12
|
||||
*/
|
||||
|
||||
#ifndef INCLUDES__H
|
||||
#define INCLUDES__H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#include <signal.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termio.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <mntent.h>
|
||||
#include <fstab.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <linux/hdreg.h>
|
||||
|
||||
#ifndef _T_BYTE
|
||||
#define _T_BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
#ifndef _T_WORD
|
||||
#define _T_WORD
|
||||
typedef unsigned short WORD;
|
||||
#endif
|
||||
|
||||
#ifndef _T_DWORD
|
||||
#define _T_DWORD
|
||||
typedef unsigned int DWORD;
|
||||
#endif
|
||||
|
||||
#ifndef BOOL
|
||||
typedef unsigned short BOOL;
|
||||
#endif
|
||||
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
|
||||
#ifndef FAILURE
|
||||
#define FAILURE -1
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef YES
|
||||
#define YES 1
|
||||
#endif
|
||||
|
||||
#ifndef NO
|
||||
#define NO 0
|
||||
#endif
|
||||
|
||||
#ifndef ERROR
|
||||
#define ERROR -1
|
||||
#endif
|
||||
|
||||
#ifndef EMPTY
|
||||
#define EMPTY 0
|
||||
#endif
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define MAXBUFLEN 8196
|
||||
|
||||
#define UNDER_DEVELOP YES
|
||||
#endif
|
||||
41
src/configMgr/c_program/impmod/iwtypes.h
Normal file
41
src/configMgr/c_program/impmod/iwtypes.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _IWTYPES_H_
|
||||
#define _IWTYPES_H_
|
||||
/*
|
||||
* iwtypes.h: Standard interWAVE type definitions and fundamental defines.
|
||||
*
|
||||
* Bruce Nelson, interWAVE, 07/28/95.
|
||||
*/
|
||||
|
||||
/* Size-significant types. Use these for structure members, for example.
|
||||
*/
|
||||
typedef unsigned char u8;
|
||||
typedef char s8;
|
||||
typedef unsigned short u16;
|
||||
typedef short s16;
|
||||
|
||||
typedef unsigned int u32;
|
||||
typedef int s32;
|
||||
|
||||
/* Efficiency-significant types: size may be 16 or 32 bits, depending on
|
||||
* compiler. These are often best for local variables and expressions.
|
||||
* These types will be signed values.
|
||||
*/
|
||||
typedef int num; /* Number (for numerical calculations). */
|
||||
typedef int ix; /* Index (for arrays, etc.). */
|
||||
|
||||
//#ifndef _T_BOOL
|
||||
typedef int bool; /* Boolean: TRUE or FALSE. */
|
||||
//#endif
|
||||
|
||||
// The classic TRUE and FALSE, for Boolean values.
|
||||
|
||||
#define TRUE 1
|
||||
#define true 1
|
||||
#define FALSE 0
|
||||
#define false 0
|
||||
|
||||
// Nulls. Note that pointers should be compared to NULLP, not NULL.
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#endif /* _IWTYPES_H_ */
|
||||
2478
src/configMgr/c_program/impmod/nmimp.c
Normal file
2478
src/configMgr/c_program/impmod/nmimp.c
Normal file
File diff suppressed because it is too large
Load Diff
459
src/configMgr/c_program/impmod/nmimp.h
Normal file
459
src/configMgr/c_program/impmod/nmimp.h
Normal file
@@ -0,0 +1,459 @@
|
||||
#ifndef _NMIMP_H_
|
||||
#define _NMIMP_H_
|
||||
/*
|
||||
* nmimp.h: Definitions of IMP data marshaling/unmarshaling stuff.
|
||||
*
|
||||
* Bruce Nelson, interWAVE, 08/16/95.
|
||||
*/
|
||||
|
||||
#include "iwtypes.h"
|
||||
#include "nmtypes.h"
|
||||
#include "nmstatus.h"
|
||||
|
||||
/* IMP agent IP port number.
|
||||
*/
|
||||
#define IMP_PORT 2112
|
||||
|
||||
/* IMP message types, i.e., operation codes. Notice that response codes are
|
||||
* the same as request codes, but with the "response bit" turned on. If the
|
||||
* NOBJ bit is on, the request/response does not apply to an object, but to an
|
||||
* entire agent and/or management application.
|
||||
*/
|
||||
#define IMP_MSG_UNDEFINED 0x000
|
||||
#define IMP_MSG_RESP_BIT 0x040
|
||||
#define IMP_MSG_NOBJ_BIT 0x080
|
||||
#define IMP_MSG_GET_REQ 0x001
|
||||
#define IMP_MSG_GET_RESP 0x041
|
||||
#define IMP_MSG_SET_REQ 0x002
|
||||
#define IMP_MSG_SET_RESP 0x042
|
||||
#define IMP_MSG_ACTION_REQ 0x003
|
||||
#define IMP_MSG_ACTION_RESP 0x043
|
||||
#define IMP_MSG_CREATE_REQ 0x004
|
||||
#define IMP_MSG_CREATE_RESP 0x044
|
||||
#define IMP_MSG_DELETE_REQ 0x005
|
||||
#define IMP_MSG_DELETE_RESP 0x045
|
||||
#define IMP_MSG_CONTENTS_REQ 0x006
|
||||
#define IMP_MSG_CONTENTS_RESP 0x046
|
||||
#define IMP_MSG_VALIDATE_REQ 0x007
|
||||
#define IMP_MSG_VALIDATE_RESP 0x047
|
||||
#define IMP_MSG_GETSEEK_REQ 0x008
|
||||
#define IMP_MSG_GETSEEK_RESP 0x048
|
||||
#define IMP_MSG_UNBUSY_REQ 0x009
|
||||
#define IMP_MSG_UNBUSY_RESP 0x049
|
||||
#define IMP_MSG_EVENT_IND 0x04a
|
||||
|
||||
#define IMP_MSG_CREATE_FWD 0x03a
|
||||
#define IMP_MSG_DELETE_FWD 0x039
|
||||
|
||||
/* Definitions of IMP type masks: upper five bits of tag byte.
|
||||
*/
|
||||
#define IMP_TYPE_MASK 0x0f8
|
||||
#define IMP_TYPE_NULL 0x080
|
||||
#define IMP_TYPE_UINT 0x088
|
||||
#define IMP_TYPE_SINT 0x090
|
||||
#define IMP_TYPE_CHAR_STRING 0x098
|
||||
#define IMP_TYPE_OBJECT_ID 0x0a0
|
||||
#define IMP_TYPE_CLASS_ID 0x0a8
|
||||
#define IMP_TYPE_ATTR_ID 0x0b0
|
||||
#define IMP_TYPE_EVENT_ID 0x0b8
|
||||
#define IMP_TYPE_ACTION_ID 0x0c0
|
||||
#define IMP_TYPE_STATUS_CODE 0x0c8
|
||||
#define IMP_TYPE_END_OF_MSG 0x0d0
|
||||
#define IMP_TYPE_USER_ID 0x0d8
|
||||
#define IMP_TYPE_COMPARATOR 0x0e0
|
||||
#define IMP_TYPE_APP_ADDR 0x0e8
|
||||
#define IMP_TYPE_LENGTH 0x0f0
|
||||
#define IMP_TYPE_IX_UINT 0x008
|
||||
#define IMP_TYPE_IX_SINT 0x010
|
||||
|
||||
/* Fixed size of an IMP marshaled length field.
|
||||
*/
|
||||
#define IMP_TYPE_LENGTH_MBYTES 3
|
||||
|
||||
/* Definitions of IMP array masks: bit two of tag byte.
|
||||
*/
|
||||
#define IMP_ARRAY_MASK 0x004
|
||||
#define IMP_ARRAY_TRUE 0x004
|
||||
#define IMP_ARRAY_FALSE 0x000
|
||||
|
||||
/* Definitions of array types and a mask to select both the type field and
|
||||
* the array bit. The marshal/unmarshal functions need to check for both
|
||||
* correct type value and correct array bit.
|
||||
*/
|
||||
#define IMP_ARRAY_TYPE_MASK (IMP_TYPE_MASK | IMP_ARRAY_MASK)
|
||||
#define IMP_ARRAY_UINT (IMP_TYPE_UINT | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_SINT (IMP_TYPE_SINT | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_CHAR_STRING (IMP_TYPE_CHAR_STRING | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_OBJECT_ID (IMP_TYPE_OBJECT_ID | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_APP_ADDR (IMP_TYPE_APP_ADDR | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_IX_UINT (IMP_TYPE_IX_UINT | IMP_ARRAY_TRUE)
|
||||
#define IMP_ARRAY_IX_SINT (IMP_TYPE_IX_SINT | IMP_ARRAY_TRUE)
|
||||
|
||||
/* Definitions of IMP unit masks: low two bits of tag byte.
|
||||
*/
|
||||
#define IMP_UNIT_MASK 0x003
|
||||
#define IMP_UNIT_1 0x000
|
||||
#define IMP_UNIT_2 0x001
|
||||
#define IMP_UNIT_3 0x002
|
||||
#define IMP_UNIT_4 0x003
|
||||
|
||||
/* Definitions of IMP tag byte values.
|
||||
*/
|
||||
#define IMP_TAG_NULL \
|
||||
(u8)(IMP_TYPE_NULL | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_UINT_1 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_SINT_1 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_UINT_2 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_SINT_2 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_UINT_4 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_FALSE | IMP_UNIT_4)
|
||||
#define IMP_TAG_SINT_4 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_FALSE | IMP_UNIT_4)
|
||||
#define IMP_TAG_UARRAY_1 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_SARRAY_1 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_UARRAY_2 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_TRUE | IMP_UNIT_2)
|
||||
#define IMP_TAG_SARRAY_2 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_TRUE | IMP_UNIT_2)
|
||||
#define IMP_TAG_UARRAY_4 \
|
||||
(u8)(IMP_TYPE_UINT | IMP_ARRAY_TRUE | IMP_UNIT_4)
|
||||
#define IMP_TAG_SARRAY_4 \
|
||||
(u8)(IMP_TYPE_SINT | IMP_ARRAY_TRUE | IMP_UNIT_4)
|
||||
#define IMP_TAG_CHAR_STRING \
|
||||
(u8)(IMP_TYPE_CHAR_STRING | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_OBJECT_ID \
|
||||
(u8)(IMP_TYPE_OBJECT_ID | IMP_ARRAY_TRUE | IMP_UNIT_2)
|
||||
#define IMP_TAG_CLASS_ID_1 \
|
||||
(u8)(IMP_TYPE_CLASS_ID | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_CLASS_ID_2 \
|
||||
(u8)(IMP_TYPE_CLASS_ID | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_ATTR_ID_2 \
|
||||
(u8)(IMP_TYPE_ATTR_ID | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_ATTR_ID_3 \
|
||||
(u8)(IMP_TYPE_ATTR_ID | IMP_ARRAY_FALSE | IMP_UNIT_3)
|
||||
#define IMP_TAG_EVENT_ID_2 \
|
||||
(u8)(IMP_TYPE_EVENT_ID | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_EVENT_ID_3 \
|
||||
(u8)(IMP_TYPE_EVENT_ID | IMP_ARRAY_FALSE | IMP_UNIT_3)
|
||||
#define IMP_TAG_ACTION_ID_2 \
|
||||
(u8)(IMP_TYPE_ACTION_ID | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_ACTION_ID_3 \
|
||||
(u8)(IMP_TYPE_ACTION_ID | IMP_ARRAY_FALSE | IMP_UNIT_3)
|
||||
#define IMP_TAG_STATUS_CODE \
|
||||
(u8)(IMP_TYPE_STATUS_CODE | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_END_OF_MSG_1 \
|
||||
(u8)(IMP_TYPE_END_OF_MSG | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_END_OF_MSG_2 \
|
||||
(u8)(IMP_TYPE_END_OF_MSG | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_END_OF_MSG_4 \
|
||||
(u8)(IMP_TYPE_END_OF_MSG | IMP_ARRAY_FALSE | IMP_UNIT_4)
|
||||
#define IMP_TAG_USER_ID \
|
||||
(u8)(IMP_TYPE_USER_ID | IMP_ARRAY_FALSE | IMP_UNIT_4)
|
||||
#define IMP_TAG_COMPARATOR \
|
||||
(u8)(IMP_TYPE_COMPARATOR | IMP_ARRAY_FALSE | IMP_UNIT_1)
|
||||
#define IMP_TAG_APP_ADDR \
|
||||
(u8)(IMP_TYPE_APP_ADDR | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_LENGTH \
|
||||
(u8)(IMP_TYPE_LENGTH | IMP_ARRAY_FALSE | IMP_UNIT_2)
|
||||
#define IMP_TAG_UARIX_1 \
|
||||
(u8)(IMP_TYPE_IX_UINT | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_SARIX_1 \
|
||||
(u8)(IMP_TYPE_IX_SINT | IMP_ARRAY_TRUE | IMP_UNIT_1)
|
||||
#define IMP_TAG_UARIX_2 \
|
||||
(u8)(IMP_TYPE_IX_UINT | IMP_ARRAY_TRUE | IMP_UNIT_2)
|
||||
#define IMP_TAG_SARIX_2 \
|
||||
(u8)(IMP_TYPE_IX_SINT | IMP_ARRAY_TRUE | IMP_UNIT_2)
|
||||
#define IMP_TAG_UARIX_4 \
|
||||
(u8)(IMP_TYPE_IX_UINT | IMP_ARRAY_TRUE | IMP_UNIT_4)
|
||||
#define IMP_TAG_SARIX_4 \
|
||||
(u8)(IMP_TYPE_IX_SINT | IMP_ARRAY_TRUE | IMP_UNIT_4)
|
||||
|
||||
/* IMP message header, unmarshaled.
|
||||
*/
|
||||
#define IMP_APP_ADDR_BUFFER_LEN 32
|
||||
struct IMPHDR
|
||||
{
|
||||
tNMLEN MsgLen;
|
||||
tNMLEN HdrLen;
|
||||
tOid ObjId;
|
||||
u16 OpCode;
|
||||
tNMSTAT StatCode;
|
||||
u32 Uid;
|
||||
u32 Seq;
|
||||
u32 TransId1;
|
||||
u32 TransId2;
|
||||
u16 Access;
|
||||
u16 Link;
|
||||
u16 AppAddrLen;
|
||||
u8 AppAddr[IMP_APP_ADDR_BUFFER_LEN];
|
||||
/*
|
||||
* The remaining fields do not get marshaled, but are very useful for
|
||||
* keeping track of request and response message data.
|
||||
*/
|
||||
u8* pReqMsg;
|
||||
u8* pRespBody;
|
||||
tMID* pMidTbl;
|
||||
void* pClone;
|
||||
tNMLEN RespBodyLen;
|
||||
tCID CrDelCid;
|
||||
u16 CrDelIx;
|
||||
u8 CrDelSave;
|
||||
u8 ContOffset;
|
||||
u8 MidTblLen;
|
||||
u8 MidTblOffset;
|
||||
u8 RespMbox;
|
||||
u8 DoAttrValidate;
|
||||
u8 DoClsValidate;
|
||||
u8 DoAttrCommit;
|
||||
u8 DoClsCommit;
|
||||
};
|
||||
typedef struct IMPHDR tIMPHDR;
|
||||
/*
|
||||
* The following definition is an estimate for the maximum size of a marshaled
|
||||
* IMP header. It uses the header structure size for the estimate of the
|
||||
* maximal data and array size info to be sent (pretty accurate). To this it
|
||||
* adds the structure size divided by four, in order to add-in at least one
|
||||
* more byte per field, for the IMP tags (over-estimated).
|
||||
*/
|
||||
#define IMP_MAX_HDR_LENGTH (sizeof(tIMPHDR) + (sizeof(tIMPHDR) >> 2))
|
||||
#define IMP_MAX_BODY_LENGTH 1024
|
||||
#define IMP_MAX_MSG_LENGTH (IMP_MAX_HDR_LENGTH + IMP_MAX_BODY_LENGTH)
|
||||
|
||||
/* IMP event header, unmarshaled. Notice that the first part of this header
|
||||
* is, and MUST BE, the same as the IMP message header.
|
||||
*/
|
||||
struct EVHDR
|
||||
{
|
||||
tNMLEN MsgLen; /* msg length */
|
||||
tNMLEN HdrLen; /* msg header length */
|
||||
tOid ObjId; /* object identifier */
|
||||
u16 OpCode; /* always "event indication" */
|
||||
tCID EvCls; /* class of event */
|
||||
u8 EvNum; /* number of event, within class */
|
||||
u8 EvCode; /* event/alarm/reply encoding */
|
||||
u32 Time; /* time of (most recent) occurrence: SSE */
|
||||
u32 GlEvNum; /* global event number */
|
||||
/*
|
||||
* The following fields are used only for alarm records.
|
||||
*/
|
||||
u32 Time1; /* time of first occurrence: SSE */
|
||||
u32 Count; /* number of occurrences: 0=cleared */
|
||||
/*
|
||||
* The following fields are used only for action replies. Their
|
||||
* values echo the values in the action request.
|
||||
*/
|
||||
u16 ActCls; /* class of action */
|
||||
u8 ActNum; /* number of action, within class */
|
||||
u32 Seq; /* requester-provided sequence number */
|
||||
u32 TransId1; /* requester-provided data */
|
||||
u32 TransId2; /* requester-provided data */
|
||||
u16 AppAddrLen; /* return address of NM application */
|
||||
u8 AppAddr[IMP_APP_ADDR_BUFFER_LEN];
|
||||
};
|
||||
typedef struct EVHDR tEVHDR;
|
||||
#define IMP_MAX_EVHDR_LENGTH (sizeof(tEVHDR) + (sizeof(tEVHDR) >> 2))
|
||||
|
||||
/* Values for event header EvCode value. This tells how to marshal and
|
||||
* unmarshal the event header.
|
||||
*/
|
||||
#define IMP_EVENT_NORMAL 0
|
||||
#define IMP_EVENT_ALARM 1
|
||||
#define IMP_EVENT_REPLY 2
|
||||
|
||||
/* The following structure is used to store information about the most recent
|
||||
* action for which a reply event has yet to be sent. It is a subset of the
|
||||
* information from the original IMP request header.
|
||||
*/
|
||||
struct ACINFO
|
||||
{
|
||||
u32 Seq;
|
||||
u32 TransId1;
|
||||
u32 TransId2;
|
||||
u16 AppAddrLen;
|
||||
u8 AppAddr[IMP_APP_ADDR_BUFFER_LEN];
|
||||
tCID ActCls;
|
||||
u8 ActNum;
|
||||
tCID EvCls;
|
||||
u8 EvNum;
|
||||
u8 RespMbox;
|
||||
};
|
||||
typedef struct ACINFO tACINFO;
|
||||
|
||||
/* Externs for Marshal/UnMarshal functions.
|
||||
*
|
||||
* NOTICE: For port of nmi to Windows 3.1, we use C++ linkage for IMP code.
|
||||
* It is NOT in a library, and we need to avoid the Visual C++ (1.51)
|
||||
* limitation of only one extern "C" per compilation (which we use up with
|
||||
* nmtypes.h).
|
||||
*/
|
||||
|
||||
extern tNMSTAT NmMarshalNull(u8** ppBuf);
|
||||
extern tNMSTAT NmUnMarshalNull(u8** ppBuf);
|
||||
extern tNMSTAT NmMarshalU8(u8** ppBuf, u8 Value);
|
||||
extern tNMSTAT NmMarshalS8(u8** ppBuf, s8 Value);
|
||||
extern tNMSTAT NmUnMarshalU8(u8** ppBuf, u8* pValue);
|
||||
#define NmUnMarshalS8(ppBuf, pValue) \
|
||||
NmUnMarshalU8((ppBuf), (u8*)(pValue))
|
||||
extern tNMSTAT NmMarshalU16(u8** ppBuf, u16 Value);
|
||||
extern tNMSTAT NmMarshalS16(u8** ppBuf, s16 Value);
|
||||
extern tNMSTAT NmUnMarshalU16(u8** ppBuf, u16* pValue);
|
||||
#define NmUnMarshalS16(ppBuf, pValue) \
|
||||
NmUnMarshalU16((ppBuf), (u16*)(pValue))
|
||||
extern tNMSTAT NmMarshalU32(u8** ppBuf, u32 Value);
|
||||
extern tNMSTAT NmMarshalS32(u8** ppBuf, s32 Value);
|
||||
extern tNMSTAT NmUnMarshalU32(u8** ppBuf, u32* pValue);
|
||||
#define NmUnMarshalS32(ppBuf, pValue) \
|
||||
NmUnMarshalU32((ppBuf), (u32*)(pValue))
|
||||
extern tNMSTAT NmMarshalByteArray(u8** ppBuf, u8* pArray, u16 ArrayLen,
|
||||
u8 Tag);
|
||||
#define NmMarshalArrayU8(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalByteArray((ppBuf), (pArray), (ArrayLen), IMP_TAG_UARRAY_1)
|
||||
#define NmMarshalArrayS8(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalByteArray((ppBuf), (u8*)(pArray), (ArrayLen), \
|
||||
IMP_TAG_SARRAY_1)
|
||||
extern tNMSTAT NmUnMarshalArrayU8(u8** ppBuf, u8* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayS8(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayU8((ppBuf), (u8*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmMarshalWordArray(u8** ppBuf, u16* pArray, u16 ArrayLen,
|
||||
u8 Tag);
|
||||
#define NmMarshalArrayU16(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalWordArray((ppBuf), (pArray), (ArrayLen), IMP_TAG_UARRAY_2)
|
||||
#define NmMarshalArrayS16(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalWordArray((ppBuf), (u16*)(pArray), (ArrayLen), \
|
||||
IMP_TAG_SARRAY_2)
|
||||
extern tNMSTAT NmUnMarshalArrayU16(u8** ppBuf, u16* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayS16(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayU16((ppBuf), (u16*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmMarshalDWordArray(u8** ppBuf, u32* pArray, u16 ArrayLen,
|
||||
u8 Tag);
|
||||
#define NmMarshalArrayU32(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalDWordArray((ppBuf), (pArray), (ArrayLen), IMP_TAG_UARRAY_4)
|
||||
#define NmMarshalArrayS32(ppBuf, pArray, ArrayLen) \
|
||||
NmMarshalDWordArray((ppBuf), (u32*)(pArray), (ArrayLen), \
|
||||
IMP_TAG_SARRAY_4)
|
||||
extern tNMSTAT NmUnMarshalArrayU32(u8** ppBuf, u32* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayS32(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayU32((ppBuf), (u32*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmMarshalString(u8** ppBuf, char* pChars);
|
||||
extern tNMSTAT NmUnMarshalString(u8** ppBuf, char** ppChars);
|
||||
extern tNMSTAT NmMarshalObjectId(u8** ppBuf, tOid* pOid);
|
||||
extern tNMSTAT NmUnMarshalObjectId(u8** ppBuf, tOid* pOid);
|
||||
extern tNMSTAT NmMarshalClassId(u8** ppBuf, tCID Cid);
|
||||
extern tNMSTAT NmUnMarshalClassId(u8** ppBuf, tCID* pCid);
|
||||
extern tNMSTAT NmMarshalClassMember(u8** ppBuf, tCID Cid, u8 Member, u8 Type);
|
||||
extern tNMSTAT NmUnMarshalClassMember(u8** ppBuf, tCID* pCid, u8* pMember,
|
||||
u8 Type);
|
||||
#define NmMarshalAttrId(ppBuf, Cid, AttrNumber) \
|
||||
NmMarshalClassMember((ppBuf), (Cid), (AttrNumber), IMP_TYPE_ATTR_ID)
|
||||
#define NmUnMarshalAttrId(ppBuf, pCid, pAttrNumber) \
|
||||
NmUnMarshalClassMember((ppBuf), (pCid), (pAttrNumber), \
|
||||
IMP_TYPE_ATTR_ID)
|
||||
#define NmMarshalEventId(ppBuf, Cid, EventNumber) \
|
||||
NmMarshalClassMember((ppBuf), (Cid), (EventNumber), IMP_TYPE_EVENT_ID)
|
||||
#define NmUnMarshalEventId(ppBuf, pCid, pEventNumber) \
|
||||
NmUnMarshalClassMember((ppBuf), (pCid), (pEventNumber), \
|
||||
IMP_TYPE_EVENT_ID)
|
||||
#define NmMarshalActionId(ppBuf, Cid, ActionNumber) \
|
||||
NmMarshalClassMember((ppBuf), (Cid), (ActionNumber), IMP_TYPE_ACTION_ID)
|
||||
#define NmUnMarshalActionId(ppBuf, pCid, pActionNumber) \
|
||||
NmUnMarshalClassMember((ppBuf), (pCid), (pActionNumber), \
|
||||
IMP_TYPE_ACTION_ID)
|
||||
extern tNMSTAT NmMarshalStatusCode(u8** ppBuf, tNMSTAT Code);
|
||||
extern tNMSTAT NmUnMarshalStatusCode(u8** ppBuf, tNMSTAT* pCode);
|
||||
extern tNMSTAT NmMarshalEndOfMsg(u8** ppBuf, u32 CkSum, u8 UseCkSum);
|
||||
extern tNMSTAT NmUnMarshalEndOfMsg(u8** ppBuf, u32* pCkSum, u8* pUseCkSum);
|
||||
extern tNMSTAT NmMarshalUserId(u8** ppBuf, u32 Uid);
|
||||
extern tNMSTAT NmUnMarshalUserId(u8** ppBuf, u32* pUid);
|
||||
extern tNMSTAT NmMarshalComparator(u8** ppBuf, u8 Comp);
|
||||
extern tNMSTAT NmUnMarshalComparator(u8** ppBuf, u8* pComp);
|
||||
extern tNMSTAT NmMarshalAppAddr(u8** ppBuf, u8* pAddr, u16 AddrLen);
|
||||
extern tNMSTAT NmUnMarshalAppAddr(u8** ppBuf, u8* pAddr, u16* pAddrLen,
|
||||
u16 BufLen);
|
||||
extern tNMSTAT NmMarshalLength(u8** ppBuf, tNMLEN Len);
|
||||
extern tNMSTAT NmUnMarshalLength(u8** ppBuf, tNMLEN* pLen);
|
||||
extern tNMSTAT NmMarshalImpHeader(u8** ppBuf, tIMPHDR* pImpHdr);
|
||||
extern tNMSTAT NmUnMarshalImpHeader(u8** ppBuf, tIMPHDR* pImpHdr);
|
||||
extern tNMSTAT NmUnMarshalImpHeadHead(u8** ppBuf, tIMPHDR* pImpHdr);
|
||||
extern tNMSTAT NmMarshalEventHeader(u8** ppBuf, tEVHDR* pEvHdr, tNMLEN BodyLen);
|
||||
extern tNMSTAT NmUnMarshalEventHeader(u8** ppBuf, tEVHDR* pEvHdr);
|
||||
extern tNMSTAT NmReadImpOpCode(u8* pBuf, u16* pOpCode);
|
||||
extern tNMSTAT NmWriteImpOpCode(u8* pBuf, u16 OpCode);
|
||||
extern tNMSTAT NmWriteImpOpAndStatus(u8* pBuf, u16 OpCode, u16 StatusCode);
|
||||
extern void NmSkipImpField(u8** ppBuf);
|
||||
extern void NmCopyImpField(u8** ppBuf, u8** ppDst);
|
||||
extern tNMSTAT NmSetAttrStatus(u8* pBuf, tCID Cid, u8 AttrId, tNMSTAT AttrStat);
|
||||
/*
|
||||
* The following array-oriented functions deal with partial arrays, that is,
|
||||
* index/value pairs, vs. values for every index (as above). The unmarshal
|
||||
* functions permit writing directly onto an array or into an array of index/
|
||||
* value pairs.
|
||||
*/
|
||||
extern tNMSTAT NmMarshalByteArIx(u8** ppBuf, tARu8* pArIx, u16 ArIxLen, u8 Tag);
|
||||
#define NmMarshalARu8(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalByteArIx((ppBuf), (pArIx), (ArIxLen), IMP_TAG_UARIX_1)
|
||||
#define NmMarshalARs8(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalByteArIx((ppBuf), (tARu8*)(pArIx), (ArIxLen), IMP_TAG_SARIX_1)
|
||||
extern tNMSTAT NmUnMarshalARu8(u8** ppBuf, tARu8* pArIx, u16* pArIxLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalARs8(ppBuf, pArIx, pArIxLen, BufLen) \
|
||||
NmUnMarshalARu8((ppBuf), (tARu8*)(pArIx), (pArIxLen), (BufLen))
|
||||
extern tNMSTAT NmUnMarshalArrayIxU8(u8** ppBuf, u8* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayIxS8(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayIxU8((ppBuf), (u8*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmMarshalWordArIx(u8** ppBuf, tARu16* pArIx, u16 ArIxLen,
|
||||
u8 Tag);
|
||||
#define NmMarshalARu16(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalWordArIx((ppBuf), (pArIx), (ArIxLen), IMP_TAG_UARIX_2)
|
||||
#define NmMarshalARs16(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalWordArIx((ppBuf), (tARu16*)(pArIx), (ArIxLen), IMP_TAG_SARIX_2)
|
||||
extern tNMSTAT NmUnMarshalARu16(u8** ppBuf, tARu16* pArIx, u16* pArIxLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalARs16(ppBuf, pArIx, pArIxLen, BufLen) \
|
||||
NmUnMarshalARu16((ppBuf), (tARu16*)(pArIx), (pArIxLen), (BufLen))
|
||||
extern tNMSTAT NmUnMarshalArrayIxU16(u8** ppBuf, u16* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayIxS16(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayIxU16((ppBuf), (u16*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmMarshalDWordArIx(u8** ppBuf, tARu32* pArIx, u16 ArIxLen,
|
||||
u8 Tag);
|
||||
#define NmMarshalARu32(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalDWordArIx((ppBuf), (pArIx), (ArIxLen), IMP_TAG_UARIX_4)
|
||||
#define NmMarshalARs32(ppBuf, pArIx, ArIxLen) \
|
||||
NmMarshalDWordArIx((ppBuf), (tARu32*)(pArIx), (ArIxLen), \
|
||||
IMP_TAG_SARIX_4)
|
||||
extern tNMSTAT NmUnMarshalARu32(u8** ppBuf, tARu32* pArIx, u16* pArIxLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalARs32(ppBuf, pArIx, pArIxLen, BufLen) \
|
||||
NmUnMarshalARu32((ppBuf), (tARu32*)(pArIx), (pArIxLen), (BufLen))
|
||||
extern tNMSTAT NmUnMarshalArrayIxU32(u8** ppBuf, u32* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalArrayIxS32(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalArrayIxU32((ppBuf), (u32*)(pArray), (pArrayLen), (BufLen))
|
||||
/*
|
||||
* The following array-oriented functions handle either the whole-array or
|
||||
* partial-array encoding.
|
||||
*/
|
||||
extern tNMSTAT NmUnMarshalAnyArU8(u8** ppBuf, u8* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalAnyArS8(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalAnyArU8((ppBuf), (u8*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmUnMarshalAnyArU16(u8** ppBuf, u16* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalAnyArS16(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalAnyArU16((ppBuf), (u16*)(pArray), (pArrayLen), (BufLen))
|
||||
extern tNMSTAT NmUnMarshalAnyArU32(u8** ppBuf, u32* pArray, u16* pArrayLen,
|
||||
u16 BufLen);
|
||||
#define NmUnMarshalAnyArS16(ppBuf, pArray, pArrayLen, BufLen) \
|
||||
NmUnMarshalAnyArU16((ppBuf), (u16*)(pArray), (pArrayLen), (BufLen))
|
||||
|
||||
#endif /* _NMIMP_H_ */
|
||||
110
src/configMgr/c_program/impmod/nmstatus.h
Normal file
110
src/configMgr/c_program/impmod/nmstatus.h
Normal file
@@ -0,0 +1,110 @@
|
||||
#ifndef _NMSTATUS_H_
|
||||
#define _NMSTATUS_H_
|
||||
/*
|
||||
* nmstatus.h: Definitions of status/error codes used with NM functions.
|
||||
*
|
||||
* IMPORTANT: PLEASE READ!
|
||||
*
|
||||
* This file is special, in that it is read by network management tools in
|
||||
* order to learn the print strings for status/error codes. For this reason,
|
||||
* the file format is very rigid.
|
||||
*
|
||||
* The file must only contain #define statements with the prefixes "NMSTAT_"
|
||||
* and "NMERROR_", and all #define values must be plain numbers. Each #define
|
||||
* must have a label modifier inside the special comment field (/ *{ ... }* /,
|
||||
* with stars connected to slashes, illegal in this comment!) that immediately
|
||||
* follows it. This label gives the print string for the status/error code.
|
||||
*
|
||||
* The "NMSTAT_" codes all report a form of success. The "NMERROR_" codes
|
||||
* report error conditions that apply to an entire operation or to a
|
||||
* particular attribute or parameter involved in the operation.
|
||||
*
|
||||
* Once a value is assigned here, it may never be changed. Add new values at
|
||||
* the END of the correct category.
|
||||
*
|
||||
* Bruce Nelson, interWAVE, 08/16/95.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Non-error status codes: 0 - 9.
|
||||
*
|
||||
* Note: NMSTAT_FAILURE implies that an operation completed without error,
|
||||
* but failed none the less. For Boolean operations, NMSTAT_SUCCESS means
|
||||
* "TRUE" and NMSTAT_FAILURE means "FALSE".
|
||||
*/
|
||||
#define NMSTAT_SUCCESS 0 /*{ label("ok") }*/
|
||||
#define NMSTAT_FAILURE 1 /*{ label("failure w/o error") }*/
|
||||
#define NMSTAT_PENDING 2 /*{ label("operation pending") }*/
|
||||
|
||||
/*
|
||||
* Begin error codes: >= 10.
|
||||
*/
|
||||
#define NMERROR_BAD_MESSAGE 10 /*{ label("unreadable message") }*/
|
||||
#define NMERROR_ENCODING 11 /*{ label("data encoding error") }*/
|
||||
#define NMERROR_PROTOCOL 12 /*{ label("protocol violation") }*/
|
||||
#define NMERROR_SYSTEM 13 /*{ label("system error") }*/
|
||||
#define NMERROR_MEMORY 14 /*{ label("out of memory") }*/
|
||||
#define NMERROR_INTERNAL 15 /*{ label("internal error") }*/
|
||||
#define NMERROR_INTERNAL_PARM 16 /*{ label("internal parm error") }*/
|
||||
#define NMERROR_VTABLE 17 /*{ label("virtual table error") }*/
|
||||
#define NMERROR_CONT_TABLE 18 /*{ label("container table error") }*/
|
||||
#define NMERROR_OPERATION 19 /*{ label("no such operation") }*/
|
||||
#define NMERROR_BAD_TYPE 20 /*{ label("no such data type") }*/
|
||||
#define NMERROR_BAD_CLASS 21 /*{ label("no such class") }*/
|
||||
#define NMERROR_BAD_ATTRIBUTE 22 /*{ label("no such attribute") }*/
|
||||
#define NMERROR_BAD_ACTION 23 /*{ label("no such action") }*/
|
||||
#define NMERROR_BAD_PARAMETER 24 /*{ label("no such parameter") }*/
|
||||
#define NMERROR_BAD_COMPARATOR 25 /*{ label("no such comparator") }*/
|
||||
#define NMERROR_TYPE 26 /*{ label("improper data type") }*/
|
||||
#define NMERROR_CLASS 27 /*{ label("improper class") }*/
|
||||
#define NMERROR_ATTRIBUTE 28 /*{ label("improper attribute") }*/
|
||||
#define NMERROR_ACTION 29 /*{ label("improper action") }*/
|
||||
#define NMERROR_PARAMETER 30 /*{ label("improper parameter") }*/
|
||||
#define NMERROR_COMPARATOR 31 /*{ label("improper comparator") }*/
|
||||
#define NMERROR_INDEX 32 /*{ label("improper index") }*/
|
||||
#define NMERROR_OBJECT 33 /*{ label("no such object") }*/
|
||||
#define NMERROR_OBJECT_EXISTS 34 /*{ label("object already exists") }*/
|
||||
#define NMERROR_OBJECT_ID 35 /*{ label("bad object identifier") }*/
|
||||
#define NMERROR_RANGE 36 /*{ label("value out-of-range") }*/
|
||||
#define NMERROR_ENUM 37 /*{ label("improper enum choice") }*/
|
||||
#define NMERROR_READONLY 38 /*{ label("read-only attribute") }*/
|
||||
#define NMERROR_ARRAY_TOO_BIG 39 /*{ label("array too long") }*/
|
||||
#define NMERROR_ARRAY_MISMATCH 40 /*{ label("array length mismatch") }*/
|
||||
#define NMERROR_APP_ADDR 41 /*{ label("bad application addr") }*/
|
||||
#define NMERROR_BUSY 42 /*{ label("busy") }*/
|
||||
#define NMERROR_KILLED 43 /*{ label("killed") }*/
|
||||
#define NMERROR_CONTINUE_HEADER 44 /*{ label("continue header error") }*/
|
||||
#define NMERROR_CONTINUE_MSG 45 /*{ label("continue msg error") }*/
|
||||
#define NMERROR_CONTINUE_OPCODE 46 /*{ label("continue opcode error") }*/
|
||||
#define NMERROR_CONTINUE_DATA 47 /*{ label("continue data error") }*/
|
||||
#define NMERROR_ATTR_ERRORS 48 /*{ label("attribute error(s)") }*/
|
||||
#define NMERROR_INTERNAL_ATTR 49 /*{ label("internal attr error") }*/
|
||||
#define NMERROR_ATTR_REJECTED 50 /*{ label("attr value rejected") }*/
|
||||
#define NMERROR_REJECT_HEADER 51 /*{ label("reject header error") }*/
|
||||
#define NMERROR_REJECT_DATA 52 /*{ label("reject data error") }*/
|
||||
#define NMERROR_INTERNAL_STAT 53 /*{ label("internal status error") }*/
|
||||
#define NMERROR_ABSTRACT 54 /*{ label("abstract class") }*/
|
||||
#define NMERROR_DBM_SAVE_VARS 55 /*{ label("dbm save vars error") }*/
|
||||
#define NMERROR_DBM_SAVE_CONTS 56 /*{ label("dbm save conts error") }*/
|
||||
#define NMERROR_DBM_REST_VARS 57 /*{ label("dbm restore vars error") }*/
|
||||
#define NMERROR_DBM_REST_CONTS 58 /*{ label("dbm restore conts error") }*/
|
||||
#define NMERROR_DBM_UNINIT 59 /*{ label("dbm uninitialized") }*/
|
||||
#define NMERROR_ADSTAT_UNLOCKED 60 /*{ label("admin state unlocked") }*/
|
||||
#define NMERROR_CHANNELS_INUSE 61 /*{ label("channel(s) in use") }*/
|
||||
#define NMERROR_OBJ_UNREACHABLE 62 /*{ label("object unreachable") }*/
|
||||
#define NMERROR_BUSY_ACTION 63 /*{ label("busy with action") }*/
|
||||
#define NMERROR_PARM_ERRORS 64 /*{ label("parameter error(s)") }*/
|
||||
#define NMERROR_PARM_UFLOW 65 /*{ label("too few parameters") }*/
|
||||
#define NMERROR_PARM_OFLOW 66 /*{ label("too many parameters") }*/
|
||||
#define NMERROR_INTERNAL_ACTION 67 /*{ label("internal action error") }*/
|
||||
#define NMERROR_ACTION_REJECTED 68 /*{ label("action rejected") }*/
|
||||
#define NMERROR_NO_TRANSITION 69 /*{ label("no transition")}*/
|
||||
#define NMERROR_CONT_READONLY 70 /*{ label("read-only container") }*/
|
||||
#define NMERROR_CREATE_REJECTED 71 /*{ label("create rejected") }*/
|
||||
#define NMERROR_DELETE_REJECTED 72 /*{ label("delete rejected") }*/
|
||||
#define NMERROR_CONT_REJECTED 73 /*{ label("contents rejected") }*/
|
||||
#define NMERROR_FORWARD_HEADER 74 /*{ label("forward header error") }*/
|
||||
#define NMERROR_FORWARD_MSG 75 /*{ label("forward msg error") }*/
|
||||
#define NMERROR_FORWARD_OPCODE 76 /*{ label("forward opcode error") }*/
|
||||
|
||||
#endif /* _NMSTATUS_H_ */
|
||||
503
src/configMgr/c_program/impmod/nmtypes.c
Normal file
503
src/configMgr/c_program/impmod/nmtypes.c
Normal file
@@ -0,0 +1,503 @@
|
||||
/*
|
||||
* nmtypes.c: Methods for types in nmtypes.h.
|
||||
*
|
||||
* Bruce Nelson, interWAVE, 08/07/95.
|
||||
*
|
||||
* Modified by : XChen
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "nmtypes.h"
|
||||
|
||||
|
||||
/*
|
||||
* Methods for "class" Dva.
|
||||
*/
|
||||
void DvaCopy(tDva* pDstDva, tDva* pSrcDva)
|
||||
{
|
||||
pDstDva->NetId = pSrcDva->NetId;
|
||||
pDstDva->NodeId = pSrcDva->NodeId;
|
||||
}
|
||||
|
||||
int DvaEqual(tDva* pDva1, tDva* pDva2)
|
||||
{
|
||||
return ((pDva1->NetId == pDva2->NetId) &&
|
||||
(pDva1->NodeId == pDva2->NodeId));
|
||||
}
|
||||
|
||||
/*
|
||||
* Methods for "class" Oid.
|
||||
*/
|
||||
void OidCtor(tOid* pOid)
|
||||
{
|
||||
u16* pDst;
|
||||
u16* pDstEnd;
|
||||
|
||||
pDst = (u16*)pOid;
|
||||
pDstEnd = pDst + (sizeof(tOid) / sizeof(u16));
|
||||
do
|
||||
{
|
||||
*pDst++ = (u16)0;
|
||||
} while (++pDst < pDstEnd);
|
||||
}
|
||||
|
||||
|
||||
/* OidCopy takes advantage of the fact that an Oid structure may be treated as
|
||||
* an array of u16 elements.
|
||||
*/
|
||||
void OidCopy(tOid* pDstOid, tOid* pSrcOid)
|
||||
{
|
||||
u16* pDst;
|
||||
u16* pSrc;
|
||||
u16* pSrcEnd;
|
||||
|
||||
pDst = (u16*)pDstOid;
|
||||
pSrc = (u16*)pSrcOid;
|
||||
pSrcEnd = pSrc + (sizeof(tOid) / sizeof(u16));
|
||||
do
|
||||
{
|
||||
*pDst++ = *pSrc;
|
||||
} while (++pSrc < pSrcEnd);
|
||||
}
|
||||
|
||||
void OidMakeChild(tOid* pDstOid, tOid* pSrcOid, tCONT DstContId, u16 DstIndex)
|
||||
{
|
||||
OidCopy(pDstOid, pSrcOid);
|
||||
pDstOid->ContId = DstContId;
|
||||
pDstOid->Ix[pDstOid->IxCnt++] = DstIndex;
|
||||
}
|
||||
|
||||
bool GetMeasPara(int Cid,int Eid,int num,char *pTempPara)
|
||||
{
|
||||
bool IsEvPara = TRUE;
|
||||
|
||||
//BtsMeasurement
|
||||
if((Cid == 22)&&(Eid == 0)&&(num == 0))
|
||||
strcpy(pTempPara,"LocationAreaCode");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 1))
|
||||
strcpy(pTempPara,"CellIdentity");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 2))
|
||||
strcpy(pTempPara,"StartTime");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 3))
|
||||
strcpy(pTempPara,"BscName");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 4))
|
||||
strcpy(pTempPara,"BtsName");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 5))
|
||||
strcpy(pTempPara,"nbrOfAvailableTCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 6))
|
||||
strcpy(pTempPara,"meanNbrOfBusyTCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 7))
|
||||
strcpy(pTempPara,"maxNbrOfBusyTCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 8))
|
||||
strcpy(pTempPara,"meanNbrOfIdleTCHsPerInterferenceBand");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 9))
|
||||
strcpy(pTempPara,"attTCHSeizures");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 10))
|
||||
strcpy(pTempPara,"succTCHSeizures");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 11))
|
||||
strcpy(pTempPara,"nbrOfAvailableSDCCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 12))
|
||||
strcpy(pTempPara,"meanNbrOfBusySDCCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 13))
|
||||
strcpy(pTempPara,"maxNbrOfBusySDCCHs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 14))
|
||||
strcpy(pTempPara,"attSDCCHSeizures");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 15))
|
||||
strcpy(pTempPara,"attSDCCHSeizuresFailures");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 16))
|
||||
strcpy(pTempPara,"accAGCH");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 17))
|
||||
strcpy(pTempPara,"accPagingChannel");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 18))
|
||||
strcpy(pTempPara,"succAccProcCMReEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 19))
|
||||
strcpy(pTempPara,"succAccProcCMServ");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 20))
|
||||
strcpy(pTempPara,"succAccProcIMSIDet");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 21))
|
||||
strcpy(pTempPara,"succAccProcLocUpd");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 22))
|
||||
strcpy(pTempPara,"succAccProcPageRsp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 23))
|
||||
strcpy(pTempPara,"succAccProcRACH");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 24))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsEmgCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 25))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsCMReEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 26))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsPageRsp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 27))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsOrigCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 28))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsLocUpd");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 29))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsOthers");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 30))
|
||||
strcpy(pTempPara,"maxNbrOfBlockCH");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 31))
|
||||
strcpy(pTempPara,"chanReqMSFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 32))
|
||||
strcpy(pTempPara,"MinQualityUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 33))
|
||||
strcpy(pTempPara,"MaxQualityUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 34))
|
||||
strcpy(pTempPara,"MeanQualityUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 35))
|
||||
strcpy(pTempPara,"TotalQualityDurationUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 36))
|
||||
strcpy(pTempPara,"TotalQualitySamplesUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 37))
|
||||
strcpy(pTempPara,"CumulativeQualityDistributionUL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 38))
|
||||
strcpy(pTempPara,"MinQualityDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 39))
|
||||
strcpy(pTempPara,"MaxQualityDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 40))
|
||||
strcpy(pTempPara,"MeanQualityDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 41))
|
||||
strcpy(pTempPara,"TotalQualityDurationDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 42))
|
||||
strcpy(pTempPara,"TotalQualitySamplesDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 43))
|
||||
strcpy(pTempPara,"CumulativeQualityDistributionDL");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 44))
|
||||
strcpy(pTempPara,"HoInterBSCReqToMSC");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 45))
|
||||
strcpy(pTempPara,"HoInterBSCOutAtmpt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 46))
|
||||
strcpy(pTempPara,"HoInterBSCMSFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 47))
|
||||
strcpy(pTempPara,"HoInterBSCOut");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 48))
|
||||
strcpy(pTempPara,"HoInterBSCIn");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 49))
|
||||
strcpy(pTempPara,"HoIntraBSCAtmpt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 50))
|
||||
strcpy(pTempPara,"HoIntraBSCIn");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 51))
|
||||
strcpy(pTempPara,"HoIntraBscFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 52))
|
||||
strcpy(pTempPara,"HoIntraBscLostMs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 53))
|
||||
strcpy(pTempPara,"FailIncomingHDOs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 54))
|
||||
strcpy(pTempPara,"AvgRachSlotCount");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 55))
|
||||
strcpy(pTempPara,"AvgRachBusyCount");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 56))
|
||||
strcpy(pTempPara,"AvgRachAccessCount");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 57))
|
||||
strcpy(pTempPara,"attTCHAssignments");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 58))
|
||||
strcpy(pTempPara,"ImmAssignToBts");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 59))
|
||||
strcpy(pTempPara,"meanTCHBusyTime");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 60))
|
||||
strcpy(pTempPara,"SuccTchSmsEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 61))
|
||||
strcpy(pTempPara,"SuccSdcchSmsEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 62))
|
||||
strcpy(pTempPara,"UnsuccTchSmsEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 63))
|
||||
strcpy(pTempPara,"UnsuccSdcchSmsEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 64))
|
||||
strcpy(pTempPara,"attTransOfPagingMessagesThePCH");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 65))
|
||||
strcpy(pTempPara,"PGCHLoading");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 66))
|
||||
strcpy(pTempPara,"nbrOfPagesDiscardedFromPCHQueue");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 67))
|
||||
strcpy(pTempPara,"TCHEmergencyCalls");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 68))
|
||||
strcpy(pTempPara,"SDCCHEmergencyCalls");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 69))
|
||||
strcpy(pTempPara,"SDCCHActFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 70))
|
||||
strcpy(pTempPara,"deleteIndMsgCount");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 71))
|
||||
strcpy(pTempPara,"UplinkAvgSignal");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 72))
|
||||
strcpy(pTempPara,"DownlinkAvgSignal");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 73))
|
||||
strcpy(pTempPara,"HoAtmpToNeighborPerTargetCell");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 74))
|
||||
strcpy(pTempPara,"HoFailToNeighborPerTargetCell");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 75))
|
||||
strcpy(pTempPara,"succOutgoingInternalInterCellHDOs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 76))
|
||||
strcpy(pTempPara,"allAvailableTCHAllocatedTime");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 77))
|
||||
strcpy(pTempPara,"allAvailableSDCCHAllocatedTime");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 78))
|
||||
strcpy(pTempPara,"attInternalHDOsUlQual");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 79))
|
||||
strcpy(pTempPara,"attInternalHDOsDlQual");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 80))
|
||||
strcpy(pTempPara,"attInternalHDOsUlLevel");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 81))
|
||||
strcpy(pTempPara,"attInternalHDOsDlLevel");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 82))
|
||||
strcpy(pTempPara,"attInternalHDOsDistance");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 83))
|
||||
strcpy(pTempPara,"attInternalHDOsOMC");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 84))
|
||||
strcpy(pTempPara,"attInternalHDOsMSCInvoke");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 85))
|
||||
strcpy(pTempPara,"attInternalHDOsBetterCell");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 86))
|
||||
strcpy(pTempPara,"attInternalHDOsDirectedRetry");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 87))
|
||||
strcpy(pTempPara,"attInternalHDOsCallControl");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 88))
|
||||
strcpy(pTempPara,"SDCCHRadioFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 89))
|
||||
strcpy(pTempPara,"SDCCHAbisFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 90))
|
||||
strcpy(pTempPara,"SDCCHAifFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 91))
|
||||
strcpy(pTempPara,"SDCCHBtsFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 92))
|
||||
strcpy(pTempPara,"SDCCHTrxFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 93))
|
||||
strcpy(pTempPara,"SDCCHBssDrop");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 94))
|
||||
strcpy(pTempPara,"TCHRadioFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 95))
|
||||
strcpy(pTempPara,"TCHAbisFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 96))
|
||||
strcpy(pTempPara,"TCHAifFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 97))
|
||||
strcpy(pTempPara,"TCHBtsFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 98))
|
||||
strcpy(pTempPara,"TCHTrxFail");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 99))
|
||||
strcpy(pTempPara,"TCHBssDrop");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 100))
|
||||
strcpy(pTempPara,"succAccProcCMOrigCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 101))
|
||||
strcpy(pTempPara,"succAccProcCMSms");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 102))
|
||||
strcpy(pTempPara,"succAccProcCMSs");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 103))
|
||||
strcpy(pTempPara,"succAccProcCMGrpCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 104))
|
||||
strcpy(pTempPara,"succAccProcCMBroadCast");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 105))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsEmgCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 106))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsCMReEst");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 107))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsPageRsp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 108))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsOrigCall");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 109))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsLocUpd");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 110))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsOthers");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 111))
|
||||
strcpy(pTempPara,"ARMtAlert");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 112))
|
||||
strcpy(pTempPara,"ARMoAlert");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 113))
|
||||
strcpy(pTempPara,"ARCallCfm");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 114))
|
||||
strcpy(pTempPara,"ARCallPro");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 115))
|
||||
strcpy(pTempPara,"ARMtConnect");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 116))
|
||||
strcpy(pTempPara,"ARMoConnect");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 117))
|
||||
strcpy(pTempPara,"ARMtConAck");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 118))
|
||||
strcpy(pTempPara,"ARMoConAck");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 119))
|
||||
strcpy(pTempPara,"ARMtSetUp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 120))
|
||||
strcpy(pTempPara,"ARMoSetUp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 121))
|
||||
strcpy(pTempPara,"ARAuthReq");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 122))
|
||||
strcpy(pTempPara,"ARAuthRes");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 123))
|
||||
strcpy(pTempPara,"ARIdReq");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 124))
|
||||
strcpy(pTempPara,"ARIdRes");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 125))
|
||||
strcpy(pTempPara,"ARTmsiRelocCmd");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 126))
|
||||
strcpy(pTempPara,"ARTmsiRelocCmp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 127))
|
||||
strcpy(pTempPara,"ARCmServAcc");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 128))
|
||||
strcpy(pTempPara,"ARCmServRej");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 129))
|
||||
strcpy(pTempPara,"ARCmServAbt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 130))
|
||||
strcpy(pTempPara,"ARLocUpdAcc");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 131))
|
||||
strcpy(pTempPara,"ARLocUpdRej");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 132))
|
||||
strcpy(pTempPara,"ARCimoCmd");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 133))
|
||||
strcpy(pTempPara,"ARCimoCmp");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 134))
|
||||
strcpy(pTempPara,"ARCimoRej");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 135))
|
||||
strcpy(pTempPara,"AifBlocking");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 136))
|
||||
strcpy(pTempPara,"TCHBlocking");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 137))
|
||||
strcpy(pTempPara,"TrauBlocking");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 138))
|
||||
strcpy(pTempPara,"HoInterBSCInAtmpt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 139))
|
||||
strcpy(pTempPara,"succTCHAssignments");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 140))
|
||||
strcpy(pTempPara,"FailTCHAssignments");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 141))
|
||||
strcpy(pTempPara,"TCHQueuedCallAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 142))
|
||||
strcpy(pTempPara,"TCHQueuedHoAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 143))
|
||||
strcpy(pTempPara,"QFullCallAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 144))
|
||||
strcpy(pTempPara,"QFullHoAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 145))
|
||||
strcpy(pTempPara,"FailQdCallAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 146))
|
||||
strcpy(pTempPara,"FailQdHoAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 147))
|
||||
strcpy(pTempPara,"AvgQLength");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 148))
|
||||
strcpy(pTempPara,"AvgQTimeCallAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 149))
|
||||
strcpy(pTempPara,"AvgQTimeHoAttempt");
|
||||
else if((Cid == 22)&&(Eid == 0)&&(num == 150))
|
||||
strcpy(pTempPara,"succAccProcPageRspSMS");
|
||||
|
||||
/* else if((Cid == 23)&&(Eid == 0)&&(num == 0))
|
||||
strcpy(pTempPara,"startTime");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 1))
|
||||
strcpy(pTempPara,"BscName");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 2))
|
||||
strcpy(pTempPara,"attImmediateAssingProcsPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 3))
|
||||
strcpy(pTempPara,"succImmediateAssingProcsPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 4))
|
||||
strcpy(pTempPara,"succInternalHDOsIntraCellPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 5))
|
||||
strcpy(pTempPara,"unsuccInternalHDOsIntraCellPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 6))
|
||||
strcpy(pTempPara,"succInternalHDOsPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 7))
|
||||
strcpy(pTempPara,"unsuccInternalHDOsPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 8))
|
||||
strcpy(pTempPara,"ClrReqToMSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 9))
|
||||
strcpy(pTempPara,"ConReqToMSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 10))
|
||||
strcpy(pTempPara,"ConCfmFromMSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 11))
|
||||
strcpy(pTempPara,"ConRefFromMSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 12))
|
||||
strcpy(pTempPara,"CMServiceRejFromMSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 13))
|
||||
strcpy(pTempPara,"attTransOfPagingMessagesPerBSC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 14))
|
||||
strcpy(pTempPara,"succInternalHDOsUlQual");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 15))
|
||||
strcpy(pTempPara,"succInternalHDOsDlQual");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 16))
|
||||
strcpy(pTempPara,"succInternalHDOsUlLevel");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 17))
|
||||
strcpy(pTempPara,"succInternalHDOsDlLevel");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 18))
|
||||
strcpy(pTempPara,"succInternalHDOsDistance");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 19))
|
||||
strcpy(pTempPara,"succInternalHDOsOMC");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 20))
|
||||
strcpy(pTempPara,"succInternalHDOsMSCInvoke");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 21))
|
||||
strcpy(pTempPara,"succInternalHDOsBetterCell");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 22))
|
||||
strcpy(pTempPara,"succInternalHDOsDirectedRetry");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 23))
|
||||
strcpy(pTempPara,"succInternalHDOsCallControl");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 24))
|
||||
strcpy(pTempPara,"flushReqReceived");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 25))
|
||||
strcpy(pTempPara,"pagingCSReqReceivedfromSGSN");
|
||||
else if((Cid == 23)&&(Eid == 0)&&(num == 26))
|
||||
strcpy(pTempPara,"pagingPSReqReceivedfromSGSN");
|
||||
*/
|
||||
else IsEvPara = FALSE;
|
||||
return IsEvPara;
|
||||
}
|
||||
bool GetTableName(int cid,char *pTab)
|
||||
{
|
||||
bool IsCid = TRUE;
|
||||
if(cid == 58)//NMCLASS_AIf
|
||||
strcpy(pTab,"AIf");
|
||||
else if(cid == 60)
|
||||
strcpy(pTab,"ALink");
|
||||
else if(cid == 59)
|
||||
strcpy(pTab,"ALinkSet");
|
||||
else if(cid == 5)
|
||||
strcpy(pTab,"AbisMgr");
|
||||
else if(cid == 6)
|
||||
strcpy(pTab,"AdjHand");
|
||||
else if(cid == 7)
|
||||
strcpy(pTab,"Bsc");
|
||||
else if(cid == 8)
|
||||
strcpy(pTab,"BssFunc");
|
||||
else if(cid == 9)
|
||||
strcpy(pTab,"Bts");
|
||||
else if(cid == 11)
|
||||
strcpy(pTab,"BtsMgr");
|
||||
else if(cid == 52)
|
||||
strcpy(pTab,"ClockMod");
|
||||
else if(cid == 44)
|
||||
strcpy(pTab,"E1port");
|
||||
else if(cid == 43)
|
||||
strcpy(pTab,"E1trmod");
|
||||
else if(cid == 49)
|
||||
strcpy(pTab,"TrauDsp");
|
||||
else if(cid == 19)
|
||||
strcpy(pTab,"Software");
|
||||
else if(cid == 20)
|
||||
strcpy(pTab,"Trx");
|
||||
else if(cid == 14)
|
||||
strcpy(pTab,"TrxCh");
|
||||
else if(cid == 27)
|
||||
strcpy(pTab,"Wavex");
|
||||
else if(cid == 18)
|
||||
strcpy(pTab,"RCarrier");
|
||||
else if(cid == 17)
|
||||
strcpy(pTab,"PwrCont");
|
||||
else if(cid == 15)
|
||||
strcpy(pTab,"HandCont");
|
||||
else if(cid == 111)
|
||||
strcpy(pTab,"SmsCb");
|
||||
else if(cid == 112)
|
||||
strcpy(pTab,"SmMsg");
|
||||
else if(cid == 124)
|
||||
strcpy(pTab,"Bssgp");
|
||||
else if(cid == 125)
|
||||
strcpy(pTab,"Bvc");
|
||||
else if(cid == 126)
|
||||
strcpy(pTab,"Ns");
|
||||
else if(cid == 127)
|
||||
strcpy(pTab,"Nse");
|
||||
else if(cid == 128)
|
||||
strcpy(pTab,"Nsvc");
|
||||
else if(cid == 130)
|
||||
strcpy(pTab,"FRPort");
|
||||
else if(cid == 131)
|
||||
strcpy(pTab,"pvc");
|
||||
|
||||
else
|
||||
IsCid = FALSE;
|
||||
return(IsCid);
|
||||
}
|
||||
201
src/configMgr/c_program/impmod/nmtypes.h
Normal file
201
src/configMgr/c_program/impmod/nmtypes.h
Normal file
@@ -0,0 +1,201 @@
|
||||
#ifndef _NMTYPES_H_
|
||||
#define _NMTYPES_H_
|
||||
/** Copyright (C) 1995 interWAVE Communications, Inc.: All Rights Reserved. **/
|
||||
/*
|
||||
* nmtypes.h: Definitions of fundamental data types used in NM classes.
|
||||
*
|
||||
* Bruce Nelson, interWAVE, 08/07/95.
|
||||
* Modified by: XChen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "iwtypes.h"
|
||||
|
||||
/* Some message types for MsgId in IW message header.
|
||||
*/
|
||||
#define NM_MSGID_IMP 0
|
||||
#define NM_MSGID_IMPSRVR_REG 1
|
||||
#define NM_MSGID_IMPSRVR_UNREG 2
|
||||
|
||||
#define MAX_OID_LEVELS 12
|
||||
#define MAX_STRING_LENGTH 128
|
||||
#define MAX_ARRAY_LENGTH 128
|
||||
#define MAX_ARRAY1_LENGTH MAX_ARRAY_LENGTH
|
||||
#define MAX_ARRAY2_LENGTH MAX_ARRAY_LENGTH
|
||||
#define MAX_ARRAY4_LENGTH MAX_ARRAY_LENGTH
|
||||
#define MAX_ATTR_COUNT 256
|
||||
#define MAX_ACTION_COUNT 256
|
||||
#define MAX_EVENT_COUNT 256
|
||||
|
||||
/* Some scalar types.
|
||||
*/
|
||||
typedef u16 tCID; /* class identifier */
|
||||
typedef u16 tCONT; /* container identifier */
|
||||
typedef u16 tNMSTAT; /* NM function return code: status/error */
|
||||
typedef u16 tNMLEN; /* NM message length type: always two bytes */
|
||||
|
||||
#define NM_CLASS_UNDEFINED ((tCID)(65535))
|
||||
#define NM_CONTID_UNDEFINED ((tCONT)(65535))
|
||||
|
||||
/* Generic type for NM functions in "virtual function" table. Note that all
|
||||
* NM functions return a non-negative status code.
|
||||
*/
|
||||
typedef tNMSTAT (*tNmFnP)();
|
||||
typedef void (*tVdFnP)();
|
||||
|
||||
/* Types used to store array index/value pairs.
|
||||
*/
|
||||
struct ARs8
|
||||
{
|
||||
u8 Index;
|
||||
s8 Value;
|
||||
};
|
||||
typedef struct ARs8 tARs8;
|
||||
struct ARu8
|
||||
{
|
||||
u8 Index;
|
||||
u8 Value;
|
||||
};
|
||||
typedef struct ARu8 tARu8;
|
||||
struct ARs16
|
||||
{
|
||||
u8 Index;
|
||||
s16 Value;
|
||||
};
|
||||
typedef struct ARs16 tARs16;
|
||||
struct ARu16
|
||||
{
|
||||
u8 Index;
|
||||
u16 Value;
|
||||
};
|
||||
typedef struct ARu16 tARu16;
|
||||
struct ARs32
|
||||
{
|
||||
u8 Index;
|
||||
s32 Value;
|
||||
};
|
||||
typedef struct ARs32 tARs32;
|
||||
struct ARu32
|
||||
{
|
||||
u8 Index;
|
||||
u32 Value;
|
||||
};
|
||||
typedef struct ARu32 tARu32;
|
||||
|
||||
/* Type used to store a class member id (e.g., attribute id).
|
||||
*/
|
||||
struct MID
|
||||
{
|
||||
tCID ClassId;
|
||||
u8 MemberId;
|
||||
u8 MemberType;
|
||||
tNmFnP MemberFn;
|
||||
tVdFnP CommitFn;
|
||||
};
|
||||
typedef struct MID tMID;
|
||||
|
||||
/* Defines for MID types.
|
||||
*/
|
||||
#define MID_TYPE_UNKNOWN 0
|
||||
#define MID_TYPE_ATTR_NUM 1
|
||||
#define MID_TYPE_ATTR_ARRAY 2
|
||||
#define MID_TYPE_ATTR_STRG 3
|
||||
#define MID_TYPE_ATTR_OID 4
|
||||
#define MID_TYPE_ATTR_CID 5
|
||||
#define MID_TYPE_ACTION 14
|
||||
#define MID_TYPE_EVENT 15
|
||||
#define MID_TYPE_TYPE_MASK 0x00f
|
||||
#define MID_TYPE_NOVAL_MASK 0x010
|
||||
#define MID_TYPE_RW_MASK 0x020
|
||||
#define MID_TYPE_RO_MASK 0x030
|
||||
#define MID_TYPE_UPDATE_MASK 0x040
|
||||
#define MID_TYPE_DEBUG_MASK 0x080
|
||||
|
||||
/* Type used to store action info (alas, tMID not reusable enough).
|
||||
*/
|
||||
struct FID
|
||||
{
|
||||
tCID ActCls;
|
||||
u8 ActNum;
|
||||
u8 ParmCount;
|
||||
tCID EvCls;
|
||||
u8 EvNum;
|
||||
tNmFnP ActFn;
|
||||
u8* pParmTypes;
|
||||
};
|
||||
typedef struct FID tFID;
|
||||
|
||||
/* The Dva structure (type tDva) represents a device (node) address.
|
||||
*
|
||||
* NOTICE: This is tentative.
|
||||
*/
|
||||
struct Dva
|
||||
{
|
||||
u16 NetId; /* network number */
|
||||
u16 NodeId; /* node number */
|
||||
};
|
||||
typedef struct Dva tDva;
|
||||
|
||||
/* Methods operating on tDva. (Function externs moved to bottom of file.)
|
||||
*/
|
||||
|
||||
/* The Oid structure (type tOid) represents an object identifier. The IxCnt
|
||||
* field must be first, since it is not explicitly marshaled, but the rest of
|
||||
* the Oid is marshaled as though it were a u16 array (of length IxCnt +
|
||||
* ((sizeof(tCONT) + sizeof(tDva)) / sizeof(u16))). The ContId must come
|
||||
* second, both to pad to a 4-byte boundary before DvAddr and because the
|
||||
* offset of the ContId field is treated at the start of the marshaled Oid
|
||||
* data. The Ix array must come last, since only part of it may be marshaled.
|
||||
*/
|
||||
struct Oid
|
||||
{
|
||||
u16 IxCnt; /* number of indexes */
|
||||
tCONT ContId; /* systemwide container id */
|
||||
tDva DvAddr; /* device address */
|
||||
u16 Ix[MAX_OID_LEVELS]; /* indexes: one per containment lvl */
|
||||
};
|
||||
typedef struct Oid tOid;
|
||||
#define OID_NON_IX_U16_COUNT ((sizeof(tCONT) + sizeof(tDva)) / sizeof(u16))
|
||||
#define OID_INIT \
|
||||
{ \
|
||||
(u16)0, \
|
||||
(tCONT)0, \
|
||||
{ (u16)0, \
|
||||
(u16)0 }, \
|
||||
{ (u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0, \
|
||||
(u16)0 } \
|
||||
}
|
||||
|
||||
/* Methods operating on tOid. (Function externs moved to bottom of file.)
|
||||
*/
|
||||
|
||||
/* Functions that manipulate arrays.
|
||||
*/
|
||||
#define s8copy(pDst, pSrc, Length) \
|
||||
u8copy((u8*)(pDst), (u8*)(pSrc), (Length))
|
||||
#define s16copy(pDst, pSrc, Length) \
|
||||
u16copy((u16*)(pDst), (u16*)(pSrc), (Length))
|
||||
#define s32copy(pDst, pSrc, Length) \
|
||||
u32copy((u32*)(pDst), (u32*)(pSrc), (Length))
|
||||
|
||||
extern void DvaCopy(tDva* pDstDva, tDva* pSrcDva);
|
||||
extern int DvaEqual(tDva* pDva1, tDva* pDva2);
|
||||
extern void OidCtor(tOid* pOid);
|
||||
extern void OidCopy(tOid* pDstOid, tOid* pSrcOid);
|
||||
extern void OidMakeChild(tOid* pDstOid, tOid* pSrcOid, tCONT DstContId,u16 DstIndex);
|
||||
|
||||
//extern bool GetEventName(int Cid,int Eid,char *pTempEid,char *pTempAlarmLevel);
|
||||
extern bool GetMeasPara(int Cid,int Eid,int num,char *pTempPara);
|
||||
extern bool GetTableName(int cid,char *pTab);
|
||||
|
||||
#endif /* _NMTYPES_H_ */
|
||||
84
src/configMgr/c_program/paraComm/Makefile
Normal file
84
src/configMgr/c_program/paraComm/Makefile
Normal file
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
|
||||
#Author: Cui Ticun
|
||||
#Version: 9.00.00
|
||||
#Date: 2007-7-1
|
||||
#Description: Makefile for paraComm module.
|
||||
|
||||
CC = gcc
|
||||
CFLAGS=-D_REENTRANT -g -Wall
|
||||
|
||||
dbINCLUDEFLAG = -I/usr/local/mysql/include
|
||||
dbLINKFLAG = -L/usr/local/mysql/lib -lmariadbclient -lz
|
||||
|
||||
dbINCLUDEFLAG.ES = -I/usr/include/mariadb
|
||||
dbLINKFLAG.ES = -L/usr/lib/mysql -lmariadbclient -lz
|
||||
|
||||
LINKFLAG=-L../../../omcLib/c_program/omcLib -lomcLib \
|
||||
-L../../../../plat/snmp/lib -lsnmp \
|
||||
-L../../../../plat/sccp/lib -lsccp \
|
||||
-L../../../../plat/iptrans/lib -liptrans \
|
||||
-L../../../../plat/debug/lib -ldebug \
|
||||
-L../../../../plat/public/lib -lpublic \
|
||||
|
||||
LINK_SUFFIX = $(dbINCLUDEFLAG) $(dbLINKFLAG) $(LINKFLAG)
|
||||
LINK_SUFFIX.ES = $(dbINCLUDEFLAG.ES) $(dbLINKFLAG.ES)$(LINKFLAG)
|
||||
|
||||
PROGS = paraComm
|
||||
|
||||
PARACOMM_OBJ = paraCommMain.o paraComm.o initParaConf.o
|
||||
PARACOMM_OBJ.ES = paraCommMain.o.ES paraComm.o.ES initParaConf.o.ES
|
||||
|
||||
LIB_OBJ = paraComm.o initParaConf.o
|
||||
LIB_OBJ.ES = paraComm.o.ES initParaConf.o.ES
|
||||
|
||||
default: linuxES
|
||||
|
||||
all:
|
||||
@echo " **** Compiling $(PROGS) ****"
|
||||
@echo "make clean -- Delete the target files"
|
||||
@echo "make linux72 -- Generate target files for Redhat Linux 72"
|
||||
@echo "make linuxES -- Generate target files for Redhat Linux ES"
|
||||
|
||||
|
||||
linux72: $(PARACOMM_OBJ)
|
||||
@echo Linking $(PROGS)
|
||||
@$(CC) $(CFLAGS) -o $(PROGS) $(PARACOMM_OBJ) $(LINK_SUFFIX) -lm
|
||||
ar r libparaComm.a $(LIB_OBJ)
|
||||
rm -f *.o core *~
|
||||
#cp -f $(PROGS) ../../../../bin
|
||||
#cp -f $(PROGS) /usr/local/omc/bin/
|
||||
|
||||
linuxES: $(PARACOMM_OBJ.ES)
|
||||
@echo Linking $(PROGS)
|
||||
@$(CC) $(CFLAGS) -o $(PROGS) $(PARACOMM_OBJ) $(LINK_SUFFIX.ES) -lm
|
||||
ar r libparaComm.a $(LIB_OBJ)
|
||||
|
||||
installbin: $(PROGS)
|
||||
cp -f $(PROGS) ../../../../bin/
|
||||
|
||||
installomc: $(PROGS)
|
||||
cp -f $(PROGS) /usr/local/omc/bin/
|
||||
|
||||
installall: installbin installomc
|
||||
|
||||
paraCommMain.o: paraCommMain.c
|
||||
$(CC) $(CFLAGS) -c paraCommMain.c $(dbINCLUDEFLAG)
|
||||
|
||||
paraComm.o: paraComm.c
|
||||
$(CC) $(CFLAGS) -c paraComm.c $(dbINCLUDEFLAG)
|
||||
|
||||
initParaConf.o: initParaConf.c
|
||||
$(CC) $(CFLAGS) -c initParaConf.c $(dbINCLUDEFLAG)
|
||||
|
||||
paraCommMain.o.ES: paraCommMain.c
|
||||
$(CC) $(CFLAGS) -c paraCommMain.c $(dbINCLUDEFLAG.ES)
|
||||
|
||||
paraComm.o.ES: paraComm.c
|
||||
$(CC) $(CFLAGS) -c paraComm.c $(dbINCLUDEFLAG.ES)
|
||||
|
||||
initParaConf.o.ES: initParaConf.c
|
||||
$(CC) $(CFLAGS) -c initParaConf.c $(dbINCLUDEFLAG.ES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a $(PROGS)
|
||||
478
src/configMgr/c_program/paraComm/initParaConf.c
Normal file
478
src/configMgr/c_program/paraComm/initParaConf.c
Normal file
@@ -0,0 +1,478 @@
|
||||
/*************************************************
|
||||
File name: initParaConf.c
|
||||
Author: Cui Ticun
|
||||
Version: 9.00.00
|
||||
Date: 2007-7-1
|
||||
Description:This file init every modules' paraConf table from MIB files,
|
||||
It includes the function 'int initDbFromMib()',which is called by paraCommInit.
|
||||
It calls snmp's functions:extern int init_mib();
|
||||
extern struct tree *getLGCroot();
|
||||
extern struct tree *get_tree(const int *oid, int oidlen, struct tree *subtree);
|
||||
extern void close_mib();
|
||||
|
||||
History:
|
||||
No.
|
||||
Author
|
||||
Date
|
||||
Version
|
||||
Description
|
||||
*************************************************/
|
||||
|
||||
#include "paraComm.h"
|
||||
|
||||
#define SYSTEM_TYPE 355
|
||||
|
||||
static MYSQL *dbConn;
|
||||
char indexsQuery[10240];
|
||||
extern FILE *paraCommLog;
|
||||
|
||||
void preOrderMibTree(struct tree *mibTree);
|
||||
void orderEnums(struct enum_list *enums,char *str);
|
||||
void orderIndexes(struct index_list *indexes,char *str);
|
||||
//BYTE str2oid(char *str, DWORD * array, BYTE max);
|
||||
BYTE str2oid(char *str, int * array, BYTE max);
|
||||
|
||||
#define MAX_MODULE_NUMBER 64
|
||||
int global_mod_index;
|
||||
//DWORD global_mod_oids[MAX_MODULE_NUMBER][32];
|
||||
int global_mod_oids[MAX_MODULE_NUMBER][32];
|
||||
int global_mod_systype[MAX_MODULE_NUMBER];
|
||||
/*=
|
||||
{
|
||||
{1373,2,3,3,2,2},
|
||||
{1373,2,3,3,64,2}
|
||||
};
|
||||
|
||||
int global_mod_systype[global_mod_total]={320,355};
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************
|
||||
Function: // initDbFromMib
|
||||
Description: // Get oid info from MIB file and init the paramConf tables.
|
||||
Calls: // extern int init_mib();extern struct tree *getLGCroot();extern struct get_tree;extern void close_mib();
|
||||
Called By: // paraCommInit();
|
||||
Table Accessed: //
|
||||
Table Updated: // paramConf
|
||||
Input: //
|
||||
Output: //
|
||||
Return: // 1:OK,0:error
|
||||
Others: //
|
||||
*************************************************/
|
||||
int initDbFromMib()
|
||||
{
|
||||
//DWORD oidArr[32]={ 1373, 2, 3, 3, 2, 2 };
|
||||
struct tree *tmpLGCRoot;
|
||||
struct tree *mibTree;
|
||||
int i,oidlen;
|
||||
char tmpSql[10240];
|
||||
int mod_total;
|
||||
MYSQL_RES *res=NULL;
|
||||
MYSQL_ROW rows;
|
||||
|
||||
|
||||
//init db connect
|
||||
dbConn = mysql_conn(HOSTNAME, PUB_DB);
|
||||
if (dbConn == NULL) {
|
||||
omcLog(paraCommLog,"[ERR][initDbFromMib]:mysql connect OMC_PUB");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//memset(global_mod_oids,0,sizeof(DWORD)*32*MAX_MODULE_NUMBER);
|
||||
memset(global_mod_oids,0,sizeof(int)*32*MAX_MODULE_NUMBER);
|
||||
sprintf(tmpSql, "SELECT sysTypeNo,entryOid FROM sysMibConf WHERE isEnable = '1' ");
|
||||
|
||||
res = (MYSQL_RES *) mysql_getres(dbConn, tmpSql);
|
||||
|
||||
if(res == NULL)
|
||||
{
|
||||
omcLog(paraCommLog, " Database may be stopped,when initDbFromMib");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
global_mod_index=0;
|
||||
mod_total=0;
|
||||
while ((rows = mysql_fetch_row(res)))
|
||||
{
|
||||
if(mod_total >= MAX_MODULE_NUMBER)
|
||||
{
|
||||
omcLog(paraCommLog,"The number pf mib files is too large");
|
||||
break;
|
||||
}
|
||||
|
||||
//mod_oids[mod_total]
|
||||
global_mod_systype[mod_total]=atoi(rows[0]);
|
||||
oidlen=str2oid(rows[1],global_mod_oids[mod_total],20);
|
||||
/*
|
||||
for(i=0;i<oidlen+1;i++)
|
||||
printf("%d.",global_mod_oids[mod_total][i]);
|
||||
printf("\n");
|
||||
*/
|
||||
mod_total++;
|
||||
}
|
||||
|
||||
mysql_free_result(res);
|
||||
|
||||
init_mib();
|
||||
tmpLGCRoot=getLGCroot();
|
||||
|
||||
for(global_mod_index=0;global_mod_index<mod_total;global_mod_index++)
|
||||
{
|
||||
sprintf(tmpSql,"DELETE FROM OBJ_%d.paramConf",global_mod_systype[global_mod_index]);
|
||||
mysql_getnores(dbConn,tmpSql);
|
||||
|
||||
mibTree=get_tree((int*)global_mod_oids[global_mod_index],6,tmpLGCRoot);
|
||||
|
||||
if(mibTree==tmpLGCRoot || mibTree->subid != global_mod_oids[global_mod_index][5]){
|
||||
printf("Cannot find the OID in MIB File:");
|
||||
for(i=0;i<6;i++){
|
||||
printf("%ld.",global_mod_oids[global_mod_index][i]);
|
||||
}
|
||||
printf("\n");
|
||||
exit(1);
|
||||
}
|
||||
// indexsQuery[0]=0;
|
||||
memset(&indexsQuery[0], 0x00, sizeof(indexsQuery));
|
||||
preOrderMibTree(mibTree);
|
||||
strcat(indexsQuery,")");
|
||||
|
||||
//Modify Index's access from MIB_ACCESS_READWRITE to MIB_ACCESS_CREATE
|
||||
if(strlen(indexsQuery)>3)
|
||||
{
|
||||
sprintf(tmpSql,"UPDATE OBJ_%d.paramConf SET maxAccess='%d' WHERE maxAccess='%d' AND %s",
|
||||
global_mod_systype[global_mod_index],MIB_ACCESS_CREATE,MIB_ACCESS_READWRITE,indexsQuery);
|
||||
mysql_getnores(dbConn,tmpSql);
|
||||
}
|
||||
|
||||
sprintf(tmpSql,"UPDATE OBJ_%d.paramConf SET operType='%d' WHERE name_2 LIKE '%%CreateTimeStamp'",
|
||||
global_mod_systype[global_mod_index],DO_NOT_DISPLAY);
|
||||
//printf("tmpSql=%s\n",tmpSql);
|
||||
mysql_getnores(dbConn,tmpSql);
|
||||
|
||||
sprintf(tmpSql,"UPDATE OBJ_%d.paramConf SET operType='%d' WHERE name_2 LIKE '%%AdministrationState'",
|
||||
global_mod_systype[global_mod_index],LABEL);
|
||||
//printf("tmpSql=%s\n",tmpSql);
|
||||
mysql_getnores(dbConn,tmpSql);
|
||||
}
|
||||
close_mib();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // preOrderBinTree
|
||||
Description: // Preorder traversal the mibtree(bintree)
|
||||
Calls: //
|
||||
Called By: // initDbFromMib
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: // struct tree *mibTree
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
void preOrderMibTree(struct tree *mibTree)
|
||||
{
|
||||
int i;
|
||||
//16384
|
||||
char tmpStr[40960];
|
||||
char tmpStr1[20480];
|
||||
char tmpSql[40960];
|
||||
|
||||
char tmpEnumsList[1024];
|
||||
char tmpIndexesList[1024];
|
||||
char *onePart;
|
||||
char *anotherPart;
|
||||
int tmpLen;
|
||||
char *tempc;
|
||||
char name[128];
|
||||
char desc[2048];
|
||||
|
||||
if(mibTree){
|
||||
//printf("%s\n",mibTree->label);
|
||||
sprintf(tmpSql,"REPLACE INTO OBJ_%d.paramConf SET ",global_mod_systype[global_mod_index]);
|
||||
// name
|
||||
sprintf(tmpStr,"name_1='%s',name_2='%s'",mibTree->label,mibTree->label);
|
||||
strcat(tmpSql,tmpStr);
|
||||
|
||||
|
||||
sprintf(name,"none");
|
||||
if(mibTree->description && strstr(mibTree->description,"Name:")!=NULL)
|
||||
{
|
||||
sprintf(desc,mibTree->description);
|
||||
tempc=strstr(desc,"\n");
|
||||
if(tempc != NULL)
|
||||
*tempc=0;
|
||||
tempc=strstr(desc,"Name:");
|
||||
if(tempc == NULL)
|
||||
{
|
||||
sprintf(name,"none");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name,"%s",tempc+5);
|
||||
//printf("%s\n",name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Description
|
||||
if(mibTree->indexes){
|
||||
if(mibTree->description && !strstr(mibTree->description,"Description."))
|
||||
sprintf(tmpStr,",desc_1='Table Parameter, %s',desc_2='Table Parameter, %s'",mibTree->description,mibTree->description);
|
||||
else
|
||||
{
|
||||
if(strcmp(name,"none"))
|
||||
sprintf(tmpStr,",desc_1='Table Parameter, level:1, Name:%s',desc_2='Table Parameter, level:1, Name:%s'",name,name);
|
||||
else
|
||||
sprintf(tmpStr,",desc_1='Table Parameter, level:1',desc_2='Table Parameter, level:1'");
|
||||
}
|
||||
strcat(tmpSql,tmpStr);
|
||||
}else{
|
||||
char tmpdesc[4096];
|
||||
tmpdesc[0]=0;
|
||||
if(mibTree->description)
|
||||
{
|
||||
if(strstr(mibTree->description,"Hidden Flag:Yes"))
|
||||
{
|
||||
strcat(tmpdesc,"Hidden Parameter;");
|
||||
}
|
||||
else if(strstr(mibTree->description,"Key Parameter:Yes"))
|
||||
{
|
||||
strcat(tmpdesc,"Key Parameter;");
|
||||
}
|
||||
else if(strstr(mibTree->description,"PASSWORD:Visible"))
|
||||
{
|
||||
strcat(tmpdesc,"PASSWORD:Visible;");
|
||||
}
|
||||
else if(strstr(mibTree->description,"PASSWORD:Invisible"))
|
||||
{
|
||||
strcat(tmpdesc,"PASSWORD:Invisible;");
|
||||
}
|
||||
|
||||
if(strcmp(name,"none"))
|
||||
{
|
||||
sprintf(tmpStr,"Name:%s;",name);
|
||||
strcat(tmpdesc,tmpStr);
|
||||
}
|
||||
|
||||
if((tempc=strstr(mibTree->description,"RelationPoint:")))
|
||||
{
|
||||
char *tempc1=NULL;
|
||||
|
||||
tempc1=strstr(tempc,"\n");
|
||||
if(tempc1 != NULL)
|
||||
*tempc1=0;
|
||||
sprintf(tmpStr,"%s;",tempc);
|
||||
strcat(tmpdesc,tmpStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(strlen(tmpdesc)>0)
|
||||
{
|
||||
sprintf(tmpStr,",desc_1='%s',desc_2='%s'",tmpdesc,tmpdesc);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
/*
|
||||
|
||||
if(mibTree->description&&strstr(mibTree->description,"Hidden Flag:Yes"))
|
||||
{
|
||||
sprintf(tmpStr,",desc_1='Hidden Parameter',desc_2='Hidden Parameter'");
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
else if(mibTree->description&&
|
||||
strstr(mibTree->description,"Key Parameter:Yes")){
|
||||
if(strcmp(name,"none"))
|
||||
sprintf(tmpStr,",desc_1='Key Parameter, Name:%s',desc_2='Key Parameter, Name:%s'",name,name);
|
||||
else
|
||||
sprintf(tmpStr,",desc_1='Key Parameter',desc_2='Key Parameter'");
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
else if(strcmp(name,"none"))
|
||||
{
|
||||
sprintf(tmpStr,",desc_1='Name:%s',desc_2='Name:%s'",name,name);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//OPAQUE DECODE RULE:
|
||||
if(mibTree->description){
|
||||
if((onePart=strstr(mibTree->description,"OPAQUE DECODE RULE:"))){
|
||||
|
||||
strsep(&(onePart),":");
|
||||
if((anotherPart=strstr(mibTree->description,"Remark:")))
|
||||
strncpy(tmpStr1,onePart,(anotherPart-onePart));
|
||||
else
|
||||
strcpy(tmpStr1,onePart);
|
||||
sprintf(tmpStr,",setTemplate_1='%s',setTemplate_2='%s'",tmpStr1,tmpStr1);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
if(mibTree->description){
|
||||
//Note
|
||||
if((onePart=strstr(mibTree->description,"Remark:"))){
|
||||
strsep(&(onePart),":");
|
||||
if(onePart){
|
||||
sprintf(tmpStr,",note_1=\"%s\",note_2=\"%s\"",onePart,onePart);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Max Access
|
||||
sprintf(tmpStr,",maxAccess='%d'",mibTree->access);
|
||||
strcat(tmpSql,tmpStr);
|
||||
|
||||
//operType
|
||||
if(mibTree->access==MIB_ACCESS_READONLY){
|
||||
sprintf(tmpStr,",operType='%d'",LABEL);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}else if(mibTree->access==MIB_ACCESS_NOACCESS){
|
||||
sprintf(tmpStr,",operType='%d'",DO_NOT_DISPLAY);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}else{
|
||||
if(mibTree->type==TYPE_INTEGER&&mibTree->enums){
|
||||
sprintf(tmpStr,",operType='%d'",PULLDOWN_MENU);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}else{
|
||||
sprintf(tmpStr,",operType='%d'",TEXTBOX);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
//valueType
|
||||
sprintf(tmpStr,",valueType='%d'",mibTree->type);
|
||||
strcat(tmpSql,tmpStr);
|
||||
|
||||
//initValue
|
||||
if(mibTree->defaultValue){
|
||||
sprintf(tmpStr,",initValue='%s'",mibTree->defaultValue);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
|
||||
//minValue
|
||||
//maxValue
|
||||
if(mibTree->ranges){
|
||||
sprintf(tmpStr,",`minValue`='%d',`maxValue`='%d'",mibTree->ranges->low,mibTree->ranges->high);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
|
||||
//template
|
||||
if(mibTree->enums){
|
||||
tmpEnumsList[0]=0;
|
||||
orderEnums(mibTree->enums,tmpEnumsList);
|
||||
|
||||
tmpLen=strlen(tmpEnumsList);
|
||||
tmpEnumsList[tmpLen-1]=0;
|
||||
|
||||
sprintf(tmpStr,",setTemplate_1='%s',setTemplate_2='%s'",tmpEnumsList,tmpEnumsList);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}else if(mibTree->indexes){
|
||||
tmpIndexesList[0]=0;
|
||||
orderIndexes(mibTree->indexes,tmpIndexesList);
|
||||
|
||||
tmpLen=strlen(tmpIndexesList);
|
||||
tmpIndexesList[tmpLen-1]=0;
|
||||
|
||||
sprintf(tmpStr,",setTemplate_1='%s',setTemplate_2='%s'",tmpIndexesList,tmpIndexesList);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
|
||||
//level_x
|
||||
for(i=11;i<mibTree->oid_len;i++){
|
||||
sprintf(tmpStr,",level_%d=%d",i-10,mibTree->oid[i]);
|
||||
strcat(tmpSql,tmpStr);
|
||||
}
|
||||
|
||||
if(mysql_getnores(dbConn,tmpSql)<0){
|
||||
printf("\n%s\n",tmpSql);
|
||||
}
|
||||
|
||||
/*
|
||||
for(i=0;i<mibTree->oid_len;i++){
|
||||
printf("%d.",mibTree->oid[i]);
|
||||
}
|
||||
printf("\n");
|
||||
*/
|
||||
preOrderMibTree(mibTree->child_list);
|
||||
preOrderMibTree(mibTree->next_peer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // orderEnums
|
||||
Description: // construct the list of enumerated integers to a string
|
||||
Calls: //
|
||||
Called By: // preOrderMibTree
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: // struct enum_list *enums,
|
||||
Output: // char *str
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
void orderEnums(struct enum_list *enums,char *str)
|
||||
{
|
||||
char tmpStr[64];
|
||||
if(enums){
|
||||
sprintf(tmpStr,"%s=%d;",enums->label,enums->value);
|
||||
strcat(str,tmpStr);
|
||||
orderEnums(enums->next,str);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // orderIndexes
|
||||
Description: // construct the list of enumerated indexes to a string
|
||||
Calls: //
|
||||
Called By: // preOrderMibTree
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: // struct index_list *indexes
|
||||
Output: // char *str
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
void orderIndexes(struct index_list *indexes,char *str)
|
||||
{
|
||||
char tmpStr[64];
|
||||
if(indexes){
|
||||
sprintf(tmpStr,"%s;",indexes->ilabel);
|
||||
strcat(str,tmpStr);
|
||||
if(strlen(indexsQuery)>0)
|
||||
sprintf(tmpStr," OR name_2='%s'",indexes->ilabel);
|
||||
else
|
||||
sprintf(tmpStr," (name_2='%s'",indexes->ilabel);
|
||||
strcat(indexsQuery,tmpStr);
|
||||
orderIndexes(indexes->next,str);
|
||||
}
|
||||
}
|
||||
|
||||
//BYTE str2oid(char *str, DWORD * array, BYTE max)
|
||||
BYTE str2oid(char *str, int * array, BYTE max)
|
||||
{
|
||||
BYTE sub = 0;
|
||||
short len, i;
|
||||
char *pvar;
|
||||
len = strlen(str);
|
||||
pvar = str;
|
||||
for (i = 0; i < len && sub < max; i++) {
|
||||
if (str[i] == '.') {
|
||||
str[i] = '\0';
|
||||
if (strlen(pvar) == 0)
|
||||
continue;
|
||||
array[sub++] = atoi(pvar);
|
||||
pvar = str + i + 1;
|
||||
}
|
||||
}
|
||||
if (strlen(pvar) == 0)
|
||||
return sub;
|
||||
array[sub++] = atoi(pvar);
|
||||
return sub;
|
||||
}
|
||||
656
src/configMgr/c_program/paraComm/mib/LGC-MIB.my
Normal file
656
src/configMgr/c_program/paraComm/mib/LGC-MIB.my
Normal file
@@ -0,0 +1,656 @@
|
||||
--
|
||||
-- LGC-MIB-070927.my
|
||||
-- MIB generated by MG-SOFT Visual MIB Builder Version 7.0 Build 209
|
||||
-- Thursday, September 27, 2007 at 09:40:50
|
||||
--
|
||||
|
||||
LGC-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
enterprises, TimeTicks, MODULE-IDENTITY
|
||||
FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC;
|
||||
|
||||
|
||||
-- 1.3.6.1.4.1.1373.2
|
||||
lgcSS MODULE-IDENTITY
|
||||
LAST-UPDATED "200706041222Z" -- June 04, 2007 at 12:22 GMT
|
||||
ORGANIZATION
|
||||
"LGC Wireless"
|
||||
CONTACT-INFO
|
||||
"lcrd
|
||||
lcrdsupport@lgcwireless.com"
|
||||
DESCRIPTION
|
||||
"The MIB module for lgcWireless's Softswitch products."
|
||||
REVISION "200706041223Z" -- June 04, 2007 at 12:23 GMT
|
||||
DESCRIPTION
|
||||
"This is the first release version of the MIB"
|
||||
::= { lgcNS 2 }
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Type definitions
|
||||
--
|
||||
|
||||
AdminStateChoices ::= INTEGER
|
||||
{
|
||||
locked(0),
|
||||
unlocked(1),
|
||||
shutDown(2)
|
||||
}
|
||||
|
||||
OperStateChoices ::= INTEGER
|
||||
{
|
||||
disable(0),
|
||||
enable(1)
|
||||
}
|
||||
|
||||
AvailStateChoices ::= INTEGER
|
||||
{
|
||||
inTest(0),
|
||||
failed(1),
|
||||
powerOff(2),
|
||||
offLine(3),
|
||||
onLine(4),
|
||||
dependency(5),
|
||||
degraded(6),
|
||||
notInstalled(7)
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Textual conventions
|
||||
--
|
||||
|
||||
-- TEXTUAL-CONVENTION MACRO ::=
|
||||
-- BEGIN
|
||||
-- TYPE NOTATION ::=
|
||||
-- DisplayPart
|
||||
-- "STATUS" Status
|
||||
-- "DESCRIPTION" Text
|
||||
-- ReferPart
|
||||
-- "SYNTAX" Syntax
|
||||
--
|
||||
-- VALUE NOTATION ::=
|
||||
-- value(VALUE Syntax)
|
||||
--
|
||||
-- DisplayPart ::=
|
||||
-- "DISPLAY-HINT" Text
|
||||
-- | empty
|
||||
--
|
||||
-- Status ::=
|
||||
-- "current"
|
||||
-- | "deprecated"
|
||||
-- | "obsolete"
|
||||
--
|
||||
-- ReferPart ::=
|
||||
-- "REFERENCE" Text
|
||||
-- | empty
|
||||
--
|
||||
-- -- -- uses the NVT ASCII character set
|
||||
-- Text ::= """" string """"
|
||||
--
|
||||
-- Syntax ::=
|
||||
-- type(ObjectSyntax)
|
||||
-- | "BITS" "{" Kibbles "}"
|
||||
-- Kibbles ::=
|
||||
-- Kibble
|
||||
-- | Kibbles "," Kibble
|
||||
-- Kibble ::=
|
||||
-- identifier "(" nonNegativeNumber ")"
|
||||
-- END
|
||||
DisplayString8 ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT
|
||||
"8a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents textual information taken from the NVT ASCII
|
||||
character set, as defined in pages 4, 10-11 of RFC 854.
|
||||
|
||||
To summarize RFC 854, the NVT ASCII repertoire specifies:
|
||||
|
||||
- the use of character codes 0-127 (decimal)
|
||||
|
||||
- the graphics characters (32-126) are interpreted as
|
||||
US ASCII
|
||||
|
||||
- NUL, LF, CR, BEL, BS, HT, VT and FF have the special
|
||||
meanings specified in RFC 854
|
||||
|
||||
- the other 25 codes have no standard interpretation
|
||||
|
||||
- the sequence 'CR LF' means newline
|
||||
|
||||
- the sequence 'CR NUL' means carriage-return
|
||||
|
||||
- an 'LF' not preceded by a 'CR' means moving to the
|
||||
same column on the next line.
|
||||
|
||||
- the sequence 'CR x' for any x other than LF or NUL is
|
||||
illegal. (Note that this also means that a string may
|
||||
end with either 'CR LF' or 'CR NUL', but not with CR.)
|
||||
|
||||
Any object defined using this syntax may not exceed 255
|
||||
characters in length."
|
||||
SYNTAX OCTET STRING (SIZE (0..8))
|
||||
|
||||
DisplayString16 ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT
|
||||
"16a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A version of DisplayString that contains only 16 characters most."
|
||||
SYNTAX OCTET STRING (SIZE (0..16))
|
||||
|
||||
DisplayString32 ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT
|
||||
"32a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A version of DisplayString that contains only 32 characters most."
|
||||
SYNTAX OCTET STRING (SIZE (0..32))
|
||||
|
||||
DisplayString64 ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT
|
||||
"64a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A version of DisplayString that contains only 64 characters most."
|
||||
SYNTAX OCTET STRING (SIZE (0..64))
|
||||
|
||||
DisplayString ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT
|
||||
"255a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A version of DisplayString that contains only 255 characters most."
|
||||
SYNTAX OCTET STRING (SIZE (0..255))
|
||||
|
||||
RowStatus ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The RowStatus textual convention is used to manage the
|
||||
creation and deletion of conceptual rows, and is used as the
|
||||
value of the SYNTAX clause for the status column of a
|
||||
conceptual row (as described in Section 7.7.1 of [2].)
|
||||
|
||||
The status column has six defined values:
|
||||
|
||||
- `active', which indicates that the conceptual row is
|
||||
available for use by the managed device;
|
||||
|
||||
- `notInService', which indicates that the conceptual
|
||||
row exists in the agent, but is unavailable for use by
|
||||
the managed device (see NOTE below);
|
||||
|
||||
- `notReady', which indicates that the conceptual row
|
||||
exists in the agent, but is missing information
|
||||
necessary in order to be available for use by the
|
||||
managed device;
|
||||
|
||||
- `createAndGo', which is supplied by a management
|
||||
station wishing to create a new instance of a
|
||||
conceptual row and to have its status automatically set
|
||||
to active, making it available for use by the managed
|
||||
device;
|
||||
|
||||
- `createAndWait', which is supplied by a management
|
||||
station wishing to create a new instance of a
|
||||
conceptual row (but not make it available for use by
|
||||
the managed device); and,
|
||||
|
||||
- `destroy', which is supplied by a management station
|
||||
wishing to delete all of the instances associated with
|
||||
an existing conceptual row.
|
||||
|
||||
Whereas five of the six values (all except `notReady') may
|
||||
be specified in a management protocol set operation, only
|
||||
three values will be returned in response to a management
|
||||
protocol retrieval operation: `notReady', `notInService' or
|
||||
`active'. That is, when queried, an existing conceptual row
|
||||
has only three states: it is either available for use by
|
||||
the managed device (the status column has value `active');
|
||||
it is not available for use by the managed device, though
|
||||
the agent has sufficient information to make it so (the
|
||||
status column has value `notInService'); or, it is not
|
||||
available for use by the managed device, and an attempt to
|
||||
make it so would fail because the agent has insufficient
|
||||
information (the state column has value `notReady').
|
||||
|
||||
NOTE WELL
|
||||
|
||||
This textual convention may be used for a MIB table,
|
||||
irrespective of whether the values of that table's
|
||||
conceptual rows are able to be modified while it is
|
||||
active, or whether its conceptual rows must be taken
|
||||
out of service in order to be modified. That is, it is
|
||||
the responsibility of the DESCRIPTION clause of the
|
||||
status column to specify whether the status column must
|
||||
not be `active' in order for the value of some other
|
||||
column of the same conceptual row to be modified. If
|
||||
such a specification is made, affected columns may be
|
||||
changed by an SNMP set PDU if the RowStatus would not
|
||||
be equal to `active' either immediately before or after
|
||||
processing the PDU. In other words, if the PDU also
|
||||
contained a varbind that would change the RowStatus
|
||||
value, the column in question may be changed if the
|
||||
RowStatus was not equal to `active' as the PDU was
|
||||
received, or if the varbind sets the status to a value
|
||||
other than 'active'.
|
||||
|
||||
|
||||
Also note that whenever any elements of a row exist, the
|
||||
RowStatus column must also exist.
|
||||
|
||||
To summarize the effect of having a conceptual row with a
|
||||
status column having a SYNTAX clause value of RowStatus,
|
||||
consider the following state diagram:
|
||||
|
||||
|
||||
STATE
|
||||
+--------------+-----------+-------------+-------------
|
||||
| A | B | C | D
|
||||
| |status col.|status column|
|
||||
|status column | is | is |status column
|
||||
ACTION |does not exist| notReady | notInService| is active
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError ->D|inconsist- |inconsistent-|inconsistent-
|
||||
column to | or | entValue| Value| Value
|
||||
createAndGo |inconsistent- | | |
|
||||
| Value| | |
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError see 1|inconsist- |inconsistent-|inconsistent-
|
||||
column to | or | entValue| Value| Value
|
||||
createAndWait |wrongValue | | |
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |inconsistent- |inconsist- |noError |noError
|
||||
column to | Value| entValue| |
|
||||
active | | | |
|
||||
| | or | |
|
||||
| | | |
|
||||
| |see 2 ->D| ->D| ->D
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |inconsistent- |inconsist- |noError |noError ->C
|
||||
column to | Value| entValue| |
|
||||
notInService | | | |
|
||||
| | or | | or
|
||||
| | | |
|
||||
| |see 3 ->C| ->C|wrongValue
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError |noError |noError |noError
|
||||
column to | | | |
|
||||
destroy | ->A| ->A| ->A| ->A
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set any other |see 4 |noError |noError |see 5
|
||||
column to some| | | |
|
||||
value | | see 1| ->C| ->D
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
|
||||
(1) goto B or C, depending on information available to the
|
||||
agent.
|
||||
|
||||
(2) if other variable bindings included in the same PDU,
|
||||
provide values for all columns which are missing but
|
||||
required, then return noError and goto D.
|
||||
|
||||
(3) if other variable bindings included in the same PDU,
|
||||
provide values for all columns which are missing but
|
||||
required, then return noError and goto C.
|
||||
|
||||
(4) at the discretion of the agent, the return value may be
|
||||
either:
|
||||
|
||||
inconsistentName: because the agent does not choose to
|
||||
create such an instance when the corresponding
|
||||
RowStatus instance does not exist, or
|
||||
|
||||
inconsistentValue: if the supplied value is
|
||||
inconsistent with the state of some other MIB object's
|
||||
value, or
|
||||
|
||||
noError: because the agent chooses to create the
|
||||
instance.
|
||||
|
||||
If noError is returned, then the instance of the status
|
||||
column must also be created, and the new state is B or C,
|
||||
depending on the information available to the agent. If
|
||||
inconsistentName or inconsistentValue is returned, the row
|
||||
remains in state A.
|
||||
|
||||
(5) depending on the MIB definition for the column/table,
|
||||
either noError or inconsistentValue may be returned.
|
||||
|
||||
NOTE: Other processing of the set request may result in a
|
||||
response other than noError being returned, e.g.,
|
||||
wrongValue, noCreation, etc.
|
||||
|
||||
|
||||
Conceptual Row Creation
|
||||
|
||||
There are four potential interactions when creating a
|
||||
conceptual row: selecting an instance-identifier which is
|
||||
not in use; creating the conceptual row; initializing any
|
||||
objects for which the agent does not supply a default; and,
|
||||
making the conceptual row available for use by the managed
|
||||
device.
|
||||
|
||||
Interaction 1: Selecting an Instance-Identifier
|
||||
|
||||
The algorithm used to select an instance-identifier varies
|
||||
for each conceptual row. In some cases, the instance-
|
||||
identifier is semantically significant, e.g., the
|
||||
destination address of a route, and a management station
|
||||
selects the instance-identifier according to the semantics.
|
||||
|
||||
In other cases, the instance-identifier is used solely to
|
||||
distinguish conceptual rows, and a management station
|
||||
without specific knowledge of the conceptual row might
|
||||
examine the instances present in order to determine an
|
||||
unused instance-identifier. (This approach may be used, but
|
||||
it is often highly sub-optimal; however, it is also a
|
||||
questionable practice for a naive management station to
|
||||
attempt conceptual row creation.)
|
||||
|
||||
Alternately, the MIB module which defines the conceptual row
|
||||
might provide one or more objects which provide assistance
|
||||
in determining an unused instance-identifier. For example,
|
||||
if the conceptual row is indexed by an integer-value, then
|
||||
an object having an integer-valued SYNTAX clause might be
|
||||
defined for such a purpose, allowing a management station to
|
||||
issue a management protocol retrieval operation. In order
|
||||
to avoid unnecessary collisions between competing management
|
||||
stations, `adjacent' retrievals of this object should be
|
||||
different.
|
||||
|
||||
Finally, the management station could select a pseudo-random
|
||||
number to use as the index. In the event that this index
|
||||
was already in use and an inconsistentValue was returned in
|
||||
response to the management protocol set operation, the
|
||||
management station should simply select a new pseudo-random
|
||||
number and retry the operation.
|
||||
|
||||
A MIB designer should choose between the two latter
|
||||
algorithms based on the size of the table (and therefore the
|
||||
efficiency of each algorithm). For tables in which a large
|
||||
number of entries are expected, it is recommended that a MIB
|
||||
object be defined that returns an acceptable index for
|
||||
creation. For tables with small numbers of entries, it is
|
||||
recommended that the latter pseudo-random index mechanism be
|
||||
used.
|
||||
|
||||
|
||||
Interaction 2: Creating the Conceptual Row
|
||||
|
||||
Once an unused instance-identifier has been selected, the
|
||||
management station determines if it wishes to create and
|
||||
activate the conceptual row in one transaction or in a
|
||||
negotiated set of interactions.
|
||||
|
||||
Interaction 2a: Creating and Activating the Conceptual Row
|
||||
|
||||
The management station must first determine the column
|
||||
requirements, i.e., it must determine those columns for
|
||||
which it must or must not provide values. Depending on the
|
||||
complexity of the table and the management station's
|
||||
knowledge of the agent's capabilities, this determination
|
||||
can be made locally by the management station. Alternately,
|
||||
the management station issues a management protocol get
|
||||
operation to examine all columns in the conceptual row that
|
||||
it wishes to create. In response, for each column, there
|
||||
are three possible outcomes:
|
||||
|
||||
- a value is returned, indicating that some other
|
||||
management station has already created this conceptual
|
||||
row. We return to interaction 1.
|
||||
|
||||
- the exception `noSuchInstance' is returned,
|
||||
indicating that the agent implements the object-type
|
||||
associated with this column, and that this column in at
|
||||
least one conceptual row would be accessible in the MIB
|
||||
view used by the retrieval were it to exist. For those
|
||||
columns to which the agent provides read-create access,
|
||||
the `noSuchInstance' exception tells the management
|
||||
station that it should supply a value for this column
|
||||
when the conceptual row is to be created.
|
||||
|
||||
- the exception `noSuchObject' is returned, indicating
|
||||
that the agent does not implement the object-type
|
||||
associated with this column or that there is no
|
||||
conceptual row for which this column would be
|
||||
accessible in the MIB view used by the retrieval. As
|
||||
such, the management station can not issue any
|
||||
management protocol set operations to create an
|
||||
instance of this column.
|
||||
|
||||
Once the column requirements have been determined, a
|
||||
management protocol set operation is accordingly issued.
|
||||
This operation also sets the new instance of the status
|
||||
column to `createAndGo'.
|
||||
|
||||
When the agent processes the set operation, it verifies that
|
||||
it has sufficient information to make the conceptual row
|
||||
available for use by the managed device. The information
|
||||
available to the agent is provided by two sources: the
|
||||
management protocol set operation which creates the
|
||||
conceptual row, and, implementation-specific defaults
|
||||
supplied by the agent (note that an agent must provide
|
||||
implementation-specific defaults for at least those objects
|
||||
which it implements as read-only). If there is sufficient
|
||||
information available, then the conceptual row is created, a
|
||||
`noError' response is returned, the status column is set to
|
||||
`active', and no further interactions are necessary (i.e.,
|
||||
interactions 3 and 4 are skipped). If there is insufficient
|
||||
information, then the conceptual row is not created, and the
|
||||
set operation fails with an error of `inconsistentValue'.
|
||||
On this error, the management station can issue a management
|
||||
protocol retrieval operation to determine if this was
|
||||
because it failed to specify a value for a required column,
|
||||
or, because the selected instance of the status column
|
||||
already existed. In the latter case, we return to
|
||||
interaction 1. In the former case, the management station
|
||||
can re-issue the set operation with the additional
|
||||
information, or begin interaction 2 again using
|
||||
`createAndWait' in order to negotiate creation of the
|
||||
conceptual row.
|
||||
|
||||
NOTE WELL
|
||||
|
||||
Regardless of the method used to determine the column
|
||||
requirements, it is possible that the management
|
||||
station might deem a column necessary when, in fact,
|
||||
the agent will not allow that particular columnar
|
||||
instance to be created or written. In this case, the
|
||||
management protocol set operation will fail with an
|
||||
error such as `noCreation' or `notWritable'. In this
|
||||
case, the management station decides whether it needs
|
||||
to be able to set a value for that particular columnar
|
||||
instance. If not, the management station re-issues the
|
||||
management protocol set operation, but without setting
|
||||
a value for that particular columnar instance;
|
||||
otherwise, the management station aborts the row
|
||||
creation algorithm.
|
||||
|
||||
Interaction 2b: Negotiating the Creation of the Conceptual
|
||||
Row
|
||||
|
||||
The management station issues a management protocol set
|
||||
operation which sets the desired instance of the status
|
||||
column to `createAndWait'. If the agent is unwilling to
|
||||
process a request of this sort, the set operation fails with
|
||||
an error of `wrongValue'. (As a consequence, such an agent
|
||||
must be prepared to accept a single management protocol set
|
||||
operation, i.e., interaction 2a above, containing all of the
|
||||
columns indicated by its column requirements.) Otherwise,
|
||||
the conceptual row is created, a `noError' response is
|
||||
returned, and the status column is immediately set to either
|
||||
`notInService' or `notReady', depending on whether it has
|
||||
sufficient information to make the conceptual row available
|
||||
for use by the managed device. If there is sufficient
|
||||
information available, then the status column is set to
|
||||
`notInService'; otherwise, if there is insufficient
|
||||
information, then the status column is set to `notReady'.
|
||||
Regardless, we proceed to interaction 3.
|
||||
|
||||
Interaction 3: Initializing non-defaulted Objects
|
||||
|
||||
The management station must now determine the column
|
||||
requirements. It issues a management protocol get operation
|
||||
to examine all columns in the created conceptual row. In
|
||||
the response, for each column, there are three possible
|
||||
outcomes:
|
||||
|
||||
- a value is returned, indicating that the agent
|
||||
implements the object-type associated with this column
|
||||
and had sufficient information to provide a value. For
|
||||
those columns to which the agent provides read-create
|
||||
access (and for which the agent allows their values to
|
||||
be changed after their creation), a value return tells
|
||||
the management station that it may issue additional
|
||||
management protocol set operations, if it desires, in
|
||||
order to change the value associated with this column.
|
||||
|
||||
- the exception `noSuchInstance' is returned,
|
||||
indicating that the agent implements the object-type
|
||||
associated with this column, and that this column in at
|
||||
least one conceptual row would be accessible in the MIB
|
||||
view used by the retrieval were it to exist. However,
|
||||
the agent does not have sufficient information to
|
||||
provide a value, and until a value is provided, the
|
||||
conceptual row may not be made available for use by the
|
||||
managed device. For those columns to which the agent
|
||||
provides read-create access, the `noSuchInstance'
|
||||
exception tells the management station that it must
|
||||
issue additional management protocol set operations, in
|
||||
order to provide a value associated with this column.
|
||||
|
||||
- the exception `noSuchObject' is returned, indicating
|
||||
that the agent does not implement the object-type
|
||||
associated with this column or that there is no
|
||||
conceptual row for which this column would be
|
||||
accessible in the MIB view used by the retrieval. As
|
||||
such, the management station can not issue any
|
||||
management protocol set operations to create an
|
||||
instance of this column.
|
||||
|
||||
If the value associated with the status column is
|
||||
`notReady', then the management station must first deal with
|
||||
all `noSuchInstance' columns, if any. Having done so, the
|
||||
value of the status column becomes `notInService', and we
|
||||
proceed to interaction 4.
|
||||
|
||||
Interaction 4: Making the Conceptual Row Available
|
||||
|
||||
Once the management station is satisfied with the values
|
||||
associated with the columns of the conceptual row, it issues
|
||||
a management protocol set operation to set the status column
|
||||
to `active'. If the agent has sufficient information to
|
||||
make the conceptual row available for use by the managed
|
||||
device, the management protocol set operation succeeds (a
|
||||
`noError' response is returned). Otherwise, the management
|
||||
protocol set operation fails with an error of
|
||||
`inconsistentValue'.
|
||||
|
||||
|
||||
NOTE WELL
|
||||
|
||||
A conceptual row having a status column with value
|
||||
`notInService' or `notReady' is unavailable to the
|
||||
managed device. As such, it is possible for the
|
||||
managed device to create its own instances during the
|
||||
time between the management protocol set operation
|
||||
which sets the status column to `createAndWait' and the
|
||||
management protocol set operation which sets the status
|
||||
column to `active'. In this case, when the management
|
||||
protocol set operation is issued to set the status
|
||||
column to `active', the values held in the agent
|
||||
supersede those used by the managed device.
|
||||
|
||||
If the management station is prevented from setting the
|
||||
status column to `active' (e.g., due to management station
|
||||
or network failure) the conceptual row will be left in the
|
||||
`notInService' or `notReady' state, consuming resources
|
||||
indefinitely. The agent must detect conceptual rows that
|
||||
have been in either state for an abnormally long period of
|
||||
time and remove them. It is the responsibility of the
|
||||
DESCRIPTION clause of the status column to indicate what an
|
||||
abnormally long period of time would be. This period of
|
||||
time should be long enough to allow for human response time
|
||||
(including `think time') between the creation of the
|
||||
conceptual row and the setting of the status to `active'.
|
||||
In the absense of such information in the DESCRIPTION
|
||||
clause, it is suggested that this period be approximately 5
|
||||
minutes in length. This removal action applies not only to
|
||||
newly-created rows, but also to previously active rows which
|
||||
are set to, and left in, the notInService state for a
|
||||
prolonged period exceeding that which is considered normal
|
||||
for such a conceptual row.
|
||||
|
||||
|
||||
Conceptual Row Suspension
|
||||
|
||||
When a conceptual row is `active', the management station
|
||||
may issue a management protocol set operation which sets the
|
||||
instance of the status column to `notInService'. If the
|
||||
agent is unwilling to do so, the set operation fails with an
|
||||
error of `wrongValue'. Otherwise, the conceptual row is
|
||||
taken out of service, and a `noError' response is returned.
|
||||
It is the responsibility of the DESCRIPTION clause of the
|
||||
status column to indicate under what circumstances the
|
||||
status column should be taken out of service (e.g., in order
|
||||
for the value of some other column of the same conceptual
|
||||
row to be modified).
|
||||
|
||||
|
||||
Conceptual Row Deletion
|
||||
|
||||
For deletion of conceptual rows, a management protocol set
|
||||
operation is issued which sets the instance of the status
|
||||
column to `destroy'. This request may be made regardless of
|
||||
the current value of the status column (e.g., it is possible
|
||||
to delete conceptual rows which are either `notReady',
|
||||
`notInService' or `active'.) If the operation succeeds,
|
||||
then all instances associated with the conceptual row are
|
||||
immediately removed."
|
||||
SYNTAX INTEGER
|
||||
{
|
||||
active(1),
|
||||
notInService(2),
|
||||
notReady(3),
|
||||
createAndGo(4),
|
||||
createAndWait(5),
|
||||
destroy(6)
|
||||
}
|
||||
|
||||
-- the following two values are states:
|
||||
-- these values may be read or written
|
||||
-- the following value is a state:
|
||||
-- this value may be read, but not written
|
||||
-- the following three values are
|
||||
-- actions: these values may be written,
|
||||
-- but are never read
|
||||
TimeStamp ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of the sysUpTime object at which a specific
|
||||
occurrence happened. The specific occurrence must be
|
||||
defined in the description of any object defined using this
|
||||
type."
|
||||
SYNTAX TimeTicks
|
||||
|
||||
|
||||
--
|
||||
-- Node definitions
|
||||
--
|
||||
|
||||
-- 1.3.6.1.4.1.1373
|
||||
lgcNS OBJECT IDENTIFIER ::= { enterprises 1373 }
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
||||
--
|
||||
-- LGC-MIB-070927.my
|
||||
--
|
||||
4191
src/configMgr/c_program/paraComm/mib/LGC-SS-MSC-MIB.my
Normal file
4191
src/configMgr/c_program/paraComm/mib/LGC-SS-MSC-MIB.my
Normal file
File diff suppressed because it is too large
Load Diff
4356
src/configMgr/c_program/paraComm/mib/LGC-SS-MSC-MIB_070824.my
Normal file
4356
src/configMgr/c_program/paraComm/mib/LGC-SS-MSC-MIB_070824.my
Normal file
File diff suppressed because it is too large
Load Diff
344
src/configMgr/c_program/paraComm/mib/SNMPv2-SMI
Normal file
344
src/configMgr/c_program/paraComm/mib/SNMPv2-SMI
Normal file
@@ -0,0 +1,344 @@
|
||||
SNMPv2-SMI DEFINITIONS ::= BEGIN
|
||||
|
||||
-- the path to the root
|
||||
|
||||
org OBJECT IDENTIFIER ::= { iso 3 } -- "iso" = 1
|
||||
dod OBJECT IDENTIFIER ::= { org 6 }
|
||||
internet OBJECT IDENTIFIER ::= { dod 1 }
|
||||
|
||||
directory OBJECT IDENTIFIER ::= { internet 1 }
|
||||
|
||||
mgmt OBJECT IDENTIFIER ::= { internet 2 }
|
||||
mib-2 OBJECT IDENTIFIER ::= { mgmt 1 }
|
||||
transmission OBJECT IDENTIFIER ::= { mib-2 10 }
|
||||
|
||||
experimental OBJECT IDENTIFIER ::= { internet 3 }
|
||||
|
||||
private OBJECT IDENTIFIER ::= { internet 4 }
|
||||
enterprises OBJECT IDENTIFIER ::= { private 1 }
|
||||
|
||||
security OBJECT IDENTIFIER ::= { internet 5 }
|
||||
|
||||
snmpV2 OBJECT IDENTIFIER ::= { internet 6 }
|
||||
|
||||
-- transport domains
|
||||
snmpDomains OBJECT IDENTIFIER ::= { snmpV2 1 }
|
||||
|
||||
-- transport proxies
|
||||
snmpProxys OBJECT IDENTIFIER ::= { snmpV2 2 }
|
||||
|
||||
-- module identities
|
||||
snmpModules OBJECT IDENTIFIER ::= { snmpV2 3 }
|
||||
|
||||
-- Extended UTCTime, to allow dates with four-digit years
|
||||
-- (Note that this definition of ExtUTCTime is not to be IMPORTed
|
||||
-- by MIB modules.)
|
||||
ExtUTCTime ::= OCTET STRING(SIZE(11 | 13))
|
||||
-- format is YYMMDDHHMMZ or YYYYMMDDHHMMZ
|
||||
|
||||
-- where: YY - last two digits of year (only years
|
||||
-- between 1900-1999)
|
||||
-- YYYY - last four digits of the year (any year)
|
||||
-- MM - month (01 through 12)
|
||||
-- DD - day of month (01 through 31)
|
||||
-- HH - hours (00 through 23)
|
||||
-- MM - minutes (00 through 59)
|
||||
-- Z - denotes GMT (the ASCII character Z)
|
||||
--
|
||||
-- For example, "9502192015Z" and "199502192015Z" represent
|
||||
-- 8:15pm GMT on 19 February 1995. Years after 1999 must use
|
||||
-- the four digit year format. Years 1900-1999 may use the
|
||||
-- two or four digit format.
|
||||
|
||||
-- definitions for information modules
|
||||
|
||||
MODULE-IDENTITY MACRO ::=
|
||||
BEGIN
|
||||
TYPE NOTATION ::=
|
||||
"LAST-UPDATED" value(Update ExtUTCTime)
|
||||
"ORGANIZATION" Text
|
||||
"CONTACT-INFO" Text
|
||||
"DESCRIPTION" Text
|
||||
RevisionPart
|
||||
|
||||
VALUE NOTATION ::=
|
||||
value(VALUE OBJECT IDENTIFIER)
|
||||
|
||||
RevisionPart ::=
|
||||
Revisions
|
||||
| empty
|
||||
Revisions ::=
|
||||
Revision
|
||||
| Revisions Revision
|
||||
Revision ::=
|
||||
"REVISION" value(Update ExtUTCTime)
|
||||
"DESCRIPTION" Text
|
||||
|
||||
-- a character string as defined in section 3.1.1
|
||||
Text ::= value(IA5String)
|
||||
END
|
||||
|
||||
OBJECT-IDENTITY MACRO ::=
|
||||
BEGIN
|
||||
TYPE NOTATION ::=
|
||||
"STATUS" Status
|
||||
"DESCRIPTION" Text
|
||||
|
||||
ReferPart
|
||||
|
||||
VALUE NOTATION ::=
|
||||
value(VALUE OBJECT IDENTIFIER)
|
||||
|
||||
Status ::=
|
||||
"current"
|
||||
| "deprecated"
|
||||
| "obsolete"
|
||||
|
||||
ReferPart ::=
|
||||
"REFERENCE" Text
|
||||
| empty
|
||||
|
||||
-- a character string as defined in section 3.1.1
|
||||
Text ::= value(IA5String)
|
||||
END
|
||||
|
||||
-- names of objects
|
||||
-- (Note that these definitions of ObjectName and NotificationName
|
||||
-- are not to be IMPORTed by MIB modules.)
|
||||
|
||||
ObjectName ::=
|
||||
OBJECT IDENTIFIER
|
||||
|
||||
NotificationName ::=
|
||||
OBJECT IDENTIFIER
|
||||
|
||||
-- syntax of objects
|
||||
|
||||
-- the "base types" defined here are:
|
||||
-- 3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER
|
||||
-- 8 application-defined types: Integer32, IpAddress, Counter32,
|
||||
-- Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64
|
||||
|
||||
ObjectSyntax ::=
|
||||
CHOICE {
|
||||
simple
|
||||
SimpleSyntax,
|
||||
-- note that SEQUENCEs for conceptual tables and
|
||||
-- rows are not mentioned here...
|
||||
|
||||
application-wide
|
||||
ApplicationSyntax
|
||||
}
|
||||
|
||||
-- built-in ASN.1 types
|
||||
|
||||
SimpleSyntax ::=
|
||||
CHOICE {
|
||||
-- INTEGERs with a more restrictive range
|
||||
-- may also be used
|
||||
integer-value -- includes Integer32
|
||||
INTEGER (-2147483648..2147483647),
|
||||
-- OCTET STRINGs with a more restrictive size
|
||||
-- may also be used
|
||||
string-value
|
||||
OCTET STRING (SIZE (0..65535)),
|
||||
objectID-value
|
||||
OBJECT IDENTIFIER
|
||||
}
|
||||
|
||||
-- indistinguishable from INTEGER, but never needs more than
|
||||
-- 32-bits for a two's complement representation
|
||||
Integer32 ::=
|
||||
INTEGER (-2147483648..2147483647)
|
||||
|
||||
-- application-wide types
|
||||
|
||||
ApplicationSyntax ::=
|
||||
CHOICE {
|
||||
ipAddress-value
|
||||
IpAddress,
|
||||
counter-value
|
||||
Counter32,
|
||||
timeticks-value
|
||||
TimeTicks,
|
||||
arbitrary-value
|
||||
Opaque,
|
||||
big-counter-value
|
||||
Counter64,
|
||||
unsigned-integer-value -- includes Gauge32
|
||||
Unsigned32
|
||||
}
|
||||
|
||||
-- in network-byte order
|
||||
|
||||
-- (this is a tagged type for historical reasons)
|
||||
IpAddress ::=
|
||||
[APPLICATION 0]
|
||||
IMPLICIT OCTET STRING (SIZE (4))
|
||||
|
||||
-- this wraps
|
||||
Counter32 ::=
|
||||
[APPLICATION 1]
|
||||
IMPLICIT INTEGER (0..4294967295)
|
||||
|
||||
-- this doesn't wrap
|
||||
Gauge32 ::=
|
||||
[APPLICATION 2]
|
||||
IMPLICIT INTEGER (0..4294967295)
|
||||
|
||||
-- an unsigned 32-bit quantity
|
||||
-- indistinguishable from Gauge32
|
||||
Unsigned32 ::=
|
||||
[APPLICATION 2]
|
||||
IMPLICIT INTEGER (0..4294967295)
|
||||
|
||||
-- hundredths of seconds since an epoch
|
||||
TimeTicks ::=
|
||||
[APPLICATION 3]
|
||||
IMPLICIT INTEGER (0..4294967295)
|
||||
|
||||
-- for backward-compatibility only
|
||||
Opaque ::=
|
||||
[APPLICATION 4]
|
||||
IMPLICIT OCTET STRING
|
||||
|
||||
-- for counters that wrap in less than one hour with only 32 bits
|
||||
Counter64 ::=
|
||||
[APPLICATION 6]
|
||||
IMPLICIT INTEGER (0..18446744073709551615)
|
||||
|
||||
-- definition for objects
|
||||
|
||||
OBJECT-TYPE MACRO ::=
|
||||
BEGIN
|
||||
TYPE NOTATION ::=
|
||||
"SYNTAX" Syntax
|
||||
UnitsPart
|
||||
"MAX-ACCESS" Access
|
||||
"STATUS" Status
|
||||
"DESCRIPTION" Text
|
||||
ReferPart
|
||||
|
||||
IndexPart
|
||||
DefValPart
|
||||
|
||||
VALUE NOTATION ::=
|
||||
value(VALUE ObjectName)
|
||||
|
||||
Syntax ::= -- Must be one of the following:
|
||||
-- a base type (or its refinement),
|
||||
-- a textual convention (or its refinement), or
|
||||
-- a BITS pseudo-type
|
||||
type
|
||||
| "BITS" "{" NamedBits "}"
|
||||
|
||||
NamedBits ::= NamedBit
|
||||
| NamedBits "," NamedBit
|
||||
|
||||
NamedBit ::= identifier "(" number ")" -- number is nonnegative
|
||||
|
||||
UnitsPart ::=
|
||||
"UNITS" Text
|
||||
| empty
|
||||
|
||||
Access ::=
|
||||
"not-accessible"
|
||||
| "accessible-for-notify"
|
||||
| "read-only"
|
||||
| "read-write"
|
||||
| "read-create"
|
||||
|
||||
Status ::=
|
||||
"current"
|
||||
| "deprecated"
|
||||
| "obsolete"
|
||||
|
||||
ReferPart ::=
|
||||
"REFERENCE" Text
|
||||
| empty
|
||||
|
||||
IndexPart ::=
|
||||
"INDEX" "{" IndexTypes "}"
|
||||
| "AUGMENTS" "{" Entry "}"
|
||||
| empty
|
||||
IndexTypes ::=
|
||||
IndexType
|
||||
| IndexTypes "," IndexType
|
||||
IndexType ::=
|
||||
"IMPLIED" Index
|
||||
| Index
|
||||
|
||||
Index ::=
|
||||
-- use the SYNTAX value of the
|
||||
-- correspondent OBJECT-TYPE invocation
|
||||
value(ObjectName)
|
||||
Entry ::=
|
||||
-- use the INDEX value of the
|
||||
-- correspondent OBJECT-TYPE invocation
|
||||
value(ObjectName)
|
||||
|
||||
DefValPart ::= "DEFVAL" "{" Defvalue "}"
|
||||
| empty
|
||||
|
||||
Defvalue ::= -- must be valid for the type specified in
|
||||
-- SYNTAX clause of same OBJECT-TYPE macro
|
||||
value(ObjectSyntax)
|
||||
| "{" BitsValue "}"
|
||||
|
||||
BitsValue ::= BitNames
|
||||
| empty
|
||||
|
||||
BitNames ::= BitName
|
||||
| BitNames "," BitName
|
||||
|
||||
BitName ::= identifier
|
||||
|
||||
-- a character string as defined in section 3.1.1
|
||||
Text ::= value(IA5String)
|
||||
END
|
||||
|
||||
-- definitions for notifications
|
||||
|
||||
NOTIFICATION-TYPE MACRO ::=
|
||||
BEGIN
|
||||
TYPE NOTATION ::=
|
||||
ObjectsPart
|
||||
"STATUS" Status
|
||||
"DESCRIPTION" Text
|
||||
ReferPart
|
||||
|
||||
VALUE NOTATION ::=
|
||||
value(VALUE NotificationName)
|
||||
|
||||
ObjectsPart ::=
|
||||
"OBJECTS" "{" Objects "}"
|
||||
| empty
|
||||
Objects ::=
|
||||
Object
|
||||
|
||||
| Objects "," Object
|
||||
Object ::=
|
||||
value(ObjectName)
|
||||
|
||||
Status ::=
|
||||
"current"
|
||||
| "deprecated"
|
||||
| "obsolete"
|
||||
|
||||
ReferPart ::=
|
||||
"REFERENCE" Text
|
||||
| empty
|
||||
|
||||
-- a character string as defined in section 3.1.1
|
||||
Text ::= value(IA5String)
|
||||
END
|
||||
|
||||
-- definitions of administrative identifiers
|
||||
|
||||
zeroDotZero OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A value used for null identifiers."
|
||||
::= { 0 0 }
|
||||
|
||||
END
|
||||
772
src/configMgr/c_program/paraComm/mib/SNMPv2-TC
Normal file
772
src/configMgr/c_program/paraComm/mib/SNMPv2-TC
Normal file
@@ -0,0 +1,772 @@
|
||||
SNMPv2-TC DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
TimeTicks FROM SNMPv2-SMI;
|
||||
|
||||
-- definition of textual conventions
|
||||
|
||||
TEXTUAL-CONVENTION MACRO ::=
|
||||
|
||||
BEGIN
|
||||
TYPE NOTATION ::=
|
||||
DisplayPart
|
||||
"STATUS" Status
|
||||
"DESCRIPTION" Text
|
||||
ReferPart
|
||||
"SYNTAX" Syntax
|
||||
|
||||
VALUE NOTATION ::=
|
||||
value(VALUE Syntax) -- adapted ASN.1
|
||||
|
||||
DisplayPart ::=
|
||||
"DISPLAY-HINT" Text
|
||||
| empty
|
||||
|
||||
Status ::=
|
||||
"current"
|
||||
| "deprecated"
|
||||
| "obsolete"
|
||||
|
||||
ReferPart ::=
|
||||
"REFERENCE" Text
|
||||
| empty
|
||||
|
||||
-- a character string as defined in [2]
|
||||
Text ::= value(IA5String)
|
||||
|
||||
Syntax ::= -- Must be one of the following:
|
||||
-- a base type (or its refinement), or
|
||||
-- a BITS pseudo-type
|
||||
type
|
||||
| "BITS" "{" NamedBits "}"
|
||||
|
||||
NamedBits ::= NamedBit
|
||||
| NamedBits "," NamedBit
|
||||
|
||||
NamedBit ::= identifier "(" number ")" -- number is nonnegative
|
||||
|
||||
END
|
||||
|
||||
DisplayString ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "255a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents textual information taken from the NVT ASCII
|
||||
|
||||
character set, as defined in pages 4, 10-11 of RFC 854.
|
||||
|
||||
To summarize RFC 854, the NVT ASCII repertoire specifies:
|
||||
|
||||
- the use of character codes 0-127 (decimal)
|
||||
|
||||
- the graphics characters (32-126) are interpreted as
|
||||
US ASCII
|
||||
|
||||
- NUL, LF, CR, BEL, BS, HT, VT and FF have the special
|
||||
meanings specified in RFC 854
|
||||
|
||||
- the other 25 codes have no standard interpretation
|
||||
|
||||
- the sequence 'CR LF' means newline
|
||||
|
||||
- the sequence 'CR NUL' means carriage-return
|
||||
|
||||
- an 'LF' not preceded by a 'CR' means moving to the
|
||||
same column on the next line.
|
||||
|
||||
- the sequence 'CR x' for any x other than LF or NUL is
|
||||
illegal. (Note that this also means that a string may
|
||||
end with either 'CR LF' or 'CR NUL', but not with CR.)
|
||||
|
||||
Any object defined using this syntax may not exceed 255
|
||||
characters in length."
|
||||
SYNTAX OCTET STRING (SIZE (0..255))
|
||||
|
||||
PhysAddress ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "1x:"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents media- or physical-level addresses."
|
||||
SYNTAX OCTET STRING
|
||||
|
||||
MacAddress ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "1x:"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents an 802 MAC address represented in the
|
||||
`canonical' order defined by IEEE 802.1a, i.e., as if it
|
||||
were transmitted least significant bit first, even though
|
||||
802.5 (in contrast to other 802.x protocols) requires MAC
|
||||
addresses to be transmitted most significant bit first."
|
||||
SYNTAX OCTET STRING (SIZE (6))
|
||||
|
||||
TruthValue ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents a boolean value."
|
||||
SYNTAX INTEGER { true(1), false(2) }
|
||||
|
||||
TestAndIncr ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents integer-valued information used for atomic
|
||||
operations. When the management protocol is used to specify
|
||||
that an object instance having this syntax is to be
|
||||
modified, the new value supplied via the management protocol
|
||||
must precisely match the value presently held by the
|
||||
instance. If not, the management protocol set operation
|
||||
fails with an error of `inconsistentValue'. Otherwise, if
|
||||
the current value is the maximum value of 2^31-1 (2147483647
|
||||
decimal), then the value held by the instance is wrapped to
|
||||
zero; otherwise, the value held by the instance is
|
||||
incremented by one. (Note that regardless of whether the
|
||||
management protocol set operation succeeds, the variable-
|
||||
binding in the request and response PDUs are identical.)
|
||||
|
||||
The value of the ACCESS clause for objects having this
|
||||
syntax is either `read-write' or `read-create'. When an
|
||||
instance of a columnar object having this syntax is created,
|
||||
any value may be supplied via the management protocol.
|
||||
|
||||
When the network management portion of the system is re-
|
||||
initialized, the value of every object instance having this
|
||||
syntax must either be incremented from its value prior to
|
||||
the re-initialization, or (if the value prior to the re-
|
||||
initialization is unknown) be set to a pseudo-randomly
|
||||
generated value."
|
||||
SYNTAX INTEGER (0..2147483647)
|
||||
|
||||
AutonomousType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents an independently extensible type identification
|
||||
value. It may, for example, indicate a particular sub-tree
|
||||
with further MIB definitions, or define a particular type of
|
||||
protocol or hardware."
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
|
||||
InstancePointer ::= TEXTUAL-CONVENTION
|
||||
STATUS obsolete
|
||||
DESCRIPTION
|
||||
"A pointer to either a specific instance of a MIB object or
|
||||
a conceptual row of a MIB table in the managed device. In
|
||||
the latter case, by convention, it is the name of the
|
||||
particular instance of the first accessible columnar object
|
||||
in the conceptual row.
|
||||
|
||||
The two uses of this textual convention are replaced by
|
||||
VariablePointer and RowPointer, respectively."
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
|
||||
VariablePointer ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A pointer to a specific object instance. For example,
|
||||
sysContact.0 or ifInOctets.3."
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
|
||||
RowPointer ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Represents a pointer to a conceptual row. The value is the
|
||||
name of the instance of the first accessible columnar object
|
||||
in the conceptual row.
|
||||
|
||||
For example, ifIndex.3 would point to the 3rd row in the
|
||||
ifTable (note that if ifIndex were not-accessible, then
|
||||
ifDescr.3 would be used instead)."
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
|
||||
RowStatus ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The RowStatus textual convention is used to manage the
|
||||
creation and deletion of conceptual rows, and is used as the
|
||||
value of the SYNTAX clause for the status column of a
|
||||
conceptual row (as described in Section 7.7.1 of [2].)
|
||||
|
||||
The status column has six defined values:
|
||||
|
||||
- `active', which indicates that the conceptual row is
|
||||
available for use by the managed device;
|
||||
|
||||
- `notInService', which indicates that the conceptual
|
||||
row exists in the agent, but is unavailable for use by
|
||||
the managed device (see NOTE below); 'notInService' has
|
||||
no implication regarding the internal consistency of
|
||||
the row, availability of resources, or consistency with
|
||||
the current state of the managed device;
|
||||
|
||||
- `notReady', which indicates that the conceptual row
|
||||
exists in the agent, but is missing information
|
||||
necessary in order to be available for use by the
|
||||
managed device (i.e., one or more required columns in
|
||||
the conceptual row have not been instanciated);
|
||||
|
||||
- `createAndGo', which is supplied by a management
|
||||
station wishing to create a new instance of a
|
||||
conceptual row and to have its status automatically set
|
||||
to active, making it available for use by the managed
|
||||
device;
|
||||
|
||||
- `createAndWait', which is supplied by a management
|
||||
station wishing to create a new instance of a
|
||||
conceptual row (but not make it available for use by
|
||||
the managed device); and,
|
||||
- `destroy', which is supplied by a management station
|
||||
wishing to delete all of the instances associated with
|
||||
an existing conceptual row.
|
||||
|
||||
Whereas five of the six values (all except `notReady') may
|
||||
be specified in a management protocol set operation, only
|
||||
three values will be returned in response to a management
|
||||
protocol retrieval operation: `notReady', `notInService' or
|
||||
`active'. That is, when queried, an existing conceptual row
|
||||
has only three states: it is either available for use by
|
||||
the managed device (the status column has value `active');
|
||||
it is not available for use by the managed device, though
|
||||
the agent has sufficient information to attempt to make it
|
||||
so (the status column has value `notInService'); or, it is
|
||||
not available for use by the managed device, and an attempt
|
||||
to make it so would fail because the agent has insufficient
|
||||
information (the state column has value `notReady').
|
||||
|
||||
NOTE WELL
|
||||
|
||||
This textual convention may be used for a MIB table,
|
||||
irrespective of whether the values of that table's
|
||||
conceptual rows are able to be modified while it is
|
||||
active, or whether its conceptual rows must be taken
|
||||
out of service in order to be modified. That is, it is
|
||||
the responsibility of the DESCRIPTION clause of the
|
||||
status column to specify whether the status column must
|
||||
not be `active' in order for the value of some other
|
||||
column of the same conceptual row to be modified. If
|
||||
such a specification is made, affected columns may be
|
||||
changed by an SNMP set PDU if the RowStatus would not
|
||||
be equal to `active' either immediately before or after
|
||||
processing the PDU. In other words, if the PDU also
|
||||
contained a varbind that would change the RowStatus
|
||||
value, the column in question may be changed if the
|
||||
RowStatus was not equal to `active' as the PDU was
|
||||
received, or if the varbind sets the status to a value
|
||||
other than 'active'.
|
||||
|
||||
Also note that whenever any elements of a row exist, the
|
||||
RowStatus column must also exist.
|
||||
|
||||
To summarize the effect of having a conceptual row with a
|
||||
status column having a SYNTAX clause value of RowStatus,
|
||||
consider the following state diagram:
|
||||
|
||||
STATE
|
||||
+--------------+-----------+-------------+-------------
|
||||
| A | B | C | D
|
||||
| |status col.|status column|
|
||||
|status column | is | is |status column
|
||||
ACTION |does not exist| notReady | notInService| is active
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError ->D|inconsist- |inconsistent-|inconsistent-
|
||||
column to | or | entValue| Value| Value
|
||||
createAndGo |inconsistent- | | |
|
||||
| Value| | |
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError see 1|inconsist- |inconsistent-|inconsistent-
|
||||
column to | or | entValue| Value| Value
|
||||
createAndWait |wrongValue | | |
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |inconsistent- |inconsist- |noError |noError
|
||||
column to | Value| entValue| |
|
||||
active | | | |
|
||||
| | or | |
|
||||
| | | |
|
||||
| |see 2 ->D|see 8 ->D| ->D
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |inconsistent- |inconsist- |noError |noError ->C
|
||||
column to | Value| entValue| |
|
||||
notInService | | | |
|
||||
| | or | | or
|
||||
| | | |
|
||||
| |see 3 ->C| ->C|see 6
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set status |noError |noError |noError |noError ->A
|
||||
column to | | | | or
|
||||
destroy | ->A| ->A| ->A|see 7
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
set any other |see 4 |noError |noError |see 5
|
||||
column to some| | | |
|
||||
value | | see 1| ->C| ->D
|
||||
--------------+--------------+-----------+-------------+-------------
|
||||
|
||||
(1) goto B or C, depending on information available to the
|
||||
agent.
|
||||
|
||||
(2) if other variable bindings included in the same PDU,
|
||||
provide values for all columns which are missing but
|
||||
required, and all columns have acceptable values, then
|
||||
return noError and goto D.
|
||||
|
||||
(3) if other variable bindings included in the same PDU,
|
||||
provide legal values for all columns which are missing but
|
||||
required, then return noError and goto C.
|
||||
|
||||
(4) at the discretion of the agent, the return value may be
|
||||
either:
|
||||
|
||||
inconsistentName: because the agent does not choose to
|
||||
create such an instance when the corresponding
|
||||
RowStatus instance does not exist, or
|
||||
|
||||
inconsistentValue: if the supplied value is
|
||||
inconsistent with the state of some other MIB object's
|
||||
value, or
|
||||
|
||||
noError: because the agent chooses to create the
|
||||
instance.
|
||||
|
||||
If noError is returned, then the instance of the status
|
||||
column must also be created, and the new state is B or C,
|
||||
depending on the information available to the agent. If
|
||||
inconsistentName or inconsistentValue is returned, the row
|
||||
remains in state A.
|
||||
|
||||
(5) depending on the MIB definition for the column/table,
|
||||
either noError or inconsistentValue may be returned.
|
||||
|
||||
(6) the return value can indicate one of the following
|
||||
errors:
|
||||
|
||||
wrongValue: because the agent does not support
|
||||
notInService (e.g., an agent which does not support
|
||||
createAndWait), or
|
||||
|
||||
inconsistentValue: because the agent is unable to take
|
||||
the row out of service at this time, perhaps because it
|
||||
is in use and cannot be de-activated.
|
||||
|
||||
(7) the return value can indicate the following error:
|
||||
|
||||
inconsistentValue: because the agent is unable to
|
||||
remove the row at this time, perhaps because it is in
|
||||
use and cannot be de-activated.
|
||||
|
||||
(8) the transition to D can fail, e.g., if the values of the
|
||||
conceptual row are inconsistent, then the error code would
|
||||
be inconsistentValue.
|
||||
|
||||
NOTE: Other processing of (this and other varbinds of) the
|
||||
set request may result in a response other than noError
|
||||
being returned, e.g., wrongValue, noCreation, etc.
|
||||
|
||||
Conceptual Row Creation
|
||||
|
||||
There are four potential interactions when creating a
|
||||
conceptual row: selecting an instance-identifier which is
|
||||
not in use; creating the conceptual row; initializing any
|
||||
objects for which the agent does not supply a default; and,
|
||||
making the conceptual row available for use by the managed
|
||||
device.
|
||||
|
||||
Interaction 1: Selecting an Instance-Identifier
|
||||
|
||||
The algorithm used to select an instance-identifier varies
|
||||
for each conceptual row. In some cases, the instance-
|
||||
identifier is semantically significant, e.g., the
|
||||
destination address of a route, and a management station
|
||||
selects the instance-identifier according to the semantics.
|
||||
|
||||
In other cases, the instance-identifier is used solely to
|
||||
distinguish conceptual rows, and a management station
|
||||
without specific knowledge of the conceptual row might
|
||||
examine the instances present in order to determine an
|
||||
unused instance-identifier. (This approach may be used, but
|
||||
it is often highly sub-optimal; however, it is also a
|
||||
questionable practice for a naive management station to
|
||||
attempt conceptual row creation.)
|
||||
|
||||
Alternately, the MIB module which defines the conceptual row
|
||||
might provide one or more objects which provide assistance
|
||||
in determining an unused instance-identifier. For example,
|
||||
if the conceptual row is indexed by an integer-value, then
|
||||
an object having an integer-valued SYNTAX clause might be
|
||||
defined for such a purpose, allowing a management station to
|
||||
issue a management protocol retrieval operation. In order
|
||||
to avoid unnecessary collisions between competing management
|
||||
stations, `adjacent' retrievals of this object should be
|
||||
different.
|
||||
|
||||
Finally, the management station could select a pseudo-random
|
||||
number to use as the index. In the event that this index
|
||||
|
||||
was already in use and an inconsistentValue was returned in
|
||||
response to the management protocol set operation, the
|
||||
management station should simply select a new pseudo-random
|
||||
number and retry the operation.
|
||||
|
||||
A MIB designer should choose between the two latter
|
||||
algorithms based on the size of the table (and therefore the
|
||||
efficiency of each algorithm). For tables in which a large
|
||||
number of entries are expected, it is recommended that a MIB
|
||||
object be defined that returns an acceptable index for
|
||||
creation. For tables with small numbers of entries, it is
|
||||
recommended that the latter pseudo-random index mechanism be
|
||||
used.
|
||||
|
||||
Interaction 2: Creating the Conceptual Row
|
||||
|
||||
Once an unused instance-identifier has been selected, the
|
||||
management station determines if it wishes to create and
|
||||
activate the conceptual row in one transaction or in a
|
||||
negotiated set of interactions.
|
||||
|
||||
Interaction 2a: Creating and Activating the Conceptual Row
|
||||
|
||||
The management station must first determine the column
|
||||
requirements, i.e., it must determine those columns for
|
||||
which it must or must not provide values. Depending on the
|
||||
complexity of the table and the management station's
|
||||
knowledge of the agent's capabilities, this determination
|
||||
can be made locally by the management station. Alternately,
|
||||
the management station issues a management protocol get
|
||||
operation to examine all columns in the conceptual row that
|
||||
it wishes to create. In response, for each column, there
|
||||
are three possible outcomes:
|
||||
|
||||
- a value is returned, indicating that some other
|
||||
management station has already created this conceptual
|
||||
row. We return to interaction 1.
|
||||
|
||||
- the exception `noSuchInstance' is returned,
|
||||
indicating that the agent implements the object-type
|
||||
associated with this column, and that this column in at
|
||||
least one conceptual row would be accessible in the MIB
|
||||
view used by the retrieval were it to exist. For those
|
||||
columns to which the agent provides read-create access,
|
||||
the `noSuchInstance' exception tells the management
|
||||
station that it should supply a value for this column
|
||||
when the conceptual row is to be created.
|
||||
|
||||
- the exception `noSuchObject' is returned, indicating
|
||||
that the agent does not implement the object-type
|
||||
associated with this column or that there is no
|
||||
conceptual row for which this column would be
|
||||
accessible in the MIB view used by the retrieval. As
|
||||
such, the management station can not issue any
|
||||
management protocol set operations to create an
|
||||
instance of this column.
|
||||
|
||||
Once the column requirements have been determined, a
|
||||
management protocol set operation is accordingly issued.
|
||||
This operation also sets the new instance of the status
|
||||
column to `createAndGo'.
|
||||
|
||||
When the agent processes the set operation, it verifies that
|
||||
it has sufficient information to make the conceptual row
|
||||
available for use by the managed device. The information
|
||||
available to the agent is provided by two sources: the
|
||||
management protocol set operation which creates the
|
||||
conceptual row, and, implementation-specific defaults
|
||||
supplied by the agent (note that an agent must provide
|
||||
implementation-specific defaults for at least those objects
|
||||
which it implements as read-only). If there is sufficient
|
||||
information available, then the conceptual row is created, a
|
||||
`noError' response is returned, the status column is set to
|
||||
`active', and no further interactions are necessary (i.e.,
|
||||
interactions 3 and 4 are skipped). If there is insufficient
|
||||
information, then the conceptual row is not created, and the
|
||||
set operation fails with an error of `inconsistentValue'.
|
||||
On this error, the management station can issue a management
|
||||
protocol retrieval operation to determine if this was
|
||||
because it failed to specify a value for a required column,
|
||||
or, because the selected instance of the status column
|
||||
already existed. In the latter case, we return to
|
||||
interaction 1. In the former case, the management station
|
||||
can re-issue the set operation with the additional
|
||||
information, or begin interaction 2 again using
|
||||
`createAndWait' in order to negotiate creation of the
|
||||
conceptual row.
|
||||
|
||||
NOTE WELL
|
||||
|
||||
Regardless of the method used to determine the column
|
||||
requirements, it is possible that the management
|
||||
station might deem a column necessary when, in fact,
|
||||
the agent will not allow that particular columnar
|
||||
instance to be created or written. In this case, the
|
||||
management protocol set operation will fail with an
|
||||
error such as `noCreation' or `notWritable'. In this
|
||||
case, the management station decides whether it needs
|
||||
to be able to set a value for that particular columnar
|
||||
instance. If not, the management station re-issues the
|
||||
management protocol set operation, but without setting
|
||||
a value for that particular columnar instance;
|
||||
otherwise, the management station aborts the row
|
||||
creation algorithm.
|
||||
|
||||
Interaction 2b: Negotiating the Creation of the Conceptual
|
||||
Row
|
||||
|
||||
The management station issues a management protocol set
|
||||
operation which sets the desired instance of the status
|
||||
column to `createAndWait'. If the agent is unwilling to
|
||||
process a request of this sort, the set operation fails with
|
||||
an error of `wrongValue'. (As a consequence, such an agent
|
||||
must be prepared to accept a single management protocol set
|
||||
operation, i.e., interaction 2a above, containing all of the
|
||||
columns indicated by its column requirements.) Otherwise,
|
||||
the conceptual row is created, a `noError' response is
|
||||
returned, and the status column is immediately set to either
|
||||
`notInService' or `notReady', depending on whether it has
|
||||
sufficient information to (attempt to) make the conceptual
|
||||
row available for use by the managed device. If there is
|
||||
sufficient information available, then the status column is
|
||||
set to `notInService'; otherwise, if there is insufficient
|
||||
information, then the status column is set to `notReady'.
|
||||
Regardless, we proceed to interaction 3.
|
||||
|
||||
Interaction 3: Initializing non-defaulted Objects
|
||||
|
||||
The management station must now determine the column
|
||||
requirements. It issues a management protocol get operation
|
||||
to examine all columns in the created conceptual row. In
|
||||
the response, for each column, there are three possible
|
||||
outcomes:
|
||||
|
||||
- a value is returned, indicating that the agent
|
||||
implements the object-type associated with this column
|
||||
and had sufficient information to provide a value. For
|
||||
those columns to which the agent provides read-create
|
||||
access (and for which the agent allows their values to
|
||||
be changed after their creation), a value return tells
|
||||
the management station that it may issue additional
|
||||
management protocol set operations, if it desires, in
|
||||
order to change the value associated with this column.
|
||||
|
||||
- the exception `noSuchInstance' is returned,
|
||||
indicating that the agent implements the object-type
|
||||
associated with this column, and that this column in at
|
||||
least one conceptual row would be accessible in the MIB
|
||||
view used by the retrieval were it to exist. However,
|
||||
the agent does not have sufficient information to
|
||||
provide a value, and until a value is provided, the
|
||||
conceptual row may not be made available for use by the
|
||||
managed device. For those columns to which the agent
|
||||
provides read-create access, the `noSuchInstance'
|
||||
exception tells the management station that it must
|
||||
issue additional management protocol set operations, in
|
||||
order to provide a value associated with this column.
|
||||
|
||||
- the exception `noSuchObject' is returned, indicating
|
||||
that the agent does not implement the object-type
|
||||
associated with this column or that there is no
|
||||
conceptual row for which this column would be
|
||||
accessible in the MIB view used by the retrieval. As
|
||||
such, the management station can not issue any
|
||||
management protocol set operations to create an
|
||||
instance of this column.
|
||||
|
||||
If the value associated with the status column is
|
||||
`notReady', then the management station must first deal with
|
||||
all `noSuchInstance' columns, if any. Having done so, the
|
||||
value of the status column becomes `notInService', and we
|
||||
proceed to interaction 4.
|
||||
|
||||
Interaction 4: Making the Conceptual Row Available
|
||||
|
||||
Once the management station is satisfied with the values
|
||||
associated with the columns of the conceptual row, it issues
|
||||
a management protocol set operation to set the status column
|
||||
to `active'. If the agent has sufficient information to
|
||||
make the conceptual row available for use by the managed
|
||||
device, the management protocol set operation succeeds (a
|
||||
`noError' response is returned). Otherwise, the management
|
||||
protocol set operation fails with an error of
|
||||
`inconsistentValue'.
|
||||
|
||||
NOTE WELL
|
||||
|
||||
A conceptual row having a status column with value
|
||||
`notInService' or `notReady' is unavailable to the
|
||||
managed device. As such, it is possible for the
|
||||
managed device to create its own instances during the
|
||||
time between the management protocol set operation
|
||||
which sets the status column to `createAndWait' and the
|
||||
management protocol set operation which sets the status
|
||||
column to `active'. In this case, when the management
|
||||
protocol set operation is issued to set the status
|
||||
column to `active', the values held in the agent
|
||||
supersede those used by the managed device.
|
||||
|
||||
If the management station is prevented from setting the
|
||||
status column to `active' (e.g., due to management station
|
||||
or network failure) the conceptual row will be left in the
|
||||
`notInService' or `notReady' state, consuming resources
|
||||
indefinitely. The agent must detect conceptual rows that
|
||||
have been in either state for an abnormally long period of
|
||||
time and remove them. It is the responsibility of the
|
||||
DESCRIPTION clause of the status column to indicate what an
|
||||
abnormally long period of time would be. This period of
|
||||
time should be long enough to allow for human response time
|
||||
(including `think time') between the creation of the
|
||||
conceptual row and the setting of the status to `active'.
|
||||
In the absence of such information in the DESCRIPTION
|
||||
clause, it is suggested that this period be approximately 5
|
||||
minutes in length. This removal action applies not only to
|
||||
newly-created rows, but also to previously active rows which
|
||||
are set to, and left in, the notInService state for a
|
||||
prolonged period exceeding that which is considered normal
|
||||
for such a conceptual row.
|
||||
|
||||
Conceptual Row Suspension
|
||||
|
||||
When a conceptual row is `active', the management station
|
||||
may issue a management protocol set operation which sets the
|
||||
instance of the status column to `notInService'. If the
|
||||
agent is unwilling to do so, the set operation fails with an
|
||||
error of `wrongValue' or `inconsistentValue'. Otherwise,
|
||||
the conceptual row is taken out of service, and a `noError'
|
||||
response is returned. It is the responsibility of the
|
||||
DESCRIPTION clause of the status column to indicate under
|
||||
what circumstances the status column should be taken out of
|
||||
service (e.g., in order for the value of some other column
|
||||
of the same conceptual row to be modified).
|
||||
|
||||
Conceptual Row Deletion
|
||||
|
||||
For deletion of conceptual rows, a management protocol set
|
||||
operation is issued which sets the instance of the status
|
||||
column to `destroy'. This request may be made regardless of
|
||||
the current value of the status column (e.g., it is possible
|
||||
to delete conceptual rows which are either `notReady',
|
||||
`notInService' or `active'.) If the operation succeeds,
|
||||
then all instances associated with the conceptual row are
|
||||
immediately removed."
|
||||
SYNTAX INTEGER {
|
||||
-- the following two values are states:
|
||||
-- these values may be read or written
|
||||
active(1),
|
||||
notInService(2),
|
||||
-- the following value is a state:
|
||||
-- this value may be read, but not written
|
||||
notReady(3),
|
||||
-- the following three values are
|
||||
-- actions: these values may be written,
|
||||
-- but are never read
|
||||
createAndGo(4),
|
||||
createAndWait(5),
|
||||
destroy(6)
|
||||
}
|
||||
|
||||
TimeStamp ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of the sysUpTime object at which a specific
|
||||
occurrence happened. The specific occurrence must be
|
||||
|
||||
defined in the description of any object defined using this
|
||||
type.
|
||||
|
||||
If sysUpTime is reset to zero as a result of a re-
|
||||
initialization of the network management (sub)system, then
|
||||
the values of all TimeStamp objects are also reset.
|
||||
However, after approximately 497 days without a re-
|
||||
initialization, the sysUpTime object will reach 2^^32-1 and
|
||||
then increment around to zero; in this case, existing values
|
||||
of TimeStamp objects do not change. This can lead to
|
||||
ambiguities in the value of TimeStamp objects."
|
||||
SYNTAX TimeTicks
|
||||
|
||||
TimeInterval ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A period of time, measured in units of 0.01 seconds."
|
||||
SYNTAX INTEGER (0..2147483647)
|
||||
|
||||
DateAndTime ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A date-time specification.
|
||||
|
||||
field octets contents range
|
||||
----- ------ -------- -----
|
||||
1 1-2 year* 0..65536
|
||||
2 3 month 1..12
|
||||
3 4 day 1..31
|
||||
4 5 hour 0..23
|
||||
5 6 minutes 0..59
|
||||
6 7 seconds 0..60
|
||||
(use 60 for leap-second)
|
||||
7 8 deci-seconds 0..9
|
||||
8 9 direction from UTC '+' / '-'
|
||||
9 10 hours from UTC* 0..13
|
||||
10 11 minutes from UTC 0..59
|
||||
|
||||
* Notes:
|
||||
- the value of year is in network-byte order
|
||||
- daylight saving time in New Zealand is +13
|
||||
|
||||
For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
|
||||
displayed as:
|
||||
|
||||
1992-5-26,13:30:15.0,-4:0
|
||||
|
||||
Note that if only local time is known, then timezone
|
||||
information (fields 8-10) is not present."
|
||||
SYNTAX OCTET STRING (SIZE (8 | 11))
|
||||
|
||||
StorageType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Describes the memory realization of a conceptual row. A
|
||||
row which is volatile(2) is lost upon reboot. A row which
|
||||
is either nonVolatile(3), permanent(4) or readOnly(5), is
|
||||
backed up by stable storage. A row which is permanent(4)
|
||||
can be changed but not deleted. A row which is readOnly(5)
|
||||
cannot be changed nor deleted.
|
||||
|
||||
If the value of an object with this syntax is either
|
||||
permanent(4) or readOnly(5), it cannot be written.
|
||||
Conversely, if the value is either other(1), volatile(2) or
|
||||
nonVolatile(3), it cannot be modified to be permanent(4) or
|
||||
readOnly(5). (All illegal modifications result in a
|
||||
'wrongValue' error.)
|
||||
|
||||
Every usage of this textual convention is required to
|
||||
specify the columnar objects which a permanent(4) row must
|
||||
at a minimum allow to be writable."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- eh?
|
||||
volatile(2), -- e.g., in RAM
|
||||
nonVolatile(3), -- e.g., in NVRAM
|
||||
permanent(4), -- e.g., partially in ROM
|
||||
readOnly(5) -- e.g., completely in ROM
|
||||
}
|
||||
|
||||
TDomain ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Denotes a kind of transport service.
|
||||
|
||||
Some possible values, such as snmpUDPDomain, are defined in
|
||||
the SNMPv2-TM MIB module. Other possible values are defined
|
||||
in other MIB modules."
|
||||
REFERENCE "The SNMPv2-TM MIB module is defined in RFC 1906."
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
|
||||
TAddress ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Denotes a transport service address.
|
||||
|
||||
A TAddress value is always interpreted within the context of a
|
||||
TDomain value. Thus, each definition of a TDomain value must
|
||||
be accompanied by a definition of a textual convention for use
|
||||
with that TDomain. Some possible textual conventions, such as
|
||||
SnmpUDPAddress for snmpUDPDomain, are defined in the SNMPv2-TM
|
||||
MIB module. Other possible textual conventions are defined in
|
||||
other MIB modules."
|
||||
REFERENCE "The SNMPv2-TM MIB module is defined in RFC 1906."
|
||||
SYNTAX OCTET STRING (SIZE (1..255))
|
||||
|
||||
END
|
||||
5
src/configMgr/c_program/paraComm/mib/index
Normal file
5
src/configMgr/c_program/paraComm/mib/index
Normal file
@@ -0,0 +1,5 @@
|
||||
LGC-MIB.my
|
||||
LGC-SS-MSC-MIB.my
|
||||
SNMPv2-SMI
|
||||
SNMPv2-TC
|
||||
|
||||
1916
src/configMgr/c_program/paraComm/paraComm.c
Normal file
1916
src/configMgr/c_program/paraComm/paraComm.c
Normal file
File diff suppressed because it is too large
Load Diff
220
src/configMgr/c_program/paraComm/paraComm.h
Normal file
220
src/configMgr/c_program/paraComm/paraComm.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/*************************************************
|
||||
File name: paraComm.h
|
||||
Author: Cui Ticun
|
||||
Version: 9.00.00
|
||||
Date: 2007-7-1
|
||||
Description:
|
||||
|
||||
History:
|
||||
No.
|
||||
Author
|
||||
Date
|
||||
Version
|
||||
Description
|
||||
*************************************************/
|
||||
|
||||
#ifndef paraComm__H
|
||||
#define paraComm__H
|
||||
|
||||
#ifndef SNMP__H
|
||||
#include "../../../../plat/snmp/src/include/snmp.h"
|
||||
#include "../../../../plat/snmp/src/mib_parser/snmp_mib_api.h"
|
||||
#include "../../../../plat/snmp/src/mib_parser/snmp_mib.h"
|
||||
#endif
|
||||
|
||||
#include "../../../omcLib/c_program/omcLib/omcLib.h"
|
||||
|
||||
#ifndef MYSQL__H
|
||||
#include "mysql.h"
|
||||
#endif
|
||||
|
||||
#ifndef paraComm_DEBUG
|
||||
#define paraComm_DEBUG 0
|
||||
#endif
|
||||
|
||||
#define paraComm_LogPath "../log"
|
||||
#define paraComm_LogFile "paraComm"
|
||||
|
||||
#define MaxCommNum 32 //max number of command can be execute at the same time
|
||||
#define MaxOidLen 20 //max number of object ID
|
||||
#define MaxColumnNum 4096 //max number of columns in one table
|
||||
#define MaxInstanceNoLevel 4 //max level of instanceNo
|
||||
#define MaxVarNum 50 //max number of var in one pdu
|
||||
#define MaxLenOfParaValue 512 //max len of One parameter value
|
||||
#define DefPort 4958 //define port
|
||||
#define HOSTNAME "localhost" //DB's adress
|
||||
#define PUB_DB "OMC_PUB" //OMC's public database
|
||||
#define ConfTable "OMC_PUB.sysConf" //system config table
|
||||
#define CommTable "OMC_PUB.parameterComm" //command table
|
||||
#define IpTable "OMC_PUB.sysInfo" //system's IP table
|
||||
#define nPubFlag 99 //if sysNo == nPubFlag this parameter is system param
|
||||
|
||||
//commState flag define
|
||||
#define nProcFail 0
|
||||
#define nWaitProc 1
|
||||
#define nInProc 2
|
||||
#define nOutProc 3
|
||||
|
||||
//procState flag define
|
||||
#define nIdle 0
|
||||
#define nWaitResponse 1
|
||||
|
||||
//parameter type define
|
||||
#define nSubSysParam 0
|
||||
#define nGlobalSubSysParam 1
|
||||
#define nGlobalSysParam 2
|
||||
|
||||
//snmp pdu type define [define in snmp.h]
|
||||
/*
|
||||
#define PDU_GET 0
|
||||
#define PDU_GETNEXT 1
|
||||
#define PDU_RSP 2
|
||||
#define PDU_SET 3
|
||||
#define PDU_GETBULK 5
|
||||
#define PDU_INFORM 6
|
||||
#define PDU_TRAP 7
|
||||
#define PDU_REPORT 8
|
||||
*/
|
||||
|
||||
//snmp var type code
|
||||
#define nInteger 0x02
|
||||
#define nOctetString 0x04
|
||||
#define nNull 0x05
|
||||
#define nObjectId 0x06
|
||||
#define nIPAddress 0x40
|
||||
#define nNoSuchObject 0x80
|
||||
#define nNoSuchInstance 0x81
|
||||
#define nEndOfMibView 0x82
|
||||
|
||||
//Operation_type
|
||||
#define DO_NOT_DISPLAY 0
|
||||
#define PULLDOWN_MENU 1
|
||||
#define TEXTBOX 2
|
||||
#define LABEL 3
|
||||
|
||||
//command type define
|
||||
#define nGetComm 0
|
||||
#define nSetComm 3
|
||||
#define nGetBulkComm 5
|
||||
#define nNewEntryComm 9
|
||||
|
||||
/***********************Error display define***************************/
|
||||
#define CONF_COMMAND_ERR_0000 "0000:Command successful"
|
||||
|
||||
//ERR_001*:should prompt the operator "Check the device's status"
|
||||
#define CONF_COMMAND_ERR_0101 "0101:OMC cannot get the device IP"
|
||||
#define CONF_COMMAND_ERR_0102 "0102:The device IP is error"
|
||||
|
||||
//ERR_002*:should prompt the operator "Check the software version of OMC and device"
|
||||
#define CONF_COMMAND_ERR_0201 "0201:OMC cannot get the object value"
|
||||
#define CONF_COMMAND_ERR_0202 "0202:OMC cannot get the instance value"
|
||||
|
||||
//ERR_003*:should prompt the operator "Check the OMC's status or send command again"
|
||||
#define CONF_COMMAND_ERR_0301 "0301:OMC send snmp message failed"
|
||||
|
||||
//ERR_004*:should prompt the operator "Check the device's status or send command again"
|
||||
#define CONF_COMMAND_ERR_0401 "0401:Invailed response message"
|
||||
#define CONF_COMMAND_ERR_0402 "0402:Error Response message"
|
||||
#define CONF_COMMAND_ERR_0403 "0403:Response timeout"
|
||||
|
||||
|
||||
#define CONF_COMMAND_ERR_9999 "9999:Unknown error"
|
||||
/******************Error display define End*******************************/
|
||||
|
||||
|
||||
typedef struct snmpInfoDef{
|
||||
/*General Info*/
|
||||
char dstIP[16];
|
||||
int needMuliObj; //can send or get more one objid in one packet
|
||||
WORD dstPort;
|
||||
WORD maxMsgLen;
|
||||
char snmpCommunity[16];
|
||||
|
||||
BYTE preOidLen; //The total OID of one system,it's defined in sysConf
|
||||
BYTE oidLen; //The oid len of the command's parameters
|
||||
int oid[MaxOidLen]; //The oid of this command's parameters
|
||||
BOOL isTablePara; //If or Not this command's parameters are table parameters
|
||||
int columnNum; //The column number of this table parameters
|
||||
int column[MaxColumnNum];//The columns of this table parameters
|
||||
BYTE instanceNoLevel; //The instanceNo level of this command's parameters
|
||||
int instanceNo[MaxInstanceNoLevel];//The instanceNo of this command's parameters
|
||||
}snmpInfoDef;
|
||||
|
||||
typedef struct unitComm {
|
||||
/*General Info*/
|
||||
WORD commId; //ID in command table,which is also SNMP's request_id
|
||||
WORD commType; //Command type get,set,get bulk,newEntry
|
||||
BYTE paramType; //0:subsys param/1:global subsys param/2:global sys param
|
||||
WORD sysTypeNo;
|
||||
WORD sysNo;
|
||||
WORD subSysNo;
|
||||
|
||||
MYSQL_RES *paramSet; //Store the infor,which is need when packeting SNMP message
|
||||
WORD totalNum;
|
||||
WORD finishNum;
|
||||
char desc[256];
|
||||
char paramTable[64];
|
||||
|
||||
snmpInfoDef snmpInfo;
|
||||
|
||||
/*command process info*/
|
||||
BYTE commState; //this command's state:0= nFailed, 1=nWaitProc, 2=nNoFinish, 3=nFinished
|
||||
BYTE procState; //command process state:0=idle,1=waitResponse
|
||||
BYTE waitTimeCount; //the times number of timeout
|
||||
BYTE timeoutCount; //the timeCount
|
||||
|
||||
//var_list info
|
||||
BYTE varNum;
|
||||
|
||||
BYTE levelWidth[MaxVarNum]; //The level(!=0) number of the parameter
|
||||
|
||||
char readValue[MaxVarNum][512];
|
||||
} unitComm;
|
||||
|
||||
/*************************************************
|
||||
Function: // initDbFromMib
|
||||
Description: // Get oid info from MIB file and init the paramConf tables.
|
||||
Calls: // extern int init_mib();extern struct tree *getLGCroot();extern struct get_tree;extern void close_mib();
|
||||
Called By: // paraCommInit();
|
||||
Table Accessed: //
|
||||
Table Updated: // paramConf
|
||||
Input: //
|
||||
Output: //
|
||||
Return: // 1:OK,0:error
|
||||
Others: //
|
||||
*************************************************/
|
||||
int initDbFromMib();
|
||||
|
||||
/*************************************************
|
||||
Function: // paraCommInit
|
||||
Description: // 1.Init OMC_PUB.parameterComm
|
||||
// 2.Init Commands Array
|
||||
// 3.Init Every module's paramConf
|
||||
Calls: // omcLogInit();initUnitComm();initDbFromMib();
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: // OMC_PUB.parameterComm;OBJ_xxx.paramConf
|
||||
Input: //
|
||||
Output: //
|
||||
Return: // 1:OK,0:error
|
||||
Others: //
|
||||
*************************************************/
|
||||
int paraCommInit();
|
||||
|
||||
/*************************************************
|
||||
Function: // paraCommTimer
|
||||
Description: // <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>顣
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>
|
||||
|
||||
Calls: // paraCommScan();paraCommProc();omcLogInit();
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: // 1:OK,0:error
|
||||
Others: //
|
||||
*************************************************/
|
||||
int paraCommTimer();
|
||||
#endif
|
||||
137
src/configMgr/c_program/paraComm/paraCommMain.c
Normal file
137
src/configMgr/c_program/paraComm/paraCommMain.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/*************************************************
|
||||
File name: paraCommMain.c
|
||||
Author: Cui Ticun
|
||||
Version: 9:00:00
|
||||
Date: 2007-7-2
|
||||
Description:
|
||||
|
||||
History:
|
||||
No.
|
||||
Author
|
||||
Date
|
||||
Version
|
||||
Description
|
||||
*************************************************/
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "paraComm.h"
|
||||
|
||||
static struct itimerval itimer, old_itimer;
|
||||
|
||||
void onParaCommTimer();
|
||||
void setParaCommTimer();
|
||||
void setup_daemon(void);
|
||||
int timerCounter = 0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char runMode;
|
||||
|
||||
runMode = getopt(argc, argv, "d");
|
||||
switch (runMode) {
|
||||
case 'd':
|
||||
setup_daemon();
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
}
|
||||
debug_init();
|
||||
fprintf(stderr, "\n Calling iptrans_init() \n");
|
||||
iptrans_init();
|
||||
|
||||
fprintf(stderr, "\n Calling snmp_init() \n");
|
||||
snmp_init(4957);
|
||||
|
||||
fprintf(stderr, "\n Calling paraCommInit() \n");
|
||||
if(paraCommInit()<=0)
|
||||
{
|
||||
exitLog("paraComm:main, paraCommInit function error");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
setParaCommTimer();
|
||||
|
||||
while (1) {
|
||||
usleep(50);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void onParaCommTimer()
|
||||
{
|
||||
paraCommTimer();
|
||||
/*
|
||||
if (timerCounter > 5) {
|
||||
paraCommTimer();
|
||||
timerCounter = 0;
|
||||
}
|
||||
timerCounter++;
|
||||
*/
|
||||
}
|
||||
|
||||
void setParaCommTimer()
|
||||
{
|
||||
struct sigaction act;
|
||||
act.sa_handler = onParaCommTimer;
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
if (sigaction(SIGALRM, &act, NULL) < 0) {
|
||||
perror("Produce Sigaction");
|
||||
exitLog("paraComm:setParaCommTimer, sigaction function error");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
itimer.it_interval.tv_sec = 0;
|
||||
itimer.it_interval.tv_usec = 20 * 1000;
|
||||
itimer.it_value.tv_sec = 0;
|
||||
itimer.it_value.tv_usec = 20 * 1000;
|
||||
|
||||
if (setitimer(ITIMER_REAL, &itimer, &old_itimer) != 0) {
|
||||
printf("Setting Timer error! \n");
|
||||
exitLog("paraComm:setParaCommTimer, setitimer function error");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void setup_daemon(void)
|
||||
{
|
||||
/*
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
close(i);
|
||||
*/
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
{
|
||||
perror("setup_daemon(), 1st fork()");
|
||||
exit(2);
|
||||
}
|
||||
default:
|
||||
exit(0);
|
||||
case 0:
|
||||
if (setsid() == -1) {
|
||||
perror("setup_daemon(), setsid()");
|
||||
exit(3);
|
||||
}
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
{
|
||||
perror("setup_daemon(), 2nd fork()");
|
||||
exit(3);
|
||||
}
|
||||
|
||||
default:
|
||||
exit(0);
|
||||
case 0:
|
||||
umask(0);
|
||||
/* and return with daemon set up */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user