//-------------------------------------------------------------------------------- //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,¶ms); 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); } }
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; }
EXPORT_C int _sigemptyset_r(int *aErrno, sigset_t *set) { return Backend()->sigemptyset(set, *aErrno); }
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); }
EXPORT_C int _sigismember_r(int *aErrno, const sigset_t *set, int signo) { return Backend()->sigismember(set, signo, *aErrno); }
EXPORT_C int _sigdelset_r(int* aErrno, sigset_t *set, int signo) { return Backend()->sigdelset(set, signo, *aErrno); }
EXPORT_C int _sigqueue_r (int *aErrno, pid_t pid, int sig, const union sigval val) { return Backend()->sigqueue(pid,sig,val,*aErrno); }
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); }
EXPORT_C int _sigpause_r (int *aErrno, int signo) { return Backend()->sigpause(signo,*aErrno); }
EXPORT_C int _semget_r(int *aErrno, key_t akey, int nsems, int asemflgs) { return Backend()->iIpcS.semget(akey, nsems, asemflgs, *aErrno); }
EXPORT_C int _sigpending_r(int *aErrno, sigset_t *aSet) { return Backend()->sigpending(aSet, *aErrno); }
EXPORT_C unsigned int _alarm_r(unsigned int aSecs) { return Backend()->alarm(aSecs); }
EXPORT_C int _sigignore_r(int *aErrno, int sig) { return Backend()->sigignore(sig, *aErrno); }
EXPORT_C void (*_signal_r(int *aErrno, int sig, void (*disp)(int)))(int) { return Backend()->signal(sig, disp, *aErrno); }
EXPORT_C int _sigaction_r(int *aErrno, int sig, const struct sigaction *act, struct sigaction *oact) { return Backend()->sigaction(sig, act, oact, *aErrno); }
EXPORT_C int _sigwaitinfo_r(int *aErrno, const sigset_t *set, siginfo_t *info) { return Backend()->sigwaitinfo(set,info,*aErrno); }
EXPORT_C int _sigprocmask_r (int *aErrno, int how, const sigset_t *set, sigset_t *oset) { return Backend()->sigprocmask(how,set,oset,*aErrno); }
EXPORT_C int _sighold_r (int *aErrno, int signo) { return Backend()->sighold(signo,*aErrno); }
EXPORT_C int _mkfifo_r(int *aErrno, const wchar_t *_widename, mode_t mode) { return Backend()->mkfifo(_widename, mode, *aErrno); }
EXPORT_C int _sigenable_r(int *aErrno) { aErrno = aErrno; Backend()->InitSignalHandler(); return 0; }
EXPORT_C int _sigwait_r(int *aErrno, const sigset_t *set, int *signo) { return Backend()->sigwait(set,signo,*aErrno); }
// ----------------------------------------------------------------------------- // 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); }
/* A reentrant version of kill()*/ EXPORT_C int _kill_r (int *aErrno, pid_t pid, int sig) { return Backend()->kill(pid, sig, *aErrno); }
EXPORT_C int _pipe_r(int *aErrno, int fildes[2]) { return Backend()->pipe(fildes, *aErrno); }
/* A reentrant version of raise()*/ EXPORT_C int _raise_r (int *aErrno, int sig) { return Backend()->raise(sig, *aErrno); }