First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
15 // WARNING: This file contains some APIs which are internal and are subject
16 // to change without notice. Such APIs should therefore not be used
17 // outside the Kernel and Hardware Services package.
29 #ifndef __KERNEL_MODE__
33 #if defined(DATAPAGING_TEST_ON)
34 #define DATAPAGING_TEST(s) s
36 #define DATAPAGING_TEST(s)
40 class RPipe: public RBusLogicalChannel
42 RPipe class object represent the user side handle. It is derived from RBusLogicalChannel
43 which is the base class for handle to the kernel side device driver instance. It encapsulates
44 both named and unnamed pipe methods.
51 Structure for holding driver capabilities information
52 (Just a version number.)
62 Enumeration for the modes of opening a pipe.
68 EOpenToWriteNamedPipeButFailOnNoReaders
82 TBuf8<KMaxKernelName> iName;
85 typedef TPckgBuf<TPipeInfo> TPipeInfoBuf;
91 Returns the version information of the DPipe Factory object
93 inline static TVersion VersionRequired();
96 Returns the name of the DPipe factory object
98 inline static const TDesC& Name();
102 Support for un-named pipe
104 IMPORT_C static TInt Create( TInt aSize, RPipe& aReader, RPipe& aWriter, TOwnerType aTypeR = EOwnerProcess, TOwnerType aTypeW = EOwnerProcess);
106 TInt Create(const TInt sSize, TOwnerType aType = EOwnerProcess);
108 TInt Open(const RPipe& aWriter, TOwnerType aType = EOwnerProcess);
112 Support for named pipe
115 IMPORT_C static TInt Define( const TDesC& aName, TInt aSize);
117 IMPORT_C static TInt Define( const TDesC& aName, TInt aSize, const TSecurityPolicy& aPolicy);
120 IMPORT_C static TInt Destroy(const TDesC& aName);
122 IMPORT_C TInt Open(const TDesC& aName, TMode aMode);
124 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
126 IMPORT_C TInt Open(RMessagePtr2 aMessage, TInt aParam, TOwnerType aType=EOwnerProcess);
128 IMPORT_C static TInt Init();
131 Non-blocking read/write operations
133 IMPORT_C TInt Read ( TDes8& aData, TInt aSize);
135 IMPORT_C TInt Write( const TDesC8& aBuf, TInt aSize);
138 Blocking read/write operations
140 IMPORT_C TInt ReadBlocking(TDes8& aData, TInt aSize);
142 IMPORT_C TInt WriteBlocking (const TDesC8& aBuf, TInt aSize);
144 IMPORT_C TInt Size();
146 IMPORT_C void NotifySpaceAvailable( TInt aSize, TRequestStatus&);
148 IMPORT_C void NotifyDataAvailable( TRequestStatus&);
150 IMPORT_C void Wait(const TDesC& aName, TRequestStatus& aStatus);
152 IMPORT_C TInt MaxSize();
155 IMPORT_C TInt CancelSpaceAvailable();
157 IMPORT_C TInt CancelDataAvailable();
159 IMPORT_C void CancelWait();
161 IMPORT_C void Flush();
163 IMPORT_C void Close();
165 IMPORT_C TInt HandleType()const;
167 TInt PipeHandle()const;
169 IMPORT_C void WaitForReader(const TDesC& aName, TRequestStatus& aStatus);
171 IMPORT_C void WaitForWriter(const TDesC& aName, TRequestStatus& aStatus);
174 Enumeration of Request messages.
179 EOpenToReadNamedPipe,
180 EOpenToWriteNamedPipe,
181 EOpenToWriteButFailOnNoReaderNamedPipe,
194 EWaitNotificationCheck,
195 ECancelSpaceAvailable,
196 ECancelDataAvailable,
197 ECancelWaitNotification,
203 Enumeration of Wait Request.
213 void Wait(const TDesC& aName, TRequestStatus& aStatus, TInt aChoice);
215 void ReqComplete(TRequestStatus& aState, TInt aval);
223 inline TVersion RPipe::VersionRequired()
226 const TInt KMajorVersionNumber=1;
227 const TInt KMinorVersionNumber=0;
228 const TInt KBuildVersionNumber=1;
230 TVersion (KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber);
233 inline const TDesC& RPipe::Name()
235 _LIT(KRpipeDevice, "SymbianPipe");
240 #endif // __RPIPE_H__