
Hi,
is it possible to parse MIB file that contains multiple DEFINITIONs (SMIv1, SMIv2, SMIng) statements? Currently smiLoadModule(char* mibFile) returns name of last DEFINITION (it seems that way) in MIB file. When calling smiGetFirstNode(modile, ANY) method returns NULL.
IS MIB with multiple DEFITION statements valid MIB?
Any pointer?
Best regards, Miroslav Beranič ml. ----------------------------------- miroslav.beranic@gmail.com

On Sat, Jan 10, 2009 at 11:04:40PM +0100, Miroslav Berani?? ml. wrote:
Hi,
is it possible to parse MIB file that contains multiple DEFINITIONs (SMIv1, SMIv2, SMIng) statements?
yes
Currently smiLoadModule(char* mibFile) returns name of last DEFINITION (it seems that way) in MIB file.
It returns the name of the last MIB module.
When calling smiGetFirstNode(modile, ANY) method returns NULL.
A question concerning the result of a function call without telling us anything about the context of the call can't be answered.
IS MIB with multiple DEFITION statements valid MIB?
The term "MIB" is ambiguous here - you have to work on terminology to get things straight. Some true statements:
a) A valid SMIv2 MIB module has exactly one DEFINITION "statement". (It is actually not a "statement" but I spare you the details of ASN.1 here.)
b) The SMIv2 specification never talks about MIB files; the spec only defines how MIB modules are structured, not how they are stored in files. As a consequence, the notion of MIB files is implementation specific.
c) Libsmi is able to parse files containing multiple MIB modules and smiLoadModule() returns the name of the last parsed MIB module contained in a MIB file.
/js

Greetings,
2009/1/10 Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de:
On Sat, Jan 10, 2009 at 11:04:40PM +0100, Miroslav Berani?? ml. wrote:
Hi,
is it possible to parse MIB file that contains multiple DEFINITIONs (SMIv1, SMIv2, SMIng) statements?
yes
Currently smiLoadModule(char* mibFile) returns name of last DEFINITION (it seems that way) in MIB file.
It returns the name of the last MIB module.
How do I retrieve all MIB modules inside one MIB file? How do I count modules? How I retrieve first one?
(all questions are in context multiple MIB modules inside one MIB file)
When calling smiGetFirstNode(modile, ANY) method returns NULL.
A question concerning the result of a function call without telling us anything about the context of the call can't be answered.
I was talking in the context of loading multiple MIB modules contained inside one MIB file. When I call method smiGetFirstNode(Module*, ANY) it returns NULL. Why is this so?
IS MIB with multiple DEFITION statements valid MIB?
The term "MIB" is ambiguous here - you have to work on terminology to get things straight. Some true statements:
I agree with you and I apologise for ambiguity.
a) A valid SMIv2 MIB module has exactly one DEFINITION "statement". (It is actually not a "statement" but I spare you the details of ASN.1 here.)
Can you "tell" me in one sentence. I read the RFC, but have no clue at this time how to name it correctly. Would it be better to say: keyword, macro or clause ?
b) The SMIv2 specification never talks about MIB files; the spec only defines how MIB modules are structured, not how they are stored in files. As a consequence, the notion of MIB files is implementation specific.
c) Libsmi is able to parse files containing multiple MIB modules and smiLoadModule() returns the name of the last parsed MIB module contained in a MIB file.
Thanks for your time and to correct me, greatly appreciated. When I was talking about MIB, I was referring to MIB file (one MIB file).
How is it possible to load MIB file with multiple MIB modules contained is one MIB file (with libsmi)? Does it make a difference if source (MIB file) is written in SMIv1,SMIv2,SMIvg - regarding parser behaviour? I looked at some examples/tools in source tree (SVN trunk), but have not found any example how to do this (load multiple modules). Any pointer - file name, or short snippet.
to a) So what are you saying is that MIB file with multiple DEFINITION "statements" is not valid MIB (when talking about SMIv2). to b) I guess this is answered with paragraph c. to c) Please one short example
Is there any documentation like data model relations (what is parent, what is child, ...)?
BTW: Would it be possible to rename function argument in file smi.h:646 from class to (let say) klass? I had trouble with linking it inside C++.
/js
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
Best regards, Miroslav

On Sun, Jan 11, 2009 at 12:27:21AM +0100, Miroslav Berani?? ml. wrote:
How do I retrieve all MIB modules inside one MIB file? How do I count modules? How I retrieve first one?
(all questions are in context multiple MIB modules inside one MIB file)
There are no API functions to do this sort of thing. In general, I recommend to put just one module into a MIB file; this will also help with the resolution of imports.
When calling smiGetFirstNode(modile, ANY) method returns NULL.
A question concerning the result of a function call without telling us anything about the context of the call can't be answered.
I was talking in the context of loading multiple MIB modules contained inside one MIB file. When I call method smiGetFirstNode(Module*, ANY) it returns NULL. Why is this so?
Sorry, I can't help with this.
a) A valid SMIv2 MIB module has exactly one DEFINITION "statement". (It is actually not a "statement" but I spare you the details of ASN.1 here.)
Can you "tell" me in one sentence. I read the RFC, but have no clue at this time how to name it correctly. Would it be better to say: keyword, macro or clause ?
RFC 2578 calls it a keyword.
How is it possible to load MIB file with multiple MIB modules contained is one MIB file (with libsmi)? Does it make a difference if source (MIB file) is written in SMIv1,SMIv2,SMIvg - regarding parser behaviour? I looked at some examples/tools in source tree (SVN trunk), but have not found any example how to do this (load multiple modules). Any pointer - file name, or short snippet.
Assume file DOUBLE-MIB contains the following:
A-MIB DEFINITIONS ::= BEGIN END
B-MIB DEFINITIONS ::= BEGIN END
You can now do things like smidump -p /tmp/DOUBLE-MIB A-MIB or also smidump -p /tmp/DOUBLE-MIB B-MIB.
to a) So what are you saying is that MIB file with multiple DEFINITION "statements" is not valid MIB (when talking about SMIv2).
No, I was talking about MIB modules.
to b) I guess this is answered with paragraph c. to c) Please one short example
See above.
Is there any documentation like data model relations (what is parent, what is child, ...)?
Maybe.
BTW: Would it be possible to rename function argument in file smi.h:646 from class to (let say) klass? I had trouble with linking it inside C++.
Sure.
/js

