source: trunk/packages/xen-3.1/xen-3.1/tools/vnet/vnet-module/vnet.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 3.0 KB
Line 
1/*
2 * Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free software Foundation, Inc.,
16 * 59 Temple Place, suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19#ifndef __VNET_VNET_H__
20#define __VNET_VNET_H__
21
22#ifdef __KERNEL__
23
24#include <asm/atomic.h>
25#include <linux/skbuff.h>
26#include <linux/if.h>
27#include <linux/netdevice.h>
28
29#else
30
31#include <linux/netdevice.h> // struct net_device_stats
32
33struct net_device {
34    char name[IFNAMSIZ];
35    char tap[255];
36    int  tapfd;
37};
38
39#endif
40
41#include <if_varp.h>
42
43struct sk_buff;
44
45struct IOStream;
46struct Vmac;
47struct Vif;
48struct SkbContext;
49struct VarpAddr;
50struct Tunnel;
51struct SAState;
52
53/** Vnet property record. */
54typedef struct Vnet {
55    /** Vnet id. */
56    struct VnetId vnet;
57    /** Reference count. */
58    atomic_t refcount;
59    /** Security flag. If true the vnet requires ESP. */
60    int security;
61    char device[IFNAMSIZ];
62
63    struct net_device *dev;
64   
65    /** Max size of the header. */
66    int header_n;
67    int mtu;
68    /** Statistics. */
69    struct net_device_stats stats;
70    int recursion;
71} Vnet;
72
73extern void vnet_print(struct IOStream *io);
74extern void Vnet_print(struct Vnet *info, struct IOStream *io);
75
76extern int Vnet_lookup(struct VnetId *vnet, struct Vnet **info);
77extern int Vnet_create(struct Vnet *info);
78extern int Vnet_add(struct Vnet *info);
79extern int Vnet_del(struct VnetId *vnet);
80extern void Vnet_incref(struct Vnet *info);
81extern void Vnet_decref(struct Vnet *info);
82extern int Vnet_alloc(struct Vnet **info);
83extern struct Vnet *vnet_physical;
84
85extern int skb_xmit(struct sk_buff *skb);
86extern int skb_xmit_fwd(struct sk_buff *skb);
87extern int vnet_skb_send(struct sk_buff *skb, struct VnetId *vnet);
88extern int vnet_skb_recv(struct sk_buff *skb, struct Vnet *vnet);
89
90extern int vnet_check_context(struct VnetId *vnet, struct SkbContext *context, struct Vnet **vinfo);
91
92extern int vnet_tunnel_open(struct VnetId *vnet, struct VarpAddr *addr, struct Tunnel **tunnel);
93extern int vnet_tunnel_lookup(struct VnetId *vnet, struct VarpAddr *addr, struct Tunnel **tunnel);
94extern int vnet_tunnel_send(struct VnetId *vnet, struct VarpAddr *addr, struct sk_buff *skb);
95
96extern int vnet_init(void);
97
98extern int vnet_sa_security(u32 spi, int protocol, u32 addr);
99extern int vnet_sa_create(u32 spi, int protocol, u32 addr, struct SAState **sa);
100
101enum {
102    VNET_PHYS = 1,
103    VNET_VIF = 2,
104};
105
106extern struct HashTable *vnet_table;
107
108#endif /* !__VNET_VNET_H__ */
Note: See TracBrowser for help on using the repository browser.