aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-11-25 18:49:31 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:35 -0600
commit57f9ef173d940ec5c2d04a9d1a37b4c86c9f5b27 (patch)
treed09cf6d79d90f6fe807225ebce68ab7fa3d60f7d /net.c
parent665a3b071dc6351f9d1840dc50f7cda80bca5f40 (diff)
downloadqemu-57f9ef173d940ec5c2d04a9d1a37b4c86c9f5b27.zip
qemu-57f9ef173d940ec5c2d04a9d1a37b4c86c9f5b27.tar.gz
qemu-57f9ef173d940ec5c2d04a9d1a37b4c86c9f5b27.tar.bz2
net: add qemu_foreach_nic()
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net.c b/net.c
index a1ec243..c71699d 100644
--- a/net.c
+++ b/net.c
@@ -326,6 +326,26 @@ qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
return vc;
}
+void qemu_foreach_nic(qemu_nic_foreach func, void *opaque)
+{
+ VLANClientState *nc;
+ VLANState *vlan;
+
+ QTAILQ_FOREACH(nc, &non_vlan_clients, next) {
+ if (nc->info->type == NET_CLIENT_TYPE_NIC) {
+ func(DO_UPCAST(NICState, nc, nc), opaque);
+ }
+ }
+
+ QTAILQ_FOREACH(vlan, &vlans, next) {
+ QTAILQ_FOREACH(nc, &vlan->clients, next) {
+ if (nc->info->type == NET_CLIENT_TYPE_NIC) {
+ func(DO_UPCAST(NICState, nc, nc), opaque);
+ }
+ }
+ }
+}
+
int qemu_can_send_packet(VLANClientState *sender)
{
VLANState *vlan = sender->vlan;