Esempio n. 1
0
void UPnpNotifyTask::ProcessDevice(
    MSocketDevice *pSocket, UPnpDevice *pDevice)
{
    // ----------------------------------------------------------------------
    // Loop for each device and send the 2 required messages
    //
    // -=>TODO: Need to add support to only notify 
    //          Version 1 of a service.
    // ----------------------------------------------------------------------

    SendNotifyMsg( pSocket, pDevice->GetUDN(), "" );
    SendNotifyMsg( pSocket, pDevice->m_sDeviceType, pDevice->GetUDN() );
        
    // ------------------------------------------------------------------
    // Loop for each service in this device and send the 1 required message
    // ------------------------------------------------------------------

    UPnpServiceList::const_iterator sit = pDevice->m_listServices.begin();
    for (; sit != pDevice->m_listServices.end(); ++sit)
        SendNotifyMsg( pSocket, (*sit)->m_sServiceType, pDevice->GetUDN() );

    // ----------------------------------------------------------------------
    // Process any Embedded Devices
    // ----------------------------------------------------------------------

    UPnpDeviceList::iterator dit = pDevice->m_listDevices.begin();
    for (; dit != pDevice->m_listDevices.end(); ++dit)
        ProcessDevice( pSocket, *dit);
}
Esempio n. 2
0
void UPnpNotifyTask::Execute( TaskQueue *pQueue )
{
    MSocketDevice *pMulticast = new MMulticastSocketDevice(
        SSDP_GROUP, SSDP_PORT);

    // ----------------------------------------------------------------------
    // Must send rootdevice Notification for first device.
    // ----------------------------------------------------------------------

    UPnpDevice &device = UPnp::g_UPnpDeviceDesc.m_rootDevice;

    SendNotifyMsg( pMulticast, "upnp:rootdevice", device.GetUDN() );

    // ----------------------------------------------------------------------
    // Process rest of notifications
    // ----------------------------------------------------------------------

    ProcessDevice( pMulticast, &device );

    // ----------------------------------------------------------------------
    // Clean up and reshedule task if needed (timeout = m_nMaxAge / 2).
    // ----------------------------------------------------------------------

    delete pMulticast;

    pMulticast = nullptr;

    m_mutex.lock();

    if (m_eNTS == NTS_alive) 
        pQueue->AddTask( (m_nMaxAge / 2) * 1000, (Task *)this  );

    m_mutex.unlock();

}
Esempio n. 3
0
// Notify people we're quitting
BOOL quit_notify(void)
{
	APTR trap;
	char port[40];

	// Lock trap list
	trap=LockTrapList();

	// Look for quit traps
	while ((trap=FindTrapEntry(trap,"quit",port)))
	{
		// Send abort message
		rexx_handler_msg(port,0,0,HA_String,0,"quit",TAG_END);
	}

	// Unlock trap list
	UnlockTrapList();

	// Broadcast notify message
	SendNotifyMsg(DN_OPUS_QUIT,GUI->dopus_copy,0,0,GUI->rexx_port_name,0);

	return 1;
}