-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
109 lines (98 loc) · 4.01 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
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
package iwbemremoterefresher
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"
iunknown "github.com/oiweiwei/go-msrpc/msrpc/dcom/iunknown/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)
_ = iunknown.GoPackage
)
// IWbemRemoteRefresher server interface.
type RemoteRefresherServer interface {
// IUnknown base class.
iunknown.UnknownServer
// The IWbemRemoteRefresher::RemoteRefresh method MUST return the updated collection
// of CIM instances and enumerations previously configured by the IWbemRefreshingServices
// interface pointer.
//
// Return Values: This method MUST return an HRESULT value that MUST indicate the status
// of the method call.
//
// The server MUST return WBEM_S_NO_ERROR (specified in section 2.2.11) to indicate
// the successful completion of the method.
//
// The IWbemRemoteRefresher::RemoteRefresh method MUST be called on the IWbemRemoteRefresher
// interface pointer returned as a member of the _WBEM_REFRESH_INFO structure from IWbemRefreshingServices
// methods or on the interface returned by IWbemRefreshingServices::GetRemoteRefresher
// method invocation.
RemoteRefresh(context.Context, *RemoteRefreshRequest) (*RemoteRefreshResponse, error)
// The IWbemRemoteRefresher::StopRefreshing method MUST remove a set of CIM instances
// or enumerations from the collection previously configured by the IWbemRefreshingServices
// interface pointer.
//
// Return Values: This method MUST return an HRESULT value that MUST indicate the status
// of the method call. In case of success, the server MUST return WBEM_S_NO_ERROR (as
// specified in section 2.2.11) to indicate the successful completion of the method.
//
// The IWbemRemoteRefresher::StopRefreshing method MUST be called on the IWbemRemoteRefresher
// interface pointer that is returned as a member of the _WBEM_REFRESH_INFO structure
// from the methods of the IWbemRefreshingServices interface or on the interface that
// is returned by the IWbemRefreshingServices::GetRemoteRefresher method invocation.
StopRefreshing(context.Context, *StopRefreshingRequest) (*StopRefreshingResponse, error)
// The IWbemRemoteRefresher::Opnum5NotUsedOnWire method MUST return a random GUID that
// identifies the server object that receives the call.
//
// Return Values: This method MUST return an HRESULT value that MUST indicate the status
// of the method call. The server MUST return WBEM_S_NO_ERROR (specified in section
// 2.2.11) to indicate the successful completion of the method.
//
// Opnum5NotUsedOnWire
}
func RegisterRemoteRefresherServer(conn dcerpc.Conn, o RemoteRefresherServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewRemoteRefresherServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(RemoteRefresherSyntaxV0_0))...)
}
func NewRemoteRefresherServerHandle(o RemoteRefresherServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return RemoteRefresherServerHandle(ctx, o, opNum, r)
}
}
func RemoteRefresherServerHandle(ctx context.Context, o RemoteRefresherServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 3 {
// IUnknown base method.
return iunknown.UnknownServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 3: // RemoteRefresh
in := &RemoteRefreshRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.RemoteRefresh(ctx, in)
return resp.xxx_ToOp(ctx), err
case 4: // StopRefreshing
in := &StopRefreshingRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.StopRefreshing(ctx, in)
return resp.xxx_ToOp(ctx), err
case 5: // Opnum5NotUsedOnWire
// Opnum5NotUsedOnWire
return nil, nil
}
return nil, nil
}