ReactOS 0.4.17-dev-1281-g065abb3
UcxStaticStreams Class Reference

#include <pipe.h>

Collaboration diagram for UcxStaticStreams:

Public Member Functions

VOID SetStreamInfo (_In_ PSTREAM_INFO StreamInfo)
 
UcxStream * Stream (_In_ ULONG Index)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS Create (_In_ UCXENDPOINT Endpoint, _Inout_ PUCXSSTREAMS_INIT *Init, _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes, _Out_ UCXSSTREAMS *StaticStreams)
 
static UcxStaticStreams * FromHandle (_In_ UCXSSTREAMS Handle)
 

Public Attributes

UCXSSTREAMS m_Handle
 
ULONG m_StreamCount
 
UcxEndpoint * m_Endpoint
 
UcxStaticStreamsInit * m_Init
 

Static Private Attributes

static EVT_WDF_OBJECT_CONTEXT_DESTROY EvtDestroy
 

Detailed Description

Definition at line 351 of file pipe.h.

Member Function Documentation

◆ Create()

_Must_inspect_result_ NTSTATUS UcxStaticStreams::Create ( _In_ UCXENDPOINT  Endpoint,
_Inout_ PUCXSSTREAMS_INIT *  Init,
_In_opt_ PWDF_OBJECT_ATTRIBUTES  Attributes,
_Out_ UCXSSTREAMS *  StaticStreams 
)
static

Definition at line 531 of file pipe.cpp.

536{
537 UcxStaticStreamsInit* StreamsInit = *Init;
538 WDF_OBJECT_ATTRIBUTES Primary;
542
544
545 /* The stream entries follow the context in the same allocation */
547 Primary.ContextSizeOverride = sizeof(UcxStaticStreams) + StreamsInit->StreamCount * sizeof(UcxStream);
548 Primary.ParentObject = StreamsInit->Endpoint;
550
552 if (!NT_SUCCESS(Status))
553 {
554 DPRINT1("Streams object create failed for endpoint %p 0x%lx\n", Endpoint, Status);
555 return Status;
556 }
557
558 Context = new (UcxGetStaticStreamsContext(Object)) UcxStaticStreams();
559 Context->m_Handle = (UCXSSTREAMS)Object;
560 Context->m_StreamCount = StreamsInit->StreamCount;
562 Context->m_Init = StreamsInit;
563
564 StreamsInit->Created = Context->m_Handle;
565 *StaticStreams = Context->m_Handle;
566 *Init = NULL;
567
568 return STATUS_SUCCESS;
569}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
static UcxEndpoint * FromHandle(_In_ UCXENDPOINT Handle)
Definition: pipe.cpp:91
static EVT_WDF_OBJECT_CONTEXT_DESTROY EvtDestroy
Definition: pipe.h:389
UCXSSTREAMS m_Handle
Definition: pipe.h:380
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
_In_ UCXHUB_DEVICE_CONTEXT _In_ UCXENDPOINT Endpoint
Definition: hubucx.h:238
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define STATUS_SUCCESS
Definition: shellext.h:65
UCXENDPOINT Endpoint
Definition: pipe.h:112
UCXSSTREAMS Created
Definition: pipe.h:116
ULONG StreamCount
Definition: pipe.h:113
WDFOBJECT ParentObject
Definition: wdfobject.h:130
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback
Definition: wdfobject.h:115
_Must_inspect_result_ _In_ UCXENDPOINT _Inout_ PUCXSSTREAMS_INIT _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXSSTREAMS * StaticStreams
Definition: ucxsstreams.h:55
_Must_inspect_result_ NTSTATUS NTAPI UcxCreateObjectWithTwoContexts(_In_ PWDF_OBJECT_ATTRIBUTES Primary, _In_opt_ PWDF_OBJECT_ATTRIBUTES Secondary, _Out_ WDFOBJECT *Object)
Definition: ucxutil.cpp:19
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170

Referenced by Create().

◆ FromHandle()

UcxStaticStreams * UcxStaticStreams::FromHandle ( _In_ UCXSSTREAMS  Handle)
static

Definition at line 523 of file pipe.cpp.

525{
526 return UcxGetStaticStreamsContext(Handle);
527}
ULONG Handle
Definition: gdb_input.c:15

Referenced by FromHandle().

◆ SetStreamInfo()

VOID UcxStaticStreams::SetStreamInfo ( _In_ PSTREAM_INFO  StreamInfo)

Called per stream with IDs counting up from 1; a bad call fails the whole set.

