-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdfsrh.go
757 lines (727 loc) · 21.6 KB
/
dfsrh.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
// The dfsrh package implements the DFSRH client protocol.
//
// # Introduction
//
// The Distributed File System: Replication Helper (DFS-R Helper) Protocol is a set
// of DCOM interfaces for configuring and monitoring the Distributed File System.
//
// # Overview
//
// The Distributed File System: Replication Helper (DFS-R Helper) Protocol provides
// a set of DCOM interfaces for configuring and monitoring Distributed File System–Replication
// (DFS-R) on a server, as specified in [MS-FRS2]. The server end of the protocol is
// a DCOM service that implements the DCOM interface. The client end of the protocol
// is an application that invokes methods on the interface to make DFS-R configuration
// changes and monitor the status of the DFS-R service on the server.
//
// The first part of the Distributed File System: Replication Helper (DFS-R Helper)
// Protocol consists of interfaces for creating, modifying, and deleting configuration
// objects in Active Directory by using the machine account of the server.
//
// For all replication members, the configuration related to a member is stored in the
// computer object for the local machine in Active Directory. It is common for system
// components that are unrelated to DFS-R to set permissions on the computer object
// that will prevent modification of the object by some users and still permit modification
// by using the credentials for the computer. Therefore, a server implementation uses
// the credentials of the local machine account when it sends commands to update Active
// Directory objects.
//
// If a user has sufficient privileges to connect to the server that is running the
// DFS-R Helper Protocol and to invoke methods implemented by the DFS-R Helper Protocol
// interfaces, the server works as a proxy for making configuration changes on behalf
// of the client application that is running under the user's account.
//
// The client sends the server information about the Active Directory operation that
// the client is trying to accomplish. The server then attempts to execute the command
// by using the machine account and returns information about the status of the operation.
//
// The second part of the Distributed File System: Replication Helper (DFS-R Helper)
// Protocol is an interface for monitoring DFS-R on the computer and collecting various
// statistics about the DFS-R operation.
//
// The information that is collected by using the Distributed File System: Replication
// Helper (DFS-R Helper) Protocol includes, among other types of information, the following
// statistics:
//
// * Information about replication errors that are encountered by DFS-R on the server.
//
// * The count and size of replicated files on the server.
//
// * Disk use on the server.
//
// * Information about replicated folders ( acefe7bd-5912-4f18-9554-b3da50a2ee44#gt_064adaf1-86c7-43e5-a157-b0949980181e
// ) on the server.
//
// * Replication backlog—the number of files that are not yet fully replicated.
package dfsrh
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"
dcom "github.com/oiweiwei/go-msrpc/msrpc/dcom"
oaut "github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut"
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)
_ = oaut.GoPackage
_ = dcom.GoPackage
)
var (
// import guard
GoPackage = "dcom/dfsrh"
)
// HelperErrorsEnum type represents DfsrHelperErrorsEnum RPC enumeration.
//
// The DfsrHelperErrorsEnum enumeration defines error codes that are specific to the
// IADProxy and IADProxy2 interfaces.
//
// The UUID for this enumeration is {9009D654-250B-4e0d-9AB0-ACB63134F69F}.
type HelperErrorsEnum uint32
var (
// dfsrHelperErrorNotLocalAdmin: Reserved for future use.
HelperErrorsEnumNotLocalAdmin HelperErrorsEnum = 2147753985
// dfsrHelperErrorCreateVerifyServerControl: Cannot create LDAP_SERVER_VERIFY_NAME_OID
// control for the LDAP command.
HelperErrorsEnumCreateVerifyServerControl HelperErrorsEnum = 2147753986
// dfsrHelperLdapErrorBase: This is the base value for LDAP errors.
HelperErrorsEnumLDAPErrorBase HelperErrorsEnum = 2147758080
)
func (o HelperErrorsEnum) String() string {
switch o {
case HelperErrorsEnumNotLocalAdmin:
return "HelperErrorsEnumNotLocalAdmin"
case HelperErrorsEnumCreateVerifyServerControl:
return "HelperErrorsEnumCreateVerifyServerControl"
case HelperErrorsEnumLDAPErrorBase:
return "HelperErrorsEnumLDAPErrorBase"
}
return "Invalid"
}
// ReportingFlags type represents DfsrReportingFlags RPC enumeration.
//
// The DfsrReportingFlags enumeration represents the options for generating health reports,
// which are used in IServerHealthReport and IServerHealthReport2 interfaces. The UUID
// for this enumeration is {CEB5D7B4-3964-4f71-AC17-4BF57A379D87}.
//
// Any bitmask that consists of one, or a combination, of the following enumerated values
// is supported:
type ReportingFlags uint16
var (
// REPORTING_FLAGS_NONE: Default report options.
ReportingFlagsNone ReportingFlags = 0
// REPORTING_FLAGS_BACKLOG: Return the count of backlog transactions.
ReportingFlagsBacklog ReportingFlags = 1
// REPORTING_FLAGS_FILES: Return the count and cumulative size of files in the replicated
// folders.
ReportingFlagsFiles ReportingFlags = 2
)
func (o ReportingFlags) String() string {
switch o {
case ReportingFlagsNone:
return "ReportingFlagsNone"
case ReportingFlagsBacklog:
return "ReportingFlagsBacklog"
case ReportingFlagsFiles:
return "ReportingFlagsFiles"
}
return "Invalid"
}
// ADAttributeData structure represents _AdAttributeData RPC structure.
type ADAttributeData struct {
Operation int32 `idl:"name:operation" json:"operation"`
AttributeName *oaut.String `idl:"name:attributeName" json:"attribute_name"`
AttributeValue *oaut.String `idl:"name:attributeValue" json:"attribute_value"`
IsString int16 `idl:"name:isString" json:"is_string"`
Length int32 `idl:"name:length" json:"length"`
}
func (o *ADAttributeData) 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 *ADAttributeData) 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.Operation); err != nil {
return err
}
if o.AttributeName != nil {
_ptr_attributeName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.AttributeName != nil {
if err := o.AttributeName.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&oaut.String{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.AttributeName, _ptr_attributeName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.AttributeValue != nil {
_ptr_attributeValue := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.AttributeValue != nil {
if err := o.AttributeValue.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&oaut.String{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.AttributeValue, _ptr_attributeValue); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.IsString); err != nil {
return err
}
if err := w.WriteData(o.Length); err != nil {
return err
}
return nil
}
func (o *ADAttributeData) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.Operation); err != nil {
return err
}
_ptr_attributeName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.AttributeName == nil {
o.AttributeName = &oaut.String{}
}
if err := o.AttributeName.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_attributeName := func(ptr interface{}) { o.AttributeName = *ptr.(**oaut.String) }
if err := w.ReadPointer(&o.AttributeName, _s_attributeName, _ptr_attributeName); err != nil {
return err
}
_ptr_attributeValue := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.AttributeValue == nil {
o.AttributeValue = &oaut.String{}
}
if err := o.AttributeValue.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_attributeValue := func(ptr interface{}) { o.AttributeValue = *ptr.(**oaut.String) }
if err := w.ReadPointer(&o.AttributeValue, _s_attributeValue, _ptr_attributeValue); err != nil {
return err
}
if err := w.ReadData(&o.IsString); err != nil {
return err
}
if err := w.ReadData(&o.Length); err != nil {
return err
}
return nil
}
// VersionVectorData structure represents _VersionVectorData RPC structure.
type VersionVectorData struct {
UncompressedSize int32 `idl:"name:uncompressedSize" json:"uncompressed_size"`
BacklogCount int32 `idl:"name:backlogCount" json:"backlog_count"`
ContentSetGUID *oaut.String `idl:"name:contentSetGuid" json:"content_set_guid"`
VersionVector *oaut.Variant `idl:"name:versionVector" json:"version_vector"`
}
func (o *VersionVectorData) 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 *VersionVectorData) 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.UncompressedSize); err != nil {
return err
}
if err := w.WriteData(o.BacklogCount); err != nil {
return err
}
if o.ContentSetGUID != nil {
_ptr_contentSetGuid := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.ContentSetGUID != nil {
if err := o.ContentSetGUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&oaut.String{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.ContentSetGUID, _ptr_contentSetGuid); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.VersionVector != nil {
_ptr_versionVector := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.VersionVector != nil {
if err := o.VersionVector.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&oaut.Variant{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.VersionVector, _ptr_versionVector); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *VersionVectorData) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.UncompressedSize); err != nil {
return err
}
if err := w.ReadData(&o.BacklogCount); err != nil {
return err
}
_ptr_contentSetGuid := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.ContentSetGUID == nil {
o.ContentSetGUID = &oaut.String{}
}
if err := o.ContentSetGUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_contentSetGuid := func(ptr interface{}) { o.ContentSetGUID = *ptr.(**oaut.String) }
if err := w.ReadPointer(&o.ContentSetGUID, _s_contentSetGuid, _ptr_contentSetGuid); err != nil {
return err
}
_ptr_versionVector := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.VersionVector == nil {
o.VersionVector = &oaut.Variant{}
}
if err := o.VersionVector.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_versionVector := func(ptr interface{}) { o.VersionVector = *ptr.(**oaut.Variant) }
if err := w.ReadPointer(&o.VersionVector, _s_versionVector, _ptr_versionVector); err != nil {
return err
}
return nil
}
// ServerHealthReport structure represents IServerHealthReport RPC structure.
type ServerHealthReport dcom.InterfacePointer
func (o *ServerHealthReport) InterfacePointer() *dcom.InterfacePointer {
return (*dcom.InterfacePointer)(o)
}
func (o *ServerHealthReport) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ServerHealthReport) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *ServerHealthReport) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *ServerHealthReport) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// IADProxy2 structure represents IADProxy2 RPC structure.
type IADProxy2 dcom.InterfacePointer
func (o *IADProxy2) InterfacePointer() *dcom.InterfacePointer { return (*dcom.InterfacePointer)(o) }
func (o *IADProxy2) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *IADProxy2) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *IADProxy2) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *IADProxy2) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// ServerHealthReport2 structure represents IServerHealthReport2 RPC structure.
type ServerHealthReport2 dcom.InterfacePointer
func (o *ServerHealthReport2) InterfacePointer() *dcom.InterfacePointer {
return (*dcom.InterfacePointer)(o)
}
func (o *ServerHealthReport2) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ServerHealthReport2) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *ServerHealthReport2) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *ServerHealthReport2) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// IADProxy structure represents IADProxy RPC structure.
type IADProxy dcom.InterfacePointer
func (o *IADProxy) InterfacePointer() *dcom.InterfacePointer { return (*dcom.InterfacePointer)(o) }
func (o *IADProxy) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *IADProxy) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *IADProxy) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *IADProxy) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}