X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_host_events.c;h=2f52e3061a1ca0d7130beddc05e6ad9e9820d434;hb=a0d3be5212e7a5053ba213ce7bd26c7124cf01e3;hp=bbacce5113d8f1e5cb18921bf243383af14e4d0f;hpb=7ee094e43dab15b0139847bca24cef904f8a42f6;p=palacios.git diff --git a/palacios/src/palacios/vmm_host_events.c b/palacios/src/palacios/vmm_host_events.c index bbacce5..2f52e30 100644 --- a/palacios/src/palacios/vmm_host_events.c +++ b/palacios/src/palacios/vmm_host_events.c @@ -30,6 +30,7 @@ int v3_init_host_events(struct v3_vm_info * vm) { INIT_LIST_HEAD(&(host_evts->timer_events)); INIT_LIST_HEAD(&(host_evts->serial_events)); INIT_LIST_HEAD(&(host_evts->console_events)); + INIT_LIST_HEAD(&(host_evts->packet_events)); return 0; } @@ -68,6 +69,9 @@ int v3_hook_host_event(struct v3_vm_info * vm, case HOST_CONSOLE_EVT: list_add(&(hook->link), &(host_evts->console_events)); break; + case HOST_PACKET_EVT: + list_add(&(hook->link), &(host_evts->packet_events)); + break; } return 0; @@ -198,3 +202,30 @@ int v3_deliver_console_event(struct v3_vm_info * vm, return 0; } + +int v3_deliver_packet_event(struct v3_vm_info * vm, + struct v3_packet_event * evt) { + struct v3_host_events * host_evts = NULL; + struct v3_host_event_hook * hook = NULL; + + if (vm == NULL) { + vm = v3_get_foreground_vm(); + } + + host_evts = &(vm->host_event_hooks); + + if (vm->run_state != VM_RUNNING) { + return -1; + } + + list_for_each_entry(hook, &(host_evts->packet_events), link) { + if (hook->cb.packet_handler(vm, evt, hook->private_data) == -1) { + return -1; + } + } + + return 0; +} + + +