1
/* server functions auto-generated by pidl */
2
#include "librpc/gen_ndr/ndr_dbgidl.h"
4
/* dbgidl - dcerpc server boilerplate generated by pidl */
7
static NTSTATUS dbgidl__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
9
#ifdef DCESRV_INTERFACE_DBGIDL_BIND
10
return DCESRV_INTERFACE_DBGIDL_BIND(dce_call,iface);
16
static void dbgidl__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
18
#ifdef DCESRV_INTERFACE_DBGIDL_UNBIND
19
DCESRV_INTERFACE_DBGIDL_UNBIND(context, iface);
25
static NTSTATUS dbgidl__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
27
enum ndr_err_code ndr_err;
28
uint16_t opnum = dce_call->pkt.u.request.opnum;
30
dce_call->fault_code = 0;
32
if (opnum >= ndr_table_dbgidl.num_calls) {
33
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
34
return NT_STATUS_NET_WRITE_FAULT;
37
*r = talloc_named(mem_ctx,
38
ndr_table_dbgidl.calls[opnum].struct_size,
40
ndr_table_dbgidl.calls[opnum].name);
41
NT_STATUS_HAVE_NO_MEMORY(*r);
43
/* unravel the NDR for the packet */
44
ndr_err = ndr_table_dbgidl.calls[opnum].ndr_pull(pull, NDR_IN, *r);
45
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
46
dcerpc_log_packet(dce_call->conn->packet_log_dir,
47
&ndr_table_dbgidl, opnum, NDR_IN,
48
&dce_call->pkt.u.request.stub_and_verifier);
49
dce_call->fault_code = DCERPC_FAULT_NDR;
50
return NT_STATUS_NET_WRITE_FAULT;
56
static NTSTATUS dbgidl__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
58
uint16_t opnum = dce_call->pkt.u.request.opnum;
62
struct dummy_dbgidl *r2 = (struct dummy_dbgidl *)r;
63
if (DEBUGLEVEL >= 10) {
64
NDR_PRINT_FUNCTION_DEBUG(dummy_dbgidl, NDR_IN, r2);
66
dcesrv_dummy_dbgidl(dce_call, mem_ctx, r2);
67
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
68
DEBUG(5,("function dummy_dbgidl will reply async\n"));
74
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
78
if (dce_call->fault_code != 0) {
79
dcerpc_log_packet(dce_call->conn->packet_log_dir,
80
&ndr_table_dbgidl, opnum, NDR_IN,
81
&dce_call->pkt.u.request.stub_and_verifier);
82
return NT_STATUS_NET_WRITE_FAULT;
88
static NTSTATUS dbgidl__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
90
uint16_t opnum = dce_call->pkt.u.request.opnum;
94
struct dummy_dbgidl *r2 = (struct dummy_dbgidl *)r;
95
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
96
DEBUG(5,("function dummy_dbgidl replied async\n"));
98
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
99
NDR_PRINT_FUNCTION_DEBUG(dummy_dbgidl, NDR_OUT | NDR_SET_VALUES, r2);
101
if (dce_call->fault_code != 0) {
102
DEBUG(2,("dcerpc_fault %s in dummy_dbgidl\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
108
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
112
if (dce_call->fault_code != 0) {
113
dcerpc_log_packet(dce_call->conn->packet_log_dir,
114
&ndr_table_dbgidl, opnum, NDR_IN,
115
&dce_call->pkt.u.request.stub_and_verifier);
116
return NT_STATUS_NET_WRITE_FAULT;
122
static NTSTATUS dbgidl__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
124
enum ndr_err_code ndr_err;
125
uint16_t opnum = dce_call->pkt.u.request.opnum;
127
ndr_err = ndr_table_dbgidl.calls[opnum].ndr_push(push, NDR_OUT, r);
128
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
129
dce_call->fault_code = DCERPC_FAULT_NDR;
130
return NT_STATUS_NET_WRITE_FAULT;
136
const struct dcesrv_interface dcesrv_dbgidl_interface = {
138
.syntax_id = {{0x1d55b526,0xc137,0x46c5,{0xab,0x79},{0x63,0x8f,0x2a,0x68,0xe8,0x69}},1.0},
139
.bind = dbgidl__op_bind,
140
.unbind = dbgidl__op_unbind,
141
.ndr_pull = dbgidl__op_ndr_pull,
142
.dispatch = dbgidl__op_dispatch,
143
.reply = dbgidl__op_reply,
144
.ndr_push = dbgidl__op_ndr_push
148
static NTSTATUS dbgidl__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
152
for (i=0;i<ndr_table_dbgidl.endpoints->count;i++) {
154
const char *name = ndr_table_dbgidl.endpoints->names[i];
156
ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_dbgidl_interface, NULL);
157
if (!NT_STATUS_IS_OK(ret)) {
158
DEBUG(1,("dbgidl_op_init_server: failed to register endpoint '%s'\n",name));
166
static bool dbgidl__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
168
if (dcesrv_dbgidl_interface.syntax_id.if_version == if_version &&
169
GUID_equal(&dcesrv_dbgidl_interface.syntax_id.uuid, uuid)) {
170
memcpy(iface,&dcesrv_dbgidl_interface, sizeof(*iface));
177
static bool dbgidl__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
179
if (strcmp(dcesrv_dbgidl_interface.name, name)==0) {
180
memcpy(iface, &dcesrv_dbgidl_interface, sizeof(*iface));
187
NTSTATUS dcerpc_server_dbgidl_init(void)
190
struct dcesrv_endpoint_server ep_server;
192
/* fill in our name */
193
ep_server.name = "dbgidl";
195
/* fill in all the operations */
196
ep_server.init_server = dbgidl__op_init_server;
198
ep_server.interface_by_uuid = dbgidl__op_interface_by_uuid;
199
ep_server.interface_by_name = dbgidl__op_interface_by_name;
201
/* register ourselves with the DCERPC subsystem. */
202
ret = dcerpc_register_ep_server(&ep_server);
204
if (!NT_STATUS_IS_OK(ret)) {
205
DEBUG(0,("Failed to register 'dbgidl' endpoint server!\n"));