Lines Matching refs:vc

304 void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6])
306 snprintf(vc->info_str, sizeof(vc->info_str),
308 vc->model,
320 VLANClientState *vc;
322 for (vc = vlan->first_client; vc; vc = vc->next)
323 if (vc != vc1 && strcmp(vc->model, model) == 0)
341 VLANClientState *vc, **pvc;
342 vc = g_malloc0(sizeof(VLANClientState));
343 vc->model = strdup(model);
345 vc->name = strdup(name);
347 vc->name = assign_name(vc, model);
348 vc->can_receive = can_receive;
349 vc->receive = receive;
350 vc->receive_iov = receive_iov;
351 vc->cleanup = cleanup;
352 vc->opaque = opaque;
353 vc->vlan = vlan;
355 vc->next = NULL;
359 *pvc = vc;
360 return vc;
363 void qemu_del_vlan_client(VLANClientState *vc)
365 VLANClientState **pvc = &vc->vlan->first_client;
368 if (*pvc == vc) {
369 *pvc = vc->next;
370 if (vc->cleanup) {
371 vc->cleanup(vc);
373 free(vc->name);
374 free(vc->model);
375 g_free(vc);
397 VLANClientState *vc;
399 for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
400 if (vc == sender) {
405 if (!vc->can_receive || vc->can_receive(vc)) {
415 VLANClientState *vc;
420 for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
423 if (vc == sender) {
427 if (vc->link_down) {
432 len = vc->receive(vc, buf, size);
442 void qemu_flush_queued_packets(VLANClientState *vc)
446 while ((packet = vc->vlan->send_queue) != NULL) {
449 vc->vlan->send_queue = packet->next;
453 packet->next = vc->vlan->send_queue;
454 vc->vlan->send_queue = packet;
511 void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size)
513 qemu_send_packet_async(vc, buf, size, NULL);
516 static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
531 return vc->receive(vc, buffer, offset);
547 VLANClientState *vc;
552 for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
555 if (vc == sender) {
559 if (vc->link_down) {
564 if (vc->receive_iov) {
565 len = vc->receive_iov(vc, iov, iovcnt);
567 len = vc_sendv_compat(vc, iov, iovcnt);
632 qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt)
634 return qemu_sendv_packet_async(vc, iov, iovcnt, NULL);
694 static ssize_t slirp_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
706 static void net_slirp_cleanup(VLANClientState *vc)
1025 VLANClientState *vc;
1034 static ssize_t tap_receive_iov(VLANClientState *vc, const struct iovec *iov,
1037 TAPState *s = vc->opaque;
1047 static ssize_t tap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1049 TAPState *s = vc->opaque;
1063 return qemu_can_send_packet(s->vc);
1086 static void tap_send_completed(VLANClientState *vc)
1088 TAPState *s = vc->opaque;
1104 size = qemu_send_packet_async(s->vc, s->buf, size, tap_send_completed);
1111 static void tap_cleanup(VLANClientState *vc)
1113 TAPState *s = vc->opaque;
1134 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, tap_receive,
1137 snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd);
1398 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1412 VLANClientState *vc;
1424 qemu_send_packet(s->vc, buf, size);
1428 static ssize_t vde_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1430 VDEState *s = vc->opaque;
1440 static void vde_cleanup(VLANClientState *vc)
1442 VDEState *s = vc->opaque;
1468 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, vde_receive,
1471 snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d",
1479 VLANClientState *vc;
1496 static ssize_t net_socket_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1498 NetSocketState *s = vc->opaque;
1506 static ssize_t net_socket_receive_dgram(VLANClientState *vc, const uint8_t *buf, size_t size)
1508 NetSocketState *s = vc->opaque;
1570 qemu_send_packet(s->vc, s->buf, s->packet_len);
1592 qemu_send_packet(s->vc, s->buf, size);
1655 static void net_socket_cleanup(VLANClientState *vc)
1657 NetSocketState *s = vc->opaque;
1707 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive_dgram,
1714 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1735 s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive,
1737 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1792 snprintf(s1->vc->info_str, sizeof(s1->vc->info_str),
1885 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1914 snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1948 static ssize_t dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
1950 DumpState *s = vc->opaque;
1977 static void net_dump_cleanup(VLANClientState *vc)
1979 DumpState *s = vc->opaque;
2419 VLANClientState *vc;
2423 for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
2424 if (!strcmp(vc->name, device)) {
2429 if (!vc) {
2433 if (!net_host_check_device(vc->model)) {
2437 qemu_del_vlan_client(vc);
2463 VLANClientState *vc;
2467 for(vc = vlan->first_client; vc != NULL; vc = vc->next)
2468 monitor_printf(mon, " %s: %s\n", vc->name, vc->info_str);
2475 VLANClientState *vc = NULL;
2478 for (vc = vlan->first_client; vc != NULL; vc = vc->next)
2479 if (strcmp(vc->name, name) == 0)
2483 if (!vc) {
2489 vc->link_down = 0;
2491 vc->link_down = 1;
2496 if (vc->link_status_changed)
2497 vc->link_status_changed(vc);
2508 VLANClientState *vc = vlan->first_client;
2510 while (vc) {
2511 VLANClientState *next = vc->next;
2513 qemu_del_vlan_client(vc);
2515 vc = next;