文档库

最新最全的文档下载
当前位置:文档库 > mib库的编写

mib库的编写

网络管理老师让在实验课上写一个MIB库,当时不知道怎样写,不知道是用什么语言写。经过老师指点终于领悟了方法,其实是在TXT文档里面写的,不是很复杂,与C语言中的子函数调用差不多,不过与其结构不同。有点C语言中的结构体的感觉,呵呵!

在网上找了好多关于MIB库的资料,但是没有一个是关于MIB库的编写的,现在将自己编写的MIB库粘贴出来,与大家分享!

--**************author:****(0106****)********
--**************data:2009/04/10****************

SCORE-MIB DEFINITIONS ::= BEGIN

IMPORTS
enterprises, Counter
FROM RFC1155-SMI
OBJECT-TYPE
FROM RFC-1212;

haohao OBJECT IDENTIFIER ::= { enterprises 50000 }

String ::= OCTET STRING

score OBJECT IDENTIFIER ::= { haohao 1 }

--课程信息
course OBJECT-TYPE
SYNTAX SEQUENCE OF CourseSituation
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"The cource Situation."
::= { score 1 }
--老师信息
teacher OBJECT-TYPE
SYNTAX SEQUENCE OF TeacherSituation
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"The teacher's situation."
::= { score 2 }
--选课同学信息
scoreTable OBJECT-TYPE
SYNTAX SEQUENCE OF ScoreEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"Score table."
::= { score 3 }


courseSituation OBJECT-TYPE
SYNTAX CourseSituation
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"Course's name."
INDEX { courseName }
::= { course 1 }

teacherSituation OBJECT-TYPE
SYNTAX TeacherSituation
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"Teacher's Situation."
INDEX { teacherName }
::= { teacher 1 }

scoreEntry OBJECT-TYPE
SYNTAX ScoreEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"Score entry."
INDEX { studentNo }
::= { scoreTable 1 }

--定义课程信息:课程名称、开课日期
CourseSituation ::=
SEQUENCE {
courseName
String,
courseDate
String
}
courseName OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"course's Name."
::= { courseSituation 1 }
courseDate OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"course's Tate."
::= { courseSituation 2 }

--定义老师信息:老师姓名、性别、年龄
TeacherSituation ::=
SEQUENCE {
teacherName
String,
teacherGende

r
INTEGER,
teacherAge
String
}
teacherName OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"teacher's Name."
::= { teacherSituation 1 }
teacherGender OBJECT-TYPE
SYNTAX INTEGER {male(1), female(2)}
ACCESS read-only
STATUS mandatory
DESCRIPTION
"teacher's Gender."
::= { teacherSituation 2 }
teacherAge OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Teacher's Age."
::= { teacherSituation 3 }
--定义学生信息:学号、姓名、性别、该学科分数
ScoreEntry ::=
SEQUENCE {
studentNo
String,
studentName
String,
studentGender
INTEGER,
studentScore
INTEGER
}
studentNo OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Student number."
::= { scoreEntry 1 }
studentName OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Student name."
::= { scoreEntry 2 }
studentGender OBJECT-TYPE
SYNTAX INTEGER {male(1), female(2)}
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Gender."
::= { scoreEntry 3 }
studentScore OBJECT-TYPE
SYNTAX INTEGER (0..100)
ACCESS read-write
STATUS mandatory
DESCRIPTION
"Score."
::= { scoreEntry 4 }
END