diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-12-14 13:22:12 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-12-14 13:22:12 +0000 |
commit | f6eb8342cba87c7c8f17471ed9783b567d36b0ed (patch) | |
tree | 40484486513e10f1fb4764ce62f7fdc3f8df17ff /source4/rpc_server | |
parent | 4cd6b8a64b5d995190a28b2a8308e688847df49c (diff) | |
download | samba-f6eb8342cba87c7c8f17471ed9783b567d36b0ed.tar.gz samba-f6eb8342cba87c7c8f17471ed9783b567d36b0ed.tar.bz2 samba-f6eb8342cba87c7c8f17471ed9783b567d36b0ed.zip |
added auto-generation of the server side boilerplate code for each
pipe.
The server side code gets generated as librpc/gen_ndr/ndr_NAME_s.c and
gets included in the pipe module
(This used to be commit bd3dcfe5820489a838e19b244266bd9126af5eb4)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 18 | ||||
-rw-r--r-- | source4/rpc_server/echo/rpc_echo.c | 82 | ||||
-rw-r--r-- | source4/rpc_server/epmapper/rpc_epmapper.c | 78 |
3 files changed, 23 insertions, 155 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index a34c00cd58..cbde3c9532 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -792,12 +792,28 @@ int dcesrv_lookup_endpoints(const struct dcerpc_interface_table *table, } +BOOL dcesrv_set_interface(struct dcesrv_state *dce, + const char *uuid, uint32 if_version, + const struct dcerpc_interface_table *table, + const dcesrv_dispatch_fn_t *dispatch_table) +{ + if (strcasecmp(table->uuid, uuid) != 0 || if_version != table->if_version) { + DEBUG(2,("Attempt to use unknown interface %s/%d\n", uuid, if_version)); + return False; + } + + dce->ndr = table; + dce->dispatch = dispatch_table; + return True; +} + + /* initialise the dcerpc server subsystem */ BOOL dcesrv_init(struct dcesrv_context *dce) { - rpc_echo_init(dce); + rpc_rpcecho_init(dce); rpc_epmapper_init(dce); return True; } diff --git a/source4/rpc_server/echo/rpc_echo.c b/source4/rpc_server/echo/rpc_echo.c index d62ebc3d26..1d3846aaff 100644 --- a/source4/rpc_server/echo/rpc_echo.c +++ b/source4/rpc_server/echo/rpc_echo.c @@ -55,14 +55,14 @@ static NTSTATUS echo_SourceData(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, s return NT_STATUS_OK; } -static NTSTATUS echo_TestCall(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct TestCall *r) +static NTSTATUS echo_TestCall(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct echo_TestCall *r) { r->out.s2 = "this is a test string"; return NT_STATUS_OK; } -static NTSTATUS echo_TestCall2(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct TestCall2 *r) +static NTSTATUS echo_TestCall2(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct echo_TestCall2 *r) { r->out.info = talloc(mem_ctx, sizeof(*r->out.info)); if (!r->out.info) { @@ -109,79 +109,5 @@ static NTSTATUS echo_TestCall2(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, st } - - -/************************************************************************** - all the code below this point is boilerplate that will be auto-generated -***************************************************************************/ - -static const dcesrv_dispatch_fn_t dispatch_table[] = { - (dcesrv_dispatch_fn_t)echo_AddOne, - (dcesrv_dispatch_fn_t)echo_EchoData, - (dcesrv_dispatch_fn_t)echo_SinkData, - (dcesrv_dispatch_fn_t)echo_SourceData, - (dcesrv_dispatch_fn_t)echo_TestCall, - (dcesrv_dispatch_fn_t)echo_TestCall2 -}; - - -/* - return True if we want to handle the given endpoint -*/ -static BOOL op_query_endpoint(const struct dcesrv_endpoint *ep) -{ - return dcesrv_table_query(&dcerpc_table_rpcecho, ep); -} - -/* - setup for a particular rpc interface -*/ -static BOOL op_set_interface(struct dcesrv_state *dce, const char *uuid, uint32 if_version) -{ - if (strcasecmp(uuid, dcerpc_table_rpcecho.uuid) != 0 || - if_version != dcerpc_table_rpcecho.if_version) { - DEBUG(2,("Attempt to use unknown interface %s/%d\n", uuid, if_version)); - return False; - } - - dce->ndr = &dcerpc_table_rpcecho; - dce->dispatch = dispatch_table; - - return True; -} - - -/* op_connect is called when a connection is made to an endpoint */ -static NTSTATUS op_connect(struct dcesrv_state *dce) -{ - return NT_STATUS_OK; -} - -static void op_disconnect(struct dcesrv_state *dce) -{ - /* nothing to do */ -} - - -static int op_lookup_endpoints(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **e) -{ - return dcesrv_lookup_endpoints(&dcerpc_table_rpcecho, mem_ctx, e); -} - -static const struct dcesrv_endpoint_ops rpc_echo_ops = { - op_query_endpoint, - op_set_interface, - op_connect, - op_disconnect, - op_lookup_endpoints -}; - -/* - register with the dcerpc server -*/ -void rpc_echo_init(struct dcesrv_context *dce) -{ - if (!dcesrv_endpoint_register(dce, &rpc_echo_ops, &dcerpc_table_rpcecho)) { - DEBUG(1,("Failed to register rpcecho endpoint\n")); - } -} +/* include the generated boilerplate */ +#include "librpc/gen_ndr/ndr_echo_s.c" diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index 43e4d4514f..f2ecc0faa9 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -319,79 +319,5 @@ static NTSTATUS epm_MgmtDelete(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, } -/************************************************************************** - all the code below this point is boilerplate that will be auto-generated -***************************************************************************/ - -static const dcesrv_dispatch_fn_t dispatch_table[] = { - (dcesrv_dispatch_fn_t)epm_Insert, - (dcesrv_dispatch_fn_t)epm_Delete, - (dcesrv_dispatch_fn_t)epm_Lookup, - (dcesrv_dispatch_fn_t)epm_Map, - (dcesrv_dispatch_fn_t)epm_LookupHandleFree, - (dcesrv_dispatch_fn_t)epm_InqObject, - (dcesrv_dispatch_fn_t)epm_MgmtDelete -}; - - -/* - return True if we want to handle the given endpoint -*/ -static BOOL op_query_endpoint(const struct dcesrv_endpoint *ep) -{ - return dcesrv_table_query(&dcerpc_table_epmapper, ep); -} - -/* - setup for a particular rpc interface -*/ -static BOOL op_set_interface(struct dcesrv_state *dce, const char *uuid, uint32 if_version) -{ - if (strcasecmp(uuid, dcerpc_table_epmapper.uuid) != 0 || - if_version != dcerpc_table_epmapper.if_version) { - DEBUG(2,("Attempt to use unknown interface %s/%d\n", uuid, if_version)); - return False; - } - - dce->ndr = &dcerpc_table_epmapper; - dce->dispatch = dispatch_table; - - return True; -} - - -/* op_connect is called when a connection is made to an endpoint */ -static NTSTATUS op_connect(struct dcesrv_state *dce) -{ - return NT_STATUS_OK; -} - -static void op_disconnect(struct dcesrv_state *dce) -{ - /* nothing to do */ -} - - -static int op_lookup_endpoints(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **e) -{ - return dcesrv_lookup_endpoints(&dcerpc_table_epmapper, mem_ctx, e); -} - - -static const struct dcesrv_endpoint_ops rpc_epmapper_ops = { - op_query_endpoint, - op_set_interface, - op_connect, - op_disconnect, - op_lookup_endpoints -}; - -/* - register with the dcerpc server -*/ -void rpc_epmapper_init(struct dcesrv_context *dce) -{ - if (!dcesrv_endpoint_register(dce, &rpc_epmapper_ops, &dcerpc_table_epmapper)) { - DEBUG(1,("Failed to register epmapper endpoint\n")); - } -} +/* include the generated boilerplate */ +#include "librpc/gen_ndr/ndr_epmapper_s.c" |