Skip to content

Commit

Permalink
More useful OID display for the case when the exact OID is not known
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@239 f711b948-2313-0410-aaa9-d29f33439f0b
  • Loading branch information
hploetz committed Jun 10, 2007
1 parent 9a1a0cc commit 56e9027
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion TLV_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,18 @@ def decode_oid(value):

if len(oidCache) == 0:
loadOids()
return " %s (%s)" % (str_rep, oidCache.get(str_rep, ("No description available",))[0])
description = oidCache.get(str_rep, None)
if description is None:
steps = [oid[:e] for e in range(len(oid)-1, 0, -1)]
for step in steps:
new_str_rep = ".".join([str(a) for a in step])
if oidCache.has_key(new_str_rep):
description = ("%s %s" % (oidCache[new_str_rep][0], ".".join([str(a) for a in oid[len(step):]])),)
break
if description is None:
description = ("No description available",)

return " %s (%s)" % (str_rep, description[0])

_gtimere = re.compile(r'(\d{4})(\d\d)(\d\d)(\d\d)(?:(\d\d)(\d\d(?:[.,]\d+)?)?)?(|Z|(?:[+-]\d\d(?:\d\d)?))$')
def decode_generalized_time(value):
Expand Down Expand Up @@ -511,3 +522,4 @@ def pack(tlv_data, recalculate_length = False):
print utils.hexdump(c)

loadOids()

3 changes: 3 additions & 0 deletions oids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@

# I made this one up --Henryk
2.23.136.1.1.1 icao-sodData The data contained in the EF.SOD

# From tr-03110-eac-1.0.pdf
0.4.0.127.0.7 bsi-de Base OID for BSI, Germany

0 comments on commit 56e9027

Please sign in to comment.