-
Notifications
You must be signed in to change notification settings - Fork 2
/
v1.go
2616 lines (2492 loc) · 99.9 KB
/
v1.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
package irpcasyncnotify
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"
irpcremoteobject "github.com/oiweiwei/go-msrpc/msrpc/pan/irpcremoteobject/v1"
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)
_ = dtyp.GoPackage
_ = dcetypes.GoPackage
_ = irpcremoteobject.GoPackage
)
var (
// import guard
GoPackage = "pan"
)
var (
// Syntax UUID
IrpcAsyncNotifySyntaxUUID = &uuid.UUID{TimeLow: 0xb6edbfa, TimeMid: 0x4a24, TimeHiAndVersion: 0x4fc6, ClockSeqHiAndReserved: 0x8a, ClockSeqLow: 0x23, Node: [6]uint8{0x94, 0x2b, 0x1e, 0xca, 0x65, 0xd1}}
// Syntax ID
IrpcAsyncNotifySyntaxV1_0 = &dcerpc.SyntaxID{IfUUID: IrpcAsyncNotifySyntaxUUID, IfVersionMajor: 1, IfVersionMinor: 0}
)
// IRPCAsyncNotify interface.
type IrpcAsyncNotifyClient interface {
// The IRPCAsyncNotify_RegisterClient method is called by clients to register to receive
// notifications and to associate the parameters describing the set of notifications
// they are registering to receive with a remote object.
//
// Return Values: This method MUST return zero to indicate success, or an HRESULT error
// value ([MS-ERREF] section 2.1.1) to indicate failure. Protocol-specific error values
// are defined in the following table. The client SHOULD treat all error return values
// the same, except where noted.
//
// +--------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+----------------------------------------------------------------------------------+
// +--------------+----------------------------------------------------------------------------------+
// | 0x80070005 | The client does not have authorization to register for notifications with the |
// | | set of parameters specified in this call. If this error value is returned, the |
// | | client SHOULD NOT retry this call; the client SHOULD consider the error to be |
// | | fatal and report it to the higher level caller. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007000E | The server does not have enough memory for the new registration. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x80070015 | The server has reached its maximum registration limit. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007007B | The pName parameter does not conform to the format specified above. If this |
// | | error value is returned, the client SHOULD NOT retry this call; the client |
// | | SHOULD consider the error to be fatal and report it to the higher level caller. |
// +--------------+----------------------------------------------------------------------------------+
//
// Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying
// RPC protocol [MS-RPCE].
//
// Unless specified otherwise, if a failure is indicated by an error return or an exception,
// the client SHOULD retry this method call by performing the following steps:
//
// *
//
// Call IRPCRemoteObject_Create to generate a new PRPCREMOTEOBJECT (section 2.2.4) (
// a47aca7c-fcc3-4151-8fb6-1de5225ecfa5 ).
//
// *
//
// Call IRPCAsyncNotify_RegisterClient with the new PRPCREMOTEOBJECT.
//
// Retries SHOULD be separated by time intervals decaying from 1 second to 1 minute
// to reduce a potential burden on the server.
//
// The IRPCAsyncNotify_RegisterClient method MUST be called by clients to register for
// receiving notifications. Servers MUST associate the given remote object with the
// registration parameters specified.
//
// A client MUST NOT call IRPCAsyncNotify_RegisterClient if a prior call to IRPCAsyncNotify_RegisterClient
// succeeded using the same PRPCREMOTEOBJECT value, unless a later call to IRPCAsyncNotify_UnregisterClient
// also succeeded.
//
// If registering for unidirectional communication mode, a client SHOULD call IRPCAsyncNotify_GetNotification
// after a successful call to IRPCAsyncNotify_RegisterClient using the same PRPCREMOTEOBJECT
// value.
//
// If registering for bidirectional communication mode, a client SHOULD call IRPCAsyncNotify_GetNewChannel
// after a successful call to IRPCAsyncNotify_RegisterClient using the same PRPCREMOTEOBJECT
// value.
//
// Servers MUST support the concurrent registration of multiple remote objects with
// different registration parameters, including notification type, filter, and communication
// mode.
//
// Servers SHOULD consider the security and privacy context prior to letting clients
// monitor and receive notifications for all user identities. Relevant access rights
// are defined in the following table.
//
// +-------------------------------+----------------------------------------------------------------------------------+
// | | |
// | NAME/VALUE | DESCRIPTION |
// | | |
// +-------------------------------+----------------------------------------------------------------------------------+
// +-------------------------------+----------------------------------------------------------------------------------+
// | SERVER_ALL_ACCESS 0x000F0003 | Combines the WO (Write Owner), WD (Write DACL), RC (Read Control), and DE |
// | | (Delete) bits of the ACCESS_MASK data type ([MS-DTYP] section 2.4.3) with |
// | | the following protocol-specific bits: 0x00000001 (bit 31): Access rights to |
// | | administer print servers. 0x00000002 (bit 30): Access rights to enumerate print |
// | | servers. These printing-specific access rights allow a client to administer the |
// | | server and to enumerate server components such as print queues. |
// +-------------------------------+----------------------------------------------------------------------------------+
// | PRINTER_ALL_ACCESS 0x000F000C | Combines the WO (Write Owner), WD (Write DACL), RC (Read Control), and DE |
// | | (Delete) bits of the ACCESS_MASK data type with the following protocol-specific |
// | | bits: 0x00000004 (bit 29): Access rights for printers to perform administrative |
// | | tasks. 0x00000008 (bit 28): Access rights for printers to perform basic printing |
// | | operations. These printing-specific access rights allow a client basic and |
// | | administrative use of print queues. |
// +-------------------------------+----------------------------------------------------------------------------------+
//
// For calls to IRPCAsyncNotify_RegisterClient with NotifyFilter set to kAllUsers, if
// pName is set to NULL, the server SHOULD fail the call if the calling principal lacks
// any of the server access rights specified by SERVER_ALL_ACCESS. If pName points to
// the name of a print queue, the server SHOULD fail the call if the calling principal
// lacks any of the print queue access rights specified by PRINTER_ALL_ACCESS. For additional
// information concerning access rights, see [MS-AZOD] section 1.1.1.5.
RegisterClient(context.Context, *RegisterClientRequest, ...dcerpc.CallOption) (*RegisterClientResponse, error)
// The IRPCAsyncNotify_UnregisterClient method is called by registered clients to unregister
// previously-registered remote objects. For this call to succeed, the remote object
// MUST have already successfully called IRPCAsyncNotify_RegisterClient.
//
// Return Values: This method MUST return an HRESULT success value ([MS-ERREF] section
// 2.1.1) to indicate success, or an HRESULT error value to indicate failure. The client
// MUST consider all error return values fatal and report them to the higher-level caller.
//
// Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying
// RPC protocol [MS-RPCE].
//
// If a client call to IRPCAsyncNotify_GetNewChannel or IRPCAsyncNotify_GetNotification
// is blocked on the server waiting for a notification channel or notification to become
// available, the server MUST process a client call to IRPCAsyncNotify_UnregisterClient
// without waiting for the notification channel or notification.
//
// A server MUST NOT do the following:
//
// * Indicate success to a client call of IRPCAsyncNotify_UnregisterClient unless a
// prior call to IRPCAsyncNotify_RegisterClient succeeded using the same PRPCREMOTEOBJECT
// ( a47aca7c-fcc3-4151-8fb6-1de5225ecfa5 ) value.
//
// * Indicate success to a client call of IRPCAsyncNotify_UnregisterClient following
// a prior successful call to IRPCAsyncNotify_UnregisterClient by using the same PRPCREMOTEOBJECT
// value.
//
// A client MUST NOT do the following:
//
// * Call IRPCAsyncNotify_UnregisterClient, unless a prior call to IRPCAsyncNotify_RegisterClient
// succeeded by using the same PRPCREMOTEOBJECT value.
//
// * Call IRPCAsyncNotify_UnregisterClient following a prior call to IRPCAsyncNotify_UnregisterClient
// by using the same PRPCREMOTEOBJECT value.
UnregisterClient(context.Context, *UnregisterClientRequest, ...dcerpc.CallOption) (*UnregisterClientResponse, error)
// Opnum2NotUsedOnWire operation.
// Opnum2NotUsedOnWire
// The IRPCAsyncNotify_GetNewChannel method returns an array of pointers to print notification
// channels. This method MUST only be used with bidirectional communication mode.
//
// Return Values: This method MUST return zero to indicate success, or an HRESULT error
// value ([MS-ERREF] section 2.1.1) to indicate failure. Protocol-specific error values
// are defined in the following table. The client SHOULD treat all error return values
// the same, except where noted.
//
// +--------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+----------------------------------------------------------------------------------+
// +--------------+----------------------------------------------------------------------------------+
// | 0x8004000C | The server has not yet returned from a previous call to this method with the |
// | | same remote object. If this error value is returned, the client SHOULD NOT retry |
// | | this call before the previous call to this method with the specified remote |
// | | object has completed. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007000E | The server does not have enough memory for the new channel. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007071A | Incoming notifications have been terminated. Upon completion of this call with |
// | | this return value, the server MUST fail subsequent calls to this method with the |
// | | same remote object. If this error value is returned, the client SHOULD NOT retry |
// | | this call. |
// +--------------+----------------------------------------------------------------------------------+
//
// Exceptions Thrown: An exception code of 0x8004000C or 0x8007071A SHOULD be thrown
// by the server under the circumstances described in the preceding table for the corresponding
// return values. The client MUST treat these exception codes exactly as it would treat
// the same return values. No additional exceptions are thrown beyond those thrown by
// the underlying RPC protocol [MS-RPCE].
//
// Unless specified otherwise, if a failure is indicated by an error return or an exception,
// the client SHOULD retry this method call by performing the following steps:
//
// *
//
// Call IRPCRemoteObject_Create to generate a new PRPCREMOTEOBJECT (section 2.2.4) (
// a47aca7c-fcc3-4151-8fb6-1de5225ecfa5 ).
//
// *
//
// Call IRPCAsyncNotify_RegisterClient with the new PRPCREMOTEOBJECT.
//
// *
//
// Call IRPCAsyncNotify_GetNewChannel with the new PRPCREMOTEOBJECT.
//
// Retries SHOULD be separated by time intervals decaying from 1 second to 1 minute
// to reduce a potential burden on the server. Retries SHOULD terminate when the above
// sequence succeeds or the client determines that it is no longer interested in notifications
// for the particular combination of notification type, print queue name, conversation
// style, and user identity filter that were originally specified in the call to IRPCAsyncNotify_RegisterClient.
//
// If successful, the IRPCAsyncNotify_GetNewChannel method MUST return an array of pointers
// to print notification channels.
//
// A server MUST NOT do the following:
//
// * Indicate success to a client call of IRPCAsyncNotify_GetNewChannel unless a prior
// call to IRPCAsyncNotify_RegisterClient succeeded using the same PRPCREMOTEOBJECT
// value.
//
// * Indicate success to a client call of IRPCAsyncNotify_GetNewChannel following a
// prior successful call to IRPCAsyncNotify_UnregisterClient ( 20fa79b6-4905-4a50-83d5-2bc76525b3c9
// ) using the same PRPCREMOTEOBJECT value.
//
// * Complete a call to IRPCAsyncNotify_GetNewChannel unless an unreturned notification
// channel is available on the *Bidirectional Notification Channel Queue* associated
// with the *Client Registration* (Abstract Data Model, section 3.1.1.1), or an abnormal
// event happened, such as an initiated server shutdown sequence.
//
// A client SHOULD do the following:
//
// * Call IRPCAsyncNotify_GetNewChannel in response to a prior successful return from
// IRPCAsyncNotify_RegisterClient or IRPCAsyncNotify_GetNewChannel.
//
// * Call IRPCAsyncNotify_GetNotificationSendResponse ( 8c4aab2d-5dfe-469d-a9e3-003869921e45
// ) in response to a prior successful return from IRPCAsyncNotify_GetNewChannel.
//
// A client MUST NOT do the following:
//
// * Call IRPCAsyncNotify_GetNewChannel, unless a prior call to IRPCAsyncNotify_RegisterClient
// succeeded by using the same PRPCREMOTEOBJECT value. <8> ( cdec7a7c-2b2c-4b81-a40a-b12d69f880ee#Appendix_A_8
// )
//
// * Call IRPCAsyncNotify_GetNewChannel following a prior call to IRPCAsyncNotify_UnregisterClient
// by using the same PRPCREMOTEOBJECT value. <9> ( cdec7a7c-2b2c-4b81-a40a-b12d69f880ee#Appendix_A_9
// )
GetNewChannel(context.Context, *GetNewChannelRequest, ...dcerpc.CallOption) (*GetNewChannelResponse, error)
// The IRPCAsyncNotify_GetNotificationSendResponse method sends a client response to
// the server and returns the next notification sent by way of the same channel when
// it becomes available. This method MUST be used only with bidirectional communication
// mode.
//
// Return Values: This method MUST return zero to indicate success, or an HRESULT error
// value ([MS-ERREF] section 2.1.1) to indicate failure. Protocol-specific error values
// are defined in the following table. The client MUST consider all error return values
// fatal and report them to the higher-level caller.
//
// +--------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+----------------------------------------------------------------------------------+
// +--------------+----------------------------------------------------------------------------------+
// | 0x80040008 | The notification channel represented by pChannel was previously closed. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8004000C | The server has not yet returned from a previous call to |
// | | IRPCAsyncNotify_GetNotificationSendResponse or IRPCAsyncNotify_CloseChannel |
// | | (section 3.1.1.4.6) with the same notification channel. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x80040012 | The size of the client-to-server response exceeded the maximum size. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x80040014 | The notification type identifier is different from the notification type of the |
// | | notification channel. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007000E | The server does not have enough memory to complete the request. |
// +--------------+----------------------------------------------------------------------------------+
//
// Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying
// RPC protocol [MS-RPCE].
//
// If a failure is indicated by an error return or an exception, the client SHOULD close
// the channel.
//
// The first call to this method on the newly opened notification channel serves as
// a mediator among all the clients that registered themselves for the given notification
// type. This MUST be done by blocking all calls from clients until a matching server-side
// event occurs, including the following:
//
// * The channel issues a notification.
//
// * An abnormal condition occurs, such as an initiated server shutdown sequence.
//
// * The server receives a client request to close the channel.
GetNotificationSendResponse(context.Context, *GetNotificationSendResponseRequest, ...dcerpc.CallOption) (*GetNotificationSendResponseResponse, error)
// The IRPCAsyncNotify_GetNotification method returns notification data from the print
// server. This method MUST NOT be used with bidirectional communication mode.
//
// Return Values: This method MUST return zero to indicate success, or an HRESULT error
// value ([MS-ERREF] section 2.1.1) to indicate failure. Protocol-specific error values
// are defined in the following table. The client SHOULD treat all error return values
// the same, except where noted.
//
// +--------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+----------------------------------------------------------------------------------+
// +--------------+----------------------------------------------------------------------------------+
// | 0x8004000C | The server has not yet returned from a previous call to this method with the |
// | | same remote object. If this error value is returned, the client SHOULD NOT retry |
// | | this call before the previous call to this method with the specified remote |
// | | object has completed. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007000E | The server does not have enough memory to complete the request. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007071A | Incoming notifications have been terminated. Upon completion of this call with |
// | | this return value, the server MUST fail subsequent calls to this method with the |
// | | same remote object. If this error value is returned, the client SHOULD NOT retry |
// | | this call. |
// +--------------+----------------------------------------------------------------------------------+
//
// Exceptions Thrown: An exception code of 0x08004000C or 0x8007071A SHOULD be thrown
// by the server under the circumstances described in the preceding table for the corresponding
// return values. The client MUST treat these exception codes exactly as it would treat
// the same return values. No additional exceptions are thrown beyond those thrown by
// the underlying RPC protocol [MS-RPCE].
//
// Unless specified otherwise, if a failure is indicated by an error return or an exception,
// the client SHOULD retry this method call by performing the following steps:
//
// *
//
// Call IRPCRemoteObject_Create (section 3.1.2.4.1) ( e3786f60-0b93-4c5e-8cd1-3f0487e4310a
// ) to generate a new PRPCREMOTEOBJECT (section 2.2.4) ( a47aca7c-fcc3-4151-8fb6-1de5225ecfa5
// ).
//
// *
//
// Call IRPCAsyncNotify_RegisterClient with the new PRPCREMOTEOBJECT.
//
// *
//
// Call IRPCAsyncNotify_GetNotification with the new PRPCREMOTEOBJECT.
//
// Retries SHOULD be separated by time intervals decaying from 1 second to 1 minute
// to reduce a potential burden on the server. Retries SHOULD terminate when the above
// sequence succeeds or the client determines that it is no longer interested in notifications
// for the particular combination of notification type, print queue name, conversation
// style, and user identity filter that were originally specified in the call to IRPCAsyncNotify_RegisterClient.
//
// The IRPCAsyncNotify_GetNotification method MUST return data from the server that
// matches the registration for the given remote object.
//
// A server MUST NOT do the following:
//
// * Indicate success to a client call of IRPCAsyncNotify_GetNotification unless a prior
// call to IRPCAsyncNotify_RegisterClient succeeded using the same PRPCREMOTEOBJECT
// value.
//
// * Indicate success to a client call of IRPCAsyncNotify_GetNotification following
// a prior successful call to IRPCAsyncNotify_UnregisterClient ( 20fa79b6-4905-4a50-83d5-2bc76525b3c9
// ) using the same PRPCREMOTEOBJECT value.
//
// * Complete a call to IRPCAsyncNotify_GetNotification until the *Unidirectional Notification
// Queue* associated with the *Client Registration* ( Abstract Data Model (section 3.1.1.1)
// ( bd69159c-f3d8-4f7b-b2c3-f9efec7c9f62 ) ) contains an unreturned notification, or
// an abnormal condition occurs. An example of an abnormal condition is an initiated
// server shutdown sequence or remote object unregistration. An abnormal condition will
// result in a failure error code returned prior to the server having data.
//
// A server SHOULD do the following:
//
// * Discard unidirectional notifications in the absence of corresponding registered
// clients.
//
// * Buffer unidirectional notifications, up to some implementation-defined limit, <10>
// ( cdec7a7c-2b2c-4b81-a40a-b12d69f880ee#Appendix_A_10 ) for each registered client
// that does not have pending IRPCAsyncNotify_GetNotification calls.
//
// If a client wants to receive further notifications from the server, the client SHOULD
// call IRPCAsyncNotify_GetNotification in response to a prior successful return from
// IRPCAsyncNotify_GetNotification. When the client no longer wants to receive notifications
// from the server, it SHOULD call IRPCAsyncNotify_UnregisterClient, either before or
// after the return from IRPCAsyncNotify_GetNotification.
//
// A client MUST NOT do the following:
//
// * Call IRPCAsyncNotify_GetNotification unless a prior call to IRPCAsyncNotify_RegisterClient
// succeeded, using the same PRPCREMOTEOBJECT value.
//
// * Call IRPCAsyncNotify_GetNotification following a prior call to IRPCAsyncNotify_UnregisterClient
// by using the same PRPCREMOTEOBJECT value.
GetNotification(context.Context, *GetNotificationRequest, ...dcerpc.CallOption) (*GetNotificationResponse, error)
// The IRPCAsyncNotify_CloseChannel method sends a final response on the notification
// channel and closes it. This method MUST NOT be used with unidirectional communication
// mode.
//
// Return Values: This method MUST return zero or an HRESULT success value ([MS-ERREF]
// section 2.1.1) to indicate success, or an HRESULT error value to indicate failure.
//
// Protocol-specific success values are defined in the following table.
//
// +--------------+------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+------------------------------------------+
// +--------------+------------------------------------------+
// | 0x00040010 | Another client has acquired the channel. |
// +--------------+------------------------------------------+
//
// Protocol-specific error values are defined in the following table. The client MUST
// consider all error return values fatal and report them to the higher-level caller.
//
// +--------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE | DESCRIPTION |
// | | |
// +--------------+----------------------------------------------------------------------------------+
// +--------------+----------------------------------------------------------------------------------+
// | 0x80040012 | The response exceeds the maximum size allowed by the server. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x80040014 | The notification type identifier is different from the notification type of the |
// | | notification channel. |
// +--------------+----------------------------------------------------------------------------------+
// | 0x8007000E | The server does not have enough memory to complete the request. |
// +--------------+----------------------------------------------------------------------------------+
//
// Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying
// RPC protocol [MS-RPCE].
//
// If a client call to IRPCAsyncNotify_GetNotificationSendResponse is blocked on the
// server, waiting for a notification to become available on a notification channel,
// then the server MUST process a client call to this method on the same notification
// channel without waiting for a notification.
//
// A client MUST NOT call IRPCAsyncNotify_CloseChannel following a prior successful
// return from IRPCAsyncNotify_GetNotificationSendResponse with a NULL value of pChannel
// parameter or following a prior successful return from IRPCAsyncNotify_CloseChannel.<11>
CloseChannel(context.Context, *CloseChannelRequest, ...dcerpc.CallOption) (*CloseChannelResponse, error)
// AlterContext alters the client context.
AlterContext(context.Context, ...dcerpc.Option) error
}
// ConversationStyle type represents PrintAsyncNotifyConversationStyle RPC enumeration.
//
// The PrintAsyncNotifyConversationStyle enumeration MUST specify the communication
// mode expected between the sender and a registered client.
type ConversationStyle uint32
var (
// kBiDirectional: Bidirectional communication mode is specified. The sender expects
// the client to send responses to notifications.
ConversationStyleBidirectional ConversationStyle = 0
// kUniDirectional: Unidirectional communication mode is specified. The sender does
// not expect the client to respond to notifications.
ConversationStyleUnidirectional ConversationStyle = 1
)
func (o ConversationStyle) String() string {
switch o {
case ConversationStyleBidirectional:
return "ConversationStyleBidirectional"
case ConversationStyleUnidirectional:
return "ConversationStyleUnidirectional"
}
return "Invalid"
}
// UserFilter type represents PrintAsyncNotifyUserFilter RPC enumeration.
//
// The PrintAsyncNotifyUserFilter enumeration is used by clients when they register
// to receive notifications from server-resident notification sources. The following
// types of notifications can be requested:
//
// * Notifications intended specifically for a particular client's user identity.
//
// * Notifications intended for all registered client user identities.
//
// typedef [v1_enum] enum
//
// {
//
// kPerUser = 0,
//
// kAllUsers = 1,
//
// } PrintAsyncNotifyUserFilter;
type UserFilter uint32
var (
// kPerUser: Indicates that the client is requesting notifications that are intended
// specifically for its own user identity and notifications that are intended for all
// registered user identities.
UserFilterPerUser UserFilter = 0
// kAllUsers: Indicates that the client is requesting every notification, whether
// intended for a specific user identity or for all registered user identities.
UserFilterAllUsers UserFilter = 1
)
func (o UserFilter) String() string {
switch o {
case UserFilterPerUser:
return "UserFilterPerUser"
case UserFilterAllUsers:
return "UserFilterAllUsers"
}
return "Invalid"
}
// NotificationType structure represents PrintAsyncNotificationType RPC structure.
type NotificationType dtyp.GUID
func (o *NotificationType) GUID() *dtyp.GUID { return (*dtyp.GUID)(o) }
func (o *NotificationType) 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 *NotificationType) 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.Data1); err != nil {
return err
}
if err := w.WriteData(o.Data2); err != nil {
return err
}
if err := w.WriteData(o.Data3); err != nil {
return err
}
for i1 := range o.Data4 {
i1 := i1
if uint64(i1) >= 8 {
break
}
if err := w.WriteData(o.Data4[i1]); err != nil {
return err
}
}
for i1 := len(o.Data4); uint64(i1) < 8; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *NotificationType) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.Data1); err != nil {
return err
}
if err := w.ReadData(&o.Data2); err != nil {
return err
}
if err := w.ReadData(&o.Data3); err != nil {
return err
}
o.Data4 = make([]byte, 8)
for i1 := range o.Data4 {
i1 := i1
if err := w.ReadData(&o.Data4[i1]); err != nil {
return err
}
}
return nil
}
// NotifyObject structure represents PNOTIFYOBJECT RPC structure.
type NotifyObject dcetypes.ContextHandle
func (o *NotifyObject) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *NotifyObject) 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 *NotifyObject) 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 *NotifyObject) 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
}
type xxx_DefaultIrpcAsyncNotifyClient struct {
cc dcerpc.Conn
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) RegisterClient(ctx context.Context, in *RegisterClientRequest, opts ...dcerpc.CallOption) (*RegisterClientResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &RegisterClientResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) UnregisterClient(ctx context.Context, in *UnregisterClientRequest, opts ...dcerpc.CallOption) (*UnregisterClientResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &UnregisterClientResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) GetNewChannel(ctx context.Context, in *GetNewChannelRequest, opts ...dcerpc.CallOption) (*GetNewChannelResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &GetNewChannelResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) GetNotificationSendResponse(ctx context.Context, in *GetNotificationSendResponseRequest, opts ...dcerpc.CallOption) (*GetNotificationSendResponseResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &GetNotificationSendResponseResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) GetNotification(ctx context.Context, in *GetNotificationRequest, opts ...dcerpc.CallOption) (*GetNotificationResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &GetNotificationResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) CloseChannel(ctx context.Context, in *CloseChannelRequest, opts ...dcerpc.CallOption) (*CloseChannelResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &CloseChannelResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != int32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultIrpcAsyncNotifyClient) AlterContext(ctx context.Context, opts ...dcerpc.Option) error {
return o.cc.AlterContext(ctx, opts...)
}
func NewIrpcAsyncNotifyClient(ctx context.Context, cc dcerpc.Conn, opts ...dcerpc.Option) (IrpcAsyncNotifyClient, error) {
cc, err := cc.Bind(ctx, append(opts, dcerpc.WithAbstractSyntax(IrpcAsyncNotifySyntaxV1_0))...)
if err != nil {
return nil, err
}
return &xxx_DefaultIrpcAsyncNotifyClient{cc: cc}, nil
}
// xxx_RegisterClientOperation structure represents the IRPCAsyncNotify_RegisterClient operation
type xxx_RegisterClientOperation struct {
RegistrationObject *irpcremoteobject.RemoteObject `idl:"name:pRegistrationObj" json:"registration_object"`
Name string `idl:"name:pName;string;pointer:unique" json:"name"`
InNotificationType *NotificationType `idl:"name:pInNotificationType" json:"in_notification_type"`
NotifyFilter UserFilter `idl:"name:NotifyFilter" json:"notify_filter"`
ConversationStyle ConversationStyle `idl:"name:conversationStyle" json:"conversation_style"`
RemoteServerReferral string `idl:"name:ppRmtServerReferral;string" json:"remote_server_referral"`
Return int32 `idl:"name:Return" json:"return"`
}
func (o *xxx_RegisterClientOperation) OpNum() int { return 0 }
func (o *xxx_RegisterClientOperation) OpName() string {
return "/IRPCAsyncNotify/v1/IRPCAsyncNotify_RegisterClient"
}
func (o *xxx_RegisterClientOperation) xxx_PrepareRequestPayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPrepareRequestPayload(context.Context) error }); ok {
if err := hook.AfterPrepareRequestPayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *xxx_RegisterClientOperation) MarshalNDRRequest(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PrepareRequestPayload(ctx); err != nil {
return err
}
// pRegistrationObj {in} (1:{context_handle, alias=PRPCREMOTEOBJECT, names=ndr_context_handle}(struct))
{
if o.RegistrationObject != nil {
if err := o.RegistrationObject.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&irpcremoteobject.RemoteObject{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
// pName {in} (1:{string, pointer=unique}*(1)[dim:0,string,null](wchar))
{
if o.Name != "" {
_ptr_pName := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.Name); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.Name, _ptr_pName); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteDeferred(); err != nil {
return err
}
}
// pInNotificationType {in} (1:{pointer=ref}*(1))(2:{alias=PrintAsyncNotificationType, names=GUID}(struct))
{
if o.InNotificationType != nil {
if err := o.InNotificationType.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&NotificationType{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
// NotifyFilter {in} (1:{v1_enum, alias=PrintAsyncNotifyUserFilter}(enum))
{
if err := w.WriteData(uint32(o.NotifyFilter)); err != nil {
return err
}
}
// conversationStyle {in} (1:{v1_enum, alias=PrintAsyncNotifyConversationStyle}(enum))
{
if err := w.WriteData(uint32(o.ConversationStyle)); err != nil {
return err
}
}
return nil
}
func (o *xxx_RegisterClientOperation) UnmarshalNDRRequest(ctx context.Context, w ndr.Reader) error {
// pRegistrationObj {in} (1:{context_handle, alias=PRPCREMOTEOBJECT, names=ndr_context_handle}(struct))
{
if o.RegistrationObject == nil {
o.RegistrationObject = &irpcremoteobject.RemoteObject{}
}
if err := o.RegistrationObject.UnmarshalNDR(ctx, w); err != nil {
return err
}
}
// pName {in} (1:{string, pointer=unique}*(1)[dim:0,string,null](wchar))
{
_ptr_pName := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.Name); err != nil {
return err
}
return nil
})
_s_pName := func(ptr interface{}) { o.Name = *ptr.(*string) }
if err := w.ReadPointer(&o.Name, _s_pName, _ptr_pName); err != nil {
return err
}
if err := w.ReadDeferred(); err != nil {
return err
}
}
// pInNotificationType {in} (1:{pointer=ref}*(1))(2:{alias=PrintAsyncNotificationType, names=GUID}(struct))
{
if o.InNotificationType == nil {
o.InNotificationType = &NotificationType{}
}
if err := o.InNotificationType.UnmarshalNDR(ctx, w); err != nil {
return err
}
}
// NotifyFilter {in} (1:{v1_enum, alias=PrintAsyncNotifyUserFilter}(enum))
{
if err := w.ReadData((*uint32)(&o.NotifyFilter)); err != nil {
return err
}
}
// conversationStyle {in} (1:{v1_enum, alias=PrintAsyncNotifyConversationStyle}(enum))
{
if err := w.ReadData((*uint32)(&o.ConversationStyle)); err != nil {
return err
}
}
return nil
}
func (o *xxx_RegisterClientOperation) xxx_PrepareResponsePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPrepareResponsePayload(context.Context) error }); ok {
if err := hook.AfterPrepareResponsePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *xxx_RegisterClientOperation) MarshalNDRResponse(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PrepareResponsePayload(ctx); err != nil {
return err
}
// ppRmtServerReferral {out} (1:{string, pointer=ref}*(2)*(1)[dim:0,string,null](wchar))
{
if o.RemoteServerReferral != "" {
_ptr_ppRmtServerReferral := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if err := ndr.WriteUTF16NString(ctx, w, o.RemoteServerReferral); err != nil {
return err
}
return nil
})
if err := w.WritePointer(&o.RemoteServerReferral, _ptr_ppRmtServerReferral); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteDeferred(); err != nil {
return err
}
}
// Return {out} (1:{alias=HRESULT, names=LONG}(int32))
{
if err := w.WriteData(o.Return); err != nil {
return err
}
}
return nil
}
func (o *xxx_RegisterClientOperation) UnmarshalNDRResponse(ctx context.Context, w ndr.Reader) error {
// ppRmtServerReferral {out} (1:{string, pointer=ref}*(2)*(1)[dim:0,string,null](wchar))
{
_ptr_ppRmtServerReferral := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if err := ndr.ReadUTF16NString(ctx, w, &o.RemoteServerReferral); err != nil {
return err
}
return nil
})
_s_ppRmtServerReferral := func(ptr interface{}) { o.RemoteServerReferral = *ptr.(*string) }
if err := w.ReadPointer(&o.RemoteServerReferral, _s_ppRmtServerReferral, _ptr_ppRmtServerReferral); err != nil {
return err
}
if err := w.ReadDeferred(); err != nil {
return err
}
}
// Return {out} (1:{alias=HRESULT, names=LONG}(int32))
{
if err := w.ReadData(&o.Return); err != nil {
return err
}
}
return nil
}
// RegisterClientRequest structure represents the IRPCAsyncNotify_RegisterClient operation request
type RegisterClientRequest struct {
// pRegistrationObj: MUST be the remote object context handle that was returned by the
// server in the ppRemoteObject output parameter of a prior call to IRPCRemoteObject_Create
// (section 3.1.2.4.1). This value MUST NOT be NULL.
RegistrationObject *irpcremoteobject.RemoteObject `idl:"name:pRegistrationObj" json:"registration_object"`
// pName: MUST be NULL or a pointer to a NULL-terminated string, encoded in Unicode
// UTF-16LE ([RFC2781] section 4.2), which specifies the full UNC name of the print
// queue from which the print client is registering to receive notifications.
//
// This UNC name MUST be in the following format:
//
// SERVER_NAME is a DNS, NetBIOS, IPv4, or IPv6 host name.
//
// LOCAL_PRINTER_NAME is a string that MUST NOT contain the characters "\" or ",".
//
// DNS names are specified in [RFC819] section 2, and NetBIOS names are specified in
// [RFC1001] section 14. Basic notational conventions are specified in [RFC2616] section
// 2, and "host" is defined in [RFC3986] section 3.2.2.
//
// If pName is NULL, the registration MUST be made for the remote print server itself.
Name string `idl:"name:pName;string;pointer:unique" json:"name"`
// pInNotificationType: MUST be a pointer to a PrintAsyncNotificationType structure
// that specifies the notification type identifier for the notifications that the client
// is registering to receive.
InNotificationType *NotificationType `idl:"name:pInNotificationType" json:"in_notification_type"`
// NotifyFilter: MUST be a value of type PrintAsyncNotifyUserFilter that specifies whether
// the client is registering to receive notifications that are issued to all registered
// clients, irrespective of their authenticated user identity, or to receive notifications
// that are issued only to the specific authenticated user identity of the registering
// RPC client.
NotifyFilter UserFilter `idl:"name:NotifyFilter" json:"notify_filter"`
// conversationStyle: MUST be a value of type PrintAsyncNotifyConversationStyle that
// specifies whether the client is registering for bidirectional communication mode
// or unidirectional communication mode.
ConversationStyle ConversationStyle `idl:"name:conversationStyle" json:"conversation_style"`
}