aboutsummaryrefslogtreecommitdiff
path: root/goldap/assertion_value.go
blob: 89706a0b108b1c0995ffe4b87e2e775d12127b43 (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
package message

import "fmt"

//
//        AssertionValue ::= OCTET STRING

func readAssertionValue(bytes *Bytes) (assertionvalue AssertionValue, err error) {
	var octetstring OCTETSTRING
	octetstring, err = readOCTETSTRING(bytes)
	if err != nil {
		err = LdapError{fmt.Sprintf("readAssertionValue:\n%s", err.Error())}
		return
	}
	assertionvalue = AssertionValue(octetstring)
	return
}

func readTaggedAssertionValue(bytes *Bytes, class int, tag int) (assertionvalue AssertionValue, err error) {
	var octetstring OCTETSTRING
	octetstring, err = readTaggedOCTETSTRING(bytes, class, tag)
	if err != nil {
		err = LdapError{fmt.Sprintf("readTaggedAssertionValue:\n%s", err.Error())}
		return
	}
	assertionvalue = AssertionValue(octetstring)
	return
}

func (assertion AssertionValue) size() int {
	return OCTETSTRING(assertion).size()
}

func (assertion AssertionValue) sizeTagged(tag int) int {
	return OCTETSTRING(assertion).sizeTagged(tag)
}

func (assertion AssertionValue) write(bytes *Bytes) int {
	return OCTETSTRING(assertion).write(bytes)
}

func (assertion AssertionValue) writeTagged(bytes *Bytes, class int, tag int) int {
	return OCTETSTRING(assertion).writeTagged(bytes, class, tag)
}