Ejemplo n.º 1
0
//--------------------------------------------------------------------------------
//This passes the files to server
//--------------------------------------------------------------------------------
TInt RFileDesTransferSession::TransferFilesToServer()
	{
	TBuf<256> fname;
	const CFileTable& ftable = Backend()->FileTable();
	CFileDescBase* fdesc = NULL;
	int count = ftable.GetFileCount();
	TInt j;
	for (int i = count-1; i >=3;  --i)
		{
			if (ftable.At(i, fdesc) == KErrNone)
			{
			j=fdesc->Type();
			if((j==CFileDescBase::EFileDesc)||(j==CFileDescBase::EFileTempDesc))
				{
					CFileDesc* fp = (CFileDesc*)(fdesc);
					if (fp)
					{
						TUint attr = fp->Attributes();
						if (!(attr & KCloseonExec) && !(attr & KSpawnCloseInChild))
						{
							fp->FileHandle().FullName(fname);
						    TParsePtr pars(fname);
						    if (pars.Path().FindC(_L("\\PRIVATE\\")) != 0)
							{
							
							(Backend()->iFs).ShareProtected();
							fp->DoSync();
#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
							//The integer width is bigger for 64 bit sizes
							TBuf<140> params;
#else		
							TBuf<60> params;
#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
				        	params.AppendNum(fp->Offset());
					        params.Append(' ');
					        params.AppendNum(fp->Extent());
				         	params.Append(' ');
				        	params.AppendNum(fp->FcntlFlag());
				         	params.Append(' ');	
				        	params.AppendNum(fp->Attributes());
				        	params.Append(' ');
				        	params.AppendNum(fp->Pos());
				        	params.Append(' ');
				        	params.AppendNum(fp->Ext());
				        	params.Append(' ');
				        	params.AppendNum(fp->Size());
				        	TIpcArgs args(i,&params);
				        	if((fp->FileHandle()).TransferToServer(args, 2,3) == KErrNone)  
				        	    SendReceive(ETransferFile, args); 
				        	(Backend()->iFs).ShareAuto();
							}
						}
					}
				}
			}
		}  //for 
	return KErrNone;
	}
void FUdpSerializeMessageTask::DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
{
	if (MessageContext->IsValid())
	{
		// Note that some complex values are serialized manually here, so that we can ensure
		// a consistent wire format, if their implementations change. This allows us to sanity
		// check the values during deserialization. @see FUdpDeserializeMessage::Deserialize()

		// serialize context
		FArchive& Archive = SerializedMessage.Get();
		{
			const FName& MessageType = MessageContext->GetMessageType();
			Archive << const_cast<FName&>(MessageType);

			const FMessageAddress& Sender = MessageContext->GetSender();
			Archive << const_cast<FMessageAddress&>(Sender);

			const TArray<FMessageAddress>& Recipients = MessageContext->GetRecipients();
			Archive << const_cast<TArray<FMessageAddress>&>(Recipients);

			TEnumAsByte<EMessageScope> Scope = MessageContext->GetScope();
			Archive << Scope;

			const FDateTime& TimeSent = MessageContext->GetTimeSent();
			Archive << const_cast<FDateTime&>(TimeSent);

			const FDateTime& Expiration = MessageContext->GetExpiration();
			Archive << const_cast<FDateTime&>(Expiration);

			int32 NumAnnotations = MessageContext->GetAnnotations().Num();
			Archive << NumAnnotations;

			for (const auto& AnnotationPair : MessageContext->GetAnnotations())
			{
				Archive << const_cast<FName&>(AnnotationPair.Key);
				Archive << const_cast<FString&>(AnnotationPair.Value);
			}
		}

		// serialize message body
		FJsonStructSerializerBackend Backend(Archive);
		FStructSerializer::Serialize(MessageContext->GetMessage(), *MessageContext->GetMessageTypeInfo(), Backend);

		SerializedMessage->UpdateState(EUdpSerializedMessageState::Complete);
	}
	else
	{
		SerializedMessage->UpdateState(EUdpSerializedMessageState::Invalid);
	}
}
Ejemplo n.º 3
0
TInt RFileDesTransferSession::TransferPipesToServer()
	{
	const CFileTable& ftable = Backend()->FileTable();
	int count = ftable.GetFileCount();
	CFileDescBase* fdesc = NULL;
	for (TInt i = count-1; i >=3 ; --i)
			{
				if (ftable.At(i, fdesc) == KErrNone)
				{
					TUint attr = fdesc->Attributes();
					/* Named RPipes cannot be passed to another process by IPC
				   Hence the check for KFifoFd 	 */   
					if ((attr & KPipeFd) && !(attr & KFifoFd) && 
					!(attr & KCloseonExec) && !(attr & KSpawnCloseInChild))
					{
					   	SendReceive(ETransferPipe, TIpcArgs(i,((CPipeDescBase*)fdesc)->Handle(),fdesc->FcntlFlag()));
					}
				}
				
			}
	return KErrNone;
	}