Hi,
2009/1/11 Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de:
On Sun, Jan 11, 2009 at 12:27:21AM +0100, Miroslav Berani?? ml. wrote:
How do I retrieve all MIB modules inside one MIB file? How do I count modules? How I retrieve first one?
(all questions are in context multiple MIB modules inside one MIB file)
There are no API functions to do this sort of thing. In general, I recommend to put just one module into a MIB file; this will also help with the resolution of imports.
Well, it is not up to me do decide about module number inside one MIB file; so... but I agree with you. I will try to arrange it that way.
When calling smiGetFirstNode(modile, ANY) method returns NULL.
A question concerning the result of a function call without telling us anything about the context of the call can't be answered.
I was talking in the context of loading multiple MIB modules contained inside one MIB file. When I call method smiGetFirstNode(Module*, ANY) it returns NULL. Why is this so?
Sorry, I can't help with this.
a) A valid SMIv2 MIB module has exactly one DEFINITION "statement". (It is actually not a "statement" but I spare you the details of ASN.1 here.)
Can you "tell" me in one sentence. I read the RFC, but have no clue at this time how to name it correctly. Would it be better to say: keyword, macro or clause ?
RFC 2578 calls it a keyword.
How is it possible to load MIB file with multiple MIB modules contained is one MIB file (with libsmi)? Does it make a difference if source (MIB file) is written in SMIv1,SMIv2,SMIvg - regarding parser behaviour? I looked at some examples/tools in source tree (SVN trunk), but have not found any example how to do this (load multiple modules). Any pointer - file name, or short snippet.
Assume file DOUBLE-MIB contains the following:
A-MIB DEFINITIONS ::= BEGIN END
B-MIB DEFINITIONS ::= BEGIN END
You can now do things like smidump -p /tmp/DOUBLE-MIB A-MIB or also smidump -p /tmp/DOUBLE-MIB B-MIB.
It works this way, I had to use "-k" switch to make it work; to force it to go to the end.
to a) So what are you saying is that MIB file with multiple DEFINITION "statements" is not valid MIB (when talking about SMIv2).
No, I was talking about MIB modules.
to b) I guess this is answered with paragraph c. to c) Please one short example
See above.
Is there any documentation like data model relations (what is parent, what is child, ...)?
Maybe.
BTW: Would it be possible to rename function argument in file smi.h:646 from class to (let say) klass? I had trouble with linking it inside C++.
Sure.
Great.
/js
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
Best regards, Miroslav

On Sun, Jan 11, 2009 at 01:39:17PM +0100, Miroslav Berani?? ml. wrote:
There are no API functions to do this sort of thing. In general, I recommend to put just one module into a MIB file; this will also help with the resolution of imports.
Well, it is not up to me do decide about module number inside one MIB file; so... but I agree with you. I will try to arrange it that way.
For resolving imports, the libsmi parser looks for files with a matching name. If people put multiple modules into a single file, then libsmi needs to maintain an additional index in order to efficiently resolve imports, which just adds complexity.
/js

2009/1/11 Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de:
On Sun, Jan 11, 2009 at 01:39:17PM +0100, Miroslav Berani?? ml. wrote:
There are no API functions to do this sort of thing. In general, I recommend to put just one module into a MIB file; this will also help with the resolution of imports.
Well, it is not up to me do decide about module number inside one MIB file; so... but I agree with you. I will try to arrange it that way.
For resolving imports, the libsmi parser looks for files with a matching name. If people put multiple modules into a single file, then libsmi needs to maintain an additional index in order to efficiently resolve imports, which just adds complexity.
/js
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
Would you say, libsmi is stable and production ready product?
Regards, Miroslav

On Sun, Jan 11, 2009 at 02:18:12PM +0100, Miroslav Berani?? ml. wrote:
Would you say, libsmi is stable and production ready product?
You have to judge yourself what "production ready" means to your customers.
/js

2009/1/11 Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de:
On Sun, Jan 11, 2009 at 02:18:12PM +0100, Miroslav Berani?? ml. wrote:
Would you say, libsmi is stable and production ready product?
You have to judge yourself what "production ready" means to your customers.
/js
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
OK. Thanks for your help.
Regards, Miroslav
participants (2)
-
Juergen Schoenwaelder
-
Miroslav Beranič ml.