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>
35 #include <palacios/vmm_sprintf.h>
38 #define ETHERNET_HEADER_LEN 14
39 #define ETHERNET_DATA_MIN 46
40 #define ETHERNET_DATA_MAX 1500
41 #define ETHERNET_PACKET_LEN (ETHERNET_HEADER_LEN + ETHERNET_DATA_MAX)
53 int dest; //link[dest] is the link to be used to send pkt
54 int type; //EDGE|INTERFACE|ANY
57 int src_type; //EDGE|INTERFACE|ANY
63 // struct list_head entry_list;
67 // uint_t num_entries;
68 // struct list_head entries;
71 //This is the structure that stores the topology
78 unsigned short remote_port;
81 int type; //TCP=0, UDP=1,VTP=2, can be extended so on
101 struct vnet_if_device {
103 struct ethAddr device_addr;
105 int (*input)(uchar_t * pkt, uint_t size);
112 struct vnet_if_device *device;
121 // 14 (ethernet frame) + 20 bytes
123 char ethernetdest[6];
125 unsigned char ethernettype[2]; // indicates layer 3 protocol type
129 #define FOREACH(iter, list, start) for (iter = start; iter != -1; iter = list[iter].next)
130 #define FOREACH_SOCK(iter, socks, start) FOREACH(iter, socks, start)
131 #define FOREACH_LINK(iter, links, start) FOREACH(iter, links, start)
132 #define FOREACH_ROUTE(iter, routes, start) FOREACH(iter, routes, start)
133 #define FOREACH_DEVICE(iter, devices, start) FOREACH(iter, devices, start)
136 int v3_Send_pkt(uchar_t *buf, int length);
137 int v3_Register_pkt_event(int (*netif_input)(uchar_t * pkt, uint_t size));
140 int vnet_send_pkt(char *buf, int length);
141 int vnet_register_pkt_event(char *dev_name, int (*netif_input)(uchar_t * pkt, uint_t size), void *data);
143 int v3_vnet_pkt_process();