-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
137 lines (125 loc) · 6.43 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
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
package ifsrmmutablecollection
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"
ifsrmcollection "github.com/oiweiwei/go-msrpc/msrpc/dcom/fsrm/ifsrmcollection/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)
_ = ifsrmcollection.GoPackage
)
// IFsrmMutableCollection server interface.
type MutableCollectionServer interface {
// IFsrmCollection base class.
ifsrmcollection.CollectionServer
// The Add method adds the specified object to the collection of Objects Being Enumerated.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+----------------------------------------------------------------------------------+
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045303 FSRM_E_ALREADY_EXISTS | The object pointed to by the IDispatch pointer that is contained in the VARIANT |
// | | structure already exists in the collection of Objects Being Enumerated. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The item parameter is not a value type. |
// +----------------------------------+----------------------------------------------------------------------------------+
Add(context.Context, *AddRequest) (*AddResponse, error)
// The Remove method removes an object from the collection of Objects Being Enumerated.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +-------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +-------------------------+----------------------------------------------------------------------------------+
// +-------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The index is out of range; the index is less than one or greater than the size |
// | | of the collection. |
// +-------------------------+----------------------------------------------------------------------------------+
Remove(context.Context, *RemoveRequest) (*RemoveResponse, error)
// The RemoveById method removes from the collection of Objects Being Enumerated the
// object whose ID matches the specified id.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +-----------------------------+------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +-----------------------------+------------------------------------------------------------------+
// +-----------------------------+------------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | An object with the specified ID was not found in the collection. |
// +-----------------------------+------------------------------------------------------------------+
RemoveByID(context.Context, *RemoveByIDRequest) (*RemoveByIDResponse, error)
// The Clone method returns a copy of the collection of Objects Being Enumerated.
//
// Return Values: The method MUST return a nonzero error code. Upon receiving this message,
// the server MUST return E_NOTIMPL.
Clone(context.Context, *CloneRequest) (*CloneResponse, error)
}
func RegisterMutableCollectionServer(conn dcerpc.Conn, o MutableCollectionServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewMutableCollectionServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(MutableCollectionSyntaxV0_0))...)
}
func NewMutableCollectionServerHandle(o MutableCollectionServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return MutableCollectionServerHandle(ctx, o, opNum, r)
}
}
func MutableCollectionServerHandle(ctx context.Context, o MutableCollectionServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 14 {
// IFsrmCollection base method.
return ifsrmcollection.CollectionServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 14: // Add
in := &AddRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Add(ctx, in)
return resp.xxx_ToOp(ctx), err
case 15: // Remove
in := &RemoveRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Remove(ctx, in)
return resp.xxx_ToOp(ctx), err
case 16: // RemoveById
in := &RemoveByIDRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.RemoveByID(ctx, in)
return resp.xxx_ToOp(ctx), err
case 17: // Clone
in := &CloneRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Clone(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}