Mibble MIB Parser - 从 mib 中提取注释

发布于 2024-08-16 19:06:27 字数 947 浏览 4 评论 0原文

我正在使用 Mibble MIB 解析器 从 MIB 文件中提取所有简单数据类型。在我尝试提取评论文本之前,我一直成功。

以下面的模块为例:

invBookList OBJECT-TYPE
    SYNTAX  INTEGER {
                    mobydick(1),     -- call me ishmael 
                    paradiselost(2), -- aComment
                    1984(3),         -- aComment
                    solaris(4)       -- aComment
            }
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION
            "A few Books for an example."
    ::= { invMasterList 43 }

根据Mibble的API,可以通过提取SnmpObjectType然后调用适当的getter方法来访问OBJECT-TYPE。我已经完成了,并且可以成功提取除 INTEGER 语法中的注释之外的所有文本。

我尝试在 SnmpObjectType 上调用 getSyntax().getComment(),但总是返回 null。 getSyntax() 将提取 INTEGER 语法,例如:

mobydick(1),paradiselist(2),1984(3),solaris(4)

但不幸的是删除了注释。

任何人都有使用 Mibble Parser 的经验并且知道如何提取注释吗?

非常感谢。

I am using the Mibble MIB Parser to extract all simple data types from an MIB file. I've been successful until my attempt to extract comment text.

Take the following module as an example:

invBookList OBJECT-TYPE
    SYNTAX  INTEGER {
                    mobydick(1),     -- call me ishmael 
                    paradiselost(2), -- aComment
                    1984(3),         -- aComment
                    solaris(4)       -- aComment
            }
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION
            "A few Books for an example."
    ::= { invMasterList 43 }

According to Mibble's API, the OBJECT-TYPE can be accessed by extracting an SnmpObjectType and then calling the appropriate getter method. Which I have done, and can successfully extract all of the text except the comments in the INTEGER syntax.

I have tried calling getSyntax().getComment() on the SnmpObjectType, but always returns null. getSyntax() will extract the INTEGER syntax, e.g.:

mobydick(1),paradiselist(2),1984(3),solaris(4)

but unfortunately strips out the comments.

Any one out there have experience with Mibble Parser who knows how to extract the comments?

Many Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花间憩 2024-08-23 19:06:27

首先,您需要使用 Mibble 2.9 版本。然后查看 MibWriter.java 以了解如何使用 API:

https://github.com/cederberg/mibble/blob/master/src/java/net/percederberg/mibble/MibWriter.java

First, you need to use version 2.9 of Mibble. Then look into MibWriter.java to understand how to use the API:

https://github.com/cederberg/mibble/blob/master/src/java/net/percederberg/mibble/MibWriter.java

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文