r7422: Create a ejs object to wrap a smbcli_transport pointer.
authorTim Potter <tpot@samba.org>
Thu, 9 Jun 2005 07:28:21 +0000 (07:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:51 +0000 (13:17 -0500)
source/scripting/ejs/smbcalls_cli.c

index adb55a018426aa9ff65dfae7af090f46c08405eb..de31d7a9006d779e1c85e3b498f1cee6560b337f 100644 (file)
 #include "lib/ejs/ejs.h"
 #include "librpc/gen_ndr/ndr_nbt.h"
 
+static struct MprVar mprTransport(struct smbcli_transport *transport)
+{
+       struct MprVar res, val;
+
+       res = mprCreateObjVar("transport", MPR_DEFAULT_HASH_SIZE);
+
+       val = mprCreateStringVar(talloc_get_name(transport), 1);
+       mprCreateProperty(&res, "name", &val);
+
+       /* TODO: Create a C pointer "value" property */
+
+       return res;
+}
+
 /* Connect to a server */
 
 static int ejs_cli_connect(MprVarHandle eid, int argc, char **argv)
@@ -77,6 +91,10 @@ static int ejs_cli_connect(MprVarHandle eid, int argc, char **argv)
                return 0;
        }
 
+       /* Return a socket object */
+
+       ejsSetReturnValue(eid, mprTransport(transport));
+
        return 0;
 }