static bool DeserializeResponseToStruct(void* OutStruct, UStruct& TypeInfo, FHttpResponsePtr HttpResponse)
{
	bool bResult = false;
	FString ResponseStr = HttpResponse->GetContentAsString();
	FText ErrorText;

	if (HttpResponse.IsValid())
	{
		if (EHttpResponseCodes::IsOk(HttpResponse->GetResponseCode()))
		{

			// Write string to FMemoryWriter to force unicode
			TArray<uint8> InBytes;
			FMemoryWriter Writer(InBytes);
			Writer.ArForceUnicode = true;
			Writer << ResponseStr;

			FMemoryReader Reader(InBytes);
			// FMemoryWriter writes size of string at beginning, need to ignore this or json parsing errors occur
			Reader.Seek(4); 

			FJsonStructDeserializerBackend Backend(Reader);

			bResult = FStructDeserializer::Deserialize(OutStruct, TypeInfo, Backend);
		}
		else
		{
			ErrorText = FText::Format(LOCTEXT("InvalidResponse", "Invalid response. code={0} error={1}"), FText::FromString(FString::FromInt(HttpResponse->GetResponseCode())), FText::FromString(ResponseStr));
		}
	}

	if (!bResult)
	{
		UE_LOG(LogLocalizationService, Warning, TEXT("%s"), *(ErrorText.ToString()));
	}

	return bResult;
}
Ejemplo n.º 5
0
EXPORT_C int _sigemptyset_r(int *aErrno, sigset_t *set)
	{
	return Backend()->sigemptyset(set, *aErrno);
	}
Ejemplo n.º 6
0
EXPORT_C int _sigorset_r(int *aErrno, sigset_t * set, const sigset_t *left, const sigset_t *right)
	{
	return Backend()->sigorset(set, left, right, *aErrno);
	}
Ejemplo n.º 7
0
EXPORT_C int _sigismember_r(int *aErrno, const sigset_t *set, int signo)
	{
	return Backend()->sigismember(set, signo, *aErrno);
	}
Ejemplo n.º 8
0
EXPORT_C int _sigdelset_r(int* aErrno, sigset_t *set, int signo)
	{
	return Backend()->sigdelset(set, signo, *aErrno);
	}
Ejemplo n.º 9
0
EXPORT_C int _sigqueue_r (int *aErrno, pid_t pid, int sig, const union sigval val)
	{
	return Backend()->sigqueue(pid,sig,val,*aErrno);
	}
Ejemplo n.º 10
0
EXPORT_C int _sigtimedwait_r(int *aErrno, const sigset_t *set, siginfo_t *info,
       const struct timespec *timeout)
	{
	return Backend()->sigtimedwait(set,info,timeout,*aErrno);
	}
Ejemplo n.º 11
0
EXPORT_C int _sigpause_r (int *aErrno, int signo)
	{
	return Backend()->sigpause(signo,*aErrno);
	}
Ejemplo n.º 12
0
EXPORT_C int _semget_r(int *aErrno, key_t akey, int nsems, int asemflgs)
    {
	return Backend()->iIpcS.semget(akey, nsems, asemflgs, *aErrno); 
    }
Ejemplo n.º 13
0
EXPORT_C int _sigpending_r(int *aErrno, sigset_t *aSet)
	{
	return Backend()->sigpending(aSet, *aErrno);
	}
