Patent ID: 8571848

Claim:
A network emulation apparatus, comprising: a hardware processor; and a non-transitory computer-readable medium, wherein the non-transitory computer-readable medium comprises computer-readable code executable by the hardware processor, and wherein the computer-readable code comprises: a network driver interface specification (NDIS) hook driver, disposed in a kernel mode, configured to intercept packets transferred from a user-mode application program; and an emulation module, disposed in the user mode, configured to receive the packets from the NDIS hook driver, perform network emulation of a first packet in the packets, and transfer the first packet to the NDIS hook driver after the network emulation of the first packet is performed, wherein the emulation module comprises: a flow classifier configured to classify the first packet based on its flow; a plurality of real queues each corresponding to a respective flow, wherein the first packet is stored in at least one of the real queues based on its flow; a virtual queue configured to store a generated virtual packet corresponding to the first packet; a virtual network comprising a plurality of virtual nodes configured to transfer the virtual packet; and a packet dispatcher configured to transfer the first packet to the NDIS hook driver when the virtual packet corresponding to the first packet arrives at a destination node in the virtual network.