-
Notifications
You must be signed in to change notification settings - Fork 2
/
dltm.go
2935 lines (2861 loc) · 92 KB
/
dltm.go
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// The dltm package implements the DLTM client protocol.
//
// # Introduction
//
// This document specifies the Distributed Link Tracking: Central Manager Protocol.
//
// Distributed Link Tracking (DLT) consists of two protocols that work together to discover
// the new location of a file that has moved. DLT can determine whether the file has
// moved on a mass-storage device, within a computer, or between computers in a network.
// In addition to the Distributed Link Tracking: Central Manager Protocol, DLT includes
// the Distributed Link Tracking: Workstation Protocol, as specified in [MS-DLTW], which
// is used to determine a file's current location. Both DLT protocols are remote procedure
// call (RPC) interfaces.
//
// # Overview
//
// The Distributed Link Tracking: Central Manager Protocol is based on the Remote Procedure
// Call Protocol Extensions, as specified in [MS-RPCE]. The primary purpose of this
// protocol is to allow clients of the Distributed Link Tracking: Workstation Protocol
// to determine the correct server to contact when searching for a file. To accomplish
// this, the Distributed Link Tracking (DLT) Central Manager server accepts notifications
// of file and volume moves, in addition to other relevant information from participating
// computers. This information can be queried by clients to get the file's current location
// in UNC form.
//
// The following is a scenario of this protocol working together with the Distributed
// Link Tracking: Workstation Protocol:
//
// * A file is created on computer M1. M1 assigns identifiers, specifically FileID (
// a45c8c1a-fb81-4a65-a3f1-82d471da2197#gt_3b097896-b707-47b5-b1bb-384867a453ea ) and
// FileLocation ( a45c8c1a-fb81-4a65-a3f1-82d471da2197#gt_d0fe4e63-48a5-4d63-9d51-d4f99306046e
// ) , to the file.
//
// * Computer M0 makes note of the file, locally storing its identifiers.
//
// * The file is moved from computer M1 to M2 and from there to M3. In conjunction with
// these moves, the file maintains its FileID value, but a new FileLocation identifier
// is assigned.
//
// * To find the file in its new location, M0 contacts a DLT Central Manager server
// to query the current location of the file.
//
// * The DLT Central Manager server queries its tables, and determines that the file
// is currently on computer M3.
//
// * M0 contacts the Distributed Link Tracking: Central Manager Protocol on M3, and
// learns the file's new name and location.
//
// The following diagram shows the machine configuration for this example. The list
// after the diagram walks through the scenario, and describes in more detail how the
// Distributed Link Tracking: Central Manager Protocol is used.
package dltm
import (
"context"
"fmt"
"strings"
"unicode/utf16"
dcerpc "github.com/oiweiwei/go-msrpc/dcerpc"
errors "github.com/oiweiwei/go-msrpc/dcerpc/errors"
uuid "github.com/oiweiwei/go-msrpc/midl/uuid"
dltw "github.com/oiweiwei/go-msrpc/msrpc/dltw"
dtyp "github.com/oiweiwei/go-msrpc/msrpc/dtyp"
ndr "github.com/oiweiwei/go-msrpc/ndr"
)
var (
_ = context.Background
_ = fmt.Errorf
_ = utf16.Encode
_ = strings.TrimPrefix
_ = ndr.ZeroString
_ = (*uuid.UUID)(nil)
_ = (*dcerpc.SyntaxID)(nil)
_ = (*errors.Error)(nil)
_ = dltw.GoPackage
_ = dtyp.GoPackage
)
var (
// import guard
GoPackage = "dltm"
)
// VolumeSecret structure represents CVolumeSecret RPC structure.
//
// The CVolumeSecret type stores a VolumeSecret value, which is used to authenticate
// a VolumeOwner value. For an example, see section 3.1.4.4.1, which describes the processing
// of a CLAIM_VOLUME message.
type VolumeSecret struct {
// _abSecret: An 8-byte volume password. The content of these bytes is arbitrary and
// is generated by the client. See section 3.2.5.3 for an example of where this value
// is used.
Secret []byte `idl:"name:_abSecret" json:"secret"`
}
func (o *VolumeSecret) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *VolumeSecret) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
for i1 := range o.Secret {
i1 := i1
if uint64(i1) >= 8 {
break
}
if err := w.WriteData(o.Secret[i1]); err != nil {
return err
}
}
for i1 := len(o.Secret); uint64(i1) < 8; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *VolumeSecret) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
o.Secret = make([]byte, 8)
for i1 := range o.Secret {
i1 := i1
if err := w.ReadData(&o.Secret[i1]); err != nil {
return err
}
}
return nil
}
// OldFileTrackingInformation structure represents old_TRK_FILE_TRACKING_INFORMATION RPC structure.
//
// The old_TRK_FILE_TRACKING_INFORMATION structure is unused, but is included in this
// protocol because it affects the definition of the TRKSVR_MESSAGE_UNION, as defined
// in section 2.2.13.
type OldFileTrackingInformation struct {
FilePath []uint16 `idl:"name:tszFilePath" json:"file_path"`
Birth *dltw.DomainRelativeObjectID `idl:"name:droidBirth" json:"birth"`
LastObjectID *dltw.DomainRelativeObjectID `idl:"name:droidLast" json:"last_object_id"`
HResult int32 `idl:"name:hr" json:"hresult"`
}
func (o *OldFileTrackingInformation) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *OldFileTrackingInformation) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
for i1 := range o.FilePath {
i1 := i1
if uint64(i1) >= 257 {
break
}
if err := w.WriteData(o.FilePath[i1]); err != nil {
return err
}
}
for i1 := len(o.FilePath); uint64(i1) < 257; i1++ {
if err := w.WriteData(uint16(0)); err != nil {
return err
}
}
if o.Birth != nil {
if err := o.Birth.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if o.LastObjectID != nil {
if err := o.LastObjectID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if err := w.WriteData(o.HResult); err != nil {
return err
}
return nil
}
func (o *OldFileTrackingInformation) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
o.FilePath = make([]uint16, 257)
for i1 := range o.FilePath {
i1 := i1
if err := w.ReadData(&o.FilePath[i1]); err != nil {
return err
}
}
if o.Birth == nil {
o.Birth = &dltw.DomainRelativeObjectID{}
}
if err := o.Birth.UnmarshalNDR(ctx, w); err != nil {
return err
}
if o.LastObjectID == nil {
o.LastObjectID = &dltw.DomainRelativeObjectID{}
}
if err := o.LastObjectID.UnmarshalNDR(ctx, w); err != nil {
return err
}
if err := w.ReadData(&o.HResult); err != nil {
return err
}
return nil
}
// FileTrackingInformation structure represents TRK_FILE_TRACKING_INFORMATION RPC structure.
//
// The TRK_FILE_TRACKING_INFORMATION structure is used in a SEARCH message of a LnkSvrMessage
// method call to search for the current location of a file. This structure contains
// information about a file that is being tracked. See section 2.2.11 for more information
// about the SEARCH message. See section 3.2.6.3 for an example of how the TRK_FILE_TRACKING_INFORMATION
// structure is used.
type FileTrackingInformation struct {
// droidBirth: The FileID of the file for which the location is being requested. For
// details on this structure, see [MS-DLTW] section 2.2.3.
Birth *dltw.DomainRelativeObjectID `idl:"name:droidBirth" json:"birth"`
// droidLast: On input, the last FileLocation that the client knew of for the file.
// On output, this member contains the file's current FileLocation.
LastObjectID *dltw.DomainRelativeObjectID `idl:"name:droidLast" json:"last_object_id"`
// mcidLast: On completion of the SEARCH request, this member is returned by the server
// to indicate the MachineID of the VolumeOwner of the VolumeID component of the droidLast
// field. The CMachineId type is specified in [MS-DLTW] section 2.2.2.
LastMachineID *dltw.MachineID `idl:"name:mcidLast" json:"last_machine_id"`
// hr: Return value that indicates the success or failure of this message. The type
// of this field is an HRESULT but, unlike the standard definition, only zero is a successful
// return value for this field. Any nonzero value MUST be treated identically as a failure
// value.
HResult int32 `idl:"name:hr" json:"hresult"`
}
func (o *FileTrackingInformation) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *FileTrackingInformation) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
if o.Birth != nil {
if err := o.Birth.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if o.LastObjectID != nil {
if err := o.LastObjectID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if o.LastMachineID != nil {
if err := o.LastMachineID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.MachineID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if err := w.WriteData(o.HResult); err != nil {
return err
}
return nil
}
func (o *FileTrackingInformation) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if o.Birth == nil {
o.Birth = &dltw.DomainRelativeObjectID{}
}
if err := o.Birth.UnmarshalNDR(ctx, w); err != nil {
return err
}
if o.LastObjectID == nil {
o.LastObjectID = &dltw.DomainRelativeObjectID{}
}
if err := o.LastObjectID.UnmarshalNDR(ctx, w); err != nil {
return err
}
if o.LastMachineID == nil {
o.LastMachineID = &dltw.MachineID{}
}
if err := o.LastMachineID.UnmarshalNDR(ctx, w); err != nil {
return err
}
if err := w.ReadData(&o.HResult); err != nil {
return err
}
return nil
}
// OldCallSearch structure represents old_TRKSVR_CALL_SEARCH RPC structure.
//
// The old_TRKSVR_CALL_SEARCH structure is unused but is included in this protocol because
// it affects the definition of the TRKSVR_MESSAGE_UNION, as defined in section 2.2.13.
type OldCallSearch struct {
SearchCount uint32 `idl:"name:cSearch" json:"search_count"`
Searches []*OldFileTrackingInformation `idl:"name:pSearches;size_is:(cSearch)" json:"searches"`
}
func (o *OldCallSearch) xxx_PreparePayload(ctx context.Context) error {
if o.Searches != nil && o.SearchCount == 0 {
o.SearchCount = uint32(len(o.Searches))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *OldCallSearch) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if err := w.WriteData(o.SearchCount); err != nil {
return err
}
if o.Searches != nil || o.SearchCount > 0 {
_ptr_pSearches := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.SearchCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Searches {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Searches[i1] != nil {
if err := o.Searches[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&OldFileTrackingInformation{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Searches); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&OldFileTrackingInformation{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Searches, _ptr_pSearches); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *OldCallSearch) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.SearchCount); err != nil {
return err
}
_ptr_pSearches := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.SearchCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.SearchCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Searches", sizeInfo[0])
}
o.Searches = make([]*OldFileTrackingInformation, sizeInfo[0])
for i1 := range o.Searches {
i1 := i1
if o.Searches[i1] == nil {
o.Searches[i1] = &OldFileTrackingInformation{}
}
if err := o.Searches[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_pSearches := func(ptr interface{}) { o.Searches = *ptr.(*[]*OldFileTrackingInformation) }
if err := w.ReadPointer(&o.Searches, _s_pSearches, _ptr_pSearches); err != nil {
return err
}
return nil
}
// CallSearch structure represents TRKSVR_CALL_SEARCH RPC structure.
//
// The TRKSVR_CALL_SEARCH structure is used in LnkSvrMessage method calls that specify
// a SEARCH message (see section 2.2.11), to query the DLT Central Manager server for
// the location of a file. See section 3.2.6.3 for an example of client use of this
// structure.
type CallSearch struct {
// cSearch: This value MUST be set to one.
SearchCount uint32 `idl:"name:cSearch" json:"search_count"`
// pSearches: A pointer to a single search request. See TRK_FILE_TRACKING_INFORMATION
// (section 2.2.8).
Searches []*FileTrackingInformation `idl:"name:pSearches;size_is:(cSearch)" json:"searches"`
}
func (o *CallSearch) xxx_PreparePayload(ctx context.Context) error {
if o.Searches != nil && o.SearchCount == 0 {
o.SearchCount = uint32(len(o.Searches))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *CallSearch) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if err := w.WriteData(o.SearchCount); err != nil {
return err
}
if o.Searches != nil || o.SearchCount > 0 {
_ptr_pSearches := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.SearchCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Searches {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Searches[i1] != nil {
if err := o.Searches[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&FileTrackingInformation{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Searches); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&FileTrackingInformation{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Searches, _ptr_pSearches); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *CallSearch) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.SearchCount); err != nil {
return err
}
_ptr_pSearches := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.SearchCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.SearchCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Searches", sizeInfo[0])
}
o.Searches = make([]*FileTrackingInformation, sizeInfo[0])
for i1 := range o.Searches {
i1 := i1
if o.Searches[i1] == nil {
o.Searches[i1] = &FileTrackingInformation{}
}
if err := o.Searches[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_pSearches := func(ptr interface{}) { o.Searches = *ptr.(*[]*FileTrackingInformation) }
if err := w.ReadPointer(&o.Searches, _s_pSearches, _ptr_pSearches); err != nil {
return err
}
return nil
}
// CallMoveNotification structure represents TRKSVR_CALL_MOVE_NOTIFICATION RPC structure.
//
// The TRKSVR_CALL_MOVE_NOTIFICATION structure is used in LnkSvrMessage method calls
// that specify a MOVE_NOTIFICATION message (see section 2.2.11), to indicate when one
// or more files have been moved off a volume. See section 3.2.6.1 for an example of
// the client using this structure.
type CallMoveNotification struct {
// cNotifications: This field MUST contain the number of move notifications that were
// received.
NotificationsCount uint32 `idl:"name:cNotifications" json:"notifications_count"`
// cProcessed: On return to the client, this field MUST indicate the number of notifications
// from the request message that were actually processed.
ProcessedCount uint32 `idl:"name:cProcessed" json:"processed_count"`
// seq: This field MUST be set by the client to the VolumeSequenceNumber for this VolumeID.
// This value is used by the client and server to detect whether or not notifications
// have been lost. For information about sequence numbering, see sections 3.1.4.2 and
// 3.2.4.2.
Seq int32 `idl:"name:seq" json:"seq"`
// fForceSeqNumber: This field MUST be set by the client to indicate whether the seq
// value is to be ignored. If set, seq MUST be ignored. Sequence numbering is as specified
// in sections 3.1.4.2 and 3.2.4.2.
ForceSeqNumber int32 `idl:"name:fForceSeqNumber" json:"force_seq_number"`
// pvolid: This field MUST contain the VolumeID, which indicates the volume from which
// the files in this notification were moved. CVolumeId is as specified in [MS-DLTW]
// section 2.2.4.
Volume *dltw.VolumeID `idl:"name:pvolid" json:"volume"`
// rgobjidCurrent: This field MUST contain an array of ObjectIDs with the ObjectID
// for each file that was moved. CObjId is as specified in [MS-DLTW] section 2.2.5.
// Note that the previous FileLocation of each of the moved files MUST be determined
// by composing the VolumeID from the pvolid value with each of the entries in the rgobjidCurrent
// array.
Current []*dltw.ObjectID `idl:"name:rgobjidCurrent;size_is:(cNotifications)" json:"current"`
// rgdroidBirth: This field MUST contain an array of FileIDs with the FileID for each
// file that was moved in this request. Each element in the rgdroidBirth array corresponds
// to the entry with the same index in the rgobjidCurrent array. CDomainRelativeObjId
// is as specified in [MS-DLTW] section 2.2.3.
Birth []*dltw.DomainRelativeObjectID `idl:"name:rgdroidBirth;size_is:(cNotifications)" json:"birth"`
// rgdroidNew: This field MUST contain an array of FileLocations, with the new FileLocation
// for each file that was moved in this request. Each element in the rgdroidNew array
// corresponds to the entry with the same index in the rgobjidCurrent and rgdroidBirth
// arrays.
New []*dltw.DomainRelativeObjectID `idl:"name:rgdroidNew;size_is:(cNotifications)" json:"new"`
}
func (o *CallMoveNotification) xxx_PreparePayload(ctx context.Context) error {
if o.Current != nil && o.NotificationsCount == 0 {
o.NotificationsCount = uint32(len(o.Current))
}
if o.Birth != nil && o.NotificationsCount == 0 {
o.NotificationsCount = uint32(len(o.Birth))
}
if o.New != nil && o.NotificationsCount == 0 {
o.NotificationsCount = uint32(len(o.New))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *CallMoveNotification) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if err := w.WriteData(o.NotificationsCount); err != nil {
return err
}
if err := w.WriteData(o.ProcessedCount); err != nil {
return err
}
if err := w.WriteData(o.Seq); err != nil {
return err
}
if err := w.WriteData(o.ForceSeqNumber); err != nil {
return err
}
if o.Volume != nil {
_ptr_pvolid := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.Volume != nil {
if err := o.Volume.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.VolumeID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Volume, _ptr_pvolid); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.Current != nil || o.NotificationsCount > 0 {
_ptr_rgobjidCurrent := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.NotificationsCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Current {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Current[i1] != nil {
if err := o.Current[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.ObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Current); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&dltw.ObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Current, _ptr_rgobjidCurrent); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.Birth != nil || o.NotificationsCount > 0 {
_ptr_rgdroidBirth := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.NotificationsCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Birth {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Birth[i1] != nil {
if err := o.Birth[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Birth); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Birth, _ptr_rgdroidBirth); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.New != nil || o.NotificationsCount > 0 {
_ptr_rgdroidNew := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.NotificationsCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.New {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.New[i1] != nil {
if err := o.New[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.New); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.New, _ptr_rgdroidNew); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *CallMoveNotification) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.NotificationsCount); err != nil {
return err
}
if err := w.ReadData(&o.ProcessedCount); err != nil {
return err
}
if err := w.ReadData(&o.Seq); err != nil {
return err
}
if err := w.ReadData(&o.ForceSeqNumber); err != nil {
return err
}
_ptr_pvolid := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.Volume == nil {
o.Volume = &dltw.VolumeID{}
}
if err := o.Volume.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_pvolid := func(ptr interface{}) { o.Volume = *ptr.(**dltw.VolumeID) }
if err := w.ReadPointer(&o.Volume, _s_pvolid, _ptr_pvolid); err != nil {
return err
}
_ptr_rgobjidCurrent := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.NotificationsCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.NotificationsCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Current", sizeInfo[0])
}
o.Current = make([]*dltw.ObjectID, sizeInfo[0])
for i1 := range o.Current {
i1 := i1
if o.Current[i1] == nil {
o.Current[i1] = &dltw.ObjectID{}
}
if err := o.Current[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_rgobjidCurrent := func(ptr interface{}) { o.Current = *ptr.(*[]*dltw.ObjectID) }
if err := w.ReadPointer(&o.Current, _s_rgobjidCurrent, _ptr_rgobjidCurrent); err != nil {
return err
}
_ptr_rgdroidBirth := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.NotificationsCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.NotificationsCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Birth", sizeInfo[0])
}
o.Birth = make([]*dltw.DomainRelativeObjectID, sizeInfo[0])
for i1 := range o.Birth {
i1 := i1
if o.Birth[i1] == nil {
o.Birth[i1] = &dltw.DomainRelativeObjectID{}
}
if err := o.Birth[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_rgdroidBirth := func(ptr interface{}) { o.Birth = *ptr.(*[]*dltw.DomainRelativeObjectID) }
if err := w.ReadPointer(&o.Birth, _s_rgdroidBirth, _ptr_rgdroidBirth); err != nil {
return err
}
_ptr_rgdroidNew := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.NotificationsCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.NotificationsCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.New", sizeInfo[0])
}
o.New = make([]*dltw.DomainRelativeObjectID, sizeInfo[0])
for i1 := range o.New {
i1 := i1
if o.New[i1] == nil {
o.New[i1] = &dltw.DomainRelativeObjectID{}
}
if err := o.New[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_rgdroidNew := func(ptr interface{}) { o.New = *ptr.(*[]*dltw.DomainRelativeObjectID) }
if err := w.ReadPointer(&o.New, _s_rgdroidNew, _ptr_rgdroidNew); err != nil {
return err
}
return nil
}
// CallRefresh structure represents TRKSVR_CALL_REFRESH RPC structure.
//
// The TRKSVR_CALL_REFRESH structure is used in LnkSvrMessage method calls that specify
// a REFRESH message (see section 2.2.11), to indicate to the server that a file or
// volume is still in use. The server uses this to determine when an entry in its tables
// is no longer in use and can be deleted. See section 3.2.5.2 for an example of client
// use of this structure.
type CallRefresh struct {
// cSources: This field MUST contain the number of elements in the adroidBirth array.
SourcesCount uint32 `idl:"name:cSources" json:"sources_count"`
// adroidBirth: This field MUST contain an array of FileIDs, with the FileID for files
// on the client computer for which the client is requesting a refresh. The type of
// this field, CDomainRelativeObjId, is as specified in [MS-DLTW] section 2.2.3. If
// this array is empty, it indicates that there are no FileIDs to be refreshed by this
// request.
Birth []*dltw.DomainRelativeObjectID `idl:"name:adroidBirth;size_is:(cSources)" json:"birth"`
// cVolumes: This field MUST contain the number of elements in the avolid array. Note
// that this is independent of the cSources value.
VolumesCount uint32 `idl:"name:cVolumes" json:"volumes_count"`
// avolid: This field MUST contain an array of VolumeIDs for volumes on the client
// computer for which the client requests a refresh. CVolumeId is as specified in [MS-DLTW]
// section 2.2.4. If this array is empty, it indicates that there are no VolumeIDs to
// be refreshed by this request.
Volumes []*dltw.VolumeID `idl:"name:avolid;size_is:(cVolumes)" json:"volumes"`
}
func (o *CallRefresh) xxx_PreparePayload(ctx context.Context) error {
if o.Birth != nil && o.SourcesCount == 0 {
o.SourcesCount = uint32(len(o.Birth))
}
if o.Volumes != nil && o.VolumesCount == 0 {
o.VolumesCount = uint32(len(o.Volumes))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *CallRefresh) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if err := w.WriteData(o.SourcesCount); err != nil {
return err
}
if o.Birth != nil || o.SourcesCount > 0 {
_ptr_adroidBirth := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.SourcesCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Birth {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Birth[i1] != nil {
if err := o.Birth[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Birth); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&dltw.DomainRelativeObjectID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Birth, _ptr_adroidBirth); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.VolumesCount); err != nil {
return err
}