当前位置: 首页>>代码示例>>C++>>正文


C++ InterfaceList类代码示例

本文整理汇总了C++中InterfaceList的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceList类的具体用法?C++ InterfaceList怎么用?C++ InterfaceList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InterfaceList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeVrrpInterfaces

void VrrpManager::removeVrrpInterfaces ()
{
	InterfaceList interfaces = Netlink::interfaces();
	for (InterfaceList::const_iterator interface = interfaces.begin(); interface != interfaces.end(); ++interface)
	{
		if (interface->second.substr(0, 4) == "vrrp")
			Netlink::removeInterface(interface->first);
	}
}
开发者ID:pchri03,项目名称:OpenVRRP,代码行数:9,代码来源:vrrpmanager.cpp

示例2:

std::vector<IComponent*> CComponentManager::Script_GetComponentsWithInterface(void* cbdata, int iid)
{
	CComponentManager* componentManager = static_cast<CComponentManager*> (cbdata);

	std::vector<IComponent*> ret;
	InterfaceList ents = componentManager->GetEntitiesWithInterface(iid);
	for (InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it)
		ret.push_back(it->second); // TODO: maybe we should exclude local entities
	return ret;
}
开发者ID:nahumfarchi,项目名称:0ad,代码行数:10,代码来源:ComponentManager.cpp

示例3: end

const CallManager::InterfaceList CallManager::get_interfaces () const
{
  InterfaceList list;

  for (CallManager::iterator iter = begin ();
       iter != end ();
       iter++)
    list.push_back ((*iter)->get_listen_interface ());

  return list;
}
开发者ID:NeoWing,项目名称:ekiga-3.2.7,代码行数:11,代码来源:call-manager.cpp

示例4: Q_Q

