5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 08:41:36 +00:00
matterbridge/vendor/github.com/go-asn1-ber/asn1-ber/util.go

25 lines
452 B
Go
Raw Normal View History

2020-08-09 22:29:54 +00:00
package ber
import "io"
func readByte(reader io.Reader) (byte, error) {
2020-10-19 21:40:00 +00:00
bytes := make([]byte, 1)
2020-08-09 22:29:54 +00:00
_, err := io.ReadFull(reader, bytes)
if err != nil {
if err == io.EOF {
return 0, io.ErrUnexpectedEOF
}
return 0, err
}
return bytes[0], nil
}
func isEOCPacket(p *Packet) bool {
return p != nil &&
p.Tag == TagEOC &&
p.ClassType == ClassUniversal &&
p.TagType == TypePrimitive &&
len(p.ByteValue) == 0 &&
len(p.Children) == 0
}