aboutsummaryrefslogtreecommitdiff
path: root/goldap/message_id.go
blob: 05c71571b3d1aabdb11d2fb9a06be92e9df5c70b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)
}