aboutsummaryrefslogtreecommitdiff
path: root/ber/class.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/class.go')
-rw-r--r--ber/class.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/ber/class.go b/ber/class.go
index f2915fe..0839c05 100644
--- a/ber/class.go
+++ b/ber/class.go
@@ -116,3 +116,13 @@ func Ident(b []byte) (Class, Kind, Tag, int) {
}
return c, k, t, n + 1
}
+
+func Length(b []byte) (int, int) {
+ if b[0] & 0x80 != 0 {
+ l := b[0] & 0x7f
+ i := unmarshalUint(b[1:l+1])
+ return int(i), int(l+1)
+ } else {
+ return int(b[0]), 1
+ }
+}