From: Stefan Metzmacher Date: Fri, 20 Sep 2013 20:27:54 +0000 (+0200) Subject: testprogs/win32/rpcecho-win32-pipe server 1 byte reads X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=4becc0d8852145d76cc5d100cd76676e69511cb3;hp=e129290000feefcd1c88aaec51ee23a73c6589e2;p=metze%2Fsamba%2Fwip.git testprogs/win32/rpcecho-win32-pipe server 1 byte reads --- diff --git a/testprogs/win32/rpcecho-win32-pipe/rpcecho.acf b/testprogs/win32/rpcecho-win32-pipe/rpcecho.acf index 95b737c5d1cb..25569abb0faa 100755 --- a/testprogs/win32/rpcecho-win32-pipe/rpcecho.acf +++ b/testprogs/win32/rpcecho-win32-pipe/rpcecho.acf @@ -25,4 +25,6 @@ interface rpcecho { /* [async] TestSleep(); */ [async] TestBytePipeIn(); + [async] TestBytePipeOut(); +// [async] TestBytePipeInOut(); } diff --git a/testprogs/win32/rpcecho-win32-pipe/rpcecho.h b/testprogs/win32/rpcecho-win32-pipe/rpcecho.h index 0638498c96ca..4c3ddc33ea17 100644 --- a/testprogs/win32/rpcecho-win32-pipe/rpcecho.h +++ b/testprogs/win32/rpcecho-win32-pipe/rpcecho.h @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0555 */ -/* at Fri Sep 20 18:05:28 2013 +/* at Fri Sep 20 22:20:36 2013 */ /* Compiler settings for rpcecho.idl, rpcecho.acf: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 @@ -212,9 +212,16 @@ typedef struct pipe_BYTE_PIPE /* [async] */ void TestBytePipeIn( /* [in] */ PRPC_ASYNC_STATE TestBytePipeIn_AsyncHandle, - /* [in] */ long count, + /* [in] */ long num_chunks, + /* [in] */ long chunk_size, /* [ref][in] */ ASYNC_BYTE_PIPE *in_pipe); +/* [async] */ void TestBytePipeOut( + /* [in] */ PRPC_ASYNC_STATE TestBytePipeOut_AsyncHandle, + /* [in] */ long num_chunks, + /* [in] */ long chunk_size, + /* [ref][out] */ ASYNC_BYTE_PIPE *out_pipe); + extern handle_t rpcecho_IfHandle; diff --git a/testprogs/win32/rpcecho-win32-pipe/rpcecho.idl b/testprogs/win32/rpcecho-win32-pipe/rpcecho.idl index ee8327e769c3..0c0ac1bb8650 100755 --- a/testprogs/win32/rpcecho-win32-pipe/rpcecho.idl +++ b/testprogs/win32/rpcecho-win32-pipe/rpcecho.idl @@ -152,18 +152,21 @@ interface rpcecho typedef pipe byte BYTE_PIPE; long TestBytePipeIn( - [in] long count, + [in] long num_chunks, + [in] long chunk_size, [in,ref] BYTE_PIPE *in_pipe ); long TestBytePipeOut( - [in] long count, + [in] long num_chunks, + [in] long chunk_size, [out,ref] BYTE_PIPE *out_pipe ); #if 0 long TestBytePipeInOut( - [in] long count, + [in] long num_chunks, + [in] long chunk_size, [in,out,ref] BYTE_PIPE *in_out_pipe ); #endif diff --git a/testprogs/win32/rpcecho-win32-pipe/rpcecho_c.c b/testprogs/win32/rpcecho-win32-pipe/rpcecho_c.c index 9dd7ae0d62fd..6220cb468d6a 100644 --- a/testprogs/win32/rpcecho-win32-pipe/rpcecho_c.c +++ b/testprogs/win32/rpcecho-win32-pipe/rpcecho_c.c @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0555 */ -/* at Fri Sep 20 18:05:28 2013 +/* at Fri Sep 20 22:20:36 2013 */ /* Compiler settings for rpcecho.idl, rpcecho.acf: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 @@ -35,8 +35,8 @@ #include "rpcecho.h" -#define TYPE_FORMAT_STRING_SIZE 249 -#define PROC_FORMAT_STRING_SIZE 437 +#define TYPE_FORMAT_STRING_SIZE 263 +#define PROC_FORMAT_STRING_SIZE 493 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -245,7 +245,8 @@ short TestDoublePointer( /* [async] */ void TestBytePipeIn( /* [in] */ PRPC_ASYNC_STATE TestBytePipeIn_AsyncHandle, - /* [in] */ long count, + /* [in] */ long num_chunks, + /* [in] */ long chunk_size, /* [ref][in] */ ASYNC_BYTE_PIPE *in_pipe) { @@ -253,12 +254,31 @@ short TestDoublePointer( ( PMIDL_STUB_DESC )&rpcecho_StubDesc, (PFORMAT_STRING) &rpcecho__MIDL_ProcFormatString.Format[392], TestBytePipeIn_AsyncHandle, - count, + num_chunks, + chunk_size, in_pipe); } +/* [async] */ void TestBytePipeOut( + /* [in] */ PRPC_ASYNC_STATE TestBytePipeOut_AsyncHandle, + /* [in] */ long num_chunks, + /* [in] */ long chunk_size, + /* [ref][out] */ ASYNC_BYTE_PIPE *out_pipe) +{ + + NdrAsyncClientCall( + ( PMIDL_STUB_DESC )&rpcecho_StubDesc, + (PFORMAT_STRING) &rpcecho__MIDL_ProcFormatString.Format[442], + TestBytePipeOut_AsyncHandle, + num_chunks, + chunk_size, + out_pipe); + +} + + #if !defined(__RPC_WIN64__) #error Invalid build platform for this stub. #endif @@ -596,11 +616,11 @@ static const rpcecho_MIDL_PROC_FORMAT_STRING rpcecho__MIDL_ProcFormatString = 0x48, /* Old Flags: */ /* 394 */ NdrFcLong( 0x0 ), /* 0 */ /* 398 */ NdrFcShort( 0xa ), /* 10 */ -/* 400 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ -/* 402 */ NdrFcShort( 0x8 ), /* 8 */ +/* 400 */ NdrFcShort( 0x28 ), /* x86 Stack size/offset = 40 */ +/* 402 */ NdrFcShort( 0x10 ), /* 16 */ /* 404 */ NdrFcShort( 0x8 ), /* 8 */ /* 406 */ 0xcc, /* Oi2 Flags: has return, has pipes, has ext, has async handle */ - 0x3, /* 3 */ + 0x4, /* 4 */ /* 408 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ /* 410 */ NdrFcShort( 0x0 ), /* 0 */ @@ -608,24 +628,76 @@ static const rpcecho_MIDL_PROC_FORMAT_STRING rpcecho__MIDL_ProcFormatString = /* 414 */ NdrFcShort( 0x0 ), /* 0 */ /* 416 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter count */ + /* Parameter num_chunks */ /* 418 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 420 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 422 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ - /* Parameter in_pipe */ + /* Parameter chunk_size */ -/* 424 */ NdrFcShort( 0x10c ), /* Flags: pipe, in, simple ref, */ +/* 424 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 426 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 428 */ NdrFcShort( 0xf0 ), /* Type Offset=240 */ +/* 428 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ - /* Return value */ + /* Parameter in_pipe */ -/* 430 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 430 */ NdrFcShort( 0x10c ), /* Flags: pipe, in, simple ref, */ /* 432 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ -/* 434 */ 0x8, /* FC_LONG */ +/* 434 */ NdrFcShort( 0xf0 ), /* Type Offset=240 */ + + /* Return value */ + +/* 436 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 438 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ +/* 440 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure TestBytePipeOut */ + +/* 442 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x48, /* Old Flags: */ +/* 444 */ NdrFcLong( 0x0 ), /* 0 */ +/* 448 */ NdrFcShort( 0xb ), /* 11 */ +/* 450 */ NdrFcShort( 0x28 ), /* x86 Stack size/offset = 40 */ +/* 452 */ NdrFcShort( 0x10 ), /* 16 */ +/* 454 */ NdrFcShort( 0x8 ), /* 8 */ +/* 456 */ 0xcc, /* Oi2 Flags: has return, has pipes, has ext, has async handle */ + 0x4, /* 4 */ +/* 458 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 460 */ NdrFcShort( 0x0 ), /* 0 */ +/* 462 */ NdrFcShort( 0x0 ), /* 0 */ +/* 464 */ NdrFcShort( 0x0 ), /* 0 */ +/* 466 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter num_chunks */ + +/* 468 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 470 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 472 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter chunk_size */ + +/* 474 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 476 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 478 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter out_pipe */ + +/* 480 */ NdrFcShort( 0x4114 ), /* Flags: pipe, out, simple ref, srv alloc size=16 */ +/* 482 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 484 */ NdrFcShort( 0xfe ), /* Type Offset=254 */ + + /* Return value */ + +/* 486 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 488 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ +/* 490 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -817,6 +889,16 @@ static const rpcecho_MIDL_TYPE_FORMAT_STRING rpcecho__MIDL_TypeFormatString = /* 242 */ NdrFcShort( 0xfffc ), /* Offset= -4 (238) */ /* 244 */ NdrFcShort( 0x1 ), /* 1 */ /* 246 */ NdrFcShort( 0x1 ), /* 1 */ +/* 248 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 250 */ NdrFcShort( 0x4 ), /* Offset= 4 (254) */ +/* 252 */ 0x1, /* FC_BYTE */ + 0x5c, /* FC_PAD */ +/* 254 */ 0xb5, /* FC_PIPE */ + 0x0, /* 0 */ +/* 256 */ NdrFcShort( 0xfffc ), /* Offset= -4 (252) */ +/* 258 */ NdrFcShort( 0x1 ), /* 1 */ +/* 260 */ NdrFcShort( 0x1 ), /* 1 */ 0x0 } @@ -834,7 +916,8 @@ static const unsigned short rpcecho_FormatStringOffsetTable[] = 278, 322, 354, - 392 + 392, + 442 }; diff --git a/testprogs/win32/rpcecho-win32-pipe/rpcecho_s.c b/testprogs/win32/rpcecho-win32-pipe/rpcecho_s.c index 311207d5ec1d..a570d6bc83ac 100644 --- a/testprogs/win32/rpcecho-win32-pipe/rpcecho_s.c +++ b/testprogs/win32/rpcecho-win32-pipe/rpcecho_s.c @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0555 */ -/* at Fri Sep 20 18:05:28 2013 +/* at Fri Sep 20 22:20:36 2013 */ /* Compiler settings for rpcecho.idl, rpcecho.acf: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 @@ -34,8 +34,8 @@ #include #include "rpcecho.h" -#define TYPE_FORMAT_STRING_SIZE 249 -#define PROC_FORMAT_STRING_SIZE 437 +#define TYPE_FORMAT_STRING_SIZE 263 +#define PROC_FORMAT_STRING_SIZE 493 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -428,11 +428,11 @@ static const rpcecho_MIDL_PROC_FORMAT_STRING rpcecho__MIDL_ProcFormatString = 0x48, /* Old Flags: */ /* 394 */ NdrFcLong( 0x0 ), /* 0 */ /* 398 */ NdrFcShort( 0xa ), /* 10 */ -/* 400 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ -/* 402 */ NdrFcShort( 0x8 ), /* 8 */ +/* 400 */ NdrFcShort( 0x28 ), /* x86 Stack size/offset = 40 */ +/* 402 */ NdrFcShort( 0x10 ), /* 16 */ /* 404 */ NdrFcShort( 0x8 ), /* 8 */ /* 406 */ 0xcc, /* Oi2 Flags: has return, has pipes, has ext, has async handle */ - 0x3, /* 3 */ + 0x4, /* 4 */ /* 408 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ /* 410 */ NdrFcShort( 0x0 ), /* 0 */ @@ -440,24 +440,76 @@ static const rpcecho_MIDL_PROC_FORMAT_STRING rpcecho__MIDL_ProcFormatString = /* 414 */ NdrFcShort( 0x0 ), /* 0 */ /* 416 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter count */ + /* Parameter num_chunks */ /* 418 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 420 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 422 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ - /* Parameter in_pipe */ + /* Parameter chunk_size */ -/* 424 */ NdrFcShort( 0x10c ), /* Flags: pipe, in, simple ref, */ +/* 424 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 426 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 428 */ NdrFcShort( 0xf0 ), /* Type Offset=240 */ +/* 428 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ - /* Return value */ + /* Parameter in_pipe */ -/* 430 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 430 */ NdrFcShort( 0x10c ), /* Flags: pipe, in, simple ref, */ /* 432 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ -/* 434 */ 0x8, /* FC_LONG */ +/* 434 */ NdrFcShort( 0xf0 ), /* Type Offset=240 */ + + /* Return value */ + +/* 436 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 438 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ +/* 440 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure TestBytePipeOut */ + +/* 442 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x48, /* Old Flags: */ +/* 444 */ NdrFcLong( 0x0 ), /* 0 */ +/* 448 */ NdrFcShort( 0xb ), /* 11 */ +/* 450 */ NdrFcShort( 0x28 ), /* x86 Stack size/offset = 40 */ +/* 452 */ NdrFcShort( 0x10 ), /* 16 */ +/* 454 */ NdrFcShort( 0x8 ), /* 8 */ +/* 456 */ 0xcc, /* Oi2 Flags: has return, has pipes, has ext, has async handle */ + 0x4, /* 4 */ +/* 458 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 460 */ NdrFcShort( 0x0 ), /* 0 */ +/* 462 */ NdrFcShort( 0x0 ), /* 0 */ +/* 464 */ NdrFcShort( 0x0 ), /* 0 */ +/* 466 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter num_chunks */ + +/* 468 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 470 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 472 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter chunk_size */ + +/* 474 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 476 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 478 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter out_pipe */ + +/* 480 */ NdrFcShort( 0x4114 ), /* Flags: pipe, out, simple ref, srv alloc size=16 */ +/* 482 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 484 */ NdrFcShort( 0xfe ), /* Type Offset=254 */ + + /* Return value */ + +/* 486 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 488 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ +/* 490 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -649,6 +701,16 @@ static const rpcecho_MIDL_TYPE_FORMAT_STRING rpcecho__MIDL_TypeFormatString = /* 242 */ NdrFcShort( 0xfffc ), /* Offset= -4 (238) */ /* 244 */ NdrFcShort( 0x1 ), /* 1 */ /* 246 */ NdrFcShort( 0x1 ), /* 1 */ +/* 248 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 250 */ NdrFcShort( 0x4 ), /* Offset= 4 (254) */ +/* 252 */ 0x1, /* FC_BYTE */ + 0x5c, /* FC_PAD */ +/* 254 */ 0xb5, /* FC_PIPE */ + 0x0, /* 0 */ +/* 256 */ NdrFcShort( 0xfffc ), /* Offset= -4 (252) */ +/* 258 */ NdrFcShort( 0x1 ), /* 1 */ +/* 260 */ NdrFcShort( 0x1 ), /* 1 */ 0x0 } @@ -666,7 +728,8 @@ static const unsigned short rpcecho_FormatStringOffsetTable[] = 278, 322, 354, - 392 + 392, + 442 }; @@ -707,11 +770,12 @@ static const RPC_DISPATCH_FUNCTION rpcecho_table[] = NdrServerCall2, NdrServerCall2, NdrAsyncServerCall, + NdrAsyncServerCall, 0 }; static const RPC_DISPATCH_TABLE rpcecho_v1_0_DispatchTable = { - 11, + 12, (RPC_DISPATCH_FUNCTION*)rpcecho_table }; @@ -727,7 +791,8 @@ static const SERVER_ROUTINE rpcecho_ServerRoutineTable[] = (SERVER_ROUTINE)TestEnum, (SERVER_ROUTINE)TestSurrounding, (SERVER_ROUTINE)TestDoublePointer, - (SERVER_ROUTINE)TestBytePipeIn + (SERVER_ROUTINE)TestBytePipeIn, + (SERVER_ROUTINE)TestBytePipeOut }; static const MIDL_SERVER_INFO rpcecho_ServerInfo = diff --git a/testprogs/win32/rpcecho-win32-pipe/server.c b/testprogs/win32/rpcecho-win32-pipe/server.c index 2ce56e90ad6d..598a5d3db0c8 100755 --- a/testprogs/win32/rpcecho-win32-pipe/server.c +++ b/testprogs/win32/rpcecho-win32-pipe/server.c @@ -148,28 +148,66 @@ short TestDoublePointer(short ***data) void TestBytePipeIn( PRPC_ASYNC_STATE TestBytePipeIn_AsyncHandle, - long count, + long num_chunks, + long chunk_size, ASYNC_BYTE_PIPE *in_pipe) { long ret; byte in_bytes[0x80000]; - int bytes_count; + int in_bytes_count; + int i; printf("TestBytePipeIn: Start\n"); fflush(stdout); - do { - in_pipe->pull(in_pipe->state, in_bytes, sizeof(in_bytes), &bytes_count); - printf("pull bytes_count[%u]\n", bytes_count); + in_bytes_count = sizeof(in_bytes); + for (i=0; in_bytes_count > 0; i++) { + in_bytes_count = sizeof(in_bytes); + in_pipe->pull(in_pipe->state, in_bytes, sizeof(byte), &in_bytes_count); + printf("pull[%u] bytes_count[%u]\n", i, in_bytes_count); fflush(stdout); - } while (bytes_count > 0); + } printf("TestBytePipeIn: End\n"); fflush(stdout); - ret = count; + ret = i; RpcAsyncCompleteCall(TestBytePipeIn_AsyncHandle, &ret); } +void TestBytePipeOut( + PRPC_ASYNC_STATE TestBytePipeOut_AsyncHandle, + long num_chunks, + long chunk_size, + ASYNC_BYTE_PIPE *out_pipe) +{ + long ret; + byte *out_bytes = NULL; + unsigned long out_alloc_size = 0; + unsigned long out_bytes_count = 0; + int i = 0; + + printf("TestBytePipeOut: Start\n"); + fflush(stdout); + + out_alloc_size = chunk_size * sizeof(byte); + out_pipe->alloc(out_pipe->state, out_alloc_size, &out_bytes, &out_bytes_count); + memset(out_bytes, 0xCC, out_bytes_count * sizeof(byte)); + + for (i = 0; i <= num_chunks; i++) { + if (i == num_chunks) { + out_bytes_count = 0; + } + printf("[%u] push outb_len[%u]\n", i, out_bytes_count); + fflush(stdout); + out_pipe->push(out_pipe->state, out_bytes, out_bytes_count); + } + + printf("TestBytePipeOut: End\n"); + fflush(stdout); + ret = i; + RpcAsyncCompleteCall(TestBytePipeOut_AsyncHandle, &ret); +} + void main(int argc, char **argv) { RPC_STATUS status;