aboutsummaryrefslogtreecommitdiff
path: root/ber/new/dump.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/new/dump.go')
-rw-r--r--ber/new/dump.go29
1 files changed, 25 insertions, 4 deletions
diff --git a/ber/new/dump.go b/ber/new/dump.go
index 787ba11..9fc206e 100644
--- a/ber/new/dump.go
+++ b/ber/new/dump.go
@@ -12,9 +12,30 @@ func (s *state) dump(indent int) string {
if s.Len() == 0 {
return ""
}
- fmt.Println(s.Len(), s.Bytes())
- h := s.ident()
- fmt.Printf("%*s%v\n", 2*indent, "", h)
- s.subState().dump(indent + 1)
+ //fmt.Printf("%*s%x %x\n", 2*indent, "", s.Len(), s.Bytes())
+ for s.Len() > 0 {
+ h := s.ident()
+ fmt.Printf("%*s%v: ", 2*indent, "", h)
+ if h.Class == classUniversal && h.Kind == kindPrimitive {
+ switch h.Tag {
+ case tagInteger, tagEnumerated:
+ fmt.Println(s.unmarshalInt())
+ case tagBoolean:
+ fmt.Println(s.unmarshalBool())
+ case tagObjectIdentifier:
+ fmt.Println(s.unmarshalOID())
+ case tagBitString:
+ fmt.Println(s.unmarshalBitString())
+ case tagIA5String, tagOctetString:
+ fmt.Println(s.unmarshalString())
+ default:
+ fmt.Println("")
+ s.next()
+ }
+ } else {
+ fmt.Println("")
+ s.subState().dump(indent + 1)
+ }
+ }
return s.dump(indent)
}