aboutsummaryrefslogtreecommitdiff
path: root/ber/class.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/class.go')
-rw-r--r--ber/class.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/ber/class.go b/ber/class.go
index 04a796a..f2915fe 100644
--- a/ber/class.go
+++ b/ber/class.go
@@ -34,7 +34,7 @@ var kindNames = map[Kind]string{
func (k Kind) String() string { return kindNames[k] }
-type Tag byte
+type Tag int
const (
EOT Tag = iota
@@ -105,6 +105,14 @@ var tagNames = map[Tag]string{
func (t Tag) String() string { return tagNames[t] }
-func Ident(b byte) (Class, Kind, Tag) {
- return Class(b) & classMask, Kind(b) & kindMask, Tag(b) & tagMask
+func Ident(b []byte) (Class, Kind, Tag, int) {
+ var d, n int
+ c := Class(b[0]) & classMask
+ k := Kind(b[0]) & kindMask
+ t := Tag(b[0]) & tagMask
+ if t == tagMask {
+ d, n = debase128(b[1:])
+ t = Tag(d)
+ }
+ return c, k, t, n + 1
}