aboutsummaryrefslogtreecommitdiff
path: root/goldap/filter_not.go
blob: 35726ac666b5c51976557f16f44368560ea77242 (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
package message

import "fmt"

func (filterNot FilterNot) getFilterTag() int {
	return TagFilterNot
}

//             not             [2] Filter,
func (filterNot FilterNot) size() (size int) {
	size = filterNot.Filter.size()
	size += sizeTagAndLength(tagSequence, size)
	return
}

func (filterNot *FilterNot) readComponents(bytes *Bytes) (err error) {
	filterNot.Filter, err = readFilter(bytes)
	if err != nil {
		err = LdapError{fmt.Sprintf("readComponents:\n%s", err.Error())}
		return
	}
	return
}

//             not             [2] Filter,
func (filterNot FilterNot) write(bytes *Bytes) (size int) {
	size = filterNot.Filter.write(bytes)
	size += bytes.WriteTagAndLength(classContextSpecific, isCompound, TagFilterNot, size)
	return
}

//             not             [2] Filter,
func readFilterNot(bytes *Bytes) (filternot FilterNot, err error) {
	err = bytes.ReadSubBytes(classContextSpecific, TagFilterNot, filternot.readComponents)
	if err != nil {
		err = LdapError{fmt.Sprintf("readFilterNot:\n%s", err.Error())}
		return
	}
	return
}