Definition at line 573 of file pipe.cpp.

575{
578 UcxPipe* EndpointPipe = &m_Endpoint->m_Pipe;
580 ULONG Index;
581
582 if (Init == NULL)
583 {
584 DPRINT1("Streams %p stream info set outside the add callback\n", m_Handle);
585 UcxVerifierBreak(Verifying);
586 return;
587 }
588
589 if (StreamInfo->Size != sizeof(*StreamInfo))
590 {
591 DPRINT1("Streams %p stream info has bad size %lu\n", m_Handle, StreamInfo->Size);
592 Init->Failed = TRUE;
593 UcxVerifierBreak(Verifying);
594 return;
595 }
596
597 /* Counted even when this call then fails */
598 Index = Init->SetInfoCalls++;
599
600 if (Index >= m_StreamCount || StreamInfo->StreamId != Index + 1 || StreamInfo->WdfQueue == NULL)
601 {
602 DPRINT1("Streams %p bad stream info at call %lu, stream ID %lu, queue %p\n",
603 m_Handle, Index, StreamInfo->StreamId, StreamInfo->WdfQueue);
604 Init->Failed = TRUE;
605 UcxVerifierBreak(Verifying);
606 return;
607 }
608
609 WdfObjectReference(StreamInfo->WdfQueue);
610
611 Entry = Stream(Index);
612 Entry->Filled = TRUE;
613 Entry->Index = Index;
614 Entry->Streams = this;
615 Entry->StreamId = StreamInfo->StreamId;
616 Entry->Pipe.Queue = StreamInfo->WdfQueue;
617 Entry->Pipe.Endpoint = m_Endpoint;
618 Entry->Pipe.TransferType = UcxTransferType::Bulk;
619 Entry->Pipe.Kind = UcxEndpointKind::Generic;
620 Entry->Pipe.BelongsToStream = TRUE;
621 Entry->Pipe.DirectionIn = EndpointPipe->DirectionIn;
622 Entry->Pipe.MaximumTransferSize = EndpointPipe->MaximumTransferSize;
623 Entry->Pipe.Self = &Entry->Pipe;
624}
unsigned char BOOLEAN
Definition: actypes.h:127
BOOLEAN m_DriverVerifierEnabled
Definition: hostctl.h:336
UcxController * m_Controller
Definition: pipe.h:282
UcxPipe m_Pipe
Definition: pipe.h:284
ULONG m_StreamCount
Definition: pipe.h:381
UcxEndpoint * m_Endpoint
Definition: pipe.h:382
UcxStaticStreamsInit * m_Init
Definition: pipe.h:385
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
#define TRUE
Definition: types.h:120
static IStream Stream
Definition: htmldoc.c:1115
Definition: pipe.h:30
ULONG MaximumTransferSize
Definition: pipe.h:37
BOOLEAN DirectionIn
Definition: pipe.h:36
uint32_t ULONG
Definition: typedefs.h:59
FORCEINLINE VOID NTAPI UcxVerifierBreak(_In_ BOOLEAN Verifying)
Definition: ucxutil.h:168
_In_ WDFCOLLECTION _In_ ULONG Index
#define WdfObjectReference(Handle)
Definition: wdfobject.h:803

Referenced by SetStreamInfo(), and UcxApiStaticStreamsSetStreamInfo().

◆ Stream()

UcxStream * UcxStaticStreams::Stream ( _In_ ULONG  Index)
inline

Definition at line 373 of file pipe.h.

375 {
376 return &((UcxStream*)(this + 1))[Index];
377 }

Referenced by UcxEndpoint::OpenStaticStreamsComplete(), and UcxCreateStaticStreams().

Member Data Documentation

◆ EvtDestroy

VOID NTAPI UcxStaticStreams::EvtDestroy
staticprivate

Definition at line 389 of file pipe.h.

Referenced by Create().

◆ m_Endpoint

UcxEndpoint* UcxStaticStreams::m_Endpoint

Definition at line 382 of file pipe.h.

Referenced by SetStreamInfo().

◆ m_Handle

◆ m_Init

UcxStaticStreamsInit* UcxStaticStreams::m_Init

Definition at line 385 of file pipe.h.

Referenced by SetStreamInfo(), and UcxCreateStaticStreams().

◆ m_StreamCount

ULONG UcxStaticStreams::m_StreamCount

Definition at line 381 of file pipe.h.

Referenced by UcxEndpoint::OpenStaticStreamsComplete(), and SetStreamInfo().


The documentation for this class was generated from the following files: