1579afa94fc5bbf86a26e78b5a67d418aefd6817
[jelmer/samba4-debian.git] / testprogs / ejs / echo.js
1 /*
2         demonstrate access to rpc calls from ejs
3 */      
4
5 function irpcObj()
6 {
7         var o = new Object();
8         o.in = new Object();
9         return o;
10 }
11
12 function test_AddOne(binding)
13 {
14         var status;
15         var conn = new Object();
16         var io = irpcObj();
17
18         status = rpc_connect(conn, binding, "rpcecho");
19         if (status.is_ok != true) {
20            print("Failed to connect to " + binding + " - " + status.errstr + "\n");
21            return;
22         }
23
24         for (i=0;i<10;i++) {
25                 io.in.in_data = i;
26                 status = dcerpc_echo_AddOne(conn, io);
27                 print("AddOne(" + i + ")=" + io.out.out_data + "\n");
28         }
29 }
30
31 if (ARGV.length == 0) {
32    print("Usage: echo.js <RPCBINDING>\n");
33    exit(0);
34 }
35
36 var binding = ARGV[0];
37
38 test_AddOne(binding);