-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
125 lines (114 loc) · 4.97 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
package ipchcollection
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
)
// IPCHCollection server interface.
type PCHCollectionServer interface {
// IDispatch base class.
idispatch.DispatchServer
// _NewEnum operation.
Get_NewEnum(context.Context, *Get_NewEnumRequest) (*Get_NewEnumResponse, error)
// The Item method retrieves an element.
//
// Return Values: A signed 32-bit value indicating return status. This method MUST return
// zero to indicate success, or an HRESULT error value (as specified in [MS-ERREF] section
// 2.1.1) to indicate failure.
//
// +--------------------------+----------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +--------------------------+----------------------------------------------------+
// +--------------------------+----------------------------------------------------+
// | 0x00000000 S_OK | The call was successful. |
// +--------------------------+----------------------------------------------------+
// | 0x80004003 E_POINTER | The method failed due to an invalid pointer. |
// +--------------------------+----------------------------------------------------+
// | 0x8007000E E_OUTOFMEMORY | The method was unable to allocate required memory. |
// +--------------------------+----------------------------------------------------+
//
// Exceptions Thrown:
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].
GetItem(context.Context, *GetItemRequest) (*GetItemResponse, error)
// The Count method retrieves the number of elements in the collection.
//
// Return Values: A signed 32-bit value indicating return status. This method MUST return
// zero to indicate success, or an HRESULT error value (as specified in [MS-ERREF] section
// 2.1.1) to indicate failure.
//
// +--------------------------+----------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +--------------------------+----------------------------------------------------+
// +--------------------------+----------------------------------------------------+
// | 0x00000000 S_OK | The call was successful. |
// +--------------------------+----------------------------------------------------+
// | 0x80004003 E_POINTER | The method failed due to an invalid pointer. |
// +--------------------------+----------------------------------------------------+
// | 0x8007000E E_OUTOFMEMORY | The method was unable to allocate required memory. |
// +--------------------------+----------------------------------------------------+
//
// Exceptions Thrown:
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].
GetCount(context.Context, *GetCountRequest) (*GetCountResponse, error)
}
func RegisterPCHCollectionServer(conn dcerpc.Conn, o PCHCollectionServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewPCHCollectionServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(PCHCollectionSyntaxV0_0))...)
}
func NewPCHCollectionServerHandle(o PCHCollectionServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return PCHCollectionServerHandle(ctx, o, opNum, r)
}
}
func PCHCollectionServerHandle(ctx context.Context, o PCHCollectionServer, 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: // _NewEnum
in := &Get_NewEnumRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Get_NewEnum(ctx, in)
return resp.xxx_ToOp(ctx), err
case 8: // Item
in := &GetItemRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetItem(ctx, in)
return resp.xxx_ToOp(ctx), err
case 9: // Count
in := &GetCountRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetCount(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}