Update contrib.
1 // Copyright (c) 1997-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 "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.
14 // Support for pipes between processes
15 // CPipeDesc is in the parent process, CPipeChildDesc is in the child
20 #include <sys/ioctl.h>
22 NONSHARABLE_CLASS(CPipeDesc) : public CFileDescBase
28 CPipeDesc(TInt anIndex);
30 void SetClientSide(CPipeDesc*& aClientPointer);
31 TInt LSeek(int& offset, int whence);
32 void Read(TDes8& aDesc, TRequestStatus& aStatus);
33 TInt ReadCompletion(TDes8& aDesc, TInt aStatus);
35 void Write(TDes8& aDesc, TRequestStatus& aStatus);
36 TInt WriteCompletion(TDes8& aDesc, TInt aStatus);
38 TInt FStat(struct stat *st);
39 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
40 TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
43 void ClientRead(const RMessage2& aMessage);
44 void ClientWrite(const RMessage2& aMessage);
45 void ClientIoctl(const RMessage2& aMessage);
46 void ClientCancel(const RMessage2& aMessage);
52 TInt IsWriteable() { return !iIndex; } // 0 => child STDIN
53 TInt IsReadable() { return iIndex; }
54 TInt SelectMask() { return (iIndex)? E32SELECT_READ :E32SELECT_WRITE; }
55 TInt ClientSelectMask() { return (iIndex)? E32SELECT_WRITE:E32SELECT_READ; }
56 TInt ClientIoctlPending() { return iClientIoctlPending; }
58 void TransferFromClient();
59 void TransferToClient();
60 void CompleteClientIoctl(TInt ret);
61 void CompleteClientIoctl();
62 void Panic(TInt aReason);
63 void Panic(RMessage2& aMessage, TInt aReason);
65 TInt iIndex; // index into per-process table of pipes, also implies direction.
66 CPipeDesc** iClientSide;
68 // Pending info for parent operation
69 TRequestStatus* iStatus; // null implies "no pending operation"
70 TRequestStatus* iIoctlStatus;
73 // Pending info for child operation
74 TInt iClientLength; // 0 implies "no pending operation"
77 TInt iClientIoctlPending;
78 RMessage2 iIoctlMessage;
82 NONSHARABLE_CLASS(CPipeChildDesc) : public CFileDescBase
85 Basically just forwards requests to the parent CPosixServer, where the related CPipeDesc
91 CPipeChildDesc(TInt anIndex, RPosixSession& aSession);
93 TInt LSeek(int& offset, int whence);
94 void Read(TDes8& aDesc, TRequestStatus& aStatus);
95 TInt ReadCompletion(TDes8& aDesc, TInt aStatus);
97 void Write(TDes8& aDesc, TRequestStatus& aStatus);
98 TInt WriteCompletion(TDes8& aDesc, TInt aStatus);
100 TInt FStat(struct stat *st);
101 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
104 void ClientClose() { iClientClosed=1; }
109 void Cancel(TInt aType);
110 TInt IsWriteable() { return iIndex; } // 0 => child STDIN
111 TInt IsReadable() { return !iIndex; }
112 TInt SelectMask() { return (!iIndex)? E32SELECT_READ:E32SELECT_WRITE; }
114 TInt iIndex; // index into per-process table of pipes, also implies direction.
115 RPosixSession& iSession;