Re: [lisp-snmp] Patch to asn.1 to change from parsergen to a modified cl-yacc
Brought to you by:
binghe
|
From: Chun T. (binghe) <bin...@gm...> - 2009-02-09 07:08:40
|
On 2009-2-9, at 15:03, John Fremlin wrote: >>>> >>>> ASN.1 10 > (oid "SNMPv2-SMI::mib-2.SNMPv2-MIB::system") >>>> #<OBJECT-ID SNMPv2-MIB::system (1) [9]> >>> >>> This syntax can easily be supported as follows >>> >>> (defmethod oid-parse ((source string)) >>> (or >>> (with-input-from-string (s source) >>> (oid-parse s)) >>> (with-input-from-string (s (concatenate 'string *asn.1-package- >>> prefix* source)) >>> (oid-parse s)))) >> >> I'm afraid this function cannot work for (oid "SNMPv2- >> SMI::mib-2.SNMPv2-MIB::system") correctly, you just change it into: > > Why do think that? > > Look at the function. > > First it tries the old way, then it tries with an ASN.1/ prefix. > >> (oid "ASN.1/SNMPv2-SMI::mib-2.SNMPv2-MIB::system") > > Will this work with the old function? I don't think so, because of > the . No, the #\. is NOT the key, and (oid "ASN.1/SNMPv2-SMI::mib-2.SNMPv2- MIB::system") do work with the old (current) OID function, you can try it yourself. CL readtable is a very good builtin lexer. > > >> >> How can you solve the second package name "SNMPv2-MIB" in that >> string? >> >>> >>> >>> However, *asn.1-package-prefix* cannot contain a "." because of your >>> strange readtable. So it must be changed to something other than >>> "ASN.1/", perhaps "ASN1/" >> >> The strange *oid-readtable* is my way to avoid the use of SPLIT- >> SEQUENCE, it just let #\. be treat as a separator. However, this >> method can cause unnecessary synbol intern in ASN.1 package, not the >> best way to read a OID string. >> >> Give me more time to think out a better solution please. > > Cool > >> >>> >>>> Well, contact me if you really found your customers use such a MIB >>>> module name, I think we can talk about this issue later:) >>> >>> It's kind of strange that you talk about making your package perfect >>> but >>> have it so arranged that by loading in an MIB file one can overwrite >>> your package itself . . . >>> >>> I guess it's not just C programmers who don't care about >>> security ;-) >> >> The *asn.1-package-prefix* was learnt from Common Lisp's CORBA >> language mapping. I think you've persuaded me, but I cannot change it >> until I can solve the OID reader syntax issue above. > > Yes, the "." problem is annoying but it can be avoided by using > "ASN1/" > instead . . . Again, #\. is not the key, it is how to add "ASN.1/" to every "package name" in OID string. > > > Thanks for your time > > [...] > -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |