ia64/xen-unstable

view tools/vnet/vnet-module/if_varp.h @ 8740:3d7ea7972b39

Update patches for linux 2.6.15.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 02 17:16:00 2006 +0000 (2006-02-02)
parents 06d84bf87159
children 71b0f00f6344
line source
1 /*
2 * Copyright (C) 2004 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 */
20 #ifndef _VNET_IF_VARP_H
21 #define _VNET_IF_VARP_H
23 /* Need struct in_addr, struct in6_addr. */
24 #ifdef __KERNEL__
25 #include <linux/in.h>
26 #include <linux/in6.h>
27 #else
28 #include <netinet/in.h>
29 #endif
31 typedef struct Vmac {
32 unsigned char mac[ETH_ALEN];
33 } Vmac;
35 enum {
36 VARP_ID = 1,
37 VARP_OP_REQUEST = 1,
38 VARP_OP_ANNOUNCE = 2,
39 };
41 typedef struct VnetId {
42 union {
43 uint8_t vnet8[16];
44 uint16_t vnet16[8];
45 uint32_t vnet32[4];
46 } u;
47 } __attribute__((packed)) VnetId;
49 typedef struct VarpAddr {
50 uint8_t family; // AF_INET or AF_INET6.
51 union {
52 uint8_t raw[16];
53 struct in_addr ip4;
54 struct in6_addr ip6;
55 } u;
56 } __attribute__((packed)) VarpAddr;
58 typedef struct VnetMsgHdr {
59 uint16_t id;
60 uint16_t opcode;
61 } __attribute__((packed)) VnetMsgHdr;
63 typedef struct VarpHdr {
64 VnetMsgHdr hdr;
65 VnetId vnet;
66 Vmac vmac;
67 VarpAddr addr;
68 } __attribute__((packed)) VarpHdr;
71 /** Default address for varp/vnet broadcasts: 224.10.0.1 */
72 #define VARP_MCAST_ADDR 0xe00a0001
74 /** UDP port to use for varp protocol. */
75 #define VARP_PORT 1798
77 #endif /* ! _VNET_IF_VARP_H */