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 // Abstraction representing a UNIX file descriptor
15 // CFileDescBase maintains the simple semantics of
16 // Dup() and Close(), so the final Close() will
17 // delete the object and hence call the destructor.
25 #include <e32atomics.h>
33 #include <commdbconnpref.h>
40 #include "StdioClient.h"
42 //FD attributes used internally by the backend
43 const TUint KInvalidFd = 0x00000001;
44 const TUint KMMapedFd = 0x00000002;
45 const TUint KCloseonExec = 0x00000004;
46 const TUint KPipeFd = 0x00000008;
47 const TUint KIoctlOutstanding = 0x00000010;
48 const TUint KConsoleFd = 0x00000020;
49 const TUint KFifoFd = 0x00000030;
50 const TUint KSpawnCloseInChild = 0x00000040;
52 #define SET_CLOSE_ON_EXEC_FLG (1 << 2)
54 #if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
56 //Large File Support - Use RFile64 and 64 bit file sizes
62 //No large file support - Use RFile and 32 bit file sizes
66 #endif //SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS
68 // Atomic socket operations support
70 #define ATOMICSOCKETOP(realcall,on_error) \
72 if (__e32_atomic_tau_ord32((void *)&iCount, 0x8000, 0, 1) >= 0x8000) \
79 __e32_atomic_tas_ord32((void *)&iCount, 0, -1, 0); \
85 //Enumarations for Polling
93 //Enumarations for Redirection Server
101 //Enumerations for the console echo
104 EOff = 0, //Turn Off the echo
105 EOn = 1, //Turn On the echo
106 EPrintValid = 33, //Printable ascii character set <33-126>
110 // The base class for all flavours of FileDescriptor
114 NONSHARABLE_CLASS(CFileDescBase) : public CBase
121 static CFileDescBase* Open(const wchar_t* name, int mode, int perms, TInt& err);
122 static CFileDescBase* Socket(RSocketServ& aSs, int family, int style, int protocol, TInt& err);
124 virtual void Read(TDes8& aDesc, TRequestStatus& aStatus);
125 virtual TInt ReadCompletion(TDes8& aDesc, TInt aStatus);
126 virtual void ReadCancel();
128 virtual void Write(TDes8& aDesc, TRequestStatus& aStatus);
129 virtual TInt WriteCompletion(TDes8& aDesc, TInt aStatus);
130 virtual void WriteCancel();
131 virtual TInt SetAtt(TUint aSetAttMask, TUint aClearAttMask);
133 virtual void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
134 virtual TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
135 virtual void IoctlCancel();
137 virtual void RecvFrom(TDes8& aDesc, TSockAddr& from, int flags, TRequestStatus& aStatus);
138 virtual void RecvFromCancel();
140 virtual void SendTo(TDes8& aDesc, const struct sockaddr* anAddr, unsigned long aAddrLen,int flags, TRequestStatus& aStatus);
142 virtual void SendToCancel();
144 virtual TInt CompletionStatus(TInt& aLength, TInt aStatus);
146 virtual void Sync(TRequestStatus& aStatus);
147 virtual void SyncCancel();
149 virtual void Accept(CFileDescBase*& aNewSocket, TRequestStatus& aStatus, RSocketServ& aSs,TSockAddr *aAddr);
150 virtual void AcceptCancel();
152 virtual void Connect(const struct sockaddr* aAddr,unsigned long size,TRequestStatus& aStatus);
153 virtual void ConnectCancel();
154 virtual TBool GetConnectionProgress();
155 virtual void SetConnectionProgress( TBool aInProgress );
157 virtual void Shutdown(TUint aHow,TRequestStatus& aStatus);
158 virtual void ShutdownCancel();
160 virtual TBool TimedRead() {return EFalse;} //default implementation
161 TInt TimeoutValue() const {return iReadTimeout;}
163 virtual TInt LSeek(off_t& offset, int whence);
164 virtual TInt FStat(struct stat* st);
165 virtual TInt Bind(const struct sockaddr* addr, unsigned long size);
166 virtual TInt Listen(TUint qSize);
167 virtual TInt SockName(int anEnd, struct sockaddr* anAddr,unsigned long* aSize);
168 virtual TInt GetSockOpt(TInt anOptionName,TInt anOptionLevel,TDes8& anOption);
169 virtual TInt SetSockOpt(TInt anOptionName,TInt anOptionLevel,TDesC8& anOption);
170 virtual TInt Fcntl(TUint anArg, TUint aCmd);
172 virtual TInt Poll(TPollMode aMode,TBool& aReadyStatus,TInt& aErrno);
173 virtual TInt Poll(TUint aEvents);
174 virtual TInt NotifyActivity(TUint aEvents, TRequestStatus& aRequest, TTimeIntervalMicroSeconds32 timeout);
175 virtual void TweakWatchedEvents(TUint& events);
176 virtual TInt TweakReadyEvents(TInt errval);
177 virtual void CancelNotify();
180 virtual TInt Truncate(off_t /*anOffset*/)
182 return KErrNotSupported;
184 //Type of the Descriptor
190 //Set/reset the Attributes of the FD
191 inline void SetAttributes( TUint32 aBit, TBool aFlag )
205 //Get the Attributes of the FD
206 inline const TUint32 Attributes() const
211 inline const TUint32 FcntlFlag() const
216 static inline void Cleanup(TAny *aPtr)
218 ((CFileDescBase*)aPtr)->Close();
223 CleanupStack::PushL(TCleanupItem(Cleanup,this));
226 IMPORT_C TInt Close();
227 virtual void UserClose() {return;}
228 inline CFileDescBase* Dup();
229 inline void SetFid(TInt aFid) { iFid = aFid; }
230 virtual void SetFids(void *aFids);
232 inline void operator delete(TAny *aPtr) __NO_THROW
234 Backend()->Free(aPtr);
237 inline void operator delete(TAny *aPtr, TLeave) __NO_THROW
239 Backend()->Free(aPtr);
242 inline void operator delete(TAny *aPtr, TAny*) __NO_THROW
244 Backend()->Free(aPtr);
248 TBool ReadWasCancelled;
251 CFileDescBase( TUint aFcntl = 0, TUint32 aFdAttrib = 0 );
252 virtual TInt FinalClose();
253 static void Complete(TRequestStatus& aStatus, TInt aResult);
255 //Used in case of CRedirDesc
259 //For FD's other attributes
263 //Check if the path corresponds to a directory
264 static TBool CheckIfDirectory(const TDesC& aPath, RFs& aFs);
285 // Poll is required to return any of the requested events.
286 // In case of any error, "iPollErr" should be checked by the socket-descriptor
287 // to take any corrective action.
292 inline CFileDescBase* CFileDescBase::Dup ()
293 { iDupCount += 1; return this; }
296 NONSHARABLE_CLASS(CTtyDesc) : public CFileDescBase
298 Abstraction of a teletype device, which will be used for
304 inline CTtyDesc(CConsoleBase *c);
311 void Read(TDes8& aDesc, TRequestStatus &aStatus);
313 TInt ReadCompletion(TDes8& aDesc, TInt aStatus);
314 void Write(TDes8& aDesc, TRequestStatus& aStatus);
315 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
316 TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
317 TInt SetEcho(TUint8 aEcho);
319 virtual TInt FinalClose();
321 void MapCodeAndEcho(TDes8& aDesc, TKeyCode aCode);
322 void CheckConsoleCreated();
323 void Write(TDes8& aDesc);
324 CConsoleBase *iConsole;
325 //To store last non-modifiable data position and flag for reading data
332 inline CTtyDesc::CTtyDesc(CConsoleBase *c) : CFileDescBase(), iConsole(c), iEchoVal(EOn){}
333 inline CTtyDesc::CTtyDesc() : CFileDescBase(), iEchoVal(EOn) {}
336 NONSHARABLE_CLASS(CRedirDesc) : public CFileDescBase
338 client-side CRedirDesc desc class which will be used to connecting to the Redirection Server
348 virtual void Read(TDes8& aDesc, TRequestStatus& aStatus);
349 virtual void Write(TDes8& aDesc, TRequestStatus& aStatus);
350 TInt WriteCompletion(TDes8& aDesc, TInt /*aStatus*/);
351 TInt ReadCompletion(TDes8& aDesc, TInt /*aStatus*/);
352 virtual TInt Fcntl(TUint anArg, TUint aCmd);
355 TInt Poll(TUint aEvents);
356 TInt NotifyActivity(TUint aEvents, TRequestStatus& aRequest, TTimeIntervalMicroSeconds32 timeout);
357 TInt TweakReadyEvents(TInt errval);
359 TInt SetEcho(TUint8 aEcho);
363 //Handle to StdioSession
364 RStdioSession iSession;
365 TRedirConnState iStatus;
370 NONSHARABLE_CLASS(CStdErrDesc) : public CFileDescBase
373 client-side Standard Error desc class which will be used to put all stderr to RDebug::Printf
379 virtual void Write(TDes8& aDesc, TRequestStatus& aStatus);
380 TInt WriteCompletion(TDes8& aDesc, TInt /*aStatus*/);
381 virtual TInt Fcntl(TUint anArg, TUint aCmd);
388 NONSHARABLE_CLASS(CFileDesc) : public CFileDescBase
390 Abstractions for a plain file and a temporary file
398 void SetState(const TDes& params);
400 TInt Open(RFs& aSession, const TDesC& aName, int mode, int perms);
401 TInt LSeek(off_t& offset, int whence);
402 void Read(TDes8& aDesc, TRequestStatus& aStatus);
403 void Write(TDes8& aDesc, TRequestStatus& aStatus);
404 TInt FStat(struct stat *st);
405 void Sync(TRequestStatus &aStatus);
406 TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
407 TInt Fcntl(TUint anArg, TUint aCmd);
408 static void MapStat(struct stat& st, const TTime& aModTime, TUint& aAttr, const mode_t aMode = S_IFREG);
409 TInt Truncate(off_t anOffset);
410 TInt SetAtt(TUint aSetAttMask, TUint aClearAttMask);
411 TInt ProcessLockParams(FSIZE& pos, FSIZE &lock_len, TInt& lock_type, struct flock* anArg);
412 inline int CreateLock()
414 return iLock.CreateLocal();
417 inline RFILE& FileHandle()
422 inline const FSIZE Offset() const
427 inline const FSIZE Size() const
431 inline void setSize(TUint32 param)
435 inline const FSIZE Extent() const
444 virtual TInt FinalClose();
447 TInt FileRead(TUint8* aPtr,TInt aLength);
448 TInt FileWrite(TUint8* aPtr,TInt aLength);
451 TInt DoRead(TDes8& aDesc);
452 TInt DoWrite(TDes8& aDesc);
457 enum {EAlloc,EReading,EWriting};
458 enum {EBufferSize = 0x600,EReadAhead = 0x200};
461 TInt16 iDrive; // for use with stat()
472 //For locking the descriptor before any operation.
473 //To make it thread safe.
475 friend class RFileDesTransferSession;
476 friend class CFileDesTransferSession;
479 NONSHARABLE_CLASS(CTempFileDesc) : public CFileDesc
485 TInt Open(const wchar_t* aName, TInt mode);
488 return EFileTempDesc;
491 virtual TInt FinalClose();
498 Implements common functionality between CSocketDesc and CFileSocketDesc.
499 Not meant to be instantaible.
501 NONSHARABLE_CLASS(CSockDescBase) : public CFileDescBase
504 virtual TInt Socket(RSocketServ& aSs, int family, int style, int protocol);
505 TInt Fcntl(TUint anArg, TUint aCmd);
506 TInt FStat(struct stat *st);
508 void Read(TDes8& aDesc, TRequestStatus& aStatus);
509 void Write(TDes8& aDesc, TRequestStatus& aStatus);
510 void RecvFrom(TDes8& aDesc, TSockAddr& from, int flags, TRequestStatus& aStatus);
511 void SendTo(TDes8& aDesc, TSockAddr& to, int flags, TRequestStatus& aStatus);
512 TInt Poll(TUint aEvents);
513 TInt NotifyActivity(TUint aEvents, TRequestStatus& aRequest, TTimeIntervalMicroSeconds32 aTimeout);
514 void TweakWatchedEvents(TUint& events);
515 TInt TweakReadyEvents(TInt errval);
517 TInt Listen(TUint qSize);
519 TInt ReadCompletion(TDes8& aBuf, TInt aStatus);
520 void RecvFromCancel();
523 TInt SockName(int anEnd, TSockAddr& anAddr);
524 void Shutdown(TUint aHow,TRequestStatus& aStatus);
525 TInt CompletionStatus(TInt& aLength, TInt aStatus);
526 const TUint& GetSelectEvents()
529 return iSelectEvents();
532 inline TInt CreateLock()
534 TInt err = iIoctlLock.CreateLocal(1) || iReadLock.CreateLocal() || iWriteLock.CreateLocal();
537 // closes on unopened handles are safe
545 inline RSemaphore& GetIoctlLock()
549 inline TBool GetConnectionProgress()
551 return iConnectInProgress;
554 inline void SetConnectionProgress( TBool aInProgress )
556 iConnectInProgress = aInProgress;
561 CSockDescBase():iAddrFamily(-1),iProtocol(KUndefinedProtocol),iIoctlFlag(EFalse),iCount(0)
566 TSockXfrLength iLength;
568 TPckgBuf<TUint> iSelectEvents;
572 // For preventing simultaneous ioctl calls.
573 // No native support.
574 RSemaphore iIoctlLock;
577 // Safeguard against issue of a second Read/Write request while the first is pending.
578 // The iReadLock also guards OpenUsingPreference
579 //For locking the descriptor before any operation.
580 //To make it thread safe.
582 RFastLock iWriteLock;
584 //Flag to mark the connect status of a non-blocking socket as "in progress"
585 //to prevent duplicate connection request
586 TBool iConnectInProgress;
587 volatile TInt iCount;
590 inline TInt isStream() const // inline, but private
592 return iStyle==SOCK_STREAM;
596 NONSHARABLE_CLASS(CSocketDesc) : public CSockDescBase
598 Abstraction for a socket
604 TInt Socket(RSocketServ& aSs, int family, int style, int protocol);
605 void Read(TDes8& aDesc, TRequestStatus& aStatus);
606 TInt ReadCompletion (TDes8& /*aBuf*/, TInt aStatus);
608 void Write(TDes8& aDesc, TRequestStatus& aStatus);
610 void Sync(TRequestStatus& aStatus);
611 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
612 TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
615 void RecvFrom(TDes8& aDesc, TSockAddr& from, int flags, TRequestStatus& aStatus);
616 void RecvFromCancel();
617 void SendTo(TDes8& aDesc, const struct sockaddr* anAddr, unsigned long aAddrLen, int flags, TRequestStatus& aStatus);
621 void Shutdown(TUint aHow,TRequestStatus& aStatus);
622 void Accept(CFileDescBase*& aNewSocket, TRequestStatus& aStatus, RSocketServ& aSs,TSockAddr *aAddr);
624 void Connect(const struct sockaddr* aAddr,unsigned long size,TRequestStatus& aStatus);
625 void ConnectCancel();
627 TInt Bind(const struct sockaddr* addr, unsigned long size);
628 TInt Listen(TUint qSize);
629 TInt SockName(int anEnd, struct sockaddr* anAddr,unsigned long* aSize);
630 TInt GetSockOpt(TInt anOptionName,TInt anOptionLevel,TDes8& anOption);
631 TInt SetSockOpt(TInt anOptionName,TInt anOptionLevel,TDesC8& anOption);
632 TInt Fcntl(TUint anArg, TUint aCmd);
634 TInt Poll(TPollMode aMode,TBool& aReadyStatus,TInt& aErrno);
635 TInt Poll(TUint aEvents);
639 void SetFids(void *aFids);
649 TInt GetInterfaceIndex(TUint32 aAddr);
650 TInt GetInterfaceList(void *aParam);
651 TInt GetActiveInterface( void *aParam);
652 TInt GetInterfaceIndexByName(void *aParam);
653 TInt GetActiveInterfaceList(void *aParam);
654 TInt SetInterfaceByName(void *aParam);
655 TInt StartInterface(void *aParam);
656 TInt StartActiveInterface(void *aParam);
657 TInt StopInterface(void *aParam);
658 TInt OpenUsingPreference();
659 void AccessPointListL(CArrayFixFlat<TAccessPointRecord> *&aRecordPtr, TInt &aLength);
660 void AccessPointCountL(TInt &aCount);
661 void ReadRecordFromIapTableL(CCommsDbTableView* aView, TAccessPointRecord &aRecord);
662 void OpenIapTableLC(CCommsDatabase **aIapDatabase, CCommsDbTableView **aView);
663 TInt ActiveConnectionCount(TInt &aCount);
664 TInt ActiveConnectionListL(CArrayFixFlat<TAccessPointRecord> *aRecordPtr, TInt &aLength);
665 TInt GetRConnectionDetails(RConnection *aRc, TAccessPointRecord &aApr);
666 TInt StartConnection(void *aParam);
667 TInt GetConnectionPreference(TCommDbConnPref &aApr);
668 void GetIapDetailsByNameL(TBuf<KCommsDbSvrMaxColumnNameLength> aIapName, TAccessPointRecord &aRecord);
669 void StopSubConnection();
670 void StopConnection();
671 TInt StartSubConnection(void *aParam);
672 TInt GetInterface(void *Param, TInt aType);
673 TInt GetInterafceNumber(void *aParam);
674 TInt GetIpAddress( void *aParam );
676 TInt RouteRequest(TInt aReq, void *aParam);
677 TInt GetInterfaceHWAddress(void *aParam);
679 TInt ConvertRtEntry(TSoInetRouteInfo& aRouteInfo, struct rtentry *aRouteEntry);
680 TInt ConvertSockAddr(TInetAddr& aInetAddr, struct sockaddr_in *aSockAddr);
682 TInt GetInterfaceByName(const TDesC& aIfName, TPckgBuf<TSoInetInterfaceInfo>& aIface);
683 TInt Copy(TInetAddr& aDest, TInetAddr& aSrc);
685 TInt GetRemoteIpAddress( void *aParam );
686 TInt GetInterafceParamInfo( void *aParam,TInt aType);
687 void FindConnectionDetailsL(CArrayFixFlat<TAccessPointRecord>*& aRecordPtr, TInt& aCount);
688 void FindConnectionInfoL(TAccessPointRecord &aRecord,char *ptr);
689 TInt GetInterfaceDetails( void *aParam ,TInt aFlag, TInt aType );
690 TInt SetInterafceParamInfo( void *aParam,TInt aType);
691 TInt SetInterfaceDetails( void *aParam ,TInt aFlag, TInt aType );
693 TInt maybe_reopen_socket()
696 if (!__e32_atomic_load_acq32(&iSocketPtr))
701 err = OpenUsingPreference();
716 EACCESS_GETBROADCAST,
730 TAccessPointRecord iConnPref;
731 RConnection iConnection;
732 RConnection *iConnectionPtr;
733 RSubConnection iSubConnection;
734 RSubConnection *iSubConnectionPtr;
735 TInt iRConnectionIndex;
736 RSocketServ *iSockServPtr;
744 NONSHARABLE_CLASS(CSerialDesc) : public CFileDescBase
750 friend class CNotifier;
753 CSerialDesc() : CFileDescBase(), iReadThreshold(-1), iRequestedSignals(0),
754 iNotifyStatus(NULL), iNotifyParamPtr(NULL) {}
756 TInt Open(const wchar_t* name, int mode, int perms);
759 void Read(TDes8& aDesc, TRequestStatus& aStatus);
762 TInt& TimeoutValue() const;
763 void Write(TDes8& aDesc, TRequestStatus& aStatus);
764 TInt WriteCompletion(TDes8& aDesc, TInt aStatus);
767 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
768 TInt IoctlCompletion(int aCmd, void* aParam, TInt aStatus);
782 void NotifyDataAvailable(TRequestStatus& aStatus);
783 void NotifyOutputEmpty(TRequestStatus& aStatus);
784 void NotifyBreak(TRequestStatus& aStatus);
785 void NotifyWriteErrors(TRequestStatus& aStatus, TUint* aRequestParams, TUint aSignalsMask);
786 void NotifySignalChange(TRequestStatus& iStatus, TUint& aRequestParam, TUint aSignalsMask);
787 void NotifyDataAvailableCancel();
788 void NotifyOutputEmptyCancel();
789 void NotifyBreakCancel();
790 void NotifyWriteErrorsCancel();
791 void NotifySignalChangeCancel();
792 void Notify(TInt aVal); //complete the notify request
793 TInt NotifiesSupported(); //return the notifies supported at the moment
794 TBool RequestedNotifiesSupported(TInt aRequested); //see if the notifies requested are supported
795 void CancelNotifiers(const CNotifier* aCompletedNotifier); //cancel them all apart from the passed one
798 TInt ReadCompletion (TDes8& aBuf, TInt aStatus);
803 TInt iRequestedSignals;
804 TRequestStatus* iNotifyStatus;
805 TUint* iNotifyParamPtr;
806 TUint* iRequestDataPtr;
808 CNotifier* iDataAvailableNotifier;
809 CNotifier* iOutputEmptyNotifier;
810 CNotifier* iBreakNotifier;
811 CNotifier* iErrorsNotifier;
812 CNotifier* iSignalsNotifier;
817 NONSHARABLE_CLASS(CPipeDescBase) : public CFileDescBase
819 Base class with the RPipe handle and common methods
824 CPipeDescBase(const TUint16 aMode = 0) : CFileDescBase()
826 iFdAttrib |= KPipeFd;
827 if (aMode & O_NONBLOCK)
829 iFcntlFlag |= O_NONBLOCK;
833 TInt Fcntl(TUint anArg, TUint aCmd);
834 TInt FStat(struct stat *st);
835 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
861 NONSHARABLE_CLASS(CPipeReadDesc) : public CPipeDescBase
863 Handle to the read-end of an RPipe object.
868 CPipeReadDesc(const TUint16 aMode = 0) : CPipeDescBase(aMode)
870 iFcntlFlag |= O_RDONLY;
873 void Read(TDes8& aDesc, TRequestStatus& aStatus);
874 void Write(TDes8& aDesc, TRequestStatus& aStatus);
875 TInt Poll(TUint aEvents);
876 TInt NotifyActivity(TUint aEvents, TRequestStatus& aRequest, TTimeIntervalMicroSeconds32 /*timeout*/);
877 TInt TweakReadyEvents(TInt errval);
881 TInt DoRead(TDes8& aDesc);
884 NONSHARABLE_CLASS(CPipeWriteDesc) : public CPipeDescBase
886 Handle to the write-end of an RPipe object.
891 CPipeWriteDesc(const TUint16 aMode = 0) : CPipeDescBase(aMode)
893 iFcntlFlag |= O_WRONLY;
896 void Write(TDes8& aDesc, TRequestStatus& aStatus);
897 void Read(TDes8& aDesc, TRequestStatus& aStatus);
898 TInt Poll(TUint aEvents);
899 TInt NotifyActivity(TUint aEvents, TRequestStatus& aRequest, TTimeIntervalMicroSeconds32 timeout);
900 TInt TweakReadyEvents(TInt errval);
904 TInt DoWrite(TDes8& aDesc);
906 NONSHARABLE_CLASS(CFileSocketDesc) : public CSockDescBase
908 Class representing AF_UNIX socket descriptors
909 Implemented using 2 FIFOs
914 CFileSocketDesc(const TUint16 aMode = 0)
916 if (aMode & O_NONBLOCK)
918 iFcntlFlag |= O_NONBLOCK;
920 iFcntlFlag |= O_RDWR;
924 void Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus);
926 void Read(TDes8& aDesc, TRequestStatus& aStatus);
927 void Write(TDes8& aDesc, TRequestStatus& aStatus);
928 void RecvFrom(TDes8& aDesc, TSockAddr& from, int flags, TRequestStatus& aStatus);
929 void SendTo(TDes8& aDesc, const struct sockaddr* anAddr, unsigned long aAddrLen, int flags, TRequestStatus& aStatus);
930 TInt Listen(TUint qSize);
931 TInt GetSockOpt(TInt anOptionName,TInt anOptionLevel,TDes8& anOption);
932 TInt SetSockOpt(TInt anOptionName,TInt anOptionLevel,TDesC8& anOption);
933 TInt Bind(const struct sockaddr* addr, unsigned long size);
934 void Connect(const struct sockaddr* aAddr,unsigned long size, TRequestStatus& aStatus);
935 void Accept(CFileDescBase*& aNewSocket, TRequestStatus& aStatus, RSocketServ& aSs, TSockAddr *);
936 TInt Socket(RSocketServ& aSs, int family, int style, int protocol);
937 TInt SockName(int anEnd, struct sockaddr* anAddr,unsigned long* aSize);
939 void ConnectCancel();
952 return EFileSocketDesc;
955 TInt GetLocalSockAddrByPort(struct sockaddr_un* aAddr,unsigned long* aAddrLen,TUint aPortNum);
956 TInt GetLocalSockPortByPath(const struct sockaddr_un* aAddr,unsigned long aAddrLen,TUint& aPortNum);
959 TInt ValidateAddress(const struct sockaddr_un* aAddr,unsigned long* aAddrLen);
960 TInt RemoveLocalSockAddr();
962 TBuf8<KMaxFileName> iPath;
964 RFastLock iWriteLock;
968 TAutoFastLock(RFastLock &aLock):iAutoLock(aLock)
977 RFastLock &iAutoLock;
981 NONSHARABLE_CLASS(CDirectoryDesc) : public CFileDescBase
983 Abstractions for a directory
991 TInt Open(RFs& aSession, const TDesC& aName, int mode, int perms);
992 void Read(TDes8& aDesc, TRequestStatus& aStatus);
993 void Write(TDes8& aDesc, TRequestStatus& aStatus);
994 TInt Fcntl(TUint anArg, TUint aCmd);
995 TInt LSeek(off_t& offset, int whence);
996 TInt FStat(struct stat *st);
997 //Get the Name of the directory
998 inline const wchar_t* GetDirName()
1000 return (const wchar_t*)iDirName.Ptr();
1009 //Name of the directory
1013 #ifdef SYMBIAN_OE_LIBRT
1014 NONSHARABLE_CLASS(CSharedMemDesc) : public CFileDescBase
1016 Abstractions for shared memory
1024 TInt Open(const wchar_t* aName, int mode, int perms);
1025 void Read(TDes8& aDesc, TRequestStatus& aStatus);
1026 void Write(TDes8& aDesc, TRequestStatus& aStatus);
1027 TInt Fcntl(TUint anArg, TUint aCmd);
1028 TInt FStat(struct stat *st);
1029 TInt LSeek(off_t& offset, int whence);
1031 TInt ShmRead(TUint8* aPtr,TInt aLength);
1032 TInt ShmWrite(TUint8* aPtr,TInt aLength);
1033 TInt DoShmRead(TDes8& aDesc);
1034 TInt DoShmWrite(TDes8& aDesc);
1048 #endif //SYMBIAN_OE_LIBRT