void OsclGetHostByNameRequest::Success()
{
    switch (iRequestPhase)
    {
        case GetFirstHostAddress:
        {
            iDNSI->GetHostByNameSuccess(*iParam);
            if (!iDNSI->GetHostByNameResponseContainsAliasInfo() && iParam->canPersistMoreHostAddresses())
            {
                iRequestPhase = GetAlternateHostAddress;
                NewRequest();
                iDNSI->GetNextHost(*this);
            }
            else
            {
                iDNSMethod->iDNSObserver->HandleDNSEvent(iDNSMethod->iId, iDNSMethod->iDNSFxn, EPVDNSSuccess, 0);
            }
        }
        break;
        case GetAlternateHostAddress:
        {
            iDNSI->GetNextHostSuccess(*iParam);
            NewRequest();
            iDNSI->GetNextHost(*this);
        }
        break;
    }
}
Example #2
0
/******************************************************************************
* Name: CCommDevice::RequestCommand (event driven)
*
* Purpose: execute a device command - call a callback function when finished
******************************************************************************/
BOOL CCommDevice::RequestCommand( LPCTSTR lpcszData, DWORD dwResultLen, LPREQUESTPROC pProc)
{
    CCommRequest* pRequest = NewRequest();

    pRequest->m_dwRequestType = REQUEST_COMMAND;

    if( lpcszData && lpcszData[0]) {
        int len = lstrlen( lpcszData);
        pRequest->m_lpszData = new char[ len + 1];
        lstrcpy( pRequest->m_lpszData, lpcszData);
        pRequest->m_dwDataLength = len;
    }

    if( dwResultLen) {
        pRequest->m_lpszResult = new char[ dwResultLen];
        pRequest->m_dwResultLength = dwResultLen;
    }

    pRequest->m_pCompleteFunction = pProc;

    if( !Request( pRequest)) {
        delete pRequest;
        return FALSE;
    }

    return TRUE;
}
void OsclAcceptRequest::Accept(OsclSocketI &aSocket)
{
    OsclAny *p = NewRequest(sizeof(AcceptParam));
    if (!p)
        PendComplete(OsclErrNoMemory);
    else
    {
        iParam = OSCL_PLACEMENT_NEW(p, AcceptParam(aSocket));
        if (!iParam)
            PendComplete(OsclErrNoMemory);
        else
            SocketI()->Accept(*Param(), *this);
    }
}
void OsclSendToRequest::SendTo(const uint8* &aPtr, uint32 aLen, OsclNetworkAddress &aAddress)
{
    OsclAny *p = NewRequest(sizeof(SendToParam));
    if (!p)
        PendComplete(OsclErrNoMemory);
    else
    {
        iParam = OSCL_PLACEMENT_NEW(p, SendToParam(aPtr, aLen, aAddress, 0));
        if (!iParam)
            PendComplete(OsclErrNoMemory);
        else
            SocketI()->SendTo(*Param(), *this);
    }
}
/**
Start transfer. Calls into CObexActiveRW, which eventaully queues a write 

@param aPacket The Obex packet to write
 */
EXPORT_C void CObexWriterBase::StartTransfer (CObexPacket& aPacket)
	{
	LOG_LINE
	LOG_FUNC

	iPacketSize = aPacket.PacketSize();
	NewRequest(aPacket);

	if(iPacket->IsFinal() &&
	  (iPacket->PacketProcessNotificationEvents() & EObexFinalPacketStarted))
		{
		iOwner.SignalPacketProcessEvent(EObexFinalPacketStarted);
		}
	}
