-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfax.go
5032 lines (4926 loc) · 219 KB
/
fax.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 fax package implements the FAX client protocol.
//
// # Introduction
//
// The Fax Server and Client Remote Protocol Specification defines a protocol that is
// referred to as the Fax Server and Client Remote Protocol. This is a client/server
// protocol based on remote procedure call (RPC) that is used to send faxes and manage
// the fax server and its queues.
//
// # Overview
//
// The Fax Server and Client Remote Protocol manages and sends faxes, manages the fax
// server and its queues, and allows fax clients to act as RPC servers so that they
// can accept status notifications from fax servers acting as clients.
package fax
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"
dcetypes "github.com/oiweiwei/go-msrpc/msrpc/dcetypes"
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)
_ = dcetypes.GoPackage
_ = dtyp.GoPackage
)
var (
// import guard
GoPackage = "fax"
)
// MaxDevicesInGroup represents the FAX_MAX_DEVICES_IN_GROUP RPC constant
var MaxDevicesInGroup = 1000
// MaxRPCBuffer represents the FAX_MAX_RPC_BUFFER RPC constant
var MaxRPCBuffer = 1048576
// MaxRecipients represents the FAX_MAX_RECIPIENTS RPC constant
var MaxRecipients = 10000
// CopyBufferSize represents the RPC_COPY_BUFFER_SIZE RPC constant
var CopyBufferSize = 16384
// Fax structure represents RPC_FAX_HANDLE RPC structure.
type Fax dcetypes.ContextHandle
func (o *Fax) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Fax) 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 *Fax) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *Fax) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// Port structure represents RPC_FAX_PORT_HANDLE RPC structure.
type Port dcetypes.ContextHandle
func (o *Port) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Port) 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 *Port) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *Port) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// Service structure represents RPC_FAX_SVC_HANDLE RPC structure.
type Service dcetypes.ContextHandle
func (o *Service) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Service) 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 *Service) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *Service) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// MessageEnum structure represents RPC_FAX_MSG_ENUM_HANDLE RPC structure.
type MessageEnum dcetypes.ContextHandle
func (o *MessageEnum) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *MessageEnum) 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 *MessageEnum) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *MessageEnum) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// Copy structure represents RPC_FAX_COPY_HANDLE RPC structure.
type Copy dcetypes.ContextHandle
func (o *Copy) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Copy) 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 *Copy) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *Copy) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// Event structure represents RPC_FAX_EVENT_HANDLE RPC structure.
type Event dcetypes.ContextHandle
func (o *Event) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Event) 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 *Event) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *Event) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// EventEx structure represents RPC_FAX_EVENT_EX_HANDLE RPC structure.
type EventEx dcetypes.ContextHandle
func (o *EventEx) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *EventEx) 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 *EventEx) 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 err := w.WriteData(o.Attributes); err != nil {
return err
}
if o.UUID != nil {
if err := o.UUID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *EventEx) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
if o.UUID == nil {
o.UUID = &dtyp.GUID{}
}
if err := o.UUID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// CoverPageInfoExW structure represents FAX_COVERPAGE_INFO_EXW RPC structure.
//
// The FAX_COVERPAGE_INFO_EXW structure is used as an argument for the FAX_SendDocumentEx
// (section 3.1.4.1.73) call that specifies information about the fax cover page used
// when sending a fax.
type CoverPageInfoExW struct {
// dwSizeOfStruct: A DWORD ([MS-DTYP] section 2.2.9) value that holds the total size
// of the structure, in bytes. This value MUST be 24 or 40 bytes. When filled in on
// a 32-bit implementation, this value SHOULD be 24 bytes. When filled in on a 64-bit
// implementation, this value SHOULD be 40 bytes.
StructureSize uint32 `idl:"name:dwSizeOfStruct" json:"structure_size"`
// dwCoverPageFormat: A DWORD that indicates the format of the cover page template.
// This MUST be one of the values defined in FAX_ENUM_COVERPAGE_FORMATS (section 2.2.78)
// enumeration. The required file format for the cover page template is described in
// FAX_SendDocumentEx (section 3.1.4.1.73) method.
CoverPageFormat uint32 `idl:"name:dwCoverPageFormat" json:"cover_page_format"`
// lpwstrCoverPageFileName: A pointer to a null-terminated character string that holds
// the file name of the cover page template. This file name SHOULD NOT include any path
// separators. If bServerBased is FALSE, the file extension MUST be ".cov", and except
// for the terminating null character, the character string MUST contain only characters
// representing valid hexadecimal digits: "0123456789abcdefABCDEF". If bServerBased
// is TRUE the file extension SHOULD be ".cov". The cover page file MUST be present
// in the fax server queue directory when the FAX_SendDocumentEx call is made. If no
// cover-page information is available, this pointer MUST be NULL.
CoverPageFileName string `idl:"name:lpwstrCoverPageFileName;string" json:"cover_page_file_name"`
// bServerBased: A Boolean that indicates whether the cover page template specified
// by the lpwstrCoverPageFileName parameter is a new personal cover page template (when
// set to FALSE) or a server-based cover page template (when set to TRUE). For more
// details on the semantics of TRUE and FALSE, see FAX_SendDocumentEx.
ServerBased bool `idl:"name:bServerBased" json:"server_based"`
// lpwstrNote: A pointer to a null-terminated character string that holds the content
// for the note field of the cover page.
Note string `idl:"name:lpwstrNote;string" json:"note"`
// lpwstrSubject: A pointer to a null-terminated character string that holds the content
// for the subject field.
Subject string `idl:"name:lpwstrSubject;string" json:"subject"`
}
func (o *CoverPageInfoExW) 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 *CoverPageInfoExW) 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.StructureSize); err != nil {
return err
}
if err := w.WriteData(o.CoverPageFormat); err != nil {
return err
}
if o.CoverPageFileName != "" {
_ptr_lpwstrCoverPageFileName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.CoverPageFileName); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.CoverPageFileName, _ptr_lpwstrCoverPageFileName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if !o.ServerBased {
if err := w.WriteData(int32(0)); err != nil {
return err
}
} else {
if err := w.WriteData(int32(1)); err != nil {
return err
}
}
if o.Note != "" {
_ptr_lpwstrNote := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.Note); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.Note, _ptr_lpwstrNote); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.Subject != "" {
_ptr_lpwstrSubject := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.Subject); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.Subject, _ptr_lpwstrSubject); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *CoverPageInfoExW) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.StructureSize); err != nil {
return err
}
if err := w.ReadData(&o.CoverPageFormat); err != nil {
return err
}
_ptr_lpwstrCoverPageFileName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.CoverPageFileName); err != nil {
return err
}
return nil
})
_s_lpwstrCoverPageFileName := func(ptr interface{}) { o.CoverPageFileName = *ptr.(*string) }
if err := w.ReadPointer(&o.CoverPageFileName, _s_lpwstrCoverPageFileName, _ptr_lpwstrCoverPageFileName); err != nil {
return err
}
var _bServerBased int32
if err := w.ReadData(&_bServerBased); err != nil {
return err
}
o.ServerBased = _bServerBased != 0
_ptr_lpwstrNote := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.Note); err != nil {
return err
}
return nil
})
_s_lpwstrNote := func(ptr interface{}) { o.Note = *ptr.(*string) }
if err := w.ReadPointer(&o.Note, _s_lpwstrNote, _ptr_lpwstrNote); err != nil {
return err
}
_ptr_lpwstrSubject := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.Subject); err != nil {
return err
}
return nil
})
_s_lpwstrSubject := func(ptr interface{}) { o.Subject = *ptr.(*string) }
if err := w.ReadPointer(&o.Subject, _s_lpwstrSubject, _ptr_lpwstrSubject); err != nil {
return err
}
return nil
}
// JobParamW structure represents FAX_JOB_PARAMW RPC structure.
//
// The FAX_JOB_PARAMW structure contains information about a fax job, including information
// about the personal profiles (section 3.1.1) for the sender and the recipient of the
// fax. This structure is used as an input argument for the FaxObs_SendDocument (section
// 3.1.4.2.7) method.
type JobParamW struct {
// SizeOfStruct: A DWORD ([MS-DTYP] section 2.2.9) that contains the size, in bytes,
// of this structure. This value MUST be 80 or 136 bytes. When filled in on a 32-bit
// implementation, this value SHOULD be 80 bytes. When filled in on a 64-bit implementation,
// this value SHOULD be 136 bytes.
StructureSize uint32 `idl:"name:SizeOfStruct" json:"structure_size"`
// RecipientNumber: A null-terminated character string that holds the fax number of
// the fax transmission recipient.
RecipientNumber string `idl:"name:RecipientNumber;string" json:"recipient_number"`
// RecipientName: A null-terminated character string that holds the name of the fax
// transmission recipient.
RecipientName string `idl:"name:RecipientName;string" json:"recipient_name"`
// Tsid: A null-terminated character string that holds the transmitting subscriber identifier
// (TSID). The valid characters for a TSID string are the English letters, the numeric
// symbols, and the punctuation marks (ASCII range 0x20 to 0x7F).
TSID string `idl:"name:Tsid;string" json:"tsid"`
// SenderName: A null-terminated character string that holds the name of the fax transmission
// sender.
SenderName string `idl:"name:SenderName;string" json:"sender_name"`
// SenderCompany: A null-terminated character string that holds the name of the fax
// transmission sender's company.
SenderCompany string `idl:"name:SenderCompany;string" json:"sender_company"`
// SenderDept: A null-terminated character string that holds the name of the fax transmission
// sender's department.
SenderDept string `idl:"name:SenderDept;string" json:"sender_dept"`
// BillingCode: A null-terminated character string that holds an optional billing code
// for the fax transmission.
BillingCode string `idl:"name:BillingCode;string" json:"billing_code"`
// ScheduleAction: A DWORD variable that indicates when the fax is to be sent. This
// value can be one of the following values:
//
// +--------------------------------+----------------------------------------------------------------------------------+
// | | |
// | VALUE/CODE | MEANING |
// | | |
// +--------------------------------+----------------------------------------------------------------------------------+
// +--------------------------------+----------------------------------------------------------------------------------+
// | JSA_NOW 0x00000000 | The fax is to be sent as soon as a fax device is available. |
// +--------------------------------+----------------------------------------------------------------------------------+
// | JSA_SPECIFIC_TIME 0x00000001 | The fax is to be sent at the time specified by the ScheduleTime member of this |
// | | structure. |
// +--------------------------------+----------------------------------------------------------------------------------+
// | JSA_DISCOUNT_PERIOD 0x00000002 | The fax is to be sent during the discount rate period. The |
// | | FaxObs_GetConfiguration (section 3.1.4.2.24) method can be called to retrieve |
// | | the discount period for the fax server. |
// +--------------------------------+----------------------------------------------------------------------------------+
ScheduleAction uint32 `idl:"name:ScheduleAction" json:"schedule_action"`
// ScheduleTime: A SYSTEMTIME ([MS-DTYP] section 2.3.13) structure indicating the local
// date and time to send the fax, in UTC format. This member is used when the ScheduleAction
// member is set to 0x00000001 (JSA_SPECIFIC_TIME), and is otherwise ignored.
ScheduleTime *dtyp.SystemTime `idl:"name:ScheduleTime" json:"schedule_time"`
// DeliveryReportType: A DWORD variable that indicates the fax delivery report type.
// This value can be one of the FAX_ENUM_DELIVERY_REPORT_TYPES (section 2.2.76) enumeration
// values. The DRT_ATTACH_FAX value can be combined with the DRT_EMAIL value in one
// value by using an OR operation.
DeliveryReportType uint32 `idl:"name:DeliveryReportType" json:"delivery_report_type"`
// DeliveryReportAddress: A null-terminated character string. Contains the email address
// for the delivery report when the DeliveryReportType member is set to 0x00000001 (DRT_E_MAIL).
// Otherwise, this pointer value can be NULL.
DeliveryReportAddress string `idl:"name:DeliveryReportAddress;string" json:"delivery_report_address"`
// DocumentName: A null-terminated character string that holds the document name. A
// NULL pointer value specifies that no document name is specified for this fax job.
DocumentName string `idl:"name:DocumentName;string" json:"document_name"`
// CallHandle: An unsigned 32-bit integer value containing an optional TAPI call handle.
// For more information about TAPI, see [MSDN-TAPI2.2]. For more information about this
// member, see FaxObs_SendDocument.
CallHandle uint32 `idl:"name:CallHandle" json:"call_handle"`
// Reserved: A table of three 32-bit unsigned integer fields (on 32-bit implementations),
// or 64-bit unsigned integer fields (on 64-bit implementations). If the first value,
// Reserved[0], is zero, then all values in this table SHOULD be ignored.
//
// If the fax job is a normal job sent to one fax device (port), the Reserved values
// SHOULD be as follows:
//
// * *Reserved[0]* SHOULD be set to zero or to 0xFFFFFFFF (on 32-bit) or 0x00000000FFFFFFFF
// (on 64-bit).
//
// * *Reserved[1]* SHOULD contain a device identifier such as the value contained by
// the *DeviceId* member of a valid *FAX_PORT_INFO* (section 2.2.7 ( 2b46d16c-e74a-4e3b-b50c-0b94f78bebd0
// ) ) or *_FAX_PORT_INFO* (section 2.2.8 ( ed920746-d222-4e0a-a75d-905f26cf1dfc ) )
// structure, describing one fax port (device).
//
// * *Reserved[2]* SHOULD be ignored.
//
// * *Reserved[0]* SHOULD be set to 0xFFFFFFFE (on 32-bit) or 0x00000000FFFFFFFE (on
// 64-bit).
//
// * *Reserved[1]* SHOULD be set to one of the following two values:
//
// * A value of 1 (0x00000001 on 32-bit or 0x0000000000000001 on 64-bit) for the first
// *FaxObs_SendDocument* method call made by the client to start the broadcast sequence.
//
// * A value of 2 (0x00000002 on 32-bit or 0x0000000000000002 on 64-bit) for the second
// and following *FaxObs_SendDocument* method calls made by the client to continue and
// complete a started broadcast sequence.
//
// * *Reserved[2]* SHOULD be set to one of the following two values:
//
// * If *Reserved[1]* is set to a value of 1, *Reserved[2]* SHOULD be set to zero.
//
// * If *Reserved[1]* is set to a value of 2, *Reserved[2]* SHOULD contain the job identifier
// returned by the *FaxObs_SendDocument* call that started the broadcast sequence.
//
// For more information about this member, see the FaxObs_SendDocument method.
_ []uint64 `idl:"name:Reserved"`
}
func (o *JobParamW) 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 *JobParamW) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(10); err != nil {
return err
}
if err := w.WriteData(o.StructureSize); err != nil {
return err
}
if o.RecipientNumber != "" {
_ptr_RecipientNumber := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.RecipientNumber); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.RecipientNumber, _ptr_RecipientNumber); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.RecipientName != "" {
_ptr_RecipientName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.RecipientName); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.RecipientName, _ptr_RecipientName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.TSID != "" {
_ptr_Tsid := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.TSID); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.TSID, _ptr_Tsid); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.SenderName != "" {
_ptr_SenderName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.SenderName); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.SenderName, _ptr_SenderName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.SenderCompany != "" {
_ptr_SenderCompany := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.SenderCompany); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.SenderCompany, _ptr_SenderCompany); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.SenderDept != "" {
_ptr_SenderDept := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.SenderDept); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.SenderDept, _ptr_SenderDept); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.BillingCode != "" {
_ptr_BillingCode := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.BillingCode); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.BillingCode, _ptr_BillingCode); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.ScheduleAction); err != nil {
return err
}
if o.ScheduleTime != nil {
if err := o.ScheduleTime.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.SystemTime{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if err := w.WriteData(o.DeliveryReportType); err != nil {
return err
}
if o.DeliveryReportAddress != "" {
_ptr_DeliveryReportAddress := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.DeliveryReportAddress); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.DeliveryReportAddress, _ptr_DeliveryReportAddress); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if o.DocumentName != "" {
_ptr_DocumentName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.DocumentName); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.DocumentName, _ptr_DocumentName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.CallHandle); err != nil {
return err
}
// reserved Reserved
for i1 := 0; uint64(i1) < 3; i1++ {
if err := w.WriteData(uint64(0)); err != nil {
return err
}
}
return nil
}
func (o *JobParamW) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(10); err != nil {
return err
}
if err := w.ReadData(&o.StructureSize); err != nil {
return err
}
_ptr_RecipientNumber := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.RecipientNumber); err != nil {
return err
}
return nil
})
_s_RecipientNumber := func(ptr interface{}) { o.RecipientNumber = *ptr.(*string) }
if err := w.ReadPointer(&o.RecipientNumber, _s_RecipientNumber, _ptr_RecipientNumber); err != nil {
return err
}
_ptr_RecipientName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.RecipientName); err != nil {
return err
}
return nil
})
_s_RecipientName := func(ptr interface{}) { o.RecipientName = *ptr.(*string) }
if err := w.ReadPointer(&o.RecipientName, _s_RecipientName, _ptr_RecipientName); err != nil {
return err
}
_ptr_Tsid := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.TSID); err != nil {
return err
}
return nil
})
_s_Tsid := func(ptr interface{}) { o.TSID = *ptr.(*string) }
if err := w.ReadPointer(&o.TSID, _s_Tsid, _ptr_Tsid); err != nil {
return err
}
_ptr_SenderName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.SenderName); err != nil {
return err
}
return nil
})
_s_SenderName := func(ptr interface{}) { o.SenderName = *ptr.(*string) }
if err := w.ReadPointer(&o.SenderName, _s_SenderName, _ptr_SenderName); err != nil {
return err
}
_ptr_SenderCompany := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.SenderCompany); err != nil {
return err
}
return nil
})
_s_SenderCompany := func(ptr interface{}) { o.SenderCompany = *ptr.(*string) }
if err := w.ReadPointer(&o.SenderCompany, _s_SenderCompany, _ptr_SenderCompany); err != nil {
return err
}
_ptr_SenderDept := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.SenderDept); err != nil {
return err
}
return nil
})
_s_SenderDept := func(ptr interface{}) { o.SenderDept = *ptr.(*string) }
if err := w.ReadPointer(&o.SenderDept, _s_SenderDept, _ptr_SenderDept); err != nil {
return err
}
_ptr_BillingCode := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.BillingCode); err != nil {
return err
}
return nil
})
_s_BillingCode := func(ptr interface{}) { o.BillingCode = *ptr.(*string) }
if err := w.ReadPointer(&o.BillingCode, _s_BillingCode, _ptr_BillingCode); err != nil {
return err
}
if err := w.ReadData(&o.ScheduleAction); err != nil {
return err
}
if o.ScheduleTime == nil {
o.ScheduleTime = &dtyp.SystemTime{}
}
if err := o.ScheduleTime.UnmarshalNDR(ctx, w); err != nil {
return err
}
if err := w.ReadData(&o.DeliveryReportType); err != nil {
return err
}
_ptr_DeliveryReportAddress := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.DeliveryReportAddress); err != nil {
return err
}
return nil
})
_s_DeliveryReportAddress := func(ptr interface{}) { o.DeliveryReportAddress = *ptr.(*string) }
if err := w.ReadPointer(&o.DeliveryReportAddress, _s_DeliveryReportAddress, _ptr_DeliveryReportAddress); err != nil {
return err
}
_ptr_DocumentName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.DocumentName); err != nil {
return err
}
return nil
})
_s_DocumentName := func(ptr interface{}) { o.DocumentName = *ptr.(*string) }
if err := w.ReadPointer(&o.DocumentName, _s_DocumentName, _ptr_DocumentName); err != nil {
return err
}
if err := w.ReadData(&o.CallHandle); err != nil {
return err
}
// reserved Reserved
var _Reserved []uint64
_Reserved = make([]uint64, 3)
for i1 := range _Reserved {
i1 := i1
if err := w.ReadData((*ndr.Uint3264)(&_Reserved[i1])); err != nil {
return err
}
}
return nil
}
// DeviceReceiveMode type represents FAX_ENUM_DEVICE_RECEIVE_MODE RPC enumeration.
//
// The FAX_ENUM_DEVICE_RECEIVE_MODE enumeration constants describe the receive mode
// for a fax device.
type DeviceReceiveMode uint16
var (
// FAX_DEVICE_RECEIVE_MODE_OFF: Do not answer incoming calls.
DeviceReceiveModeOff DeviceReceiveMode = 0
// FAX_DEVICE_RECEIVE_MODE_AUTO: Automatically answer incoming calls after the specified
// number of rings.