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)
50 #define HANDLER_ERROR -1
51 #define HANDLER_SUCCESS 0
63 int type; //EDGE_TYPE|INTERFACE_TYPE
74 //This is the structure that stores the topology
81 unsigned short remote_port;
87 int type; //TCP=0, UDP=1,VTP=2, can be extended so on
101 #define GENERAL_NIC 0
103 struct vnet_if_device{
105 struct ethAddr device_addr;
107 int (*input)(uchar_t * pkt, uint_t size);
114 struct vnet_if_device *device;
123 // 14 (ethernet frame) + 20 bytes
125 char ethernetdest[6];
127 unsigned char ethernettype[2]; // indicates layer 3 protocol type
131 #define FOREACH(iter, list, start) for (iter = start; iter != -1; iter = list[iter].next)
132 #define FOREACH_SOCK(iter, socks, start) FOREACH(iter, socks, start)
133 #define FOREACH_LINK(iter, links, start) FOREACH(iter, links, start)
134 #define FOREACH_ROUTE(iter, routes, start) FOREACH(iter, routes, start)
135 #define FOREACH_DEVICE(iter, devices, start) FOREACH(iter, devices, start)
138 int V3_Send_pkt(uchar_t *buf, int length);
139 int V3_Register_pkt_event(int (*netif_input)(uchar_t * pkt, uint_t size));
142 int vnet_send_pkt(char *buf, int length);
143 int vnet_register_pkt_event(char *dev_name, int (*netif_input)(uchar_t * pkt, uint_t size), void *data);
145 int vnet_pkt_process();