-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Porting Mibble to C# #34
Comments
Porting to C# is a major undertaking. Mibble uses Grammatica, which already has C# support (although quite dated at this time). So generating an ASN.1 parser from the grammar file is trivial. But Mibble does a lot more. In particular it contains built-in Java code to translate the SNMP macros to usable objects. A raw parse tree isn't very "semantic", as relations between objects tend to be too flexible and too loosely linked. So Mibble "resolves" all the named type references to their actual types (in multiple steps and across imported MIBs), while also preserving enough information to separate types that resolve to same basic type (e.g. 32 bit integer). See To your questions:
|
Thanks for the thorough explanation! I was looking for a solution to parse MIB files in C# and was in dilemma of
I can see now that option 2 could worth it. I will take my chances with Sharpen to port and see how well that works. Cheers, |
First of all, thank you for providing such great library.
There has been some attempts to port Mibble to other languages (e.g. MibbleSharp as a C# port). As they might have become outdated by now, I am considering to port Mibble again in C#.
I wanted to make sure I have got a good understanding of the Mibble code structure before starting such task.
Apparently the only part of codes that are auto-generated are located at
src/java/net/percederberg/mibble/asn1
. Is that right?Honestly, I didn't expected the scale of hand-written code for an SNMP MIB parser. I expected it to be mostly auto-generated code for the grammar plus a light wrapper that loads the MIB file and feeds the parser to build the AST tree and then a minimal API for querying that tree.
I've looked through code and understood some parts of it (e.g. mechanism for importing multiple MIBs) but I'm sure I am missing many other functionalities. For instance, why types such as MibValueSymbol.java needs to be implemented? Do they abstract away the underlying AST parser nodes? And MibAnalyzer.java is one of the main places where these abstraction is carried out?
asn1.grammar
file.Do you have any comments on these? The second approach could generate a more optimal and "native" code. However, I am not sure if the generated code is compatible with the rest of codes.
The text was updated successfully, but these errors were encountered: