aboutsummaryrefslogtreecommitdiff
path: root/ldapserver/message.go
blob: f6e609ffc255b64cdc7f9668c7fdc64894f77b34 (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
47
48
49
50
51
52
53
54
55
package ldapserver

import (
	"fmt"

	ldap "github.com/lor00x/goldap/message"
)

type Message struct {
	*ldap.LDAPMessage
	Client *client
	Done   chan bool
}

func (m *Message) String() string {
	return fmt.Sprintf("MessageId=%d, %s", m.MessageID(), m.ProtocolOpName())
}

// Abandon close the Done channel, to notify handler's user function to stop any
// running process
func (m *Message) Abandon() {
	m.Done <- true
}

func (m *Message) GetAbandonRequest() ldap.AbandonRequest {
	return m.ProtocolOp().(ldap.AbandonRequest)
}

func (m *Message) GetSearchRequest() ldap.SearchRequest {
	return m.ProtocolOp().(ldap.SearchRequest)
}

func (m *Message) GetBindRequest() ldap.BindRequest {
	return m.ProtocolOp().(ldap.BindRequest)
}

func (m *Message) GetAddRequest() ldap.AddRequest {
	return m.ProtocolOp().(ldap.AddRequest)
}

func (m *Message) GetDeleteRequest() ldap.DelRequest {
	return m.ProtocolOp().(ldap.DelRequest)
}

func (m *Message) GetModifyRequest() ldap.ModifyRequest {
	return m.ProtocolOp().(ldap.ModifyRequest)
}

func (m *Message) GetCompareRequest() ldap.CompareRequest {
	return m.ProtocolOp().(ldap.CompareRequest)
}

func (m *Message) GetExtendedRequest() ldap.ExtendedRequest {
	return m.ProtocolOp().(ldap.ExtendedRequest)
}