-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.go
182 lines (168 loc) · 6.49 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package loctoloc
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"
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)
)
// LocToLoc server interface.
type LocToLocServer interface {
// The I_nsi_lookup_begin method is invoked by a client locator to enumerate the binding
// information for a set of RPC servers that satisfy a given set of criteria. The Microsoft
// Interface Definition Language (MIDL) syntax of the method is specified as follows.
//
// Return Values: This method does not return any values. RPC exceptions might be thrown
// from this method.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
LookupBegin(context.Context, *LookupBeginRequest) (*LookupBeginResponse, error)
// The I_nsi_lookup_done method is invoked to free any resources associated with the
// context handle returned by a preceding call to the I_nsi_lookup_begin method. The
// MIDL syntax of this method is specified as follows.
//
// Return Values: This method does not return any values.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
LookupDone(context.Context, *LookupDoneRequest) (*LookupDoneResponse, error)
// The I_nsi_lookup_next method is invoked to continue an enumeration of binding vectors
// that satisfy the criteria specified in a call to the I_nsi_lookup_begin method. The
// number of bindings in the binding_vector is limited by the parameter binding_max_count
// specified in the call to the I_nsi_lookup_begin method. The MIDL syntax of this method
// is specified as follows.
//
// Return Values: This method does not return any values.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
LookupNext(context.Context, *LookupNextRequest) (*LookupNextResponse, error)
// The I_nsi_entry_object_inq_next method is invoked to continue an enumeration initiated
// by a previous call to the I_nsi_entry_object_inq_begin method. The MIDL syntax of
// the method is specified as follows.
//
// Return Values: This method does not return any values. RPC exceptions can be thrown
// from this method.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
EntryObjectInquireNext(context.Context, *EntryObjectInquireNextRequest) (*EntryObjectInquireNextResponse, error)
// The I_nsi_ping_locator method is invoked by the client to determine if the target
// computer is available as a master locator. The MIDL syntax of the method is specified
// as follows.
//
// Return Values: This method does not return any values.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
PingLocator(context.Context, *PingLocatorRequest) (*PingLocatorResponse, error)
// The I_nsi_entry_object_inq_done method is invoked to free any resources associated
// with the context handle returned by a preceding call to the I_nsi_entry_object_inq_begin
// method. The MIDL syntax of the method is specified as follows.
//
// Return Values: This method does not return any values. RPC exceptions can be thrown
// from this method.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
EntryObjectInquireDone(context.Context, *EntryObjectInquireDoneRequest) (*EntryObjectInquireDoneResponse, error)
// The I_nsi_entry_object_inq_begin method is invoked to enumerate the object UUIDs
// on a name service entry. The MIDL syntax of the method is specified as follows.
//
// Return Values: This method does not return any values. RPC exceptions can be thrown
// from this method.
//
// # Exceptions Thrown
//
// No exceptions are thrown beyond those thrown by the underlying RPC protocol, as specified
// in [MS-RPCE].
EntryObjectInquireBegin(context.Context, *EntryObjectInquireBeginRequest) (*EntryObjectInquireBeginResponse, error)
}
func RegisterLocToLocServer(conn dcerpc.Conn, o LocToLocServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewLocToLocServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(LocToLocSyntaxV1_0))...)
}
func NewLocToLocServerHandle(o LocToLocServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return LocToLocServerHandle(ctx, o, opNum, r)
}
}
func LocToLocServerHandle(ctx context.Context, o LocToLocServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
switch opNum {
case 0: // I_nsi_lookup_begin
in := &LookupBeginRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.LookupBegin(ctx, in)
return resp.xxx_ToOp(ctx), err
case 1: // I_nsi_lookup_done
in := &LookupDoneRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.LookupDone(ctx, in)
return resp.xxx_ToOp(ctx), err
case 2: // I_nsi_lookup_next
in := &LookupNextRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.LookupNext(ctx, in)
return resp.xxx_ToOp(ctx), err
case 3: // I_nsi_entry_object_inq_next
in := &EntryObjectInquireNextRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EntryObjectInquireNext(ctx, in)
return resp.xxx_ToOp(ctx), err
case 4: // I_nsi_ping_locator
in := &PingLocatorRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.PingLocator(ctx, in)
return resp.xxx_ToOp(ctx), err
case 5: // I_nsi_entry_object_inq_done
in := &EntryObjectInquireDoneRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EntryObjectInquireDone(ctx, in)
return resp.xxx_ToOp(ctx), err
case 6: // I_nsi_entry_object_inq_begin
in := &EntryObjectInquireBeginRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EntryObjectInquireBegin(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}