asn2wrs blurb
"Graeme Lunt" <[email protected]> Sat, 29 Jul 2006 16:12:57 +0200
| Newsgroups | gmane.network.ethereal.devel |
|---|---|
| Message-ID | <[email protected]> |
Tomas,
I want to extend asn2wrs to generate ASN.1 type information for a given hf
that I can use to bring up ASN.1 spec at the appropriate location. Whilst I
have done this with a separate "#include packet-XXX-typearr.c", I was
wondering if the asn2wrs generated "blurb" could be used?
I can't quite tell what the asn2wrs wants to set the "blurb" to - but it is
often blank in asn2wrs generated files.
Attached is a patch (for discussion only) for what I am looking, so you can
see what I mean.
With this patch, packet-x509.c goes from:
...
{ &hf_x509af_version,
{ "version", "x509af.version",
FT_INT32, BASE_DEC, VALS(x509af_Version_vals), 0,
"", HFILL }},
{ &hf_x509af_serialNumber,
{ "serialNumber", "x509af.serialNumber",
FT_INT32, BASE_DEC, NULL, 0,
"", HFILL }},
{ &hf_x509af_signature,
{ "signature", "x509af.signature",
FT_NONE, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_x509af_issuer,
{ "issuer", "x509af.issuer",
FT_UINT32, BASE_DEC, VALS(x509if_Name_vals), 0,
"", HFILL }},
{ &hf_x509af_validity,
{ "validity", "x509af.validity",
FT_NONE, BASE_NONE, NULL, 0,
"Certificate/signedCertificate/validity", HFILL }},
{ &hf_x509af_subject,
{ "subject", "x509af.subject",
FT_UINT32, BASE_DEC, VALS(x509af_SubjectName_vals), 0,
"Certificate/signedCertificate/subject", HFILL }},
{ &hf_x509af_subjectPublicKeyInfo,
{ "subjectPublicKeyInfo", "x509af.subjectPublicKeyInfo",
FT_NONE, BASE_NONE, NULL, 0,
"Certificate/signedCertificate/subjectPublicKeyInfo", HFILL }},
to:
{ &hf_x509af_version,
{ "version", "x509af.version",
FT_INT32, BASE_DEC, VALS(x509af_Version_vals), 0,
"x509af.Version", HFILL }},
{ &hf_x509af_serialNumber,
{ "serialNumber", "x509af.serialNumber",
FT_INT32, BASE_DEC, NULL, 0,
"x509af.CertificateSerialNumber", HFILL }},
{ &hf_x509af_signature,
{ "signature", "x509af.signature",
FT_NONE, BASE_NONE, NULL, 0,
"x509af.AlgorithmIdentifier", HFILL }},
{ &hf_x509af_issuer,
{ "issuer", "x509af.issuer",
FT_UINT32, BASE_DEC, VALS(x509if_Name_vals), 0,
"x509if.Name", HFILL }},
{ &hf_x509af_validity,
{ "validity", "x509af.validity",
FT_NONE, BASE_NONE, NULL, 0,
"x509af.Validity", HFILL }},
{ &hf_x509af_subject,
{ "subject", "x509af.subject",
FT_UINT32, BASE_DEC, VALS(x509af_SubjectName_vals), 0,
"x509af.SubjectName", HFILL }},
{ &hf_x509af_subjectPublicKeyInfo,
{ "subjectPublicKeyInfo", "x509af.subjectPublicKeyInfo",
FT_NONE, BASE_NONE, NULL, 0,
"x509af.SubjectPublicKeyInfo", HFILL }},
Comments?
Graeme
_______________________________________________
Ethereal-dev mailing list
[email protected]
http://www.ethereal.com/mailman/listinfo/ethereal-dev
asn2wrs.patch
(application/octet-stream, 900 B)
Index: tools/asn2wrs.py
===================================================================
--- tools/asn2wrs.py (revision 18807)
+++ tools/asn2wrs.py (working copy)
@@ -934,10 +934,13 @@
if not len(self.eth_hf_ord) and not len(self.eth_hfpdu_ord) and not len(self.named_bit): return
fx = self.output.file_open('hfarr')
for f in (self.eth_hfpdu_ord + self.eth_hf_ord):
- if len(self.eth_hf[f]['ref']) == 1:
- blurb = '"' + self.eth_hf[f]['ref'][0] + '"'
- else:
- blurb = '""'
+# if len(self.eth_hf[f]['ref']) == 1:
+# blurb = '"' + self.eth_hf[f]['ref'][0] + '"'
+# else:
+# blurb = '""'
+ t = self.eth_hf[f]['ethtype']
+ blurb = '"' + self.eth_type[t]['proto'] + '.' + t + '"'
+
attr = self.eth_hf[f]['attr'].copy()
attr['ABBREV'] = '"%s.%s"' % (self.proto, attr['ABBREV'])
if not attr.has_key('BLURB'):