void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5()
{
    Q_Q(QBluetoothDeviceDiscoveryAgent);


    bool ok = false;
    const QString adapterPath = findAdapterForAddress(m_adapterAddress, &ok);
    if (!ok || adapterPath.isEmpty()) {
        qCWarning(QT_BT_BLUEZ) << "Cannot find Bluez 5 adapter for device search" << ok;
        lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
        errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot find valid Bluetooth adapter.");
        q->error(lastError);
        return;
    }

    adapterBluez5 = new OrgBluezAdapter1Interface(QStringLiteral("org.bluez"),
                                                  adapterPath,
                                                  QDBusConnection::systemBus());

    if (!adapterBluez5->powered()) {
        qCDebug(QT_BT_BLUEZ) << "Aborting device discovery due to offline Bluetooth Adapter";
        lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
        errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
        delete adapterBluez5;
        adapterBluez5 = 0;
        emit q->error(lastError);
        return;
    }


    QtBluezDiscoveryManager::instance()->registerDiscoveryInterest(adapterBluez5->path());
    QObject::connect(QtBluezDiscoveryManager::instance(), SIGNAL(discoveryInterrupted(QString)),
            q, SLOT(_q_discoveryInterrupted(QString)));

    // collect initial set of information
    QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
    reply.waitForFinished();
    if (!reply.isError()) {
        foreach (const QDBusObjectPath &path, reply.value().keys()) {
            const InterfaceList ifaceList = reply.value().value(path);
            foreach (const QString &iface, ifaceList.keys()) {
                if (iface == QStringLiteral("org.bluez.Device1")) {

                    if (path.path().indexOf(adapterBluez5->path()) != 0)
                        continue; //devices whose path doesn't start with same path we skip

                    deviceFoundBluez5(path.path());
                }
            }
        }
    }
开发者ID:RobinWuDev,项目名称:Qt,代码行数:51,代码来源:qbluetoothdevicediscoveryagent_bluez.cpp

示例5: sizeof

QString QBluetoothSocketPrivate::peerName() const
{
    quint64 bdaddr;

    if (socketType == QBluetoothServiceInfo::RfcommProtocol) {
        sockaddr_rc addr;
        socklen_t addrLength = sizeof(addr);

        if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
            return QString();

        convertAddress(addr.rc_bdaddr.b, bdaddr);
    } else if (socketType == QBluetoothServiceInfo::L2capProtocol) {
        sockaddr_l2 addr;
        socklen_t addrLength = sizeof(addr);

        if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
            return QString();

        convertAddress(addr.l2_bdaddr.b, bdaddr);
    } else {
        qCWarning(QT_BT_BLUEZ) << "peerName() called on socket of unknown type";
        return QString();
    }

    const QString peerAddress = QBluetoothAddress(bdaddr).toString();
    const QString localAdapter = localAddress().toString();

    if (isBluez5()) {
        OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
                                                         QStringLiteral("/"),
                                                         QDBusConnection::systemBus());
        QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
        reply.waitForFinished();
        if (reply.isError())
            return QString();

        foreach (const QDBusObjectPath &path, reply.value().keys()) {
            const InterfaceList ifaceList = reply.value().value(path);
            foreach (const QString &iface, ifaceList.keys()) {
                if (iface == QStringLiteral("org.bluez.Device1")) {
                    if (ifaceList.value(iface).value(QStringLiteral("Address")).toString()
                            == peerAddress)
                        return ifaceList.value(iface).value(QStringLiteral("Alias")).toString();
                }
            }
        }
        return QString();
    } else {
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:49,代码来源:qbluetoothsocket_bluez.cpp

示例6: get_interface_for_link

/*!	Returns a reference to an Interface that matches the given \a linkAddress.
	The link address is checked against its hardware address, or its interface
	name, or finally the interface index.
*/
Interface*
get_interface_for_link(net_domain* domain, const sockaddr* _linkAddress)
{
	sockaddr_dl& linkAddress = *(sockaddr_dl*)_linkAddress;

	RecursiveLocker locker(sLock);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		if (interface->IsBusy())
			continue;
		// Test if the hardware address matches, or if the given interface
		// matches, or if at least the index matches.
		if ((linkAddress.sdl_alen == interface->device->address.length
				&& memcmp(LLADDR(&linkAddress), interface->device->address.data,
					linkAddress.sdl_alen) == 0)
			|| (linkAddress.sdl_nlen > 0
				&& !strcmp(interface->name, (const char*)linkAddress.sdl_data))
			|| (linkAddress.sdl_nlen == 0 && linkAddress.sdl_alen == 0
				&& linkAddress.sdl_index == interface->index)) {
			if (interface->IsBusy())
				return NULL;
			if (interface->CreateDomainDatalinkIfNeeded(domain) != B_OK)
				return NULL;

			interface->AcquireReference();
			return interface;
		}
	}

	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:36,代码来源:interfaces.cpp

示例7: get_interface_address_for_link

/*!	Returns a reference to an InterfaceAddress of the specified \a domain that
	belongs to the interface identified via \a linkAddress. Only the hardware
	address is matched.

	If \a unconfiguredOnly is set, the interface address must not yet be
	configured, or must currently be in the process of being configured.
*/
InterfaceAddress*
get_interface_address_for_link(net_domain* domain, const sockaddr* address,
	bool unconfiguredOnly)
{
	sockaddr_dl& linkAddress = *(sockaddr_dl*)address;

	RecursiveLocker locker(sLock);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		if (interface->IsBusy())
			continue;
		// Test if the hardware address matches, or if the given interface
		// matches, or if at least the index matches.
		if (linkAddress.sdl_alen == interface->device->address.length
			&& memcmp(LLADDR(&linkAddress), interface->device->address.data,
				linkAddress.sdl_alen) == 0) {
			TRACE("  %s matches\n", interface->name);
			// link address matches
			if (unconfiguredOnly)
				return interface->FirstUnconfiguredForFamily(domain->family);

			return interface->FirstForFamily(domain->family);
		}
	}

	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:interfaces.cpp

示例8: dump_interfaces

static int
dump_interfaces(int argc, char** argv)
{
	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		kprintf("%p  %s\n", interface, interface->name);
	}
	return 0;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:9,代码来源:interfaces.cpp

示例9: dump_interface_refs

//! For debugging purposes only
void
dump_interface_refs(void)
{
	RecursiveLocker locker(sLock);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		dprintf("%p: %s, %ld\n", interface, interface->name,
			interface->CountReferences());
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:12,代码来源:interfaces.cpp

示例10: find_interface

/*!	Searches for a specific interface by index.
	You need to have the interface list's lock hold when calling this function.
*/
static struct Interface*
find_interface(uint32 index)
{
	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		if (interface->index == index)
			return interface;
	}

	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:14,代码来源:interfaces.cpp

示例11: interfacesAdded

void NeardHelper::interfacesAdded(const QDBusObjectPath &path, InterfaceList interfaceList)
{
    foreach (const QString &key, interfaceList.keys()) {
        if (key == QStringLiteral("org.neard.Tag")) {
            emit tagFound(path);
            break;
        }
        if (key == QStringLiteral("org.neard.Record")) {
            emit recordFound(path);
            break;
        }
    }
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:13,代码来源:neard_helper.cpp

示例12: QNearFieldManagerPrivate

// TODO We need a constructor that lets us select an adapter
QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl()
    : QNearFieldManagerPrivate(),
      m_neardHelper(NeardHelper::instance())
{
    QDBusPendingReply<ManagedObjectList> reply = m_neardHelper->dbusObjectManager()->GetManagedObjects();
    reply.waitForFinished();
    if (reply.isError()) {
        qCWarning(QT_NFC_NEARD) << "Error getting managed objects";
        return;
    }

    bool found = false;
    foreach (const QDBusObjectPath &path, reply.value().keys()) {
        const InterfaceList ifaceList = reply.value().value(path);
        foreach (const QString &iface, ifaceList.keys()) {
            if (iface == QStringLiteral("org.neard.Adapter")) {
                found = true;
                m_adapterPath = path.path();
                qCDebug(QT_NFC_NEARD) << "org.neard.Adapter found for path" << m_adapterPath;
                break;
            }
        }

        if (found)
            break;
    }

    if (!found) {
        qCWarning(QT_NFC_NEARD) << "no adapter found, neard daemon running?";
    } else {
        connect(m_neardHelper, SIGNAL(tagFound(QDBusObjectPath)),
                this,          SLOT(handleTagFound(QDBusObjectPath)));
        connect(m_neardHelper, SIGNAL(tagRemoved(QDBusObjectPath)),
                this,          SLOT(handleTagRemoved(QDBusObjectPath)));
    }
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:37,代码来源:qnearfieldmanager_neard.cpp

示例13: error

/*!	Dumps a list of all interfaces into the supplied userland buffer.
	If the interfaces don't fit into the buffer, an error (\c ENOBUFS) is
	returned.
*/
status_t
list_interfaces(int family, void* _buffer, size_t* bufferSize)
{
	RecursiveLocker locker(sLock);

	UserBuffer buffer(_buffer, *bufferSize);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		// Copy name
		buffer.Push(interface->name, IF_NAMESIZE);

		// Copy address
		InterfaceAddress* address = interface->FirstForFamily(family);
		size_t length = 0;

		if (address != NULL && address->local != NULL) {
			// Actual address
			buffer.Push(address->local, length = address->local->sa_len);
		} else {
			// Empty address
			sockaddr empty;
			empty.sa_len = 2;
			empty.sa_family = AF_UNSPEC;
			buffer.Push(&empty, length = empty.sa_len);
		}

		if (address != NULL)
			address->ReleaseReference();

		if (IF_NAMESIZE + length < sizeof(ifreq)) {
			// Make sure at least sizeof(ifreq) bytes are written for each
			// interface for compatibility with other platforms
			buffer.Pad(sizeof(ifreq) - IF_NAMESIZE - length);
		}

		if (buffer.Status() != B_OK)
			return buffer.Status();
	}

	*bufferSize = buffer.BytesConsumed();
	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:47,代码来源:interfaces.cpp

示例14: get_interface_address_for_destination

InterfaceAddress*
get_interface_address_for_destination(net_domain* domain,
	const sockaddr* destination)
{
	RecursiveLocker locker(sLock);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		if (interface->IsBusy())
			continue;

		InterfaceAddress* address
			= interface->AddressForDestination(domain, destination);
		if (address != NULL)
			return address;
	}

	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:19,代码来源:interfaces.cpp

示例15: get_interface_for_device

Interface*
get_interface_for_device(net_domain* domain, uint32 index)
{
	RecursiveLocker locker(sLock);

	InterfaceList::Iterator iterator = sInterfaces.GetIterator();
	while (Interface* interface = iterator.Next()) {
		if (interface->device->index == index) {
			if (interface->IsBusy())
				return NULL;
			if (interface->CreateDomainDatalinkIfNeeded(domain) != B_OK)
				return NULL;

			interface->AcquireReference();
			return interface;
		}
	}

	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:20,代码来源:interfaces.cpp


注:本文中的InterfaceList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。