Skip to content

Commit 8e276e7

Browse files
committed
Rename the function name to the term 'request controls' and 'response controls'
1 parent f807f31 commit 8e276e7

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

control.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
523523
return NewControlSubtreeDelete(), nil
524524
case ControlTypeDirSync:
525525
value.Description += " (DirSync)"
526-
return NewControlDirSyncForDecode(value)
526+
return NewResponseControlDirSync(value)
527527
case ControlTypeSyncState:
528528
value.Description += " (Sync State)"
529529
valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
@@ -624,8 +624,8 @@ type ControlDirSync struct {
624624
Cookie []byte
625625
}
626626

627-
// NewControlDirSyncForEncode returns a dir sync control
628-
func NewControlDirSyncForEncode(
627+
// NewRequestControlDirSync returns a dir sync control
628+
func NewRequestControlDirSync(
629629
flags int64, maxAttrCount int64, cookie []byte,
630630
) *ControlDirSync {
631631
return &ControlDirSync{
@@ -636,8 +636,8 @@ func NewControlDirSyncForEncode(
636636
}
637637
}
638638

639-
// NewControlDirSyncForDecode returns a dir sync control
640-
func NewControlDirSyncForDecode(value *ber.Packet) (*ControlDirSync, error) {
639+
// NewResponseControlDirSync returns a dir sync control
640+
func NewResponseControlDirSync(value *ber.Packet) (*ControlDirSync, error) {
641641
if value.Value != nil {
642642
valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
643643
if err != nil {

control_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func TestControlString(t *testing.T) {
4444
}
4545

4646
func TestControlDirSync(t *testing.T) {
47-
runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil))
48-
runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!")))
47+
runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil))
48+
runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!")))
4949
}
5050

5151
func runControlTest(t *testing.T, originalControl Control) {
@@ -122,7 +122,7 @@ func TestDescribeControlString(t *testing.T) {
122122
}
123123

124124
func TestDescribeControlDirSync(t *testing.T) {
125-
runAddControlDescriptions(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value")
125+
runAddControlDescriptions(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value")
126126
}
127127

128128
func runAddControlDescriptions(t *testing.T, originalControl Control, childDescriptions ...string) {

search.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ func (l *Conn) DirSync(
638638
) (*SearchResult, error) {
639639
control := FindControl(searchRequest.Controls, ControlTypeDirSync)
640640
if control == nil {
641-
c := NewControlDirSyncForEncode(flags, maxAttrCount, cookie)
641+
c := NewRequestControlDirSync(flags, maxAttrCount, cookie)
642642
searchRequest.Controls = append(searchRequest.Controls, c)
643643
} else {
644644
c := control.(*ControlDirSync)
@@ -680,7 +680,7 @@ func (l *Conn) DirSyncAsync(
680680
ctx context.Context, searchRequest *SearchRequest, bufferSize int,
681681
flags, maxAttrCount int64, cookie []byte,
682682
) Response {
683-
control := NewControlDirSyncForEncode(flags, maxAttrCount, cookie)
683+
control := NewRequestControlDirSync(flags, maxAttrCount, cookie)
684684
searchRequest.Controls = append(searchRequest.Controls, control)
685685
r := newSearchResponse(l, bufferSize)
686686
r.start(ctx, searchRequest)

v3/control.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
534534
return NewControlServerSideSortingResult(value)
535535
case ControlTypeDirSync:
536536
value.Description += " (DirSync)"
537-
return NewControlDirSyncForDecode(value)
537+
return NewResponseControlDirSync(value)
538538
case ControlTypeSyncState:
539539
value.Description += " (Sync State)"
540540
valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
@@ -635,8 +635,8 @@ type ControlDirSync struct {
635635
Cookie []byte
636636
}
637637

638-
// NewControlDirSyncForEncode returns a dir sync control
639-
func NewControlDirSyncForEncode(
638+
// NewRequestControlDirSync returns a dir sync control
639+
func NewRequestControlDirSync(
640640
flags int64, maxAttrCount int64, cookie []byte,
641641
) *ControlDirSync {
642642
return &ControlDirSync{
@@ -647,8 +647,8 @@ func NewControlDirSyncForEncode(
647647
}
648648
}
649649

650-
// NewControlDirSyncForDecode returns a dir sync control
651-
func NewControlDirSyncForDecode(value *ber.Packet) (*ControlDirSync, error) {
650+
// NewResponseControlDirSync returns a dir sync control
651+
func NewResponseControlDirSync(value *ber.Packet) (*ControlDirSync, error) {
652652
if value.Value != nil {
653653
valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
654654
if err != nil {

v3/control_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func TestControlString(t *testing.T) {
4444
}
4545

4646
func TestControlDirSync(t *testing.T) {
47-
runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil))
48-
runControlTest(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!")))
47+
runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil))
48+
runControlTest(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, []byte("I'm a cookie!")))
4949
}
5050

5151
func runControlTest(t *testing.T, originalControl Control) {
@@ -122,7 +122,7 @@ func TestDescribeControlString(t *testing.T) {
122122
}
123123

124124
func TestDescribeControlDirSync(t *testing.T) {
125-
runAddControlDescriptions(t, NewControlDirSyncForEncode(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value")
125+
runAddControlDescriptions(t, NewRequestControlDirSync(DirSyncObjectSecurity, 1000, nil), "Control Type (DirSync)", "Criticality", "Control Value")
126126
}
127127

128128
func runAddControlDescriptions(t *testing.T, originalControl Control, childDescriptions ...string) {

v3/search.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ func (l *Conn) DirSync(
640640
) (*SearchResult, error) {
641641
control := FindControl(searchRequest.Controls, ControlTypeDirSync)
642642
if control == nil {
643-
c := NewControlDirSyncForEncode(flags, maxAttrCount, cookie)
643+
c := NewRequestControlDirSync(flags, maxAttrCount, cookie)
644644
searchRequest.Controls = append(searchRequest.Controls, c)
645645
} else {
646646
c := control.(*ControlDirSync)
@@ -682,7 +682,7 @@ func (l *Conn) DirSyncAsync(
682682
ctx context.Context, searchRequest *SearchRequest, bufferSize int,
683683
flags, maxAttrCount int64, cookie []byte,
684684
) Response {
685-
control := NewControlDirSyncForEncode(flags, maxAttrCount, cookie)
685+
control := NewRequestControlDirSync(flags, maxAttrCount, cookie)
686686
searchRequest.Controls = append(searchRequest.Controls, control)
687687
r := newSearchResponse(l, bufferSize)
688688
r.start(ctx, searchRequest)

0 commit comments

Comments
 (0)