Example #6
0
/******************************************************************************
* Name: CCommDevice::RequestRead (event driven)
*
* Purpose: request data to be read from the port - call a callback function
*					 when finished
******************************************************************************/
BOOL CCommDevice::RequestRead( DWORD dwResultLen, LPREQUESTPROC pProc)
{
    CCommRequest* pRequest = NewRequest();

    pRequest->m_dwRequestType = REQUEST_READ;
    pRequest->m_lpszResult = new char[ dwResultLen];
    pRequest->m_pCompleteFunction = pProc;

    if( !Request( pRequest)) {
        delete pRequest;
        return FALSE;
    }

    return TRUE;
}
void OsclConnectRequest::Connect(OsclNetworkAddress &aAddress)
{
    OsclAny *p = NewRequest(sizeof(ConnectParam));
    if (!p)
        PendComplete(OsclErrNoMemory);
    else
    {
        iParam = OSCL_PLACEMENT_NEW(p, ConnectParam(aAddress));
        if (!iParam)
            PendComplete(OsclErrNoMemory);
        else
        {
            SocketI()->Connect(*Param(), *this);
        }
    }
}
void 
DataReceiverHandler::Read()
{
	// read int
	qint32 magic;
	this->stream >> magic;

	if (magic == REQUEST_FILE)
	{
        // get name
        QString file;
        this->stream >> file;

		this->pendingFiles.append(file);
		emit NewRequest(file, this->socket->peerAddress().toString());
	}
Example #9
0
/******************************************************************************
* Name: CCommDevice::RequestRead (event driven)
*
* Purpose: request data to be read from the port - send the result to a
*					 window when finished
******************************************************************************/
BOOL CCommDevice::RequestRead( DWORD dwResultLen, CWnd* pWnd)
{
    CCommRequest* pRequest = NewRequest();

    pRequest->m_dwRequestType = REQUEST_READ;
    pRequest->m_lpszResult = new char[ dwResultLen];
    pRequest->m_dwResultLength = dwResultLen;
    pRequest->m_pWindow = pWnd;

    if( !Request( pRequest)) {
        delete pRequest;
        return FALSE;
    }

    return TRUE;
}
void OsclGetHostByNameRequest::GetHostByName(char *name, OsclNetworkAddress *addr, Oscl_Vector<OsclNetworkAddress, OsclMemAllocator> *aAddressList)
{
    NewRequest();

    if (iParam)
        iParam->RemoveRef();
    iParam = NULL;

    if (!name || !addr)
    {
        PendComplete(OsclErrGeneral);
        return;
    }

    iParam = GetHostByNameParam::Create(name, addr, aAddressList);
    if (!iParam)
        PendComplete(OsclErrNoMemory);
    else
        iDNSI->GetHostByName(*iParam, *this);
}
Example #11
0
/******************************************************************************
* Name: CCommDevice::RequestWrite (event driven)
*
* Purpose: request data to be written to the port - call a callback function
*          when finished
******************************************************************************/
BOOL CCommDevice::RequestWrite( LPCTSTR lpszData, LPREQUESTPROC pProc)
{
    CCommRequest* pRequest = NewRequest();

    pRequest->m_dwRequestType = REQUEST_WRITE;

    if( lpszData && lpszData[0]) {
        int len = lstrlen( lpszData);
        pRequest->m_lpszData = new char[ len + 1];
        lstrcpy( pRequest->m_lpszData, lpszData);
        pRequest->m_dwDataLength = len;
    }

    pRequest->m_pCompleteFunction = pProc;

    if( !Request( pRequest)) {
        delete pRequest;
        return FALSE;
    }

    return TRUE;
}
Example #12
0
/******************************************************************************
* Name: CCommDevice::RequestWrite (event driven)
*
* Purpose: request data to be written to the port - send the result to a
*          window when finished
******************************************************************************/
BOOL CCommDevice::RequestWrite( LPCTSTR lpszData, CWnd* pWnd)
{
    CCommRequest* pRequest = NewRequest();

    pRequest->m_dwRequestType = REQUEST_WRITE;

    if( lpszData && lpszData[0]) {
        int len = lstrlen( lpszData);
        pRequest->m_lpszData = new char[ len + 1];
        lstrcpy( pRequest->m_lpszData, lpszData);
        pRequest->m_dwDataLength = len;
    }

    pRequest->m_pWindow = pWnd;

    if( !Request( pRequest)) {
        delete pRequest;
        return FALSE;
    }

    return TRUE;
}