-
Notifications
You must be signed in to change notification settings - Fork 2
/
v1.go
3269 lines (3060 loc) · 122 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 qm2qm
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 = "mqqp"
)
var (
// Syntax UUID
Qm2qmSyntaxUUID = &uuid.UUID{TimeLow: 0x1088a980, TimeMid: 0xeae5, TimeHiAndVersion: 0x11d0, ClockSeqHiAndReserved: 0x8d, ClockSeqLow: 0x9b, Node: [6]uint8{0x0, 0xa0, 0x24, 0x53, 0xc3, 0x37}}
// Syntax ID
Qm2qmSyntaxV1_0 = &dcerpc.SyntaxID{IfUUID: Qm2qmSyntaxUUID, IfVersionMajor: 1, IfVersionMinor: 0}
)
// qm2qm interface.
type Qm2qmClient interface {
// The RemoteQMStartReceive method peeks or receives a message from an open queue.
//
// If RemoteQMStartReceive is invoked with a Peek action type, as specified in the ulAction
// member of the lpRemoteReadDesc parameter, the operation completes when RemoteQMStartReceive
// returns.
//
// If RemoteQMStartReceive is invoked with a Receive action type, as specified in the
// ulAction member of the lpRemoteReadDesc parameter, the client MUST pair each call
// to RemoteQMStartReceive with a call to RemoteQMEndReceive to complete the operation,
// or to RemoteQMCancelReceive to cancel the operation.
//
// For each call to RemoteQMCancelReceive, the dwRequestID parameter MUST match the
// dwRequestID member of the lpRemoteReadDesc parameter in a previous call to RemoteQMStartReceive.
//
// If the client specifies a nonzero value for the ulTimeout member of the lpRemoteReadDesc
// parameter, and a message is not available in the queue at the time of the call, the
// server waits up to the specified time-out for a message to become available in the
// queue before responding to the call. The client can call RemoteQMCancelReceive with
// a matching REMOTEREADDESC.dwRequestID to cancel the pending RemoteQMStartReceive
// request.
//
// Before calling this method, the client MUST have already called RemoteQMOpenQueue.
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// STATUS_INVALID_PARAMETER (0xC000000D)
//
// Exceptions Thrown: None except those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
StartReceive(context.Context, *StartReceiveRequest, ...dcerpc.CallOption) (*StartReceiveResponse, error)
// The client MUST invoke the RemoteQMEndReceive method to advise the server that the
// message packet returned by the RemoteQMStartReceive, RemoteQMStartReceive2, or RemoteQMStartReceiveByLookupId
// method has been received.
//
// The combination of the RemoteQMStartReceive, RemoteQMStartReceive2, or RemoteQMStartReceiveByLookupId
// method and the positive acknowledgment of the RemoteQMEndReceive method ensures that
// a message packet is not lost in transit from the server to the client due to a network
// outage during the call sequence.
//
// Before calling this method, the following methods MUST be called:
//
// * RemoteQMOpenQueue
//
// * RemoteQMStartReceive, RemoteQMStartReceive2, or RemoteQMStartReceiveByLookupId
//
// HRESULT RemoteQMEndReceive(
//
// [in] handle_t hBind,
//
// * [in, range(1, 2)] DWORD dwAck
//
// );
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// MQ_ERROR_TRANSACTION_SEQUENCE (0xC00E0051)
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, [MS-RPCE].
EndReceive(context.Context, *EndReceiveRequest, ...dcerpc.CallOption) (*EndReceiveResponse, error)
// The RemoteQMOpenQueue method opens a queue in preparation for subsequent operations
// against it. This method assumes that the client has called qmcomm:R_QMOpenRemoteQueue
// to obtain a queue handle; for more information, see [MS-MQMP] section 3.1.4.2. This
// method is called as part of the sequence of events involved in opening a remote queue
// by an MQMP application as described in [MS-MQMP] section 4.2. This method MUST be
// called prior to calling any of the following operations:
//
// * RemoteQMStartReceive ( aab4d8fa-3a56-483c-ac61-4172a09fc199 )
//
// * RemoteQMEndReceive ( 4c0b91ba-37fa-441c-974a-91bbea58a62d )
//
// * RemoteQMCloseQueue ( f8b37cf7-cdf4-4e3a-8497-cf2c65074db5 )
//
// * RemoteQMCloseCursor ( 0ec761b0-e700-4e3d-b735-54bdf458509d )
//
// * RemoteQMCancelReceive ( 76f56b96-7c8d-432e-a169-a1b750e20527 )
//
// * RemoteQMPurgeQueue ( 119644cf-f6ca-4f74-bb4a-c2624ccab22c )
//
// * RemoteQMStartReceive2 ( a0df225e-80ea-4242-90e5-9891bfa9ebfb )
//
// * RemoteQMStartReceiveByLookupId ( b8a82b34-6feb-4057-8f7f-48275fa65068 )
//
// HRESULT RemoteQMOpenQueue(
//
// [in] handle_t hBind,
//
// * [in, range(0, 16)] DWORD dwMQS,
//
// [in] DWORD hQueue,
//
// [in] DWORD pQueue,
//
// [in] DWORD dwpContext
//
// );
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// Exceptions Thrown:
//
// No exceptions are thrown except those thrown by the underlying RPC protocol (see
// [MS-RPCE]).
OpenQueue(context.Context, *OpenQueueRequest, ...dcerpc.CallOption) (*OpenQueueResponse, error)
// The RemoteQMCloseQueue method closes a PCTX_RRSESSION_HANDLE_TYPE that was previously
// opened by using a call to the RemoteQMOpenQueue method. The client MUST call this
// method to reclaim resources on the server allocated by the RemoteQMOpenQueue method.
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
CloseQueue(context.Context, *CloseQueueRequest, ...dcerpc.CallOption) (*CloseQueueResponse, error)
// The RemoteQMCloseCursor method closes the handle for a previously created cursor.
// The client MUST call this method to reclaim resources on the server allocated by
// the qmcomm:R_QMCreateRemoteCursor method, as specified in [MS-MQMP] section 3.1.4.4.
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise,
// it MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs
// identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
CloseCursor(context.Context, *CloseCursorRequest, ...dcerpc.CallOption) (*CloseCursorResponse, error)
// The RemoteQMCancelReceive method cancels a pending call to RemoteQMStartReceive and
// provides a way for the client to cancel a blocked request.
//
// Before calling this method, the following methods MUST be called:
//
// * RemoteQMOpenQueue ( 0dbcb6fd-ed56-44c3-9c02-e9fa2d7798b3 )
//
// * RemoteQMStartReceive or RemoteQMStartReceive2 ( a0df225e-80ea-4242-90e5-9891bfa9ebfb
// )
//
// HRESULT RemoteQMCancelReceive(
//
// [in] handle_t hBind,
//
// [in] DWORD hQueue,
//
// [in] DWORD pQueue,
//
// [in] DWORD dwRequestID
//
// );
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise,
// it MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs
// identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR (0xC00E0001)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// STATUS_NOT_FOUND (0xC0000225)
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
CancelReceive(context.Context, *CancelReceiveRequest, ...dcerpc.CallOption) (*CancelReceiveResponse, error)
// The RemoteQMPurgeQueue method removes all messages from the queue.
//
// Before calling this method, the RemoteQMOpenQueue method MUST be called.
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT, and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// Exceptions Thrown: Failure HRESULTs returned by this method MAY<18> be thrown as
// exceptions as well as those thrown by the underlying RPC protocol, as specified in
// [MS-RPCE].
PurgeQueue(context.Context, *PurgeQueueRequest, ...dcerpc.CallOption) (*PurgeQueueResponse, error)
// The RemoteQMGetQMQMServerPort method returns an RPC port number (see [MS-RPCE]) for
// the requested combination of interface and protocol.
//
// Return Values: On success, this method returns a nonzero IP port value for the
// RPC interface specified by the dwPortType parameter. If an invalid value is specified
// for dwPortType, or if the requested interface is otherwise unavailable, or if any
// other error is encountered, this method MUST return 0x00000000.
//
// Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying
// RPC protocol (see [MS-RPCE]).
//
// As specified in section 3.1.3, this protocol configures a fixed listening endpoint
// at an RPC port number, which can vary. For the interface and protocol specified by
// the dwPortType parameter, this method returns the RPC port number determined at server
// initialization time. If the default port is already in use, the server SHOULD increment
// the port number by 11 until an unused port is found.
GetQMQMServerPort(context.Context, *GetQMQMServerPortRequest, ...dcerpc.CallOption) (*GetQMQMServerPortResponse, error)
// The RemoteQmGetVersion method retrieves the Message queuing version of the server;
// this method is called before the RemoteQMOpenQueue method.<21>
//
// Return Values: This method has no return values.
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
GetVersion(context.Context, *GetVersionRequest, ...dcerpc.CallOption) (*GetVersionResponse, error)
// The RemoteQMStartReceive2 method functions in the same way as RemoteQMStartReceive
// (section 3.1.4.1), except that it returns a structure that contains the SequentialId
// of the message.<25>
//
// Return Values: On success, this method MUST return MQ_OK (0x00000000).
//
// If an error occurs, the server MUST return a failure HRESULT, and the client MUST
// treat all failure HRESULTs identically.
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
StartReceive2(context.Context, *StartReceive2Request, ...dcerpc.CallOption) (*StartReceive2Response, error)
// The RemoteQMStartReceiveByLookupId method reads a message from the opened remote
// queue by using the lookup identifier.<27>
//
// Return Values: The method MUST return MQ_OK (0x00000000) on success; otherwise, it
// MUST return a failure HRESULT and the client MUST treat all failure HRESULTs identically.
//
// MQ_OK (0x00000000)
//
// MQ_ERROR_INVALID_HANDLE (0xC00E0007)
//
// MQ_ERROR_INVALID_PARAMETER (0xC00E0006)
//
// MQ_ERROR_IO_TIMEOUT ((0xC00E001B))
//
// MQ_ERROR_MESSAGE_ALREADY_RECEIVED ((0xC00E001D))
//
// Exceptions Thrown: No exceptions are thrown except those thrown by the underlying
// RPC protocol, as specified in [MS-RPCE].
StartReceiveByLookupID(context.Context, *StartReceiveByLookupIDRequest, ...dcerpc.CallOption) (*StartReceiveByLookupIDResponse, error)
// AlterContext alters the client context.
AlterContext(context.Context, ...dcerpc.Option) error
}
// Session structure represents PCTX_RRSESSION_HANDLE_TYPE RPC structure.
type Session dcetypes.ContextHandle
func (o *Session) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Session) 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 *Session) 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 *Session) 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
}
// Context structure represents PCTX_REMOTEREAD_HANDLE_TYPE RPC structure.
type Context dcetypes.ContextHandle
func (o *Context) ContextHandle() *dcetypes.ContextHandle { return (*dcetypes.ContextHandle)(o) }
func (o *Context) 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 *Context) 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 *Context) 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
}
// RemoteReadAck type represents REMOTEREADACK RPC enumeration.
//
// The REMOTEREADACK enumeration represents an acknowledgment (ACK) or a negative acknowledgment
// (NACK), indicating a successfully or an unsuccessfully delivered packet, respectively.
type RemoteReadAck uint16
var (
// RR_UNKNOWN: No acknowledgment.
RemoteReadAckUnknown RemoteReadAck = 0
// RR_NACK: Negative acknowledgment for a packet.
RemoteReadAckNack RemoteReadAck = 1
// RR_ACK: Acknowledgment for a packet.
RemoteReadAckAck RemoteReadAck = 2
)
func (o RemoteReadAck) String() string {
switch o {
case RemoteReadAckUnknown:
return "RemoteReadAckUnknown"
case RemoteReadAckNack:
return "RemoteReadAckNack"
case RemoteReadAckAck:
return "RemoteReadAckAck"
}
return "Invalid"
}
// RemoteReadDesc structure represents REMOTEREADDESC RPC structure.
//
// This structure is used to encapsulate the information necessary to perform operations
// RemoteQMStartReceive, RemoteQMStartReceive2, and RemoteQMStartReceiveByLookupId.
type RemoteReadDesc struct {
RemoteQueue uint32 `idl:"name:hRemoteQueue" json:"remote_queue"`
Cursor uint32 `idl:"name:hCursor" json:"cursor"`
// ulAction: The following table describes possible actions. The Peek and Receive
// operations both enable access to the contents of a message. This value is set by
// the client.
//
// +--------------------------------------+----------------------------------------------------------------------------------+
// | | |
// | VALUE | TYPE/MEANING |
// | | |
// +--------------------------------------+----------------------------------------------------------------------------------+
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_ACTION_RECEIVE 0x00000000 | Type = Receive Reads and removes a message from the current cursor location if |
// | | hCursor is nonzero or from the front of the queue if hCursor is set to zero. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_ACTION_PEEK_CURRENT 0x80000000 | Type = Peek Reads a message from the current cursor location if hCursor is |
// | | nonzero or from the front of the queue if hCursor is set to zero but does not |
// | | remove it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_ACTION_PEEK_NEXT 0x80000001 | Type = Peek Reads a message following the message at the current cursor location |
// | | but does not remove it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_PEEK_CURRENT 0x40000010 | Type = Peek Reads the message specified by a lookup identifier but does not |
// | | remove it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_PEEK_NEXT 0x40000011 | Type = Peek Reads the message following the message specified by a lookup |
// | | identifier but does not remove it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_PEEK_PREV 0x40000012 | Type = Peek Reads the message preceding the message specified by a lookup |
// | | identifier but does not remove it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_RECEIVE_CURRENT 0x40000020 | Type = Receive Reads the message specified by a lookup identifier and removes it |
// | | from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_RECEIVE_NEXT 0x40000021 | Type = Receive Reads the message following the message specified by a lookup |
// | | identifier and removes it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
// | MQ_LOOKUP_RECEIVE_PREV 0x40000022 | Type = Receive Reads the message preceding the message specified by a lookup |
// | | identifier and removes it from the queue. |
// +--------------------------------------+----------------------------------------------------------------------------------+
Action uint32 `idl:"name:ulAction" json:"action"`
// ulTimeout: Specifies a time-out in milliseconds for the server to wait for a message
// to become available in the queue. This value is set by the client. To specify an
// infinite time-out, the client MUST set this field to 0xFFFFFFFF.
Timeout uint32 `idl:"name:ulTimeout" json:"timeout"`
// dwSize: Specifies the size, in bytes, of lpBuffer. The valid range is 0 to 0x00420000.
// This value is set by the server and MUST be set to 0 by the client.
Size uint32 `idl:"name:dwSize" json:"size"`
Queue uint32 `idl:"name:dwQueue" json:"queue"`
// dwRequestID: The client MUST set this member to a unique identifier for the receive
// request, which could later be used to identify and cancel the receive request. This
// value is set by the client. The client SHOULD NOT<6> reuse this identifier until
// a call to the RemoteQMEndReceive (Opnum 1) method or to the RemoteQMCancelReceive
// (Opnum 5) method has been made for that receive request.
RequestID uint32 `idl:"name:dwRequestID" json:"request_id"`
// Reserved: This is a reserved field of type DWORD that MUST be ignored.
//
// +------------+---------------------+
// | | |
// | VALUE | MEANING |
// | | |
// +------------+---------------------+
// +------------+---------------------+
// | 0x00000000 | Returned by client. |
// +------------+---------------------+
// | 0x00000001 | Returned by server. |
// +------------+---------------------+
_ uint32 `idl:"name:Reserved"`
// dwArriveTime: The server MUST set this value to the time that the message was added
// to the queue. The time MUST be expressed as the number of seconds elapsed since 00:00:00.0,
// January 1, 1970 Coordinated Universal Time (UTC).
ArriveTime uint32 `idl:"name:dwArriveTime" json:"arrive_time"`
// eAckNack: This is a reserved field and MUST be ignored by the client and the server.
AckNack RemoteReadAck `idl:"name:eAckNack" json:"ack_nack"`
// lpBuffer: This field represents a pointer to a buffer containing the UserMessage
// Packet ([MS-MQMQ] section 2.2.20). The size of this field is specified by dwSize.
// This value is set by the server and MUST be set to NULL by the client.
Buffer []byte `idl:"name:lpBuffer;size_is:(dwSize);length_is:(dwSize);pointer:unique" json:"buffer"`
}
func (o *RemoteReadDesc) xxx_PreparePayload(ctx context.Context) error {
if o.Buffer != nil && o.Size == 0 {
o.Size = uint32(len(o.Buffer))
}
if o.Buffer != nil && o.Size == 0 {
o.Size = uint32(len(o.Buffer))
}
if o.Size > uint32(4325376) {
return fmt.Errorf("Size is out of range")
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *RemoteReadDesc) 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.RemoteQueue); err != nil {
return err
}
if err := w.WriteData(o.Cursor); err != nil {
return err
}
if err := w.WriteData(o.Action); err != nil {
return err
}
if err := w.WriteData(o.Timeout); err != nil {
return err
}
if err := w.WriteData(o.Size); err != nil {
return err
}
if err := w.WriteData(o.Queue); err != nil {
return err
}
if err := w.WriteData(o.RequestID); err != nil {
return err
}
// reserved Reserved
if err := w.WriteData(uint32(0)); err != nil {
return err
}
if err := w.WriteData(o.ArriveTime); err != nil {
return err
}
if err := w.WriteData(uint16(o.AckNack)); err != nil {
return err
}
if o.Buffer != nil || o.Size > 0 {
_ptr_lpBuffer := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.Size)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
dimLength1 := uint64(o.Size)
if dimLength1 > sizeInfo[0] {
dimLength1 = sizeInfo[0]
} else {
sizeInfo[0] = dimLength1
}
if err := w.WriteSize(0); err != nil {
return err
}
if err := w.WriteSize(dimLength1); err != nil {
return err
}
for i1 := range o.Buffer {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Buffer[i1]); err != nil {
return err
}
}
for i1 := len(o.Buffer); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Buffer, _ptr_lpBuffer); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *RemoteReadDesc) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.RemoteQueue); err != nil {
return err
}
if err := w.ReadData(&o.Cursor); err != nil {
return err
}
if err := w.ReadData(&o.Action); err != nil {
return err
}
if err := w.ReadData(&o.Timeout); err != nil {
return err
}
if err := w.ReadData(&o.Size); err != nil {
return err
}
if err := w.ReadData(&o.Queue); err != nil {
return err
}
if err := w.ReadData(&o.RequestID); err != nil {
return err
}
// reserved Reserved
var _Reserved uint32
if err := w.ReadData(&_Reserved); err != nil {
return err
}
if err := w.ReadData(&o.ArriveTime); err != nil {
return err
}
if err := w.ReadData((*uint16)(&o.AckNack)); err != nil {
return err
}
_ptr_lpBuffer := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Buffer", sizeInfo[0])
}
o.Buffer = make([]byte, sizeInfo[0])
for i1 := range o.Buffer {
i1 := i1
if err := w.ReadData(&o.Buffer[i1]); err != nil {
return err
}
}
return nil
})
_s_lpBuffer := func(ptr interface{}) { o.Buffer = *ptr.(*[]byte) }
if err := w.ReadPointer(&o.Buffer, _s_lpBuffer, _ptr_lpBuffer); err != nil {
return err
}
return nil
}
// RemoteReadDesc2 structure represents REMOTEREADDESC2 RPC structure.
//
// This structure is used by RemoteQMStartReceive2 and RemoteQMStartReceiveByLookupId
// to encapsulate the parameters necessary for execution of these operations.
type RemoteReadDesc2 struct {
// pRemoteReadDesc: A pointer to a REMOTEREADDESC structure, as specified in section
// 2.2.2.1.
RemoteReadDesc *RemoteReadDesc `idl:"name:pRemoteReadDesc" json:"remote_read_desc"`
// SequentialId: This field is set by the server to the value of a unique message
// identifier that corresponds to a received message.
SequentialID uint64 `idl:"name:SequentialId" json:"sequential_id"`
}
func (o *RemoteReadDesc2) 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 *RemoteReadDesc2) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(8); err != nil {
return err
}
if o.RemoteReadDesc != nil {
_ptr_pRemoteReadDesc := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.RemoteReadDesc != nil {
if err := o.RemoteReadDesc.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&RemoteReadDesc{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.RemoteReadDesc, _ptr_pRemoteReadDesc); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.SequentialID); err != nil {
return err
}
return nil
}
func (o *RemoteReadDesc2) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(8); err != nil {
return err
}
_ptr_pRemoteReadDesc := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.RemoteReadDesc == nil {
o.RemoteReadDesc = &RemoteReadDesc{}
}
if err := o.RemoteReadDesc.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_pRemoteReadDesc := func(ptr interface{}) { o.RemoteReadDesc = *ptr.(**RemoteReadDesc) }
if err := w.ReadPointer(&o.RemoteReadDesc, _s_pRemoteReadDesc, _ptr_pRemoteReadDesc); err != nil {
return err
}
if err := w.ReadData(&o.SequentialID); err != nil {
return err
}
return nil
}
type xxx_DefaultQm2qmClient struct {
cc dcerpc.Conn
}
func (o *xxx_DefaultQm2qmClient) StartReceive(ctx context.Context, in *StartReceiveRequest, opts ...dcerpc.CallOption) (*StartReceiveResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &StartReceiveResponse{}
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_DefaultQm2qmClient) EndReceive(ctx context.Context, in *EndReceiveRequest, opts ...dcerpc.CallOption) (*EndReceiveResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &EndReceiveResponse{}
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_DefaultQm2qmClient) OpenQueue(ctx context.Context, in *OpenQueueRequest, opts ...dcerpc.CallOption) (*OpenQueueResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &OpenQueueResponse{}
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_DefaultQm2qmClient) CloseQueue(ctx context.Context, in *CloseQueueRequest, opts ...dcerpc.CallOption) (*CloseQueueResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &CloseQueueResponse{}
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_DefaultQm2qmClient) CloseCursor(ctx context.Context, in *CloseCursorRequest, opts ...dcerpc.CallOption) (*CloseCursorResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &CloseCursorResponse{}
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_DefaultQm2qmClient) CancelReceive(ctx context.Context, in *CancelReceiveRequest, opts ...dcerpc.CallOption) (*CancelReceiveResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &CancelReceiveResponse{}
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_DefaultQm2qmClient) PurgeQueue(ctx context.Context, in *PurgeQueueRequest, opts ...dcerpc.CallOption) (*PurgeQueueResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &PurgeQueueResponse{}
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_DefaultQm2qmClient) GetQMQMServerPort(ctx context.Context, in *GetQMQMServerPortRequest, opts ...dcerpc.CallOption) (*GetQMQMServerPortResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &GetQMQMServerPortResponse{}
out.xxx_FromOp(ctx, op)
if op.Return != uint32(0) {
return out, fmt.Errorf("%s: %w", op.OpName(), errors.New(ctx, op.Return))
}
return out, nil
}
func (o *xxx_DefaultQm2qmClient) GetVersion(ctx context.Context, in *GetVersionRequest, opts ...dcerpc.CallOption) (*GetVersionResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &GetVersionResponse{}
out.xxx_FromOp(ctx, op)
return out, nil
}
func (o *xxx_DefaultQm2qmClient) StartReceive2(ctx context.Context, in *StartReceive2Request, opts ...dcerpc.CallOption) (*StartReceive2Response, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &StartReceive2Response{}
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_DefaultQm2qmClient) StartReceiveByLookupID(ctx context.Context, in *StartReceiveByLookupIDRequest, opts ...dcerpc.CallOption) (*StartReceiveByLookupIDResponse, error) {
op := in.xxx_ToOp(ctx)
if err := o.cc.Invoke(ctx, op, opts...); err != nil {
return nil, err
}
out := &StartReceiveByLookupIDResponse{}
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_DefaultQm2qmClient) AlterContext(ctx context.Context, opts ...dcerpc.Option) error {
return o.cc.AlterContext(ctx, opts...)
}
func NewQm2qmClient(ctx context.Context, cc dcerpc.Conn, opts ...dcerpc.Option) (Qm2qmClient, error) {
cc, err := cc.Bind(ctx, append(opts, dcerpc.WithAbstractSyntax(Qm2qmSyntaxV1_0))...)
if err != nil {
return nil, err
}
return &xxx_DefaultQm2qmClient{cc: cc}, nil
}
// xxx_StartReceiveOperation structure represents the RemoteQMStartReceive operation
type xxx_StartReceiveOperation struct {
Context *Context `idl:"name:pphContext" json:"context"`
RemoteReadDesc *RemoteReadDesc `idl:"name:lpRemoteReadDesc" json:"remote_read_desc"`
Return int32 `idl:"name:Return" json:"return"`
}
func (o *xxx_StartReceiveOperation) OpNum() int { return 0 }
func (o *xxx_StartReceiveOperation) OpName() string { return "/qm2qm/v1/RemoteQMStartReceive" }
func (o *xxx_StartReceiveOperation) 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_StartReceiveOperation) MarshalNDRRequest(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PrepareRequestPayload(ctx); err != nil {
return err
}
// lpRemoteReadDesc {in, out} (1:{pointer=ref}*(1))(2:{alias=REMOTEREADDESC}(struct))
{
if o.RemoteReadDesc != nil {
if err := o.RemoteReadDesc.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&RemoteReadDesc{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if err := w.WriteDeferred(); err != nil {
return err
}
}
return nil
}
func (o *xxx_StartReceiveOperation) UnmarshalNDRRequest(ctx context.Context, w ndr.Reader) error {
// lpRemoteReadDesc {in, out} (1:{pointer=ref}*(1))(2:{alias=REMOTEREADDESC}(struct))
{
if o.RemoteReadDesc == nil {
o.RemoteReadDesc = &RemoteReadDesc{}
}
if err := o.RemoteReadDesc.UnmarshalNDR(ctx, w); err != nil {
return err
}
if err := w.ReadDeferred(); err != nil {
return err
}
}
return nil
}
func (o *xxx_StartReceiveOperation) xxx_PrepareResponsePayload(ctx context.Context) error {