diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-09-16 13:41:01 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-09-16 13:41:01 +0200 |
commit | 477d7014edc787ba9a977acd19fcbfc55531768b (patch) | |
tree | ac8b65be8634fa9526cd727da60893244d11e88a /goldap/message_id.go | |
parent | a53641e773730ba171df2602c8d199968d6e6447 (diff) | |
download | bottin-477d7014edc787ba9a977acd19fcbfc55531768b.tar.gz bottin-477d7014edc787ba9a977acd19fcbfc55531768b.zip |
Vendor goldap
Diffstat (limited to 'goldap/message_id.go')
-rw-r--r-- | goldap/message_id.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/goldap/message_id.go b/goldap/message_id.go new file mode 100644 index 0000000..05c7157 --- /dev/null +++ b/goldap/message_id.go @@ -0,0 +1,46 @@ +package message + +import "fmt" + +func readTaggedMessageID(bytes *Bytes, class int, tag int) (ret MessageID, err error) { + var integer INTEGER + integer, err = readTaggedPositiveINTEGER(bytes, class, tag) + if err != nil { + err = LdapError{fmt.Sprintf("readTaggedMessageID:\n%s", err.Error())} + return + } + return MessageID(integer), err +} + +// MessageID ::= INTEGER (0 .. maxInt) +// +// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- +// +func readMessageID(bytes *Bytes) (ret MessageID, err error) { + return readTaggedMessageID(bytes, classUniversal, tagInteger) +} + +// MessageID ::= INTEGER (0 .. maxInt) +// +// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- +// +func (m MessageID) write(bytes *Bytes) int { + return INTEGER(m).write(bytes) +} +func (m MessageID) writeTagged(bytes *Bytes, class int, tag int) int { + return INTEGER(m).writeTagged(bytes, class, tag) +} + +// MessageID ::= INTEGER (0 .. maxInt) +// +// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- +// +func (m MessageID) size() int { + return INTEGER(m).size() +} +func (m MessageID) sizeTagged(tag int) int { + return INTEGER(m).sizeTagged(tag) +} +func (l MessageID) Int() int { + return int(l) +} |