2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2009, Lei Xia <lxia@northwestern.edu>
11 * Copyright (c) 2009, Yuan Tang <ytang@northwestern.edu>
12 * Copyright (c) 2009, Jack Lange <jarusl@cs.northwestern.edu>
13 * Copyright (c) 2009, Peter Dinda <pdinda@northwestern.edu
14 * Copyright (c) 2009, The V3VEE Project <http://www.v3vee.org>
15 * All rights reserved.
17 * Author: Lei Xia <lxia@northwestern.edu>
18 * Yuan Tang <ytang@northwestern.edu>
19 * Jack Lange <jarusl@cs.northwestern.edu>
20 * Peter Dinda <pdinda@northwestern.edu
22 * This is free software. You are permitted to use,
23 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
29 #include <palacios/vmm.h>
30 #include <palacios/vmm_string.h>
31 #include <palacios/vmm_types.h>
32 #include <palacios/vmm_queue.h>
33 #include <palacios/vmm_socket.h>
34 #include <palacios/vmm_hashtable.h>
37 #define ETHERNET_HEADER_LEN 14
38 #define ETHERNET_DATA_MIN 46
39 #define ETHERNET_DATA_MAX 1500
40 #define ETHERNET_PACKET_LEN (ETHERNET_HEADER_LEN + ETHERNET_DATA_MAX)
51 int type; //EDGE_TYPE|INTERFACE_TYPE
62 //This is the structure that stores the topology
69 unsigned short remote_port;
75 int type; //TCP=0, UDP=1,VTP=2, can be extended so on
91 struct vnet_if_device {
93 struct ethAddr device_addr;
95 int (*input)(uchar_t * pkt, uint_t size);
102 struct vnet_if_device *device;
111 // 14 (ethernet frame) + 20 bytes
113 char ethernetdest[6];
115 unsigned char ethernettype[2]; // indicates layer 3 protocol type
119 #define FOREACH(iter, list, start) for (iter = start; iter != -1; iter = list[iter].next)
120 #define FOREACH_SOCK(iter, socks, start) FOREACH(iter, socks, start)
121 #define FOREACH_LINK(iter, links, start) FOREACH(iter, links, start)
122 #define FOREACH_ROUTE(iter, routes, start) FOREACH(iter, routes, start)
123 #define FOREACH_DEVICE(iter, devices, start) FOREACH(iter, devices, start)
126 int V3_Send_pkt(uchar_t *buf, int length);
127 int V3_Register_pkt_event(int (*netif_input)(uchar_t * pkt, uint_t size));
130 int vnet_send_pkt(char *buf, int length);
131 int vnet_register_pkt_event(char *dev_name, int (*netif_input)(uchar_t * pkt, uint_t size), void *data);
133 int vnet_pkt_process();