class RPipe : public RBusLogicalChannel |
RPipe class object represent the user side handle. It is derived from RBusLogicalChannel which is the base class for handle to the kernel side device driver instance. It encapsulates both named and unnamed pipe methods.
Public Member Functions | |
---|---|
IMPORT_C TInt | CancelDataAvailable () |
IMPORT_C TInt | CancelSpaceAvailable () |
IMPORT_C void | CancelWait () |
IMPORT_C void | Close () |
IMPORT_C TInt | Create ( TInt , RPipe &, RPipe &, TOwnerType , TOwnerType ) |
TInt | Create (const TInt , TOwnerType ) |
IMPORT_C TInt | Define (const TDesC &, TInt ) |
IMPORT_C TInt | Define (const TDesC &, TInt , const TSecurityPolicy &) |
IMPORT_C TInt | Destroy (const TDesC &) |
IMPORT_C void | Flush () |
IMPORT_C TInt | HandleType () |
IMPORT_C TInt | Init () |
IMPORT_C TInt | MaxSize () |
const TDesC & | Name () |
IMPORT_C void | NotifyDataAvailable ( TRequestStatus &) |
IMPORT_C void | NotifySpaceAvailable ( TInt , TRequestStatus &) |
TInt | Open (const RPipe &, TOwnerType ) |
IMPORT_C TInt | Open (const TDesC &, TMode ) |
IMPORT_C TInt | Open ( TInt , TOwnerType ) |
IMPORT_C TInt | Open ( RMessagePtr2 , TInt , TOwnerType ) |
TInt | PipeHandle () |
IMPORT_C TInt | Read ( TDes8 &, TInt ) |
IMPORT_C TInt | ReadBlocking ( TDes8 &, TInt ) |
IMPORT_C TInt | Size () |
TVersion | VersionRequired () |
IMPORT_C void | Wait (const TDesC &, TRequestStatus &) |
IMPORT_C void | WaitForReader (const TDesC &, TRequestStatus &) |
IMPORT_C void | WaitForWriter (const TDesC &, TRequestStatus &) |
IMPORT_C TInt | Write (const TDesC8 &, TInt ) |
IMPORT_C TInt | WriteBlocking (const TDesC8 &, TInt ) |
Private Member Functions | |
---|---|
void | ReqComplete ( TRequestStatus &, TInt ) |
void | Wait (const TDesC &, TRequestStatus &, TInt ) |
Public Member Enumerations | |
---|---|
enum | TChannelType { EChannelUnset = 0x0, EReadChannel = 0x1, EWriteChannel = 0x2 } |
enum | TMode { EOpenToRead , EOpenToWrite , EOpenToWriteNamedPipeButFailOnNoReaders } |
enum |
TRequest
{
EDefineNamedPipe , EOpenToReadNamedPipe , EOpenToWriteNamedPipe , EOpenToWriteButFailOnNoReaderNamedPipe , EDestroyNamedPipe , ECreateUnNamedPipe , EOpenUnNamedPipe , ERead , EWrite , ESize , EReadBlocking , EWriteBlocking , EDataAvailable , EDataAvailableCount , ESpaceAvailable , EWaitNotification , EWaitNotificationCheck , ECancelSpaceAvailable , ECancelDataAvailable , ECancelWaitNotification , EFlushPipe , EClosePipe , EGetPipeInfo } |
enum | TWaitRequest { EWaitForReader , EWaitForWriter } |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes |
Public Member Type Definitions | |
---|---|
typedef | TPckgBuf < TPipeInfo > TPipeInfoBuf |
Private Attributes | |
---|---|
TInt | iHandleType |
TInt | iPipeHandle |
TInt | iSize |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
IMPORT_C TInt | CancelDataAvailable | ( | ) |
Cancels an outstanding data available notifier request.
IMPORT_C TInt | CancelSpaceAvailable | ( | ) |
Cancels an outstanding space available notifier request.
IMPORT_C void | CancelWait | ( | ) |
Cancel previous call to RPipe::Wait() , RPipe::WaitForReader (), RPipe::WaitForWriter ()
IMPORT_C void | Close | ( | ) |
Close the handle. This method exhibits different behaviour depending upon whether the pipe is named or unnamed. Named pipes are allowed to persist without any open handles. Closing the last handle on a named pipe will not destroy the kernel-side object. For an unnamed pipe, closing the last handle will destroy the kernel-side pipe object. Any unread data in the pipe will be discarded. An attempt to close an unnamed pipe will have no effect. Closing a handle will not affect the state of any other handles that may be open on the pipe.
IMPORT_C TInt | Create | ( | TInt | aSize, |
RPipe & | aReader, | |||
RPipe & | aWriter, | |||
TOwnerType | aTypeR = EOwnerProcess, | |||
TOwnerType | aTypeW = EOwnerProcess | |||
) | [static] |
Support for un-named pipe
Static method to create a new, unnamed pipe. By default, any thread in the process can use the handle to access the Pipe. However, specifying EOwnerThread as the second and fourth parameter to this function, means that only the creating thread can use this handle to access the Pipe.
TInt aSize | Size of the pipe to be created, in bytes. |
RPipe & aReader | Handle to the read end of the pipe. If the call is successful, this handle will be opened for reading. |
RPipe & aWriter | Handle to the write end of the pipe. If the call is successful, this handle will be opened for writing. |
TOwnerType aTypeR = EOwnerProcess | |
TOwnerType aTypeW = EOwnerProcess | The type of the ownership of the handle to be created for the read and write |
TInt | Create | ( | const TInt | sSize, |
TOwnerType | aType = EOwnerProcess | |||
) |
Creates a Kernel side pipe and opens a handle for reading. By default any thread in the process can use the handle to access to Read the Pipe. However, specifying EOwnerThread as the second parameter to this function, means that only the creating thread can use this handle to access the pipe.
const TInt sSize | |
TOwnerType aType = EOwnerProcess | The type of the handle to be created for the reading end of the pipe |
IMPORT_C TInt | Define | ( | const TDesC & | aName, |
TInt | aSize | |||
) | [static] |
Support for named pipe
Static method to create a new, named pipe of a given size. Calling this method will create a new kernel object only. No user-side handles are created or opened.
IMPORT_C TInt | Define | ( | const TDesC & | aName, |
TInt | aSize, | |||
const TSecurityPolicy & | aPolicy | |||
) | [static] |
Static method to create a new, named pipe of a given size. Calling this method will create a new kernel object only. No user-side handles are created or opened.
const TDesC & aName | Name to be assigned to the Kernel-side pipe object. |
TInt aSize | Size of the pipe to create, in bytes. |
const TSecurityPolicy & aPolicy |
IMPORT_C TInt | Destroy | ( | const TDesC & | aName | ) | [static] |
Static method to destroy a previously created named pipe. Any data not read from the pipe will be discarded. This method will fail if there is any handles still open on the pipe or the calling thread as insufficient capabilities.
const TDesC & aName | Name of the Kernel-side pipe object to destroy |
IMPORT_C TInt | HandleType | ( | ) | const |
This method returns the Type of operation it can perform with the current handle.
IMPORT_C void | NotifyDataAvailable | ( | TRequestStatus & | ) |
This method registers the request status object to be completed when data become available in the pipe.
TRequestStatus & | Status request that will complete when Data is available. |
IMPORT_C void | NotifySpaceAvailable | ( | TInt | aSize, |
TRequestStatus & | ||||
) |
This method registers the request status object to be completed when at least aSize bytes are available for writing data into the pipe.
TInt aSize | Amount of space to wait for in the pipe. |
TRequestStatus & | Status request that will complete when aSize bytes become available. |
TInt | Open | ( | const RPipe & | aWriter, |
TOwnerType | aType = EOwnerProcess | |||
) |
Opens a handle to write to a pipe. The pipe must have been created previously. By default any thread in the process can use the handle to access to write to the pipe. However, specifying EOwnerThread as the second parameter to this function, means that only the opening thread can use this handle to write to the pipe.
const RPipe & aWriter | Handle to the reading end of the pipe. |
TOwnerType aType = EOwnerProcess | The type of the handle to be created for the write end |
IMPORT_C TInt | Open | ( | const TDesC & | aName, |
TMode | aMode | |||
) |
Opens the pipe for the access mode specified. If the handle is opened to read or Write. The handle is opened regardless of whether or not there is a open handle at the other end.
If the handle is opened as " Write but Fail On No Readers" the call will fail unless there is atleast one handle open for reading at the other end.
IMPORT_C TInt | Open | ( | TInt | aArgumentIndex, |
TOwnerType | aType = EOwnerProcess | |||
) |
Opens the handle to pipe which is passed by a process to child process using RProcess.SetParameter function call. Pipe handle type remains same(i.e. if read handle is passed by process then read handle will be open).
TInt aArgumentIndex | An index that identifies the slot in the process environment data that contains the handle number. This is a value relative to zero, i.e. 0 is the first item/slot. This can range from 0 to 15. |
TOwnerType aType = EOwnerProcess | The type of the handle to be created for the read/write end |
IMPORT_C TInt | Open | ( | RMessagePtr2 | aMessage, |
TInt | aParam, | |||
TOwnerType | aType = EOwnerProcess | |||
) |
Opens a handle to pipe using a handle number sent by a client to a server. This function is called by the server.
RMessagePtr2 aMessage | The message pointer. |
TInt aParam | An index specifying which of the four message arguments contains the handle number. |
TOwnerType aType = EOwnerProcess | An enumeration whose enumerators define the ownership of this logical channel handle. If not explicitly specified, EOwnerProcess is taken as default. |
IMPORT_C TInt | Read | ( | TDes8 & | aData, |
TInt | aSize | |||
) |
Non-blocking read/write operations
This is non-blocking synchronous method to read aNumByte bytes from the pipe into the descriptor aMsg and returns the number of bytes read. If the pipe is empty the call will immediately return a value of zero to indicate that no data was read
A successful RPipe::Read() operation will free up more space in the pipe.
IMPORT_C TInt | ReadBlocking | ( | TDes8 & | aData, |
TInt | aSize | |||
) |
Blocking read/write operations
This is synchronous, blocking read operation. If the pipe is empty the client thread will be blocked until data become available. A successful RPipe::ReadBlocking() operation will free up more space in the pipe. This method is accompanied by data notification method to complete the blocking mechanism
void | ReqComplete | ( | TRequestStatus & | aState, |
TInt | aval | |||
) | [private] |
TRequestStatus & aState | |
TInt aval |
TVersion | VersionRequired | ( | ) | [static, inline] |
Returns the version information of the DPipe Factory object
IMPORT_C void | Wait | ( | const TDesC & | aName, |
TRequestStatus & | aStatus | |||
) |
Block the thread until the other end of the pipe is opened for reading. If the other end is already opened for reading the call will not block and status will complete immediately This function will be deprecated , use WaitForReader. Please note that Wait API will open a valid Write End of the pipe if not opened already. User need not open write end of the pipe again after Wait call.
const TDesC & aName | Name of the kernel-side pipe object to wait for |
TRequestStatus & aStatus | Status request that will complete when the other end is opened for reading. |
void | Wait | ( | const TDesC & | aName, |
TRequestStatus & | aStatus, | |||
TInt | aChoice | |||
) | [private] |
Block the thread until the other end of the pipe is opened for reading (or writing). If the other end is already opened for reading (or writing) the call will not block and status will complete immediately.
const TDesC & aName | Name of the kernel-side pipe object to wait for |
TRequestStatus & aStatus | Status request that will complete when the other end is opened for reading (or Writing). |
TInt aChoice | EWaitForReader for WaitForReader. EWaitForWriter for WaitForWriter. |
IMPORT_C void | WaitForReader | ( | const TDesC & | aName, |
TRequestStatus & | aStatus | |||
) |
Block the thread until the other end of the pipe is opened for reading. If the other end is already opened for reading the call will not block and status will complete immediately.
Please note that WaitForReader API will open a valid Write End of the pipe if not opened already. User need not open write end of the pipe again after WaitForReader call.
const TDesC & aName | Name of the kernel-side pipe object to wait for |
TRequestStatus & aStatus | Status request that will complete when the other end is opened for reading. |
IMPORT_C void | WaitForWriter | ( | const TDesC & | aName, |
TRequestStatus & | aStatus | |||
) |
Block the thread until the other end of the pipe is opened for writing. If the other end is already opened for writing the call will not block and status will complete immediately
Please note that WaitForWriter API will open a valid Read End of the pipe if not opened already. User need not open read end of the pipe again after WaitForWriter call.
const TDesC & aName | Name of the kernel-side pipe object to wait for |
TRequestStatus & aStatus | Status request that will complete when the other end is opened for writing. |
IMPORT_C TInt | Write | ( | const TDesC8 & | aBuf, |
TInt | aSize | |||
) |
This is non-blocking synchronous method to write data from aData. If the pipe is full it will return immediately with KErrOverFlow
IMPORT_C TInt | WriteBlocking | ( | const TDesC8 & | aBuf, |
TInt | aSize | |||
) |
This is a synchronous, blocking write operation. It will attempt to write aNumByte's worth of data to the pipe, waiting till space is available. If aNumByte is less than or equal to the pipe size, MaxSize() , the write shall be atomic (w.r.t other threads sharing this channel), otherwise the data will be split into multiple atomic writes of pipe size (except, of course, if less than MaxSize bytes of data remain to be written).
Enumeration for the modes of opening a pipe.
EOpenToRead | |
EOpenToWrite | |
EOpenToWriteNamedPipeButFailOnNoReaders |
EDefineNamedPipe | |
EOpenToReadNamedPipe | |
EOpenToWriteNamedPipe | |
EOpenToWriteButFailOnNoReaderNamedPipe | |
EDestroyNamedPipe | |
ECreateUnNamedPipe | |
EOpenUnNamedPipe | |
ERead | |
EWrite | |
ESize | |
EReadBlocking | |
EWriteBlocking | |
EDataAvailable | |
EDataAvailableCount | |
ESpaceAvailable | |
EWaitNotification | |
EWaitNotificationCheck | |
ECancelSpaceAvailable | |
ECancelDataAvailable | |
ECancelWaitNotification | |
EFlushPipe | |
EClosePipe | |
EGetPipeInfo |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.