-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
103 lines (93 loc) · 3.64 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
package iwbembackuprestoreex
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"
iwbembackuprestore "github.com/oiweiwei/go-msrpc/msrpc/dcom/wmi/iwbembackuprestore/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)
_ = iwbembackuprestore.GoPackage
)
// IWbemBackupRestoreEx server interface.
type BackupRestoreExServer interface {
// IWbemBackupRestore base class.
iwbembackuprestore.BackupRestoreServer
// On the IWbemBackupRestoreEx::Pause method invocation, the server MUST set the IsServerPaused
// flag to True and MUST persist the CIM database in a consistent state.
//
// This method has no parameters.
//
// 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.
//
// If Pause is called and the IsServerPaused flag is set to True, the server MUST return
// WBEM_E_INVALID_OPERATION. In case of any other failure, the server MUST return an
// HRESULT whose S (severity) bit is set as specified in [MS-ERREF] section 2.1. The
// actual HRESULT value is implementation dependent.
//
// The IWbemBackupRestoreEx::Pause method MUST be called on the interface that is obtained
// from the DCOM Remote Protocol activation of the CLSID_WbemBackupRestore interface,
// as specified in this section.
Pause(context.Context, *PauseRequest) (*PauseResponse, error)
// On the IWbemBackupRestoreEx::Resume method invocation, the server MUST set the IsServerPaused
// flag to False.
//
// This method has no parameters.
//
// Return Values: This method MUST return an HRESULT value that MUST indicate the status
// of the method call. The server MUST return a WBEM_S_NO_ERROR (specified in section
// 2.2.11) to indicate the successful completion of the method.
//
// If Resume is called and the IsServerPaused flag is set to False, the server MUST
// return WBEM_E_INVALID_OPERATION.
//
// In case of any other failure, the server MUST return an HRESULT whose S (severity)
// bit is set as specified in [MS-ERREF] section 2.1. The actual HRESULT value is implementation
// dependent.
Resume(context.Context, *ResumeRequest) (*ResumeResponse, error)
}
func RegisterBackupRestoreExServer(conn dcerpc.Conn, o BackupRestoreExServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewBackupRestoreExServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(BackupRestoreExSyntaxV0_0))...)
}
func NewBackupRestoreExServerHandle(o BackupRestoreExServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return BackupRestoreExServerHandle(ctx, o, opNum, r)
}
}
func BackupRestoreExServerHandle(ctx context.Context, o BackupRestoreExServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 5 {
// IWbemBackupRestore base method.
return iwbembackuprestore.BackupRestoreServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 5: // Pause
in := &PauseRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Pause(ctx, in)
return resp.xxx_ToOp(ctx), err
case 6: // Resume
in := &ResumeRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Resume(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}