aboutsummaryrefslogtreecommitdiff
path: root/ber
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-09-25 21:00:18 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-09-25 21:00:18 +0200
commitf3676c95947644fcdf2499b03b4a837910545395 (patch)
tree674acea4f146ccd4f7e4910d69cbb997ed86b7b5 /ber
parent511cf41a779929b5c81b7429c37dc11bd9544182 (diff)
zzz...
Diffstat (limited to 'ber')
-rw-r--r--ber/new/dump.go30
1 files changed, 10 insertions, 20 deletions
diff --git a/ber/new/dump.go b/ber/new/dump.go
index 5baaf1e..f3ba672 100644
--- a/ber/new/dump.go
+++ b/ber/new/dump.go
@@ -12,32 +12,22 @@ func Dump(b []byte) string {
}
func (s *state) dump(ident int) string {
+ if s.Len() == 0 {
+ return ""
+ }
h := s.ident()
fmt.Printf("%*s", 2*ident, "")
fmt.Printf("%v %x\n", h, s.Bytes())
if h.Kind == kindConstructed {
- s.subState().dump(ident + 1)
+ return s.subState().dump(ident + 1)
}
- if h.Class == classUniversal {
- /*
- switch h.Tag {
- case tagInteger:
- fmt.Println(h.Tag, s.unmarshalInt())
- case tagObjectIdentifier:
- fmt.Println(h.Tag, s.unmarshalOID())
- case tagBitString:
- fmt.Println(h.Tag, s.unmarshalBitString())
- case tagIA5String, tagOctetString:
- fmt.Println(h.Tag, s.unmarshalString())
- case tagBoolean:
- fmt.Println(h.Tag, s.unmarshalBool())
- default:
- fmt.Println(h.Tag, s.next())
- }
- */
+ switch h.Tag {
+ case tagInteger:
+ fmt.Println(h.Tag, s.unmarshalInt())
+ // here be dragons
}
- if s.Len() > 0 {
- s.subState().dump(ident)
+ for s.Len() > 0 {
+ s.dump(ident)
}
return ""
}