1 /* server functions auto-generated by pidl */
2 #include "bin/default/librpc/gen_ndr/ndr_atsvc.h"
4 NTSTATUS dcerpc_server_atsvc_init(void);
6 /* atsvc - dcerpc server boilerplate generated by pidl */
9 static NTSTATUS atsvc__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
11 #ifdef DCESRV_INTERFACE_ATSVC_BIND
12 return DCESRV_INTERFACE_ATSVC_BIND(dce_call,iface);
18 static void atsvc__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
20 #ifdef DCESRV_INTERFACE_ATSVC_UNBIND
21 DCESRV_INTERFACE_ATSVC_UNBIND(context, iface);
27 static NTSTATUS atsvc__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
29 enum ndr_err_code ndr_err;
30 uint16_t opnum = dce_call->pkt.u.request.opnum;
32 dce_call->fault_code = 0;
34 if (opnum >= ndr_table_atsvc.num_calls) {
35 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
36 return NT_STATUS_NET_WRITE_FAULT;
39 *r = talloc_named(mem_ctx,
40 ndr_table_atsvc.calls[opnum].struct_size,
42 ndr_table_atsvc.calls[opnum].name);
43 NT_STATUS_HAVE_NO_MEMORY(*r);
45 /* unravel the NDR for the packet */
46 ndr_err = ndr_table_atsvc.calls[opnum].ndr_pull(pull, NDR_IN, *r);
47 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
48 dcerpc_log_packet(dce_call->conn->packet_log_dir,
49 &ndr_table_atsvc, opnum, NDR_IN,
50 &dce_call->pkt.u.request.stub_and_verifier);
51 dce_call->fault_code = DCERPC_FAULT_NDR;
52 return NT_STATUS_NET_WRITE_FAULT;
58 static NTSTATUS atsvc__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
60 uint16_t opnum = dce_call->pkt.u.request.opnum;
64 struct atsvc_JobAdd *r2 = (struct atsvc_JobAdd *)r;
65 if (DEBUGLEVEL >= 10) {
66 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobAdd, NDR_IN, r2);
68 r2->out.result = dcesrv_atsvc_JobAdd(dce_call, mem_ctx, r2);
69 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
70 DEBUG(5,("function atsvc_JobAdd will reply async\n"));
75 struct atsvc_JobDel *r2 = (struct atsvc_JobDel *)r;
76 if (DEBUGLEVEL >= 10) {
77 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobDel, NDR_IN, r2);
79 r2->out.result = dcesrv_atsvc_JobDel(dce_call, mem_ctx, r2);
80 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
81 DEBUG(5,("function atsvc_JobDel will reply async\n"));
86 struct atsvc_JobEnum *r2 = (struct atsvc_JobEnum *)r;
87 if (DEBUGLEVEL >= 10) {
88 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobEnum, NDR_IN, r2);
90 r2->out.result = dcesrv_atsvc_JobEnum(dce_call, mem_ctx, r2);
91 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
92 DEBUG(5,("function atsvc_JobEnum will reply async\n"));
97 struct atsvc_JobGetInfo *r2 = (struct atsvc_JobGetInfo *)r;
98 if (DEBUGLEVEL >= 10) {
99 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobGetInfo, NDR_IN, r2);
101 r2->out.result = dcesrv_atsvc_JobGetInfo(dce_call, mem_ctx, r2);
102 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
103 DEBUG(5,("function atsvc_JobGetInfo will reply async\n"));
109 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
113 if (dce_call->fault_code != 0) {
114 dcerpc_log_packet(dce_call->conn->packet_log_dir,
115 &ndr_table_atsvc, opnum, NDR_IN,
116 &dce_call->pkt.u.request.stub_and_verifier);
117 return NT_STATUS_NET_WRITE_FAULT;
123 static NTSTATUS atsvc__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
125 uint16_t opnum = dce_call->pkt.u.request.opnum;
129 struct atsvc_JobAdd *r2 = (struct atsvc_JobAdd *)r;
130 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
131 DEBUG(5,("function atsvc_JobAdd replied async\n"));
133 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
134 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobAdd, NDR_OUT | NDR_SET_VALUES, r2);
136 if (dce_call->fault_code != 0) {
137 DEBUG(2,("dcerpc_fault %s in atsvc_JobAdd\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
142 struct atsvc_JobDel *r2 = (struct atsvc_JobDel *)r;
143 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
144 DEBUG(5,("function atsvc_JobDel replied async\n"));
146 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
147 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobDel, NDR_OUT | NDR_SET_VALUES, r2);
149 if (dce_call->fault_code != 0) {
150 DEBUG(2,("dcerpc_fault %s in atsvc_JobDel\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
155 struct atsvc_JobEnum *r2 = (struct atsvc_JobEnum *)r;
156 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
157 DEBUG(5,("function atsvc_JobEnum replied async\n"));
159 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
160 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobEnum, NDR_OUT | NDR_SET_VALUES, r2);
162 if (dce_call->fault_code != 0) {
163 DEBUG(2,("dcerpc_fault %s in atsvc_JobEnum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
168 struct atsvc_JobGetInfo *r2 = (struct atsvc_JobGetInfo *)r;
169 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
170 DEBUG(5,("function atsvc_JobGetInfo replied async\n"));
172 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
173 NDR_PRINT_FUNCTION_DEBUG(atsvc_JobGetInfo, NDR_OUT | NDR_SET_VALUES, r2);
175 if (dce_call->fault_code != 0) {
176 DEBUG(2,("dcerpc_fault %s in atsvc_JobGetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
182 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
186 if (dce_call->fault_code != 0) {
187 dcerpc_log_packet(dce_call->conn->packet_log_dir,
188 &ndr_table_atsvc, opnum, NDR_IN,
189 &dce_call->pkt.u.request.stub_and_verifier);
190 return NT_STATUS_NET_WRITE_FAULT;
196 static NTSTATUS atsvc__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
198 enum ndr_err_code ndr_err;
199 uint16_t opnum = dce_call->pkt.u.request.opnum;
201 ndr_err = ndr_table_atsvc.calls[opnum].ndr_push(push, NDR_OUT, r);
202 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
203 dce_call->fault_code = DCERPC_FAULT_NDR;
204 return NT_STATUS_NET_WRITE_FAULT;
210 const struct dcesrv_interface dcesrv_atsvc_interface = {
212 .syntax_id = {{0x1ff70682,0x0a51,0x30e8,{0x07,0x6d},{0x74,0x0b,0xe8,0xce,0xe9,0x8b}},1.0},
213 .bind = atsvc__op_bind,
214 .unbind = atsvc__op_unbind,
215 .ndr_pull = atsvc__op_ndr_pull,
216 .dispatch = atsvc__op_dispatch,
217 .reply = atsvc__op_reply,
218 .ndr_push = atsvc__op_ndr_push
222 static NTSTATUS atsvc__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
226 for (i=0;i<ndr_table_atsvc.endpoints->count;i++) {
228 const char *name = ndr_table_atsvc.endpoints->names[i];
230 ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_atsvc_interface, NULL);
231 if (!NT_STATUS_IS_OK(ret)) {
232 DEBUG(1,("atsvc_op_init_server: failed to register endpoint '%s'\n",name));
240 static bool atsvc__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
242 if (dcesrv_atsvc_interface.syntax_id.if_version == if_version &&
243 GUID_equal(&dcesrv_atsvc_interface.syntax_id.uuid, uuid)) {
244 memcpy(iface,&dcesrv_atsvc_interface, sizeof(*iface));
251 static bool atsvc__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
253 if (strcmp(dcesrv_atsvc_interface.name, name)==0) {
254 memcpy(iface, &dcesrv_atsvc_interface, sizeof(*iface));
261 NTSTATUS dcerpc_server_atsvc_init(void)
264 struct dcesrv_endpoint_server ep_server;
266 /* fill in our name */
267 ep_server.name = "atsvc";
269 /* fill in all the operations */
270 ep_server.init_server = atsvc__op_init_server;
272 ep_server.interface_by_uuid = atsvc__op_interface_by_uuid;
273 ep_server.interface_by_name = atsvc__op_interface_by_name;
275 /* register ourselves with the DCERPC subsystem. */
276 ret = dcerpc_register_ep_server(&ep_server);
278 if (!NT_STATUS_IS_OK(ret)) {
279 DEBUG(0,("Failed to register 'atsvc' endpoint server!\n"));