-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
83 lines (73 loc) · 2.65 KB
/
server.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
package iremotedispatch
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"
idispatch "github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut/idispatch/v0"
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)
_ = idispatch.GoPackage
)
// IRemoteDispatch server interface.
type RemoteDispatchServer interface {
// IDispatch base class.
idispatch.DispatchServer
// The RemoteDispatchAutoDone method is called by the client to invoke a method on the
// server.
//
// Return Values: An HRESULT that specifies success or failure. All success HRESULT
// values MUST be treated as success and all failure HRESULT values MUST be treated
// as failure.
RemoteDispatchAutoDone(context.Context, *RemoteDispatchAutoDoneRequest) (*RemoteDispatchAutoDoneResponse, error)
// The RemoteDispatchNotAutoDone method is called by the client to invoke a method on
// the server.
//
// Return Values: An HRESULT that specifies success or failure. All success HRESULT
// values MUST be treated as success and all failure HRESULT values MUST be treated
// as failure.
RemoteDispatchNotAutoDone(context.Context, *RemoteDispatchNotAutoDoneRequest) (*RemoteDispatchNotAutoDoneResponse, error)
}
func RegisterRemoteDispatchServer(conn dcerpc.Conn, o RemoteDispatchServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewRemoteDispatchServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(RemoteDispatchSyntaxV0_0))...)
}
func NewRemoteDispatchServerHandle(o RemoteDispatchServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return RemoteDispatchServerHandle(ctx, o, opNum, r)
}
}
func RemoteDispatchServerHandle(ctx context.Context, o RemoteDispatchServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 7 {
// IDispatch base method.
return idispatch.DispatchServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 7: // RemoteDispatchAutoDone
in := &RemoteDispatchAutoDoneRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.RemoteDispatchAutoDone(ctx, in)
return resp.xxx_ToOp(ctx), err
case 8: // RemoteDispatchNotAutoDone
in := &RemoteDispatchNotAutoDoneRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.RemoteDispatchNotAutoDone(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}