git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / source4 / librpc / gen_ndr / ndr_winsif_s.c
1 /* server functions auto-generated by pidl */
2 #include "bin/default/source4/librpc/gen_ndr/ndr_winsif.h"
3
4 NTSTATUS dcerpc_server_winsif_init(void);
5
6 /* winsif - dcerpc server boilerplate generated by pidl */
7
8
9 static NTSTATUS winsif__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
10 {
11 #ifdef DCESRV_INTERFACE_WINSIF_BIND
12         return DCESRV_INTERFACE_WINSIF_BIND(dce_call,iface);
13 #else
14         return NT_STATUS_OK;
15 #endif
16 }
17
18 static void winsif__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
19 {
20 #ifdef DCESRV_INTERFACE_WINSIF_UNBIND
21         DCESRV_INTERFACE_WINSIF_UNBIND(context, iface);
22 #else
23         return;
24 #endif
25 }
26
27 static NTSTATUS winsif__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
28 {
29         enum ndr_err_code ndr_err;
30         uint16_t opnum = dce_call->pkt.u.request.opnum;
31
32         dce_call->fault_code = 0;
33
34         if (opnum >= ndr_table_winsif.num_calls) {
35                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
36                 return NT_STATUS_NET_WRITE_FAULT;
37         }
38
39         *r = talloc_named(mem_ctx,
40                           ndr_table_winsif.calls[opnum].struct_size,
41                           "struct %s",
42                           ndr_table_winsif.calls[opnum].name);
43         NT_STATUS_HAVE_NO_MEMORY(*r);
44
45         /* unravel the NDR for the packet */
46         ndr_err = ndr_table_winsif.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_winsif, 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;
53         }
54
55         return NT_STATUS_OK;
56 }
57
58 static NTSTATUS winsif__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
59 {
60         uint16_t opnum = dce_call->pkt.u.request.opnum;
61
62         switch (opnum) {
63         case 0: {
64                 struct winsif_WinsRecordAction *r2 = (struct winsif_WinsRecordAction *)r;
65                 if (DEBUGLEVEL >= 10) {
66                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsRecordAction, NDR_IN, r2);
67                 }
68                 r2->out.result = dcesrv_winsif_WinsRecordAction(dce_call, mem_ctx, r2);
69                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
70                         DEBUG(5,("function winsif_WinsRecordAction will reply async\n"));
71                 }
72                 break;
73         }
74         case 1: {
75                 struct winsif_WinsStatus *r2 = (struct winsif_WinsStatus *)r;
76                 if (DEBUGLEVEL >= 10) {
77                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatus, NDR_IN, r2);
78                 }
79                 r2->out.result = dcesrv_winsif_WinsStatus(dce_call, mem_ctx, r2);
80                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
81                         DEBUG(5,("function winsif_WinsStatus will reply async\n"));
82                 }
83                 break;
84         }
85         case 2: {
86                 struct winsif_WinsTrigger *r2 = (struct winsif_WinsTrigger *)r;
87                 if (DEBUGLEVEL >= 10) {
88                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsTrigger, NDR_IN, r2);
89                 }
90                 r2->out.result = dcesrv_winsif_WinsTrigger(dce_call, mem_ctx, r2);
91                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
92                         DEBUG(5,("function winsif_WinsTrigger will reply async\n"));
93                 }
94                 break;
95         }
96         case 3: {
97                 struct winsif_WinsDoStaticInit *r2 = (struct winsif_WinsDoStaticInit *)r;
98                 if (DEBUGLEVEL >= 10) {
99                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoStaticInit, NDR_IN, r2);
100                 }
101                 r2->out.result = dcesrv_winsif_WinsDoStaticInit(dce_call, mem_ctx, r2);
102                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
103                         DEBUG(5,("function winsif_WinsDoStaticInit will reply async\n"));
104                 }
105                 break;
106         }
107         case 4: {
108                 struct winsif_WinsDoScavenging *r2 = (struct winsif_WinsDoScavenging *)r;
109                 if (DEBUGLEVEL >= 10) {
110                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoScavenging, NDR_IN, r2);
111                 }
112                 r2->out.result = dcesrv_winsif_WinsDoScavenging(dce_call, mem_ctx, r2);
113                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
114                         DEBUG(5,("function winsif_WinsDoScavenging will reply async\n"));
115                 }
116                 break;
117         }
118         case 5: {
119                 struct winsif_WinsGetDbRecs *r2 = (struct winsif_WinsGetDbRecs *)r;
120                 if (DEBUGLEVEL >= 10) {
121                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetDbRecs, NDR_IN, r2);
122                 }
123                 r2->out.result = dcesrv_winsif_WinsGetDbRecs(dce_call, mem_ctx, r2);
124                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
125                         DEBUG(5,("function winsif_WinsGetDbRecs will reply async\n"));
126                 }
127                 break;
128         }
129         case 6: {
130                 struct winsif_WinsTerm *r2 = (struct winsif_WinsTerm *)r;
131                 if (DEBUGLEVEL >= 10) {
132                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsTerm, NDR_IN, r2);
133                 }
134                 r2->out.result = dcesrv_winsif_WinsTerm(dce_call, mem_ctx, r2);
135                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
136                         DEBUG(5,("function winsif_WinsTerm will reply async\n"));
137                 }
138                 break;
139         }
140         case 7: {
141                 struct winsif_WinsBackup *r2 = (struct winsif_WinsBackup *)r;
142                 if (DEBUGLEVEL >= 10) {
143                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsBackup, NDR_IN, r2);
144                 }
145                 r2->out.result = dcesrv_winsif_WinsBackup(dce_call, mem_ctx, r2);
146                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
147                         DEBUG(5,("function winsif_WinsBackup will reply async\n"));
148                 }
149                 break;
150         }
151         case 8: {
152                 struct winsif_WinsDelDbRecs *r2 = (struct winsif_WinsDelDbRecs *)r;
153                 if (DEBUGLEVEL >= 10) {
154                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDelDbRecs, NDR_IN, r2);
155                 }
156                 r2->out.result = dcesrv_winsif_WinsDelDbRecs(dce_call, mem_ctx, r2);
157                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
158                         DEBUG(5,("function winsif_WinsDelDbRecs will reply async\n"));
159                 }
160                 break;
161         }
162         case 9: {
163                 struct winsif_WinsPullRange *r2 = (struct winsif_WinsPullRange *)r;
164                 if (DEBUGLEVEL >= 10) {
165                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsPullRange, NDR_IN, r2);
166                 }
167                 r2->out.result = dcesrv_winsif_WinsPullRange(dce_call, mem_ctx, r2);
168                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
169                         DEBUG(5,("function winsif_WinsPullRange will reply async\n"));
170                 }
171                 break;
172         }
173         case 10: {
174                 struct winsif_WinsSetPriorityClass *r2 = (struct winsif_WinsSetPriorityClass *)r;
175                 if (DEBUGLEVEL >= 10) {
176                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsSetPriorityClass, NDR_IN, r2);
177                 }
178                 r2->out.result = dcesrv_winsif_WinsSetPriorityClass(dce_call, mem_ctx, r2);
179                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
180                         DEBUG(5,("function winsif_WinsSetPriorityClass will reply async\n"));
181                 }
182                 break;
183         }
184         case 11: {
185                 struct winsif_WinsResetCounters *r2 = (struct winsif_WinsResetCounters *)r;
186                 if (DEBUGLEVEL >= 10) {
187                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsResetCounters, NDR_IN, r2);
188                 }
189                 r2->out.result = dcesrv_winsif_WinsResetCounters(dce_call, mem_ctx, r2);
190                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
191                         DEBUG(5,("function winsif_WinsResetCounters will reply async\n"));
192                 }
193                 break;
194         }
195         case 12: {
196                 struct winsif_WinsWorkerThreadUpdate *r2 = (struct winsif_WinsWorkerThreadUpdate *)r;
197                 if (DEBUGLEVEL >= 10) {
198                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsWorkerThreadUpdate, NDR_IN, r2);
199                 }
200                 r2->out.result = dcesrv_winsif_WinsWorkerThreadUpdate(dce_call, mem_ctx, r2);
201                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
202                         DEBUG(5,("function winsif_WinsWorkerThreadUpdate will reply async\n"));
203                 }
204                 break;
205         }
206         case 13: {
207                 struct winsif_WinsGetNameAndAdd *r2 = (struct winsif_WinsGetNameAndAdd *)r;
208                 if (DEBUGLEVEL >= 10) {
209                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetNameAndAdd, NDR_IN, r2);
210                 }
211                 r2->out.result = dcesrv_winsif_WinsGetNameAndAdd(dce_call, mem_ctx, r2);
212                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
213                         DEBUG(5,("function winsif_WinsGetNameAndAdd will reply async\n"));
214                 }
215                 break;
216         }
217         case 14: {
218                 struct winsif_WinsGetBrowserNames_Old *r2 = (struct winsif_WinsGetBrowserNames_Old *)r;
219                 if (DEBUGLEVEL >= 10) {
220                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetBrowserNames_Old, NDR_IN, r2);
221                 }
222                 r2->out.result = dcesrv_winsif_WinsGetBrowserNames_Old(dce_call, mem_ctx, r2);
223                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
224                         DEBUG(5,("function winsif_WinsGetBrowserNames_Old will reply async\n"));
225                 }
226                 break;
227         }
228         case 15: {
229                 struct winsif_WinsDeleteWins *r2 = (struct winsif_WinsDeleteWins *)r;
230                 if (DEBUGLEVEL >= 10) {
231                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDeleteWins, NDR_IN, r2);
232                 }
233                 r2->out.result = dcesrv_winsif_WinsDeleteWins(dce_call, mem_ctx, r2);
234                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
235                         DEBUG(5,("function winsif_WinsDeleteWins will reply async\n"));
236                 }
237                 break;
238         }
239         case 16: {
240                 struct winsif_WinsSetFlags *r2 = (struct winsif_WinsSetFlags *)r;
241                 if (DEBUGLEVEL >= 10) {
242                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsSetFlags, NDR_IN, r2);
243                 }
244                 r2->out.result = dcesrv_winsif_WinsSetFlags(dce_call, mem_ctx, r2);
245                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
246                         DEBUG(5,("function winsif_WinsSetFlags will reply async\n"));
247                 }
248                 break;
249         }
250         case 17: {
251                 struct winsif_WinsGetBrowserNames *r2 = (struct winsif_WinsGetBrowserNames *)r;
252                 if (DEBUGLEVEL >= 10) {
253                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetBrowserNames, NDR_IN, r2);
254                 }
255                 r2->out.result = dcesrv_winsif_WinsGetBrowserNames(dce_call, mem_ctx, r2);
256                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
257                         DEBUG(5,("function winsif_WinsGetBrowserNames will reply async\n"));
258                 }
259                 break;
260         }
261         case 18: {
262                 struct winsif_WinsGetDbRecsByName *r2 = (struct winsif_WinsGetDbRecsByName *)r;
263                 if (DEBUGLEVEL >= 10) {
264                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetDbRecsByName, NDR_IN, r2);
265                 }
266                 r2->out.result = dcesrv_winsif_WinsGetDbRecsByName(dce_call, mem_ctx, r2);
267                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
268                         DEBUG(5,("function winsif_WinsGetDbRecsByName will reply async\n"));
269                 }
270                 break;
271         }
272         case 19: {
273                 struct winsif_WinsStatusNew *r2 = (struct winsif_WinsStatusNew *)r;
274                 if (DEBUGLEVEL >= 10) {
275                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatusNew, NDR_IN, r2);
276                 }
277                 r2->out.result = dcesrv_winsif_WinsStatusNew(dce_call, mem_ctx, r2);
278                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
279                         DEBUG(5,("function winsif_WinsStatusNew will reply async\n"));
280                 }
281                 break;
282         }
283         case 20: {
284                 struct winsif_WinsStatusWHdl *r2 = (struct winsif_WinsStatusWHdl *)r;
285                 if (DEBUGLEVEL >= 10) {
286                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatusWHdl, NDR_IN, r2);
287                 }
288                 r2->out.result = dcesrv_winsif_WinsStatusWHdl(dce_call, mem_ctx, r2);
289                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
290                         DEBUG(5,("function winsif_WinsStatusWHdl will reply async\n"));
291                 }
292                 break;
293         }
294         case 21: {
295                 struct winsif_WinsDoScanvengingNew *r2 = (struct winsif_WinsDoScanvengingNew *)r;
296                 if (DEBUGLEVEL >= 10) {
297                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoScanvengingNew, NDR_IN, r2);
298                 }
299                 r2->out.result = dcesrv_winsif_WinsDoScanvengingNew(dce_call, mem_ctx, r2);
300                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
301                         DEBUG(5,("function winsif_WinsDoScanvengingNew will reply async\n"));
302                 }
303                 break;
304         }
305
306         default:
307                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
308                 break;
309         }
310
311         if (dce_call->fault_code != 0) {
312                 dcerpc_log_packet(dce_call->conn->packet_log_dir, 
313                           &ndr_table_winsif, opnum, NDR_IN,
314                                   &dce_call->pkt.u.request.stub_and_verifier);
315                 return NT_STATUS_NET_WRITE_FAULT;
316         }
317
318         return NT_STATUS_OK;
319 }
320
321 static NTSTATUS winsif__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
322 {
323         uint16_t opnum = dce_call->pkt.u.request.opnum;
324
325         switch (opnum) {
326         case 0: {
327                 struct winsif_WinsRecordAction *r2 = (struct winsif_WinsRecordAction *)r;
328                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
329                         DEBUG(5,("function winsif_WinsRecordAction replied async\n"));
330                 }
331                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
332                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsRecordAction, NDR_OUT | NDR_SET_VALUES, r2);
333                 }
334                 if (dce_call->fault_code != 0) {
335                         DEBUG(2,("dcerpc_fault %s in winsif_WinsRecordAction\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
336                 }
337                 break;
338         }
339         case 1: {
340                 struct winsif_WinsStatus *r2 = (struct winsif_WinsStatus *)r;
341                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
342                         DEBUG(5,("function winsif_WinsStatus replied async\n"));
343                 }
344                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
345                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatus, NDR_OUT | NDR_SET_VALUES, r2);
346                 }
347                 if (dce_call->fault_code != 0) {
348                         DEBUG(2,("dcerpc_fault %s in winsif_WinsStatus\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
349                 }
350                 break;
351         }
352         case 2: {
353                 struct winsif_WinsTrigger *r2 = (struct winsif_WinsTrigger *)r;
354                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
355                         DEBUG(5,("function winsif_WinsTrigger replied async\n"));
356                 }
357                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
358                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsTrigger, NDR_OUT | NDR_SET_VALUES, r2);
359                 }
360                 if (dce_call->fault_code != 0) {
361                         DEBUG(2,("dcerpc_fault %s in winsif_WinsTrigger\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
362                 }
363                 break;
364         }
365         case 3: {
366                 struct winsif_WinsDoStaticInit *r2 = (struct winsif_WinsDoStaticInit *)r;
367                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
368                         DEBUG(5,("function winsif_WinsDoStaticInit replied async\n"));
369                 }
370                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
371                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoStaticInit, NDR_OUT | NDR_SET_VALUES, r2);
372                 }
373                 if (dce_call->fault_code != 0) {
374                         DEBUG(2,("dcerpc_fault %s in winsif_WinsDoStaticInit\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
375                 }
376                 break;
377         }
378         case 4: {
379                 struct winsif_WinsDoScavenging *r2 = (struct winsif_WinsDoScavenging *)r;
380                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
381                         DEBUG(5,("function winsif_WinsDoScavenging replied async\n"));
382                 }
383                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
384                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoScavenging, NDR_OUT | NDR_SET_VALUES, r2);
385                 }
386                 if (dce_call->fault_code != 0) {
387                         DEBUG(2,("dcerpc_fault %s in winsif_WinsDoScavenging\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
388                 }
389                 break;
390         }
391         case 5: {
392                 struct winsif_WinsGetDbRecs *r2 = (struct winsif_WinsGetDbRecs *)r;
393                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
394                         DEBUG(5,("function winsif_WinsGetDbRecs replied async\n"));
395                 }
396                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
397                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetDbRecs, NDR_OUT | NDR_SET_VALUES, r2);
398                 }
399                 if (dce_call->fault_code != 0) {
400                         DEBUG(2,("dcerpc_fault %s in winsif_WinsGetDbRecs\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
401                 }
402                 break;
403         }
404         case 6: {
405                 struct winsif_WinsTerm *r2 = (struct winsif_WinsTerm *)r;
406                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
407                         DEBUG(5,("function winsif_WinsTerm replied async\n"));
408                 }
409                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
410                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsTerm, NDR_OUT | NDR_SET_VALUES, r2);
411                 }
412                 if (dce_call->fault_code != 0) {
413                         DEBUG(2,("dcerpc_fault %s in winsif_WinsTerm\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
414                 }
415                 break;
416         }
417         case 7: {
418                 struct winsif_WinsBackup *r2 = (struct winsif_WinsBackup *)r;
419                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
420                         DEBUG(5,("function winsif_WinsBackup replied async\n"));
421                 }
422                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
423                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsBackup, NDR_OUT | NDR_SET_VALUES, r2);
424                 }
425                 if (dce_call->fault_code != 0) {
426                         DEBUG(2,("dcerpc_fault %s in winsif_WinsBackup\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
427                 }
428                 break;
429         }
430         case 8: {
431                 struct winsif_WinsDelDbRecs *r2 = (struct winsif_WinsDelDbRecs *)r;
432                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
433                         DEBUG(5,("function winsif_WinsDelDbRecs replied async\n"));
434                 }
435                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
436                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDelDbRecs, NDR_OUT | NDR_SET_VALUES, r2);
437                 }
438                 if (dce_call->fault_code != 0) {
439                         DEBUG(2,("dcerpc_fault %s in winsif_WinsDelDbRecs\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
440                 }
441                 break;
442         }
443         case 9: {
444                 struct winsif_WinsPullRange *r2 = (struct winsif_WinsPullRange *)r;
445                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
446                         DEBUG(5,("function winsif_WinsPullRange replied async\n"));
447                 }
448                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
449                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsPullRange, NDR_OUT | NDR_SET_VALUES, r2);
450                 }
451                 if (dce_call->fault_code != 0) {
452                         DEBUG(2,("dcerpc_fault %s in winsif_WinsPullRange\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
453                 }
454                 break;
455         }
456         case 10: {
457                 struct winsif_WinsSetPriorityClass *r2 = (struct winsif_WinsSetPriorityClass *)r;
458                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
459                         DEBUG(5,("function winsif_WinsSetPriorityClass replied async\n"));
460                 }
461                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
462                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsSetPriorityClass, NDR_OUT | NDR_SET_VALUES, r2);
463                 }
464                 if (dce_call->fault_code != 0) {
465                         DEBUG(2,("dcerpc_fault %s in winsif_WinsSetPriorityClass\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
466                 }
467                 break;
468         }
469         case 11: {
470                 struct winsif_WinsResetCounters *r2 = (struct winsif_WinsResetCounters *)r;
471                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
472                         DEBUG(5,("function winsif_WinsResetCounters replied async\n"));
473                 }
474                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
475                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsResetCounters, NDR_OUT | NDR_SET_VALUES, r2);
476                 }
477                 if (dce_call->fault_code != 0) {
478                         DEBUG(2,("dcerpc_fault %s in winsif_WinsResetCounters\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
479                 }
480                 break;
481         }
482         case 12: {
483                 struct winsif_WinsWorkerThreadUpdate *r2 = (struct winsif_WinsWorkerThreadUpdate *)r;
484                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
485                         DEBUG(5,("function winsif_WinsWorkerThreadUpdate replied async\n"));
486                 }
487                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
488                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsWorkerThreadUpdate, NDR_OUT | NDR_SET_VALUES, r2);
489                 }
490                 if (dce_call->fault_code != 0) {
491                         DEBUG(2,("dcerpc_fault %s in winsif_WinsWorkerThreadUpdate\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
492                 }
493                 break;
494         }
495         case 13: {
496                 struct winsif_WinsGetNameAndAdd *r2 = (struct winsif_WinsGetNameAndAdd *)r;
497                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
498                         DEBUG(5,("function winsif_WinsGetNameAndAdd replied async\n"));
499                 }
500                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
501                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetNameAndAdd, NDR_OUT | NDR_SET_VALUES, r2);
502                 }
503                 if (dce_call->fault_code != 0) {
504                         DEBUG(2,("dcerpc_fault %s in winsif_WinsGetNameAndAdd\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
505                 }
506                 break;
507         }
508         case 14: {
509                 struct winsif_WinsGetBrowserNames_Old *r2 = (struct winsif_WinsGetBrowserNames_Old *)r;
510                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
511                         DEBUG(5,("function winsif_WinsGetBrowserNames_Old replied async\n"));
512                 }
513                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
514                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetBrowserNames_Old, NDR_OUT | NDR_SET_VALUES, r2);
515                 }
516                 if (dce_call->fault_code != 0) {
517                         DEBUG(2,("dcerpc_fault %s in winsif_WinsGetBrowserNames_Old\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
518                 }
519                 break;
520         }
521         case 15: {
522                 struct winsif_WinsDeleteWins *r2 = (struct winsif_WinsDeleteWins *)r;
523                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
524                         DEBUG(5,("function winsif_WinsDeleteWins replied async\n"));
525                 }
526                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
527                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDeleteWins, NDR_OUT | NDR_SET_VALUES, r2);
528                 }
529                 if (dce_call->fault_code != 0) {
530                         DEBUG(2,("dcerpc_fault %s in winsif_WinsDeleteWins\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
531                 }
532                 break;
533         }
534         case 16: {
535                 struct winsif_WinsSetFlags *r2 = (struct winsif_WinsSetFlags *)r;
536                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
537                         DEBUG(5,("function winsif_WinsSetFlags replied async\n"));
538                 }
539                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
540                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsSetFlags, NDR_OUT | NDR_SET_VALUES, r2);
541                 }
542                 if (dce_call->fault_code != 0) {
543                         DEBUG(2,("dcerpc_fault %s in winsif_WinsSetFlags\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
544                 }
545                 break;
546         }
547         case 17: {
548                 struct winsif_WinsGetBrowserNames *r2 = (struct winsif_WinsGetBrowserNames *)r;
549                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
550                         DEBUG(5,("function winsif_WinsGetBrowserNames replied async\n"));
551                 }
552                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
553                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetBrowserNames, NDR_OUT | NDR_SET_VALUES, r2);
554                 }
555                 if (dce_call->fault_code != 0) {
556                         DEBUG(2,("dcerpc_fault %s in winsif_WinsGetBrowserNames\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
557                 }
558                 break;
559         }
560         case 18: {
561                 struct winsif_WinsGetDbRecsByName *r2 = (struct winsif_WinsGetDbRecsByName *)r;
562                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
563                         DEBUG(5,("function winsif_WinsGetDbRecsByName replied async\n"));
564                 }
565                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
566                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsGetDbRecsByName, NDR_OUT | NDR_SET_VALUES, r2);
567                 }
568                 if (dce_call->fault_code != 0) {
569                         DEBUG(2,("dcerpc_fault %s in winsif_WinsGetDbRecsByName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
570                 }
571                 break;
572         }
573         case 19: {
574                 struct winsif_WinsStatusNew *r2 = (struct winsif_WinsStatusNew *)r;
575                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
576                         DEBUG(5,("function winsif_WinsStatusNew replied async\n"));
577                 }
578                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
579                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatusNew, NDR_OUT | NDR_SET_VALUES, r2);
580                 }
581                 if (dce_call->fault_code != 0) {
582                         DEBUG(2,("dcerpc_fault %s in winsif_WinsStatusNew\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
583                 }
584                 break;
585         }
586         case 20: {
587                 struct winsif_WinsStatusWHdl *r2 = (struct winsif_WinsStatusWHdl *)r;
588                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
589                         DEBUG(5,("function winsif_WinsStatusWHdl replied async\n"));
590                 }
591                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
592                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsStatusWHdl, NDR_OUT | NDR_SET_VALUES, r2);
593                 }
594                 if (dce_call->fault_code != 0) {
595                         DEBUG(2,("dcerpc_fault %s in winsif_WinsStatusWHdl\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
596                 }
597                 break;
598         }
599         case 21: {
600                 struct winsif_WinsDoScanvengingNew *r2 = (struct winsif_WinsDoScanvengingNew *)r;
601                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
602                         DEBUG(5,("function winsif_WinsDoScanvengingNew replied async\n"));
603                 }
604                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
605                         NDR_PRINT_FUNCTION_DEBUG(winsif_WinsDoScanvengingNew, NDR_OUT | NDR_SET_VALUES, r2);
606                 }
607                 if (dce_call->fault_code != 0) {
608                         DEBUG(2,("dcerpc_fault %s in winsif_WinsDoScanvengingNew\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
609                 }
610                 break;
611         }
612
613         default:
614                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
615                 break;
616         }
617
618         if (dce_call->fault_code != 0) {
619                 dcerpc_log_packet(dce_call->conn->packet_log_dir,
620                           &ndr_table_winsif, opnum, NDR_IN,
621                                   &dce_call->pkt.u.request.stub_and_verifier);
622                 return NT_STATUS_NET_WRITE_FAULT;
623         }
624
625         return NT_STATUS_OK;
626 }
627
628 static NTSTATUS winsif__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
629 {
630         enum ndr_err_code ndr_err;
631         uint16_t opnum = dce_call->pkt.u.request.opnum;
632
633         ndr_err = ndr_table_winsif.calls[opnum].ndr_push(push, NDR_OUT, r);
634         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
635                 dce_call->fault_code = DCERPC_FAULT_NDR;
636                 return NT_STATUS_NET_WRITE_FAULT;
637         }
638
639         return NT_STATUS_OK;
640 }
641
642 const struct dcesrv_interface dcesrv_winsif_interface = {
643         .name           = "winsif",
644         .syntax_id  = {{0x45f52c28,0x7f9f,0x101a,{0xb5,0x2b},{0x08,0x00,0x2b,0x2e,0xfa,0xbe}},1.0},
645         .bind           = winsif__op_bind,
646         .unbind         = winsif__op_unbind,
647         .ndr_pull       = winsif__op_ndr_pull,
648         .dispatch       = winsif__op_dispatch,
649         .reply          = winsif__op_reply,
650         .ndr_push       = winsif__op_ndr_push
651 };
652
653
654 static NTSTATUS winsif__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
655 {
656         int i;
657
658         for (i=0;i<ndr_table_winsif.endpoints->count;i++) {
659                 NTSTATUS ret;
660                 const char *name = ndr_table_winsif.endpoints->names[i];
661
662                 ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_winsif_interface, NULL);
663                 if (!NT_STATUS_IS_OK(ret)) {
664                         DEBUG(1,("winsif_op_init_server: failed to register endpoint '%s'\n",name));
665                         return ret;
666                 }
667         }
668
669         return NT_STATUS_OK;
670 }
671
672 static bool winsif__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
673 {
674         if (dcesrv_winsif_interface.syntax_id.if_version == if_version &&
675                 GUID_equal(&dcesrv_winsif_interface.syntax_id.uuid, uuid)) {
676                 memcpy(iface,&dcesrv_winsif_interface, sizeof(*iface));
677                 return true;
678         }
679
680         return false;
681 }
682
683 static bool winsif__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
684 {
685         if (strcmp(dcesrv_winsif_interface.name, name)==0) {
686                 memcpy(iface, &dcesrv_winsif_interface, sizeof(*iface));
687                 return true;
688         }
689
690         return false;
691 }
692
693 NTSTATUS dcerpc_server_winsif_init(void)
694 {
695         NTSTATUS ret;
696         struct dcesrv_endpoint_server ep_server;
697
698         /* fill in our name */
699         ep_server.name = "winsif";
700
701         /* fill in all the operations */
702         ep_server.init_server = winsif__op_init_server;
703
704         ep_server.interface_by_uuid = winsif__op_interface_by_uuid;
705         ep_server.interface_by_name = winsif__op_interface_by_name;
706
707         /* register ourselves with the DCERPC subsystem. */
708         ret = dcerpc_register_ep_server(&ep_server);
709
710         if (!NT_STATUS_IS_OK(ret)) {
711                 DEBUG(0,("Failed to register 'winsif' endpoint server!\n"));
712                 return ret;
713         }
714
715         return ret;
716 }
717