diff --git a/control.go b/control.go index 331ec38..eeccb4f 100644 --- a/control.go +++ b/control.go @@ -523,7 +523,7 @@ func DecodeControl(packet *ber.Packet) (Control, error) { return NewControlSubtreeDelete(), nil case ControlTypeDirSync: value.Description += " (DirSync)" - return NewControlDirSyncForDecode(value) + return NewResponseControlDirSync(value) case ControlTypeSyncState: value.Description += " (Sync State)" valueChildren, err := ber.DecodePacketErr(value.Data.Bytes()) @@ -624,8 +624,8 @@ type ControlDirSync struct { Cookie []byte } -// NewControlDirSyncForEncode returns a dir sync control -func NewControlDirSyncForEncode( +// NewRequestControlDirSync returns a dir sync control +func NewRequestControlDirSync( flags int64, maxAttrCount int64, cookie []byte, ) *ControlDirSync { return &ControlDirSync{ @@ -636,8 +636,8 @@ func NewControlDirSyncForEncode( } } -// NewControlDirSyncForDecode returns a dir sync control -func NewControlDirSyncForDecode(value *ber.Packet) (*ControlDirSync, error) { +// NewResponseControlDirSync returns a dir sync control +func NewResponseControlDirSync(value *ber.Packet) (*ControlDirSync, error) { if value.Value != nil { valueChildren, err := ber.DecodePacketErr(value.Data.Bytes()) if err != nil { diff --git a/control_test.go b/control_test.go index 90b2ab0..118f964 100644 --- a/control_test.go +++ b/control_test.go @@ -44,8 +44,8 @@ func TestControlString(t *testing.T) { } func TestControlDirSync(t *testing.T) { - runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil)) - runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!"))) + runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil)) + runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!"))) } func runControlTest(t *testing.T, originalControl Control) { @@ -122,7 +122,7 @@ func TestDescribeControlString(t *testing.T) { } func TestDescribeControlDirSync(t *testing.T) { - runAddControlDescriptions(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value") + runAddControlDescriptions(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value") } func runAddControlDescriptions(t *testing.T, originalControl Control, childDescriptions ...string) { diff --git a/search.go b/search.go index 665428e..ca86cc9 100644 --- a/search.go +++ b/search.go @@ -638,7 +638,7 @@ func (l *Conn) DirSync( ) (*SearchResult, error) { control := FindControl(searchRequest.Controls, ControlTypeDirSync) if control == nil { - c := NewControlDirSyncForEncode(flags, maxAttrCount, cookie) + c := NewRequestControlDirSync(flags, maxAttrCount, cookie) searchRequest.Controls = append(searchRequest.Controls, c) } else { c := control.(*ControlDirSync) @@ -680,7 +680,7 @@ func (l *Conn) DirSyncAsync( ctx context.Context, searchRequest *SearchRequest, bufferSize int, flags, maxAttrCount int64, cookie []byte, ) Response { - control := NewControlDirSyncForEncode(flags, maxAttrCount, cookie) + control := NewRequestControlDirSync(flags, maxAttrCount, cookie) searchRequest.Controls = append(searchRequest.Controls, control) r := newSearchResponse(l, bufferSize) r.start(ctx, searchRequest) diff --git a/v3/control.go b/v3/control.go index 2ac1a1d..1f6a6fc 100644 --- a/v3/control.go +++ b/v3/control.go @@ -534,7 +534,7 @@ func DecodeControl(packet *ber.Packet) (Control, error) { return NewControlServerSideSortingResult(value) case ControlTypeDirSync: value.Description += " (DirSync)" - return NewControlDirSyncForDecode(value) + return NewResponseControlDirSync(value) case ControlTypeSyncState: value.Description += " (Sync State)" valueChildren, err := ber.DecodePacketErr(value.Data.Bytes()) @@ -635,8 +635,8 @@ type ControlDirSync struct { Cookie []byte } -// NewControlDirSyncForEncode returns a dir sync control -func NewControlDirSyncForEncode( +// NewRequestControlDirSync returns a dir sync control +func NewRequestControlDirSync( flags int64, maxAttrCount int64, cookie []byte, ) *ControlDirSync { return &ControlDirSync{ @@ -647,8 +647,8 @@ func NewControlDirSyncForEncode( } } -// NewControlDirSyncForDecode returns a dir sync control -func NewControlDirSyncForDecode(value *ber.Packet) (*ControlDirSync, error) { +// NewResponseControlDirSync returns a dir sync control +func NewResponseControlDirSync(value *ber.Packet) (*ControlDirSync, error) { if value.Value != nil { valueChildren, err := ber.DecodePacketErr(value.Data.Bytes()) if err != nil { diff --git a/v3/control_test.go b/v3/control_test.go index 14a9bd4..5f43ccb 100644 --- a/v3/control_test.go +++ b/v3/control_test.go @@ -44,8 +44,8 @@ func TestControlString(t *testing.T) { } func TestControlDirSync(t *testing.T) { - runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil)) - runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!"))) + runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil)) + runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!"))) } func runControlTest(t *testing.T, originalControl Control) { @@ -122,7 +122,7 @@ func TestDescribeControlString(t *testing.T) { } func TestDescribeControlDirSync(t *testing.T) { - runAddControlDescriptions(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value") + runAddControlDescriptions(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value") } func runAddControlDescriptions(t *testing.T, originalControl Control, childDescriptions ...string) { diff --git a/v3/search.go b/v3/search.go index 22e1c72..4eb1076 100644 --- a/v3/search.go +++ b/v3/search.go @@ -640,7 +640,7 @@ func (l *Conn) DirSync( ) (*SearchResult, error) { control := FindControl(searchRequest.Controls, ControlTypeDirSync) if control == nil { - c := NewControlDirSyncForEncode(flags, maxAttrCount, cookie) + c := NewRequestControlDirSync(flags, maxAttrCount, cookie) searchRequest.Controls = append(searchRequest.Controls, c) } else { c := control.(*ControlDirSync) @@ -682,7 +682,7 @@ func (l *Conn) DirSyncAsync( ctx context.Context, searchRequest *SearchRequest, bufferSize int, flags, maxAttrCount int64, cookie []byte, ) Response { - control := NewControlDirSyncForEncode(flags, maxAttrCount, cookie) + control := NewRequestControlDirSync(flags, maxAttrCount, cookie) searchRequest.Controls = append(searchRequest.Controls, control) r := newSearchResponse(l, bufferSize) r.start(ctx, searchRequest)