svn commit: samba r4520 - in branches/SAMBA_4_0/source: librpc/idl rpc_server/echo torture/rpc

tridge at samba.org tridge at samba.org
Tue Jan 4 23:27:13 GMT 2005


Author: tridge
Date: 2005-01-04 23:27:12 +0000 (Tue, 04 Jan 2005)
New Revision: 4520

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

Log:
added a enum test function to the echo pipe



Modified:
   branches/SAMBA_4_0/source/librpc/idl/echo.idl
   branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c
   branches/SAMBA_4_0/source/torture/rpc/echo.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/echo.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/echo.idl	2005-01-04 23:26:12 UTC (rev 4519)
+++ branches/SAMBA_4_0/source/librpc/idl/echo.idl	2005-01-04 23:27:12 UTC (rev 4520)
@@ -92,4 +92,30 @@
 	uint32 echo_TestSleep(
 		[in] uint32 seconds
 		);
+
+	typedef enum {
+		ECHO_ENUM1 = 1,
+		ECHO_ENUM2 = 2
+	} echo_Enum1;
+
+	typedef [v1_enum] enum {
+		ECHO_ENUM1_32 = 1,
+		ECHO_ENUM2_32 = 2
+	} echo_Enum1_32;
+
+	typedef struct {
+		echo_Enum1 e1;
+		echo_Enum1_32 e2;
+	} echo_Enum2;
+
+	typedef union {
+		[case(ECHO_ENUM1)] echo_Enum1 e1;
+		[case(ECHO_ENUM2)] echo_Enum2 e2;
+	} echo_Enum3;
+
+	void echo_TestEnum(
+		[in,out,ref] echo_Enum1 *foo1,
+		[in,out,ref] echo_Enum2 *foo2,
+		[in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3
+		);
 }

Modified: branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c	2005-01-04 23:26:12 UTC (rev 4519)
+++ branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c	2005-01-04 23:27:12 UTC (rev 4520)
@@ -107,6 +107,12 @@
 	return NT_STATUS_OK;
 }
 
+static NTSTATUS echo_TestEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestEnum *r)
+{
+	r->out.foo2->e1 = ECHO_ENUM2;
+	return NT_STATUS_OK;
+}
+
 static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r)
 {
 	sleep(r->in.seconds);

Modified: branches/SAMBA_4_0/source/torture/rpc/echo.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/echo.c	2005-01-04 23:26:12 UTC (rev 4519)
+++ branches/SAMBA_4_0/source/torture/rpc/echo.c	2005-01-04 23:27:12 UTC (rev 4520)
@@ -262,6 +262,41 @@
 }
 #endif
 
+
+/*
+  test enum handling
+*/
+static BOOL test_enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+	NTSTATUS status;
+	struct echo_TestEnum r;
+	BOOL ret = True;
+	enum echo_Enum1 v = ECHO_ENUM1;
+	struct echo_Enum2 e2;
+	union echo_Enum3 e3;
+
+	r.in.foo1 = &v;
+	r.in.foo2 = &e2;
+	r.in.foo3 = &e3;
+	r.out.foo1 = &v;
+	r.out.foo2 = &e2;
+	r.out.foo3 = &e3;
+
+	e2.e1 = 76;
+	e2.e2 = ECHO_ENUM1_32;
+	e3.e1 = ECHO_ENUM2;
+
+	printf("\nTesting TestEnum\n");
+	status = dcerpc_echo_TestEnum(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("TestEnum failed - %s\n", nt_errstr(status));
+		ret = False;
+	}
+
+	return ret;
+}
+
+
 BOOL torture_rpc_echo(void)
 {
         NTSTATUS status;
@@ -303,6 +338,10 @@
 		ret = False;
 	}
 
+	if (!test_enum(p, mem_ctx)) {
+		ret = False;
+	}
+
 /*
 	if (!test_sleep(p, mem_ctx)) {
 		ret = False;



More information about the samba-cvs mailing list