summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-15 07:18:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:23:08 -0500
commita0bc4da1a307753e3b28a11863f50d66b0894190 (patch)
treed16430b5a02dd01188c7aa1722181eb947ec9442 /source4/scripting/ejs
parent7b8332369f3664af13bd7760561765a35c312b9e (diff)
downloadsamba-a0bc4da1a307753e3b28a11863f50d66b0894190.tar.gz
samba-a0bc4da1a307753e3b28a11863f50d66b0894190.tar.bz2
samba-a0bc4da1a307753e3b28a11863f50d66b0894190.zip
r8483: switched our generated ejs rpc code over to the new OO interface. This
means we don't pollute the name space, and also makes for faster startup times as we only create variables for the pipes that we use, not all pipes (This used to be commit 57d7a585e8162d21c7152952aa0cc7471968784f)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/ejsrpc.c19
-rw-r--r--source4/scripting/ejs/ejsrpc.h7
-rw-r--r--source4/scripting/ejs/smbcalls.c7
-rw-r--r--source4/scripting/ejs/smbcalls.h1
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c30
-rw-r--r--source4/scripting/ejs/smbscript.c2
6 files changed, 6 insertions, 60 deletions
diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c
index e152c8fcd1..08bc4a94ba 100644
--- a/source4/scripting/ejs/ejsrpc.c
+++ b/source4/scripting/ejs/ejsrpc.c
@@ -229,25 +229,6 @@ NTSTATUS ejs_push_string(struct ejs_rpc *ejs,
return mprSetVar(v, name, mprString(s));
}
-/*
- setup a constant int
-*/
-void ejs_set_constant_int(int eid, const char *name, int value)
-{
- struct MprVar *v = ejsGetGlobalObject(eid);
- mprSetVar(v, name, mprCreateIntegerVar(value));
-}
-
-/*
- setup a constant string
-*/
-void ejs_set_constant_string(int eid, const char *name, const char *value)
-{
- struct MprVar *v = ejsGetGlobalObject(eid);
- mprSetVar(v, name, mprCreateStringVar(value, False));
-}
-
-
NTSTATUS ejs_pull_dom_sid(struct ejs_rpc *ejs,
struct MprVar *v, const char *name, struct dom_sid *r)
{
diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h
index e4b623750d..dbd147fe1d 100644
--- a/source4/scripting/ejs/ejsrpc.h
+++ b/source4/scripting/ejs/ejsrpc.h
@@ -36,12 +36,8 @@ typedef NTSTATUS (*ejs_push_function_t)(struct ejs_rpc *, struct MprVar *, const
NTSTATUS ejs_panic(struct ejs_rpc *ejs, const char *why);
void ejs_set_switch(struct ejs_rpc *ejs, uint32_t switch_var);
-typedef void (*ejs_setup_t)(void);
-typedef void (*ejs_constants_t)(int);
+NTSTATUS smbcalls_register_ejs(const char *name, MprCFunction fn);
-NTSTATUS smbcalls_register_ejs(const char *name,
- ejs_setup_t setup,
- ejs_constants_t constants);
int ejs_rpc_call(int eid, int argc, struct MprVar **argv,
const struct dcerpc_interface_table *iface, int callnum,
@@ -120,3 +116,4 @@ BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name);
#define ejs_push_dom_sid2 ejs_push_dom_sid
#define ejs_pull_NTTIME_hyper ejs_pull_NTTIME
#define ejs_push_NTTIME_hyper ejs_push_NTTIME
+
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c
index 49bcc64c96..59e5b17034 100644
--- a/source4/scripting/ejs/smbcalls.c
+++ b/source4/scripting/ejs/smbcalls.c
@@ -132,10 +132,3 @@ void smb_setup_ejs_functions(void)
ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
}
-/*
- setup constants that can be used from ejs
-*/
-void smb_setup_ejs_constants(int eid)
-{
- smb_setup_ejs_rpc_constants(eid);
-}
diff --git a/source4/scripting/ejs/smbcalls.h b/source4/scripting/ejs/smbcalls.h
index aa5c27b4f5..927c3ccf2f 100644
--- a/source4/scripting/ejs/smbcalls.h
+++ b/source4/scripting/ejs/smbcalls.h
@@ -28,4 +28,3 @@ NTSTATUS mprGetVar(struct MprVar **v, const char *name);
void mprAddArray(struct MprVar *var, int i, struct MprVar v);
void mprSetCFunction(struct MprVar *obj, const char *name, MprCFunction fn);
void mprSetStringCFunction(struct MprVar *obj, const char *name, MprStringCFunction fn);
-
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index ccb2026446..8e7bf57972 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -361,16 +361,13 @@ done:
static struct ejs_register {
struct ejs_register *next, *prev;
const char *name;
- ejs_setup_t setup;
- ejs_constants_t constants;
+ MprCFunction fn;
} *ejs_registered;
/*
register a generated ejs module
*/
- NTSTATUS smbcalls_register_ejs(const char *name,
- ejs_setup_t setup,
- ejs_constants_t constants)
+ NTSTATUS smbcalls_register_ejs(const char *name, MprCFunction fn)
{
struct ejs_register *r;
void *ctx = ejs_registered;
@@ -380,8 +377,7 @@ static struct ejs_register {
r = talloc(ctx, struct ejs_register);
NT_STATUS_HAVE_NO_MEMORY(r);
r->name = name;
- r->setup = setup;
- r->constants = constants;
+ r->fn = fn;
DLIST_ADD(ejs_registered, r);
return NT_STATUS_OK;
}
@@ -396,24 +392,6 @@ void smb_setup_ejs_rpc(void)
ejsDefineCFunction(-1, "rpc_connect", ejs_rpc_connect, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineCFunction(-1, "irpc_connect", ejs_irpc_connect, NULL, MPR_VAR_SCRIPT_HANDLE);
for (r=ejs_registered;r;r=r->next) {
- r->setup();
+ ejsDefineCFunction(-1, r->name, r->fn, NULL, MPR_VAR_SCRIPT_HANDLE);
}
}
-
-/*
- setup constants for rpc calls
-*/
-void smb_setup_ejs_rpc_constants(int eid)
-{
- struct ejs_register *r;
- struct MprVar v;
-
- for (r=ejs_registered;r;r=r->next) {
- r->constants(eid);
- }
-
- v = mprCreatePtrVar(NULL);
- mprSetProperty(ejsGetGlobalObject(eid), "NULL", &v);
-}
-
-
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index d71d084779..8359629a85 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -71,8 +71,6 @@ void ejs_exception(const char *reason)
exit(127);
}
- smb_setup_ejs_constants(eid);
-
/* setup ARGV[] in the ejs environment */
for (i=1;argv[i];i++) {
argv_list = str_list_add(argv_list, argv[i]);