Lines Matching refs:vc

312 void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6])
314 snprintf(vc->info_str, sizeof(vc->info_str),
316 vc->model,
328 VLANClientState *vc;
330 for (vc = vlan->first_client; vc; vc = vc->next)
331 if (vc != vc1 && strcmp(vc->model, model) == 0)
349 VLANClientState *vc, **pvc;
350 vc = g_malloc0(sizeof(VLANClientState));
351 vc->model = strdup(model);
353 vc->name = strdup(name);
355 vc->name = assign_name(vc, model);
356 vc->can_receive = can_receive;
357 vc->receive = receive;
358 vc->receive_iov = receive_iov;
359 vc->cleanup = cleanup;
360 vc->opaque = opaque;
361 vc->vlan = vlan;
363 vc->next = NULL;
367 *pvc = vc;
368 return vc;
371 void qemu_del_vlan_client(VLANClientState *vc)
373 VLANClientState **pvc = &vc->vlan->first_client;
376 if (*pvc == vc) {
377 *pvc = vc->next;
378 if (vc->cleanup) {
379 vc->cleanup(vc);
381 free(vc->name);
382 free(vc->model);
383 g_free(vc);
405 VLANClientState *vc;
407 for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
408 if (vc == sender) {
413 if (!vc->can_receive || vc->can_receive(vc)) {
423 VLANClientState *vc;
428 for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
431 if (vc == sender) {
435 if (vc->link_down) {
440 len = vc->receive(vc, buf, size);
450 void qemu_flush_queued_packets(VLANClientState *vc)
454 while ((packet = vc->vlan->send_queue) != NULL) {
457 vc->vlan->send_queue = packet->next;
461 packet->next = vc->vlan->send_queue;
462 vc->vlan->send_queue = packet;
519 void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size)
521 qemu_send_packet_async(vc, buf, size, NULL);
524 static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
539 return vc->receive(vc, buffer, offset);
555 VLANClientState *vc;
560 for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
563 if (vc == sender) {
567 if (vc->link_down) {
572 if (vc->receive_iov) {
573 len = vc->receive_iov(vc, iov, iovcnt);
575 len = vc_sendv_compat(vc, iov, iovcnt);
640 qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt)
642 return qemu_sendv_packet_async(vc, iov, iovcnt, NULL);
789 static ssize_t slirp_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
808 static void net_slirp_cleanup(VLANClientState *vc)
1128 VLANClientState *vc;
1137 static ssize_t tap_receive_iov(VLANClientState *vc, const struct iovec *iov,
1140 TAPState *s = vc->opaque;
1150 static ssize_t tap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1152 TAPState *s = vc->opaque;
1166 return qemu_can_send_packet(s->vc);
1189 static void tap_send_completed(VLANClientState *vc)
1191 TAPState *s = vc->opaque;
1207 size = qemu_send_packet_async(s->vc, s->buf, size, tap_send_completed);
1214 static void tap_cleanup(VLANClientState *vc)
1216 TAPState *s = vc->opaque;
1237 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, tap_receive,
1240 snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd);
1501 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1515 VLANClientState *vc;
1527 qemu_send_packet(s->vc, buf, size);
1531 static ssize_t vde_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1533 VDEState *s = vc->opaque;
1543 static void vde_cleanup(VLANClientState *vc)
1545 VDEState *s = vc->opaque;
1571 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, vde_receive,
1574 snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d",
1582 VLANClientState *vc;
1599 static ssize_t net_socket_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1601 NetSocketState *s = vc->opaque;
1609 static ssize_t net_socket_receive_dgram(VLANClientState *vc, const uint8_t *buf, size_t size)
1611 NetSocketState *s = vc->opaque;
1672 qemu_send_packet(s->vc, s->buf, s->packet_len);
1694 qemu_send_packet(s->vc, s->buf, size);
1748 static void net_socket_cleanup(VLANClientState *vc)
1750 NetSocketState *s = vc->opaque;
1799 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive_dgram,
1806 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1827 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive,
1829 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1877 snprintf(s1->vc->info_str, sizeof(s1->vc->info_str),
1964 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1993 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
2027 static ssize_t dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
2029 DumpState *s = vc->opaque;
2056 static void net_dump_cleanup(VLANClientState *vc)
2058 DumpState *s = vc->opaque;
2498 VLANClientState *vc;
2502 for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
2503 if (!strcmp(vc->name, device)) {
2508 if (!vc) {
2512 if (!net_host_check_device(vc->model)) {
2516 qemu_del_vlan_client(vc);
2542 VLANClientState *vc;
2546 for(vc = vlan->first_client; vc != NULL; vc = vc->next)
2547 monitor_printf(mon, " %s: %s\n", vc->name, vc->info_str);
2554 VLANClientState *vc = NULL;
2557 for (vc = vlan->first_client; vc != NULL; vc = vc->next)
2558 if (strcmp(vc->name, name) == 0)
2562 if (!vc) {
2568 vc->link_down = 0;
2570 vc->link_down = 1;
2575 if (vc->link_status_changed)
2576 vc->link_status_changed(vc);
2587 VLANClientState *vc = vlan->first_client;
2589 while (vc) {
2590 VLANClientState *next = vc->next;
2592 qemu_del_vlan_client(vc);
2594 vc = next;