summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-07-04 01:31:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:08 -0500
commit766e8e1acbd4f88b194baac17859706161d4644b (patch)
tree1ba9857d2cf95e2c09a28808dac5af693e6f441a /source4/scripting
parente0d521ca79314b7c27512565262f614f67e20e64 (diff)
downloadsamba-766e8e1acbd4f88b194baac17859706161d4644b.tar.gz
samba-766e8e1acbd4f88b194baac17859706161d4644b.tar.bz2
samba-766e8e1acbd4f88b194baac17859706161d4644b.zip
r8105: Add ejsrpc push/pull functions for uint16 and uint8.
(This used to be commit ee27943e215126a2048d1082437ef2597d913371)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/ejsrpc.c44
-rw-r--r--source4/scripting/ejs/ejsrpc.h23
2 files changed, 55 insertions, 12 deletions
diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c
index bc5fdd647f..990dee123c 100644
--- a/source4/scripting/ejs/ejsrpc.c
+++ b/source4/scripting/ejs/ejsrpc.c
@@ -96,6 +96,50 @@ static NTSTATUS mprSetVar(struct MprVar *v, const char *name, struct MprVar val)
/*
+ pull a uint8 from a mpr variable to a C element
+*/
+NTSTATUS ejs_pull_uint8(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint8_t *r)
+{
+ struct MprVar *var;
+ var = mprGetVar(v, name);
+ if (var == NULL) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ *r = mprVarToInteger(var);
+ return NT_STATUS_OK;
+
+}
+
+NTSTATUS ejs_push_uint8(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint8_t r)
+{
+ return mprSetVar(v, name, mprCreateIntegerVar(r));
+}
+
+/*
+ pull a uint16 from a mpr variable to a C element
+*/
+NTSTATUS ejs_pull_uint16(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint16_t *r)
+{
+ struct MprVar *var;
+ var = mprGetVar(v, name);
+ if (var == NULL) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ *r = mprVarToInteger(var);
+ return NT_STATUS_OK;
+
+}
+
+NTSTATUS ejs_push_uint16(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint16_t r)
+{
+ return mprSetVar(v, name, mprCreateIntegerVar(r));
+}
+
+/*
pull a uint32 from a mpr variable to a C element
*/
NTSTATUS ejs_pull_uint32(struct ejs_rpc *ejs,
diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h
index b2d491d94d..252df9c235 100644
--- a/source4/scripting/ejs/ejsrpc.h
+++ b/source4/scripting/ejs/ejsrpc.h
@@ -30,19 +30,18 @@ typedef NTSTATUS (*ejs_push_function_t)(struct ejs_rpc *, struct MprVar *, const
NTSTATUS ejs_pull_rpc(struct MprVar *v, void *ptr, ejs_pull_function_t ejs_pull);
NTSTATUS ejs_push_rpc(struct MprVar *v, const void *ptr, ejs_push_function_t ejs_push);
+
+NTSTATUS ejs_pull_uint8(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint8_t *r);
+NTSTATUS ejs_push_uint8(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint8_t r);
+
+NTSTATUS ejs_pull_uint16(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint16_t *r);
+NTSTATUS ejs_push_uint16(struct ejs_rpc *ejs,
+ struct MprVar *v, const char *name, uint16_t r);
+
NTSTATUS ejs_pull_uint32(struct ejs_rpc *ejs,
struct MprVar *v, const char *name, uint32_t *r);
NTSTATUS ejs_push_uint32(struct ejs_rpc *ejs,
struct MprVar *v, const char *name, uint32_t r);
-
-
-/* echo calls */
-
-#include "librpc/gen_ndr/ndr_echo.h"
-
-NTSTATUS ejs_pull_echo_AddOne(struct ejs_rpc *ejs,
- struct MprVar *v, struct echo_AddOne *r);
-NTSTATUS ejs_push_echo_AddOne(struct ejs_rpc *ejs,
- struct MprVar *v,
- const struct echo_AddOne *r);
-