os/ossrv/genericopenlibs/openenvcore/backend/inc/sysif.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/backend/inc/sysif.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,980 @@
     1.4 +/*
     1.5 +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef SYSIF_H
    1.23 +#define SYSIF_H
    1.24 +#include <e32std.h>
    1.25 +#include <e32base.h>
    1.26 +#include <f32file.h>
    1.27 +#include <es_sock.h>
    1.28 +#include <c32comm.h>
    1.29 +#include <sys/select.h>
    1.30 +#include <spawn.h>
    1.31 +#include <sys/types.h>
    1.32 +#include <wchar.h>
    1.33 +#include "ipcclient.h"
    1.34 +#include <dirent.h>
    1.35 +#include <sys/socket.h>
    1.36 +#include <stdapis/net/if.h>
    1.37 +#include <commdb.h>
    1.38 +#include <commdbconnpref.h>
    1.39 +#include <rpipe.h>
    1.40 +
    1.41 +#include<tz.h>
    1.42 +#include <e32atomics.h>
    1.43 +
    1.44 +#ifdef SYMBIAN_OE_POSIX_SIGNALS
    1.45 +#include "signalclient.h"
    1.46 +#include "tsignalmessage.h"
    1.47 +
    1.48 +typedef void (*TSignalHandler)(int);
    1.49 +typedef void (*TSignalAction)(int, siginfo_t *, void *);
    1.50 +#endif
    1.51 +
    1.52 +/*
    1.53 +@internalComponent
    1.54 +*/
    1.55 +_LIT(KEstlibInit, "STDLIBS-INIT");
    1.56 +
    1.57 +_LIT(KFDTransferSvr,"FDTrnsfrSvr");
    1.58 +//Forward declaration for references below
    1.59 +class RPipe;
    1.60 +class CFileDesTransferServer;
    1.61 +class RFileDesTransferSession;
    1.62 +class CFileDescBase;
    1.63 +/* TODO: We don't have to do this in CFileTable. Move to methods */
    1.64 +class CFileSocketDesc;
    1.65 +class CSocketDesc;
    1.66 +struct TChild
    1.67 +/*
    1.68 +@internalComponent
    1.69 +*/
    1.70 +	{
    1.71 +	TInt iFid;
    1.72 +	TProcessId iPid;
    1.73 +	RProcess iProc;
    1.74 +
    1.75 +#ifdef __X86GCC__
    1.76 +	// The underlying data for a TProcessId is a TUint64. GCC raises an error if this is intialised to a negative value. Consider changing for all platforms.
    1.77 +	TChild(TInt aFid = -1, TProcessId aPid = 0) : iFid(aFid), iPid(aPid)
    1.78 +#else
    1.79 +	TChild(TInt aFid = -1, TProcessId aPid = -1) : iFid(aFid), iPid(aPid)
    1.80 +#endif //__X86GCC__
    1.81 +		{
    1.82 +		// nada
    1.83 +		}
    1.84 +
    1.85 +#ifdef __X86GCC__
    1.86 +	// The underlying data for a TProcessId is a TUint64. GCC raises an error if this is intialised to a negative value. Consider changing for all platforms.
    1.87 +	TChild(RProcess &aProc, TProcessId aFid = 0) : iProc(aProc), iFid(aFid)
    1.88 +#else
    1.89 +	TChild(RProcess &aProc, TProcessId aFid = -1) : iProc(aProc), iFid(aFid)
    1.90 +#endif //__X86GCC__
    1.91 +		{
    1.92 +		iPid = aProc.Id();
    1.93 +		}
    1.94 +
    1.95 +
    1.96 +	static TBool MatchByFid(const TChild& aChild1, const TChild& aChild2)
    1.97 +		{
    1.98 +		if (aChild1.iFid == aChild2.iFid)
    1.99 +			{
   1.100 +			return ETrue;
   1.101 +			}
   1.102 +		return EFalse;
   1.103 +		}
   1.104 +
   1.105 +	static TBool MatchByPid(const TChild& aChild1, const TChild& aChild2)
   1.106 +		{
   1.107 +		if (aChild1.iPid == aChild2.iPid)
   1.108 +			{
   1.109 +			return ETrue;
   1.110 +			}
   1.111 +		return EFalse;
   1.112 +		}
   1.113 +	};
   1.114 +
   1.115 +class TCLSICleanup
   1.116 +/*
   1.117 +@internalComponent
   1.118 +*/
   1.119 +	{
   1.120 +public:
   1.121 +	void StorePtrs(RHeap* aHeap, RFs* aFs, RSocketServ* aSs, RCommServ* aCs, RFastLock* aSsLock, RFastLock* aCsLock,RFastLock* aDefConnLock,RFastLock* aAESelectLock,RFastLock* aTzServerLock)
   1.122 +		{
   1.123 +		iHeap = aHeap;
   1.124 +		iFs = aFs;
   1.125 +		iSs = aSs;
   1.126 +		iCs = aCs;
   1.127 +		iSsLock = aSsLock;
   1.128 +		iCsLock = aCsLock;
   1.129 +		iDefConnLock = aDefConnLock;
   1.130 +		iAESelectLock = aAESelectLock;
   1.131 +		iTzServerLock = aTzServerLock;
   1.132 +		}
   1.133 +
   1.134 +	~TCLSICleanup()
   1.135 +		{
   1.136 +		iFs->Close();
   1.137 +		iSs->Close();
   1.138 +		iSsLock->Close();
   1.139 +		iCs->Close();
   1.140 +		iCsLock->Close();
   1.141 +		iHeap->Close();
   1.142 +		iDefConnLock->Close();
   1.143 +		iAESelectLock->Close();
   1.144 +		iTzServerLock->Close();
   1.145 +		}
   1.146 +private:
   1.147 +	RHeap* iHeap;
   1.148 +	RFs* iFs;
   1.149 +	RSocketServ* iSs;
   1.150 +	RCommServ* iCs;
   1.151 +	RFastLock* iSsLock;
   1.152 +	RFastLock* iCsLock;
   1.153 +	RFastLock* iDefConnLock;
   1.154 +	RFastLock* iAESelectLock;
   1.155 +	RFastLock* iTzServerLock;
   1.156 +	};
   1.157 +
   1.158 +
   1.159 +class TFileTableCleanup
   1.160 +{
   1.161 +public:
   1.162 +	void SaveUserHeap(RHeap* aHeap)
   1.163 +		{
   1.164 +		iUserHeap = aHeap;
   1.165 +		}
   1.166 +
   1.167 +	~TFileTableCleanup()
   1.168 +	{
   1.169 +		User::SwitchHeap(iUserHeap);
   1.170 +	}
   1.171 +
   1.172 +private:
   1.173 +	RHeap* iUserHeap;
   1.174 +};
   1.175 +
   1.176 +
   1.177 +class CFileTable // codescanner::missingcclass
   1.178 +/*
   1.179 +@internalComponent
   1.180 +*/
   1.181 +	{
   1.182 +public:
   1.183 +	CFileTable();
   1.184 +	~CFileTable();
   1.185 +
   1.186 +	TInt Init(RHeap* aHeap = NULL);
   1.187 +	void Close();
   1.188 +	void Default(CFileDescBase* aRedirMedia, CFileDescBase* aStdErrMedia);
   1.189 +	TInt Reserve();
   1.190 +	TInt Attach(TInt aFid, CFileDescBase* aFile);
   1.191 +	TInt Detach(TInt aFid, CFileDescBase*& aDetached);
   1.192 +	TInt At(TInt aFid, CFileDescBase*& aFound) const;
   1.193 +	TInt Reserve(TInt aFids[3]);
   1.194 +	TInt Detach(TInt aFids[3]);
   1.195 +
   1.196 +	int dup (int fid, int& anErrno);
   1.197 +	int dup2 (int fid1, int fid2, int& anErrno);
   1.198 +	int open (const wchar_t* name, int mode, int perms, int& anErrno);
   1.199 +	int close (int fid, int& anErrno);
   1.200 +
   1.201 +	int UserClose (int fid, int& anErrno);
   1.202 +
   1.203 +	off_t lseek (int fid, off_t offset, int whence, int& anErrno);
   1.204 +	int fstat (int fid, struct stat* st, int& anErrno);
   1.205 +	int socket (int family, int style, int protocol, int& anErrno, RSocketServ& aSs);
   1.206 +	int listen (int fd, int n, int& anErrno);
   1.207 +	int bind (int fd, const struct sockaddr* addr, unsigned long size, int& anErrno);
   1.208 +	int sockname (int fd, struct sockaddr* address, unsigned long* aAddrLen,int anEnd, int& anErrno);
   1.209 +	int getsockopt (int fd, int level, int opt, void* buf, unsigned long* len, int& anErrno);
   1.210 +	int setsockopt (int fd, int level, int opt, void* buf, unsigned long len, int& anErrno);
   1.211 +	int ioctlcomplete (int fid, int cmd, void* param, TRequestStatus& aStatus, int& anErrno);
   1.212 +	int ioctlcancel (int fid, int& anErrno);
   1.213 +	int fcntl (int aFid, int aCmd, long anArg, int& anErrno);
   1.214 +
   1.215 +	TInt Asynch (int fid, CFileDescBase*& aFile);
   1.216 +
   1.217 +	int popen (const wchar_t* file, const wchar_t* cmd,const char* mode, int& anErrno);
   1.218 +	int pclose (int aFid, int& anErrno);
   1.219 +	int popen3 (const wchar_t *file, const wchar_t *cmd, wchar_t** envp, int fids[3], int& anErrno);
   1.220 +	int system (const wchar_t* aCmd, const wchar_t* aCmdArg, int& anErrno);
   1.221 +	int waitpid (int pid, int* status, int options, int& anErrno);
   1.222 +
   1.223 +	int posix_spawn (int* pid, const wchar_t* wpath,
   1.224 +					 const posix_spawn_file_actions_t* file_actions,
   1.225 +					 const posix_spawnattr_t* attrp,
   1.226 +					 const wchar_t* wargs, wchar_t** wenvp);
   1.227 +
   1.228 +	void TransferToChild (RProcess& child, TInt aFds[], TInt aWhich, TInt aSlot);
   1.229 +	void PassEnvToChild (RProcess& child, wchar_t** aEnvp);
   1.230 +	void PassFileActionsToChild (RProcess& child,
   1.231 +								 const posix_spawn_file_actions_t* aFileActions);
   1.232 +
   1.233 +#ifdef SYMBIAN_OE_POSIX_SIGNALS
   1.234 +	void TransferSigMaskToChild(RProcess& childproc,TDes& sigmask);
   1.235 +	void CheckOrigins (wchar_t**& wenvp, int& aCount, TUint64 & aSigMask);
   1.236 +#else
   1.237 +	void CheckOrigins (wchar_t**& wenvp, int& aCount);
   1.238 +#endif
   1.239 +	TInt InheritFiles(CFileDesTransferServer* server);
   1.240 +	int pipe (int fildes[2], int& anErrno);
   1.241 +	int mkfifo (const wchar_t *pathname, mode_t mode, int& anErrno, RFs& aFs);
   1.242 +	int CreatePipeDesc (int fildes, RPipe& aHandle, TUint16 aMode = 0);
   1.243 +	void ClosePipe (int fds[2], int& err);
   1.244 +
   1.245 +	static CFileDescBase* FifoOpen (const wchar_t* pathName, mode_t mode, int perms, int& anErrno);
   1.246 +	int link (const wchar_t *oldpathName, const wchar_t *newpathName, int& anErrno, RFs& aFs);
   1.247 +	static CFileDescBase* LinkOpen (const wchar_t* pathName, mode_t mode, int perms, int& anErrno, RFs& aFs);
   1.248 +	int unlink (RFs& aFs, const wchar_t *pathName, int& anErrno);
   1.249 +	int AcceptFileSocket(CFileSocketDesc* pfs, const struct sockaddr_un* addr, int& anErrno, RFs& aFs);
   1.250 +	TInt RConnectionCount();
   1.251 +	TInt RConnectionAt (TInt aRcIndex, RConnection *&aRc);
   1.252 +	TInt AddRConnectionPtr (RConnection *aRc, TInt &aRcIndex);
   1.253 +	void RemoveRConnectionPtrAt (TInt aRcIndex);
   1.254 +	void DeleteRConnectionList();
   1.255 +
   1.256 +	CFileDesTransferServer* NewFDTransferServerL(RSemaphore &sem);
   1.257 +	void StartFDTransferServer(CFileDesTransferServer* pServer);
   1.258 +	void CloseFDTransferServer(CFileDesTransferServer* pServer);
   1.259 +
   1.260 +	int SetEcho(int aFd, TUint8 aEcho, int& aErrno);
   1.261 +
   1.262 +	void DoTransferAll(RSemaphore &sem,TDesC& name);
   1.263 +	TInt GetFileCount() const
   1.264 +		{
   1.265 +		return iFids.Count();
   1.266 +		}
   1.267 +
   1.268 +	void Lock()
   1.269 +		{
   1.270 +		iFidLock.Wait();
   1.271 +		}
   1.272 +
   1.273 +	void Unlock()
   1.274 +		{
   1.275 +		iFidLock.Signal();
   1.276 +		}
   1.277 +
   1.278 +private:
   1.279 +	TFileTableCleanup	iCleanup;
   1.280 +	CArrayPtrSeg<CFileDescBase> iFids;
   1.281 +	// invoked by dup
   1.282 +	TInt Dup(TInt aFid);
   1.283 +	// invoked by both dup2 and fcntl with F_DUPFD
   1.284 +	TInt Dup2(TInt aFid, TInt aFid2, TBool aCloseFid2);
   1.285 +	// the real dup-er.
   1.286 +    TInt DupFd(TInt aFid1, TInt aFid2);
   1.287 +	void Release(TInt aFid);
   1.288 +
   1.289 +	//Lock for protecting FIDs across threads
   1.290 +	RFastLock iFidLock;
   1.291 +
   1.292 +	//stores pids of all children of this process
   1.293 +	RArray<TChild> iChildren;
   1.294 +
   1.295 +	//Methods to manipulate iChildren
   1.296 +	void AddChild(const TChild& aChild);
   1.297 +	void RemoveChild(TInt aIdx);
   1.298 +
   1.299 +	void ExpandFTableL(TInt count);
   1.300 +
   1.301 +	const RArray<TChild>& GetChildren() const
   1.302 +		{
   1.303 +		return iChildren;
   1.304 +		}
   1.305 +
   1.306 +	TInt FindChild(const TInt aFid) const
   1.307 +		{
   1.308 +		return iChildren.Find(TChild(aFid),
   1.309 +							  TIdentityRelation<TChild>(TChild::MatchByFid));
   1.310 +		}
   1.311 +
   1.312 +	TInt FindChild(const TProcessId aPid) const
   1.313 +		{
   1.314 +		return iChildren.Find(TChild(-1, aPid),
   1.315 +							  TIdentityRelation<TChild>(TChild::MatchByPid));
   1.316 +		}
   1.317 +
   1.318 +	CArrayPtrSeg<RConnection> iRConnectionList;
   1.319 +	//Lock for protecting iRConnectionList across threads
   1.320 +	RFastLock iRcLock;
   1.321 +
   1.322 +	// A pointer to the private heap
   1.323 +	RHeap* iPrivateHeap;
   1.324 +	friend class CFileDesTransferSession;
   1.325 +	};
   1.326 +
   1.327 +
   1.328 +class PosixFilesystem
   1.329 +/*
   1.330 +@internalComponent
   1.331 +*/
   1.332 +	{
   1.333 +public:
   1.334 +	static wchar_t* getcwd(RFs& aFs, wchar_t* buf, unsigned long len, int& anErrno);
   1.335 +	static int chdir(RFs& aFs, const wchar_t* path, int& anErrno);
   1.336 +	static int mkdir(RFs& aFs, const wchar_t* path, int perms, int& anErrno);
   1.337 +	static int rmdir(RFs& aFs, const wchar_t* path, int& anErrno);
   1.338 +	static int chmod(RFs& aFs, const wchar_t* path, int perms, int& anErrno);
   1.339 +	static int reg_unlink(RFs& aFs, const wchar_t* path, int& anErrno);
   1.340 +	static int statbackend(RFs& aFs, const wchar_t* name, struct stat* st, int& anErrno);
   1.341 +	static int rename(RFs& aFs, const wchar_t* oldname, const wchar_t* newname, int& anErrno);
   1.342 +	static TInt ResolvePath(TParse& aResult, const wchar_t* path, TDes* aFilename);
   1.343 +	static TInt SetDefaultDir(RFs& aFs);
   1.344 +	static TInt CreateDefaultPrivatePath(RFs& aFs);
   1.345 +	static int utime(RFs& aFs, const wchar_t* name, const struct utimbuf* filetimes, int& anErrno);
   1.346 +	};
   1.347 +
   1.348 +
   1.349 +class TAccessPointRecord
   1.350 +	{
   1.351 +public:	
   1.352 +	TUint32 iId;
   1.353 +	TBuf<KCommsDbSvrMaxColumnNameLength> iName;
   1.354 +	TUint32 iDialogPref;
   1.355 +	TUint32 iDirection;
   1.356 +	TUint32 iService;
   1.357 +	TBuf<KCommsDbSvrMaxColumnNameLength> iServiceType;
   1.358 +	TUint32 iBearer;
   1.359 +	TBuf<KCommsDbSvrMaxColumnNameLength> iBearerType;
   1.360 +	TUint32 iNetwork;
   1.361 +	TUint32 iNetworkWeighting;
   1.362 +	TUint32 iLocation;
   1.363 +public:
   1.364 +	TAccessPointRecord();
   1.365 +	
   1.366 +	};
   1.367 +
   1.368 +// This structure encapsulates an aselect request
   1.369 +NONSHARABLE_STRUCT ( TaselectRequestInfo )
   1.370 +	{
   1.371 +	TThreadId iId;
   1.372 +	int iMaxFd;
   1.373 +	fd_set* iReadFds;
   1.374 +	fd_set* iWriteFds;
   1.375 +	fd_set* iExceptFds;
   1.376 +	struct timeval *itvptr;
   1.377 +	TRequestStatus* iRequestStatus;
   1.378 +	};
   1.379 +
   1.380 +// Holds the information about aselect requests, this used required
   1.381 +// for cancellation of the aselect requests
   1.382 +NONSHARABLE_CLASS ( TASelectRequest )
   1.383 +	{
   1.384 +public:
   1.385 +	// Thread id of the thread processing the aselect
   1.386 +	TThreadId iThreadId;
   1.387 +	// Request object used for the request
   1.388 +	TRequestStatus* iRequestStatus;
   1.389 +	};
   1.390 +
   1.391 +NONSHARABLE_CLASS(CLocalSystemInterface) : public CBase
   1.392 +/*
   1.393 +@internalComponent
   1.394 +*/
   1.395 +	{
   1.396 +public:
   1.397 +
   1.398 +
   1.399 +	IMPORT_C CLocalSystemInterface();
   1.400 +	IMPORT_C ~CLocalSystemInterface();
   1.401 +
   1.402 +#ifdef __SYMBIAN_COMPILE_UNUSED__
   1.403 +	CLocalSystemInterface& Clone();
   1.404 +	void Release();
   1.405 +	void TerminateProcess(int status);
   1.406 +#endif //__SYMBIAN_COMPILE_UNUSED__
   1.407 +
   1.408 +	int AddToDirList(DIR *aDir);
   1.409 +	int RemoveDirFromList(DIR* aDir);
   1.410 +	int FindInDirList(DIR* aDir);
   1.411 +
   1.412 +	void Exit(int code);
   1.413 +
   1.414 +	int dup (int fid, int& anErrno);
   1.415 +	int dup2 (int fid, int fid2, int& anErrno);
   1.416 +	int open (const wchar_t* name, int mode, int perms, int& anErrno);
   1.417 +	int read (int fid, char* buf, unsigned long len, int& anErrno);
   1.418 +	int write (int fid, const char* buf, unsigned long len, int& anErrno);
   1.419 +	int fsync (int fid, int& anErrno);
   1.420 +	int close (int fid, int& anErrno);
   1.421 +	off_t lseek (int fid, off_t offset, int whence, int& anErrno);
   1.422 +	int fstat (int fid, struct stat* st, int& anErrno);
   1.423 +	int ioctl (int fid, int cmd, void* param, int& anErrno);
   1.424 +	int ioctl (int fid, int cmd, void* param, TRequestStatus& aStatus, int& anErrno);
   1.425 +	int ioctl_complete (int fid, int cmd, void* param, TRequestStatus& aStatus, int& anErrno);
   1.426 +
   1.427 +#ifdef __SYMBIAN_COMPILE_UNUSED__
   1.428 +	int ioctl_cancel (int fid, int& anErrno);
   1.429 +#endif //__SYMBIAN_COMPILE_UNUSED__
   1.430 +
   1.431 +	wchar_t* getcwd (wchar_t* buf, unsigned long len, int& anErrno);
   1.432 +
   1.433 +	int chdir (const wchar_t* path, int& anErrno);
   1.434 +	int mkdir (const wchar_t* path, int perms, int& anErrno);
   1.435 +	int rmdir (const wchar_t* path, int& anErrno);
   1.436 +	int chmod (const wchar_t* path, int perms, int& anErrno);
   1.437 +	int stat (const wchar_t* name, struct stat* st, int& anErrno);
   1.438 +	int lstat (const wchar_t* name, struct stat *st, int& anErrno);
   1.439 +	int rename (const wchar_t* oldname, const wchar_t* newname, int& anErrno);
   1.440 +
   1.441 +	IMPORT_C TInt ResolvePath (TParse& aResult, const wchar_t* path, TDes* aFilename);
   1.442 +	int socket (int family, int style, int protocol, int& anErrno);
   1.443 +	int recvfrom (int fd, char* buf, unsigned long cnt, int flags, struct sockaddr* from, unsigned long* fromsize, int& anErrno);
   1.444 +	int sendto (int fd, const char* buf, unsigned long cnt, int flags, struct sockaddr* to, unsigned long tosize, int& anErrno);
   1.445 +	int shutdown (int fd, int how, int& anErrno);
   1.446 +	int listen (int fd, int n, int& anErrno);
   1.447 +	int accept (int fd, struct sockaddr *addr, size_t *size, int& anErrno);
   1.448 +	int bind (int fd, const struct sockaddr* addr, unsigned long size, int& anErrno);
   1.449 +	int connect (int fd, const struct sockaddr* addr, unsigned long size, int& anErrno);
   1.450 +	int sockname (int fd, struct sockaddr* addr, unsigned long* size, int anEnd, int& anErrno);
   1.451 +	int getsockopt (int fd, int level, int opt, void* buf, unsigned long* len, int& anErrno);
   1.452 +	int setsockopt (int fd, int level, int opt, void* buf, unsigned long len, int& anErrno);
   1.453 +
   1.454 +	int popen3 (const wchar_t *file, const wchar_t *cmd, wchar_t** envp, int fids[3], int& anErrno);
   1.455 +	int waitpid (int pid, int* status, int options, int& anErrno);
   1.456 +
   1.457 +	int fcntl (int aFid, int aCmd, long anArg, int& anErrno);
   1.458 +	int utime (const wchar_t* name, const struct utimbuf* filetimes, int& anErrno);
   1.459 +
   1.460 +	int popen (const wchar_t* file, const wchar_t* cmd, const char* mode, int& anErrno);
   1.461 +	int pclose (int aFid, int& anErrno);
   1.462 +	IMPORT_C void CheckOrigins (wchar_t**& wenvp, int& aCount);
   1.463 +#ifdef SYMBIAN_OE_POSIX_SIGNALS
   1.464 +	TInt SignalHandler();
   1.465 +	IMPORT_C void InitSignalHandler();
   1.466 +	void RegisterExitNotification(TProcessId aPid);
   1.467 +
   1.468 +	inline TUint64 GetSigMask()const
   1.469 +	{
   1.470 +		return iSigMask;
   1.471 +	}
   1.472 +
   1.473 +	int kill(pid_t pid, int sig, int& anErrno);
   1.474 +	int raise(int sig, int& anErrno);
   1.475 +	int sigqueue(pid_t pid, int sig, const union sigval val, int& anErrno);
   1.476 +
   1.477 +	int sigfillset(sigset_t *set, int& anErrno);
   1.478 +	int sigaddset(sigset_t *set, int signo, int& anErrno);
   1.479 +	int sigdelset(sigset_t *set, int signo, int& anErrno);
   1.480 +	int sigismember(const sigset_t *set, int signo, int& anErrno);
   1.481 +	int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right, int& anErrno);
   1.482 +	int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right, int& anErrno);
   1.483 +	int sigisemptyset(const sigset_t * set, int& anErrno);
   1.484 +	int sigemptyset(sigset_t * set, int& anErrno);
   1.485 +
   1.486 +	int sigprocmask(int how, const sigset_t *set, sigset_t *oset, int& anErrno);
   1.487 +	int sighold(int signo, int& anErrno);
   1.488 +	int sigrelse(int signo, int& anErrno);
   1.489 +	int sigpause(int signo, int& anErrno);
   1.490 +
   1.491 +	int sigwait(const sigset_t *set, int *sig, int& anErrno);
   1.492 +	int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout, int& anErrno);
   1.493 +	int sigwaitinfo(const sigset_t *set, siginfo_t *info, int& anErrno);
   1.494 +	int sigaction(int sig, const struct sigaction *act, struct sigaction *oact, int& anErrno);
   1.495 +	TSignalHandler sigset(int aSigNum, TSignalHandler disp, int& anErrno);
   1.496 +	TSignalHandler bsd_signal(int aSigNum, TSignalHandler aFunc,int& anErrno);
   1.497 +	TSignalHandler signal(int aSigNum, TSignalHandler aFunc,int& anErrno);
   1.498 +	int sigignore(int aSigNum, int& anErrno);
   1.499 +	unsigned int alarm(unsigned int seconds);
   1.500 +	int sigpending(sigset_t *set,int& anErrno);
   1.501 +
   1.502 +#ifdef SYMBIAN_OE_LIBRT	
   1.503 +	//start timers...
   1.504 +	IMPORT_C TInt AddTimer(const TInt& aTimerId);
   1.505 +	IMPORT_C TInt DeleteTimer(const TInt& aTimerId);
   1.506 +	IMPORT_C TInt IncrementOverrun(const TInt& aTimerId);
   1.507 +	IMPORT_C TInt ResetOverrun(const TInt& aTimerId);
   1.508 +	IMPORT_C TInt Overrun(const TInt& aTimerId);
   1.509 +	IMPORT_C TInt RaiseTimerSignal(int sig, int timerid);
   1.510 +	//end timers
   1.511 +#endif //SYMBIAN_OE_LIBRT
   1.512 +#endif // SYMBIAN_OE_POSIX_SIGNALS
   1.513 +    int pipe (int fildes[2], int& anErrno );
   1.514 +    int mkfifo (const wchar_t *pathname, mode_t mode, int& anErrno);
   1.515 +    int link (const wchar_t *oldpathName, const wchar_t *newpathName, int& anErrno );
   1.516 +    int unlink (const wchar_t *pathName, int& anErrno );
   1.517 +
   1.518 +	int select (int maxfd, fd_set* readfds,fd_set* writefds,fd_set* exceptfds, struct timeval* tvptr, int& anErrno);
   1.519 +
   1.520 +	int aselect(int maxfd, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *tvptr, TRequestStatus* requeststatus,int& anErrno);
   1.521 +
   1.522 +	int cancelaselect(TRequestStatus* requeststatus, int& anErrno, TBool perform_cleanup = EFalse);		
   1.523 +		
   1.524 +	int eselect(int maxfd, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *tvptr, int arraycount,TRequestStatus* waitarray,int& anErrno);
   1.525 +	
   1.526 +	static TInt handleaselect(TAny* aPtr);
   1.527 +	
   1.528 +	RArray<TASelectRequest>& ASelectRequest();
   1.529 +	
   1.530 +	RFastLock& ASelectLock();
   1.531 +	
   1.532 +	inline RFastLock& DefConnLock() { return iDefConnLock; }
   1.533 +	
   1.534 +	inline TInt AddSocket(CSocketDesc* aPtr)
   1.535 +	    {
   1.536 +        RHeap* oheap = User::SwitchHeap(iPrivateHeap);
   1.537 +	    TInt ret = iSocketArray.InsertInAddressOrder(aPtr);
   1.538 +	    User::SwitchHeap(oheap);	    
   1.539 +	    return ret;
   1.540 +	    }
   1.541 +	
   1.542 +	inline void RemoveSocket(CSocketDesc* aPtr)
   1.543 +	    {
   1.544 +	    TInt index = iSocketArray.FindInAddressOrder(aPtr);
   1.545 +	    if (index != -1)
   1.546 +	        {
   1.547 +			RHeap* oheap = User::SwitchHeap(iPrivateHeap);
   1.548 +            iSocketArray.Remove(index);            
   1.549 +            iSocketArray.Compress();
   1.550 +            User::SwitchHeap(oheap);
   1.551 +	        }
   1.552 +	    }
   1.553 +	
   1.554 +	int system (const wchar_t* aCmd, const wchar_t* aCmdArg, int& anErrno );
   1.555 +	const wchar_t* GetDirName (int aFid);
   1.556 +	IMPORT_C int Truncate (int aFid, off_t anOffset, int& anErrno);
   1.557 +	int fchmod (int fd , mode_t  perms, int& anErrno);
   1.558 +
   1.559 +	int posix_spawn (int* pid, const wchar_t* wpath,
   1.560 +					 const posix_spawn_file_actions_t* file_actions,
   1.561 +					 const posix_spawnattr_t* attrp,
   1.562 +					 const wchar_t* wargs, wchar_t** wenvp);
   1.563 +
   1.564 +	int SetEcho(int aFd, TUint8 aEcho, int& aErrno);
   1.565 +	
   1.566 +	//Set the default interface for network operations
   1.567 +	int setdefaultif(const struct ifreq* aIfReq);
   1.568 +	int unsetdefaultif(TBool allow_bringup = ETrue);
   1.569 +	
   1.570 +	IMPORT_C CFileDescBase* GetDesc(int aFid);
   1.571 +
   1.572 +	// functions returning session to File Server
   1.573 +	IMPORT_C RFs& FileSession();
   1.574 +    RCommServ& CommServSession();
   1.575 +    RSocketServ& SockServSession();
   1.576 +
   1.577 +	//Dynamic Memory related APIs
   1.578 +	IMPORT_C void* Alloc(size_t aNBytes);
   1.579 +	IMPORT_C void* ReAlloc(void* aPtr, size_t aNBytes);
   1.580 +	IMPORT_C void Free(void* aPtr);
   1.581 +	IMPORT_C void* AllocTLD(TInt aSize);
   1.582 +
   1.583 +	//Return the private Heap memory
   1.584 +	IMPORT_C RHeap* Heap();
   1.585 +
   1.586 +	//Return the Comms Server Lock
   1.587 +	RFastLock& CommsSessionLock();
   1.588 +
   1.589 +	//Return reference to file table
   1.590 +	const CFileTable& FileTable() const;
   1.591 +	
   1.592 +	//Get the default connection (RConnection) instance 
   1.593 +	RConnection& GetDefaultConnection();
   1.594 +	
   1.595 +	//Get the saved session path of the file server session
   1.596 +	TInt GetSessionPath(TDes& aPath);
   1.597 +	
   1.598 +	//Save the file server session path
   1.599 +	TInt SaveSessionPath(const TDesC& aPath);
   1.600 +	
   1.601 +	static void WaitForNRequest(TRequestStatus aStatusArray[], TInt aNum);
   1.602 +
   1.603 +private:
   1.604 +	//Helper function to read a record from the IAP table
   1.605 +	void ReadRecordFromIapTableL(CCommsDbTableView* aView, TAccessPointRecord &aRecord);
   1.606 +	//Get the connection preferences from an IAP name
   1.607 +	TInt GetConnectionPreferencesL(TBuf<KCommsDbSvrMaxColumnNameLength> aIapName, 
   1.608 +			 					   TCommDbConnPref &aConnPref);
   1.609 +
   1.610 +	// Helper function used by "select" api. 
   1.611 +	// The function returns "True", if an ioctl call has been made and it is to be waited upon.
   1.612 +	// The function returns "False", (if an ioctl call is not made)/(an ioctl call was made but is not to be waited upon, and will get cancelled).	
   1.613 +	TBool SelectPollIssueIoctl(fd_set** aInputFds, fd_set** aOutputFds, 
   1.614 +			TRequestStatus* aReqArray, TInt *aReqFds, TInt aNumReqs, TInt& nDescriptorsSet) ;
   1.615 +	TInt CreateaselectThread(int maxfd, fd_set* readfds, fd_set* writefds,
   1.616 +				fd_set* exceptfds, struct timeval* tvptr, 
   1.617 +				TRequestStatus* requeststatus, int& anErrno);
   1.618 +	
   1.619 +	// Helper function for the setdefaultif() API to restart the 
   1.620 +	// default RConnection with the new settings.
   1.621 +	TInt StartDefConnection();
   1.622 +	
   1.623 +	// Helper function for doing an on-demand connection to RTz server
   1.624 +	TInt OnDemandTZServerConnection();
   1.625 +private:
   1.626 +	// NOTE: iCleanup should be the first member of CLSI, since iPrivateHeap
   1.627 +	// will be destroyed from within iCleanup destructor.
   1.628 +	TCLSICleanup	iCleanup;
   1.629 +
   1.630 +	CFileTable 		iFids;
   1.631 +
   1.632 +	//The backend file session for the application
   1.633 +	RFs 			iFs;
   1.634 +	//The current session path of the application.
   1.635 +	TFileName 		iSessionPath;
   1.636 +	//Lock to guard the session path
   1.637 +	RFastLock 		iSessionPathLock;
   1.638 +	
   1.639 +	RSocketServ 	iSs;
   1.640 +	RCommServ 		iCs;
   1.641 +
   1.642 +	//Lock for protecting Socket Session across threads
   1.643 +	RFastLock 		iSSLock;
   1.644 +	//Lock for protecting Comms Session across threads
   1.645 +	RFastLock 		iCSLock;
   1.646 +	
   1.647 +	//Private Heap which will be used by the library for all memory allocation
   1.648 +	RHeap* 			iPrivateHeap;
   1.649 +
   1.650 +	//used for Opendir
   1.651 +	const static TInt KDirGran = 2;
   1.652 +	RPointerArray<TAny> iOpenDirList;
   1.653 +
   1.654 +	//in class consts
   1.655 +	const static TInt KTLDInfoListGran = 4;
   1.656 +	const static TInt KPtrsGran = 2;
   1.657 +
   1.658 +	//Thread-TLS pointers mapping
   1.659 +	class TTLDInfo
   1.660 +		{
   1.661 +	public:
   1.662 +		TTLDInfo(TThreadId id, TAny* ptr) : iTid(id), iPtrs(CLocalSystemInterface::KPtrsGran)
   1.663 +			{
   1.664 +			iPtrs.Append(ptr);
   1.665 +			}
   1.666 +		void Close(RHeap* pHeap)
   1.667 +			{
   1.668 +			TInt nptrs = iPtrs.Count();
   1.669 +			for (TInt j = 0; j < nptrs; ++j)
   1.670 +				{
   1.671 +				pHeap->Free(iPtrs[j]);
   1.672 +				}
   1.673 +			iPtrs.Close();
   1.674 +			}
   1.675 +		TThreadId iTid;
   1.676 +		RPointerArray<TAny> iPtrs;
   1.677 +		};
   1.678 +
   1.679 +	//Array of Thread-TLS pointers mappings
   1.680 +	RArray<TTLDInfo> iTLDInfoList;
   1.681 +
   1.682 +	//Protect the array from concurrent access
   1.683 +	RFastLock	iTLDListLock;
   1.684 +	//The default connection to be used for all network apis. 
   1.685 +	RConnection iDefConnection;
   1.686 +	//Protect the iDefConnection from concurrent GetDefaultConnection calls
   1.687 +	RFastLock   iDefConnLock;
   1.688 +	//Calling unsetdefaultif(), instead of setdefaultif(NULL) ensures that the torn down
   1.689 +	//connection is not brought back up again, by subsequent socket/network calls.
   1.690 +	//This variable enables this facility. It is reset to default (ETrue) by setdefaultif(<pref>)
   1.691 +	TBool iDefConnResurrect;
   1.692 +	//Lock for protecting iASelectRequest across threads
   1.693 +	RFastLock iASelectLock;
   1.694 +		
   1.695 +	// iASelectRequest holds the TASelectRequest objects of the aselect requests
   1.696 +	RArray<TASelectRequest> iASelectRequest;
   1.697 +	
   1.698 +	// Default connection settings, set/cleared using setdefaultif
   1.699 +	TConnPref* iDefConnPref;
   1.700 +    RTz     iTzServer;	
   1.701 +	RFastLock iTzServerLock;
   1.702 +	TBool	iIsRTzConnected;
   1.703 +    RPointerArray<CSocketDesc> iSocketArray;
   1.704 +#ifdef SYMBIAN_OE_POSIX_SIGNALS
   1.705 +	// Signal handler thread
   1.706 +	RThread 				iSignalHandlerThread;
   1.707 +	RPipe					iSignalReadPipe;
   1.708 +	RPipe					iSignalWritePipe;
   1.709 +	TBool					iSignalLoopRunning;
   1.710 +	RSignalSession			iSignalSession;
   1.711 +	TUint64					iSigMask;
   1.712 +	RArray<TSignalMessage>	iBlockedSigArray;
   1.713 +	RMutex					iBlockedSAMutex;
   1.714 +	TRequestStatus			iPipeReadStatus;
   1.715 +
   1.716 +	// For thread(s) to wait till signals initialization happens
   1.717 +	TInt					iSigInitWaitCount;
   1.718 +	RSemaphore				iSigInitWaitSemaphore;
   1.719 +	RMutex					iSigInitWaitMutex;
   1.720 +	TBool					iSignalsInitialized;
   1.721 +	
   1.722 +	RSemaphore				iSignalInitSemaphore;
   1.723 +
   1.724 +	class TChildWaiter
   1.725 +		{
   1.726 +	public:
   1.727 +		TChildWaiter()
   1.728 +			{
   1.729 +			iWaiterStatus = KRequestPending;
   1.730 +			iWaiterPid = 0;
   1.731 +			}
   1.732 +
   1.733 +		virtual ~TChildWaiter() {}
   1.734 +
   1.735 +		TRequestStatus iWaiterStatus;
   1.736 +		TProcessId iWaiterPid;
   1.737 +
   1.738 +		static TBool MatchByPid(const TChildWaiter& aWaiter1, const TChildWaiter& aWaiter2)
   1.739 +			{
   1.740 +			if((aWaiter1.iWaiterPid == aWaiter2.iWaiterPid) != 0)
   1.741 +				return ETrue;
   1.742 +			else
   1.743 +				return EFalse;
   1.744 +			}
   1.745 +
   1.746 +		static TBool MatchNotPending(const TChildWaiter& aWaiter1, const TChildWaiter& aWaiter2)
   1.747 +			{
   1.748 +			if(aWaiter1.iWaiterStatus == KRequestPending || aWaiter2.iWaiterStatus == KRequestPending)
   1.749 +				return EFalse;
   1.750 +			else
   1.751 +				return ETrue;
   1.752 +			}
   1.753 +		};
   1.754 +
   1.755 +	class TSignalActionInfo
   1.756 +		{
   1.757 +	public:
   1.758 +		TSignalActionInfo()
   1.759 +			{
   1.760 +			iSigHandler = SIG_DFL;
   1.761 +			iSigAction = 0;
   1.762 +			iSigFlags = 0;
   1.763 +			}
   1.764 +
   1.765 +		virtual ~TSignalActionInfo() {}
   1.766 +
   1.767 +		TSignalHandler 	iSigHandler;
   1.768 +		TSignalAction	iSigAction;
   1.769 +		TUint32			iSigFlags;
   1.770 +		};
   1.771 +
   1.772 +	TFixedArray<TSignalActionInfo,SIGRTMAX> iSigActions;
   1.773 +	RMutex          		iSigHandlerMutex;
   1.774 +	RTimer 					iAlarmTimer;
   1.775 +    TTime 					iAlarmStartTime;
   1.776 +    TRequestStatus 			iAlarmStatus;
   1.777 +    TBool 					iIsTimerActive;
   1.778 +    TUint					iCurrentTimeout;
   1.779 +
   1.780 +    void HandleSignal(TSignalMessage& aMsg, TBool aIsDequeued = EFalse);
   1.781 +	void InitializeSignalHandlers();
   1.782 +	void CallDefaultHandler(int aSigNum);
   1.783 +	void WaitOrHandleSignal(TSignalMessage aMsg);
   1.784 +	TInt SuspendOtherThreads();
   1.785 +	TInt ResumeOtherThreads();
   1.786 +	TInt EnsureSignalsInitialized();
   1.787 +	TInt SigWaitInternal(TUint64 aWaitSet,TSignalMessage* aMsg,TInt aTimeout,TBool aTimeCheckFailed=EFalse);
   1.788 +
   1.789 +	class TSignalWaiter
   1.790 +		{
   1.791 +	public:
   1.792 +		TSignalWaiter(TUint64 aWaitMask, TSignalMessage* aMsgPtr)
   1.793 +			{
   1.794 +			iSigWaitSemaphore.CreateLocal(0);
   1.795 +			iSigWaitMessagePtr = aMsgPtr;
   1.796 +			iSigWaitMask = aWaitMask;
   1.797 +
   1.798 +			RThread	lThread;
   1.799 +			iSigWaitThreadId = lThread.Id();
   1.800 +			lThread.Close();
   1.801 +			}
   1.802 +
   1.803 +		virtual ~TSignalWaiter()
   1.804 +			{
   1.805 +			iSigWaitSemaphore.Close();
   1.806 +			}
   1.807 +
   1.808 +		TUint64				iSigWaitMask;
   1.809 +		RSemaphore			iSigWaitSemaphore;
   1.810 +		TSignalMessage*		iSigWaitMessagePtr;
   1.811 +		TThreadId			iSigWaitThreadId;
   1.812 +
   1.813 +		static TBool MatchByMask(const TSignalWaiter& aWaiter1, const TSignalWaiter& aWaiter2)
   1.814 +			{
   1.815 +			if((aWaiter1.iSigWaitMask & aWaiter2.iSigWaitMask) != 0)
   1.816 +				return ETrue;
   1.817 +			else
   1.818 +				return EFalse;
   1.819 +			}
   1.820 +
   1.821 +		static TBool MatchByThreadId(const TSignalWaiter& aWaiter1, const TSignalWaiter& aWaiter2)
   1.822 +			{
   1.823 +			if(aWaiter1.iSigWaitThreadId == aWaiter2.iSigWaitThreadId)
   1.824 +				return ETrue;
   1.825 +			else
   1.826 +				return EFalse;
   1.827 +			}
   1.828 +		};
   1.829 +
   1.830 +	RArray<TSignalWaiter>	iSignalWaiterArray;
   1.831 +	RArray<TChildWaiter>	iChildWaiterArray;
   1.832 +	RMutex					iSignalWaiterMutex;
   1.833 +
   1.834 +#ifdef SYMBIAN_OE_LIBRT		
   1.835 +	//timers..
   1.836 +	TInt FindTimer(const TInt& aTimerId);
   1.837 +	class TOverrun
   1.838 +		{
   1.839 +		public:
   1.840 +			TOverrun(const TInt& aTimerId):iTimerId(aTimerId), Overruns(0) 
   1.841 +				{
   1.842 +				}
   1.843 +
   1.844 +		TInt iTimerId;
   1.845 +		TInt Overruns;
   1.846 +		};
   1.847 +		
   1.848 +	RArray<TOverrun> 		iTimerOverruns;
   1.849 +	RMutex					iTimerOverrunsMutex;
   1.850 +	//timers..
   1.851 +#endif // SYMBIAN_OE_LIBRT		
   1.852 +	
   1.853 +#endif // SYMBIAN_OE_POSIX_SIGNALS
   1.854 +public:
   1.855 +
   1.856 +	IMPORT_C RTz & TZServer(TInt& aStatus);
   1.857 +	
   1.858 +//ipc server session
   1.859 +RIpcSession iIpcS;
   1.860 +friend class RFileDesTransferSession;
   1.861 +	};
   1.862 +
   1.863 +
   1.864 +/*
   1.865 +* Return global backend object to libraries
   1.866 +*/
   1.867 +IMPORT_C CLocalSystemInterface* Backend();
   1.868 +
   1.869 +
   1.870 +
   1.871 +
   1.872 +// LIBC-BACKEND specific Symbian Error Codes
   1.873 +const TInt KErrMaxFdOpened = -1025;
   1.874 +const TInt KErrDirectoryOpen = -1026;
   1.875 +
   1.876 +
   1.877 +
   1.878 +// Directory enumeration
   1.879 +
   1.880 +NONSHARABLE_STRUCT(__EPOC32_WDIR) : public CBase	// aka "class __EPOC32_WDIR with everything public"
   1.881 +	{
   1.882 +public:
   1.883 +	__EPOC32_WDIR() {}
   1.884 +	~__EPOC32_WDIR();
   1.885 +
   1.886 +	TInt Open();
   1.887 +	TInt Open(const TDesC& aPath);
   1.888 +	TInt Open(const wchar_t *_path,int*);
   1.889 +	virtual TInt UpdateNarrow();
   1.890 +	HBufC* iPath;
   1.891 +	CDir* iEntries;
   1.892 +	TInt iIndex;		// counting down, 0 means "finished"
   1.893 +	struct wdirent iCurrent;
   1.894 +	TInt iCount ;
   1.895 +	TBuf16<KMaxFileName> iCurrentName;
   1.896 +	/* *****************************************************************
   1.897 +	Overloading new and delete operators so that they will
   1.898 +	allocate and deallocare memory from/to the private heap of backend
   1.899 +	********************************************************************/
   1.900 +	inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW
   1.901 +		{
   1.902 +		Mem::FillZ(aBase, aSize); return aBase;
   1.903 +		}
   1.904 +
   1.905 +	inline TAny* operator new(TUint aSize) __NO_THROW
   1.906 +		{
   1.907 +		return Backend()->Alloc(aSize);
   1.908 +		}
   1.909 +
   1.910 +	inline TAny* operator new(TUint aSize, TLeave)
   1.911 +		{
   1.912 +		TAny* ptr = Backend()->Alloc(aSize);
   1.913 +		if (ptr == NULL)
   1.914 +			{
   1.915 +			User::Leave(KErrNoMemory);
   1.916 +			}
   1.917 +		return ptr;
   1.918 +		}
   1.919 +
   1.920 +	inline TAny* operator new(TUint aSize, TUint aExtraSize) __NO_THROW
   1.921 +		{
   1.922 +		return Backend()->Alloc(aSize + aExtraSize);
   1.923 +		}
   1.924 +
   1.925 +	inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize)
   1.926 +		{
   1.927 +		TAny* ptr = Backend()->Alloc(aSize + aExtraSize);
   1.928 +		if (ptr == NULL)
   1.929 +			{
   1.930 +			User::Leave(KErrNoMemory);
   1.931 +			}
   1.932 +		return ptr;
   1.933 +		}
   1.934 +
   1.935 +	inline void operator delete(TAny *aPtr) __NO_THROW
   1.936 +		{
   1.937 +		Backend()->Free( aPtr );
   1.938 +		}
   1.939 +	};
   1.940 +
   1.941 +NONSHARABLE_STRUCT(__EPOC32_DIR) : public __EPOC32_WDIR
   1.942 +	{
   1.943 +public:
   1.944 +	__EPOC32_DIR(){}
   1.945 +	~__EPOC32_DIR(){}
   1.946 +
   1.947 +	virtual TInt UpdateNarrow();
   1.948 +	struct dirent iCurrentNarrow;
   1.949 +	TBuf8<KMaxFileName> iCurrentNarrowName;
   1.950 +	};
   1.951 +
   1.952 +NONSHARABLE_STRUCT (_iconv_t)
   1.953 +	{
   1.954 +	TUint toCode;
   1.955 +	TUint fromCode;
   1.956 +	};
   1.957 +
   1.958 +class TUSockAddr : public TSockAddr
   1.959 +/*
   1.960 +Utility class for converting struct sockaddr to and from EPOC32 TSockAddr
   1.961 +@internalComponent
   1.962 +*/
   1.963 +	{
   1.964 +public:
   1.965 +	TUSockAddr() : TSockAddr(), iError(0) {}
   1.966 +
   1.967 +	TUSockAddr(TAny* addr);			// constructor form of Prepare
   1.968 +	IMPORT_C TUSockAddr(const TAny* addr, TUint len);	// constructor form of Set
   1.969 +private:
   1.970 +	void Prepare(TAny* addr);
   1.971 +	void Set(const TAny* addr, TUint len);
   1.972 +public:
   1.973 +	IMPORT_C void Get(TAny* addr, unsigned long* len);
   1.974 +public:
   1.975 +	TInt iError; // To store error status of TUSockAddr functions, refers errno.h. Notebly not Symbian error codes.
   1.976 +	};
   1.977 +
   1.978 +
   1.979 +
   1.980 +
   1.981 +
   1.982 +#endif //SYSIF_H
   1.983 +