diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-11-25 18:49:10 +0000 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-12-03 09:41:30 -0600 |
commit | ebef2c093e47103464cd459d811803692c7315e6 (patch) | |
tree | 28f9b764654e6605e1c23465dfcdfd8ddff4d8a0 /net.c | |
parent | 731d5856cbb9c160fe02b90cd3cf354ea4f52f34 (diff) | |
download | qemu-ebef2c093e47103464cd459d811803692c7315e6.zip qemu-ebef2c093e47103464cd459d811803692c7315e6.tar.gz qemu-ebef2c093e47103464cd459d811803692c7315e6.tar.bz2 |
net: introduce NICState and qemu_new_nic()
Common state for all NICs.
The opaque member will replace the opaque member in VLANClientState
since only NICs need it.
The conf member will allow us to iterate over NICs, access the MAC
addr for the NIC and send a packet from each NIC in qemu_announce_self().
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.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -293,6 +293,27 @@ VLANClientState *qemu_new_net_client(NetClientInfo *info, return vc; } +NICState *qemu_new_nic(NetClientInfo *info, + NICConf *conf, + const char *model, + const char *name, + void *opaque) +{ + VLANClientState *nc; + NICState *nic; + + assert(info->type == NET_CLIENT_TYPE_NIC); + assert(info->size >= sizeof(NICState)); + + nc = qemu_new_net_client(info, conf->vlan, conf->peer, model, name); + + nic = DO_UPCAST(NICState, nc, nc); + nic->conf = conf; + nic->opaque = opaque; + + return nic; +} + VLANClientState *qemu_new_vlan_client(net_client_type type, VLANState *vlan, VLANClientState *peer, |