svn commit: samba r8281 - in branches/SAMBA_4_0/source: build/pidl/Parse/Pidl/Samba scripting/ejs

tridge at samba.org tridge at samba.org
Sun Jul 10 06:51:00 GMT 2005


Author: tridge
Date: 2005-07-10 06:51:00 +0000 (Sun, 10 Jul 2005)
New Revision: 8281

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8281

Log:
pass the callnum and rpc interface table directly from the generated
code in pidl for ejs calls. This means that ejs_rpc_call() doesn't
need to scan the rpc tables for the right interface, and doesn't need
to scan for the call name

Modified:
   branches/SAMBA_4_0/source/build/pidl/Parse/Pidl/Samba/EJS.pm
   branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/Parse/Pidl/Samba/EJS.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/Parse/Pidl/Samba/EJS.pm	2005-07-10 06:21:03 UTC (rev 8280)
+++ branches/SAMBA_4_0/source/build/pidl/Parse/Pidl/Samba/EJS.pm	2005-07-10 06:51:00 UTC (rev 8281)
@@ -628,15 +628,18 @@
 
 #################################
 # generate a ejs mapping function
-sub EjsFunction($)
+sub EjsFunction($$)
 {
 	my $d = shift;
+	my $iface = shift;
 	my $name = $d->{NAME};
+	my $callnum = uc("DCERPC_$name");
+	my $table = "&dcerpc_table_$iface";
 
 	pidl "static int ejs_$name(int eid, int argc, struct MprVar **argv)";
 	pidl "{";
 	indent;
-	pidl "return ejs_rpc_call(eid, argc, argv, \"$name\", (ejs_pull_function_t)ejs_pull_$name, (ejs_push_function_t)ejs_push_$name);";
+	pidl "return ejs_rpc_call(eid, argc, argv, $table, $callnum, (ejs_pull_function_t)ejs_pull_$name, (ejs_push_function_t)ejs_push_$name);";
 	deindent;
 	pidl "}\n";
 }
@@ -669,7 +672,7 @@
 		
 		EjsPullFunction($d);
 		EjsPushFunction($d);
-		EjsFunction($d);
+		EjsFunction($d, $name);
 
 		push (@fns, $d->{NAME});
 	}

Modified: branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h	2005-07-10 06:21:03 UTC (rev 8280)
+++ branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h	2005-07-10 06:51:00 UTC (rev 8281)
@@ -43,7 +43,8 @@
 			       ejs_setup_t setup,
 			       ejs_constants_t constants);
 
-int ejs_rpc_call(int eid, int argc, struct MprVar **argv, const char *callname,
+int ejs_rpc_call(int eid, int argc, struct MprVar **argv,
+		 const struct dcerpc_interface_table *iface, int callnum,
 		 ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push);
 
 NTSTATUS ejs_pull_struct_start(struct ejs_rpc *ejs, struct MprVar **v, const char *name);

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c	2005-07-10 06:21:03 UTC (rev 8280)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c	2005-07-10 06:51:00 UTC (rev 8281)
@@ -164,23 +164,31 @@
 
 
 /*
-  make an rpc call
-     example:
-            status = rpc_call(conn, "echo_AddOne", io);
+  make an irpc call - called via the same interface as rpc
 */
+static int ejs_irpc_call(int eid, struct MprVar *conn, struct MprVar *io, 
+			 const struct dcerpc_interface_table *iface, int callnum,
+			 ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push)
+{
+	return 0;
+}
+
+
+/*
+  backend code for making an rpc call - this is called from the pidl generated ejs
+  code
+*/
  int ejs_rpc_call(int eid, int argc, struct MprVar **argv,
-		  const char *callname,
+		  const struct dcerpc_interface_table *iface, int callnum,
 		  ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push)
 {
 	struct MprVar *conn, *io;
-	const struct dcerpc_interface_table *iface;
 	struct dcerpc_pipe *p;
-	const struct dcerpc_interface_call *call;
 	NTSTATUS status;
 	void *ptr;
 	struct rpc_request *req;
-	int callnum;
 	struct ejs_rpc *ejs;
+	const struct dcerpc_interface_call *call;
 
 	if (argc != 2 ||
 	    argv[0]->type != MPR_TYPE_OBJECT ||
@@ -192,30 +200,28 @@
 	conn     = argv[0];
 	io       = argv[1];
 
+	if (mprGetPtr(conn, "irpc")) {
+		/* its an irpc call */
+		return ejs_irpc_call(eid, conn, io, iface, callnum, ejs_pull, ejs_push);
+	}
+
 	/* get the pipe info */
 	p = mprGetPtr(conn, "pipe");
-	iface = mprGetPtr(conn, "iface");
-	if (p == NULL || iface == NULL) {
+	if (p == NULL) {
 		ejsSetErrorMsg(eid, "rpc_call invalid pipe");
 		return -1;
 	}
 
-	/* find the call by name */
-	call = dcerpc_iface_find_call(iface, callname);
-	if (call == NULL) {
-		status = NT_STATUS_OBJECT_NAME_INVALID;
-		goto done;
-	}
-	callnum = call - iface->calls;
-
 	ejs = talloc(mprMemCtx(), struct ejs_rpc);
 	if (ejs == NULL) {
 		status = NT_STATUS_NO_MEMORY;
 		goto done;
 	}
 
+	call = &iface->calls[callnum];
+
 	ejs->eid = eid;
-	ejs->callname = callname;
+	ejs->callname = call->name;
 
 	/* allocate the C structure */
 	ptr = talloc_zero_size(ejs, call->struct_size);



More information about the samba-cvs mailing list