-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
86 lines (76 loc) · 3.06 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
package ivdsserviceuninstalldisk
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
)
// IVdsServiceUninstallDisk server interface.
type ServiceUninstallDiskServer interface {
// IUnknown base class.
iunknown.UnknownServer
// The GetDiskIdFromLunInfo method retrieves the VDS object ID of a disk that corresponds
// to a specified LUN information structure.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
GetDiskIDFromLUNInfo(context.Context, *GetDiskIDFromLUNInfoRequest) (*GetDiskIDFromLUNInfoResponse, error)
// The UninstallDisks method uninstalls a specific set of disks when it is given a list
// of the VDS object IDs for the disks. All volumes that are contained wholly or partially
// on the disks are also uninstalled, and the obsolete mount points are removed.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
UninstallDisks(context.Context, *UninstallDisksRequest) (*UninstallDisksResponse, error)
}
func RegisterServiceUninstallDiskServer(conn dcerpc.Conn, o ServiceUninstallDiskServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewServiceUninstallDiskServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(ServiceUninstallDiskSyntaxV0_0))...)
}
func NewServiceUninstallDiskServerHandle(o ServiceUninstallDiskServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return ServiceUninstallDiskServerHandle(ctx, o, opNum, r)
}
}
func ServiceUninstallDiskServerHandle(ctx context.Context, o ServiceUninstallDiskServer, 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: // GetDiskIdFromLunInfo
in := &GetDiskIDFromLUNInfoRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetDiskIDFromLUNInfo(ctx, in)
return resp.xxx_ToOp(ctx), err
case 4: // UninstallDisks
in := &UninstallDisksRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.UninstallDisks(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}