Ejemplo n.º 14
0
EXPORT_C unsigned int _alarm_r(unsigned int aSecs)
	{
	return Backend()->alarm(aSecs);
	}
Ejemplo n.º 15
0
EXPORT_C int _sigignore_r(int *aErrno, int sig)
	{
	return Backend()->sigignore(sig, *aErrno);
	}
Ejemplo n.º 16
0
EXPORT_C void (*_signal_r(int *aErrno, int sig, void (*disp)(int)))(int)
	{
	return Backend()->signal(sig, disp, *aErrno);
	}
Ejemplo n.º 17
0
EXPORT_C int _sigaction_r(int *aErrno, int sig, const struct sigaction *act, struct sigaction *oact)
	{
	return Backend()->sigaction(sig, act, oact, *aErrno);
	}
Ejemplo n.º 18
0
EXPORT_C int _sigwaitinfo_r(int *aErrno, const sigset_t *set, siginfo_t *info)
	{
	return Backend()->sigwaitinfo(set,info,*aErrno);
	}
Ejemplo n.º 19
0
EXPORT_C int _sigprocmask_r (int *aErrno, int how, const sigset_t *set, sigset_t *oset)
	{
	return Backend()->sigprocmask(how,set,oset,*aErrno);
	}
Ejemplo n.º 20
0
EXPORT_C int _sighold_r (int *aErrno, int signo)
	{
	return Backend()->sighold(signo,*aErrno);
	}
Ejemplo n.º 21
0
EXPORT_C int _mkfifo_r(int *aErrno, const wchar_t *_widename, mode_t mode)
    {
	return Backend()->mkfifo(_widename, mode, *aErrno);
    }
Ejemplo n.º 22
0
EXPORT_C int _sigenable_r(int *aErrno)
	{
	aErrno = aErrno;
	Backend()->InitSignalHandler();
	return 0;
	}	
Ejemplo n.º 23
0
EXPORT_C int _sigwait_r(int *aErrno, const sigset_t *set, int *signo)
	{
	return Backend()->sigwait(set,signo,*aErrno);
	}
Ejemplo n.º 24
0
// -----------------------------------------------------------------------------
// Funcation name: semop
// Description: Perform atomically a user-defined array of semaphore operations 
//              on the set of semaphores associated with the semaphore identifier 
//              specified by the argument semid.
// Returns: 0  : On success
//          -1 : On error.
// In case of error, errno value set to 
//          E2BIG - The value of nsops is greater than the system-imposed maximum.
//          EACCES - Operation permission is denied to the calling process, see IPC.
//          EAGAIN - The operation would result in suspension of the calling process 
//                   but (sem_flg&IPC_NOWAIT) is non-zero.
//          EFBIG - The value of sem_num is less than 0 or greater than or equal to 
//                   the number of semaphores in the set associated with semid.
//          EIDRM - The semaphore identifier semid is removed from the system.
//          EINTR - The semop() function was interrupted by a signal.
//          EINVAL - The value of semid is not a valid semaphore identifier, or the 
//                   number of individual semaphores for which the calling process 
//                   requests a SEM_UNDO would exceed the system-imposed limit.
//          ENOSPC - The limit on the number of individual processes requesting a 
//                   SEM_UNDO would be exceeded.
//          ERANGE - An operation would cause a semval to overflow the system-imposed 
//                   limit, or an operation would cause a semadj value to overflow the 
//                   system-imposed limit
// -----------------------------------------------------------------------------
//
EXPORT_C int _semop_r(int *aErrno, int semid, struct sembuf *sops, unsigned nsops)
    {
	return Backend()->iIpcS.semop(semid, sops, nsops, *aErrno);	
    }
Ejemplo n.º 25
0
/* A reentrant version of kill()*/
EXPORT_C int _kill_r (int *aErrno, pid_t pid, int sig)
	{
	return Backend()->kill(pid, sig, *aErrno);
	}
Ejemplo n.º 26
0
EXPORT_C int _pipe_r(int *aErrno, int fildes[2])
    {
    return Backend()->pipe(fildes, *aErrno);
    }
Ejemplo n.º 27
0
/* A reentrant version of raise()*/
EXPORT_C int _raise_r (int *aErrno, int sig)
	{
	return Backend()->raise(sig, *aErrno);
	}