aboutsummaryrefslogtreecommitdiff
path: root/goldap/unbind_request.go
blob: 57f49e5e96a6535886d60a2d072b4b825c6b418b (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
package message

import "fmt"

//
//        UnbindRequest ::= [APPLICATION 2] NULL
func readUnbindRequest(bytes *Bytes) (unbindrequest UnbindRequest, err error) {
	var tagAndLength TagAndLength
	tagAndLength, err = bytes.ParseTagAndLength()
	if err != nil {
		err = LdapError{fmt.Sprintf("readUnbindRequest:\n%s", err.Error())}
		return
	}
	err = tagAndLength.Expect(classApplication, TagUnbindRequest, isNotCompound)
	if err != nil {
		err = LdapError{fmt.Sprintf("readUnbindRequest:\n%s", err.Error())}
		return
	}
	if tagAndLength.Length != 0 {
		err = LdapError{"readUnbindRequest: expecting NULL"}
		return
	}
	return
}

//
//        UnbindRequest ::= [APPLICATION 2] NULL
func (u UnbindRequest) write(bytes *Bytes) (size int) {
	size += bytes.WriteTagAndLength(classApplication, isNotCompound, TagUnbindRequest, 0)
	return
}

//
//        UnbindRequest ::= [APPLICATION 2] NULL
func (u UnbindRequest) size() (size int) {
	size = sizeTagAndLength(TagUnbindRequest, 0)
	return
}