~ubuntu-branches/ubuntu/karmic/vzctl/karmic

« back to all changes in this revision

Viewing changes to include/veth.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2007-04-10 18:08:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070410180816-0uuzj9fnna7gmzxv
Tags: 3.0.16-4
Etch has been released which means that this version can be uploaded
to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2000-2006 SWsoft. All rights reserved.
 
2
 *  Copyright (C) 2000-2007 SWsoft. All rights reserved.
3
3
 *
4
4
 *  This program is free software; you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU General Public License as published by
19
19
#define _VETH_H_
20
20
 
21
21
#include "list.h"
 
22
#include "dist.h"
22
23
 
23
24
#define IFNAMSIZE       16
24
25
#define ETH_ALEN        6
 
26
#define MAC_SIZE        3*ETH_ALEN - 1
 
27
#define VZNETCFG        SBINDIR "/vznetcfg"
 
28
 
 
29
#define PROC_VETH       "/proc/vz/veth"
 
30
 
 
31
#define SW_OUI          0x001851
 
32
#define DEF_VETHNAME    "veth$VEID"
 
33
 
25
34
 
26
35
/** Data structure for devices.
27
36
 */
28
37
typedef struct {
29
 
        list_elem_t list;               /**< next element. */
 
38
        list_elem_t list;               /**< prev/next element. */
30
39
        char dev_addr[ETH_ALEN];        /**< device MAC address. */
31
40
        int addrlen;                    /**< device MAC address length. */
32
41
        char dev_name[IFNAMSIZE];       /**< device name. */
33
 
        char dev_addr_ve[ETH_ALEN];     /**< device MAC address in VPS. */
34
 
        int addrlen_ve;                 /**< VPS device MAC address length. */
35
 
        char dev_name_ve[IFNAMSIZE];    /**< device name in VPS. */
 
42
        char dev_addr_ve[ETH_ALEN];     /**< device MAC address in VE. */
 
43
        int addrlen_ve;                 /**< VE device MAC address length. */
 
44
        char dev_name_ve[IFNAMSIZE];    /**< device name in VE. */
36
45
        int flags;
 
46
        int active;
 
47
        int configure;
37
48
} veth_dev;
38
49
 
39
50
/** Devices list.
40
51
 */
41
52
typedef struct {
42
53
        list_head_t dev;
 
54
        int version;
 
55
        int delall;
43
56
} veth_param;
44
57
 
45
 
/** Create/remove veth devices for VPS.
 
58
/** Create/remove veth devices for VE.
46
59
 *
47
 
 * @param h             VPS handler.
48
 
 * @param veid          VPS id.
 
60
 * @param h             VE handler.
 
61
 * @param veid          VE id.
49
62
 * @return              0 on success.
50
63
 */
51
64
struct vps_param;
52
 
int vps_setup_veth(vps_handler *h, envid_t veid, struct vps_param *param);
 
65
int vps_setup_veth(vps_handler *h, envid_t veid, dist_actions *actions,
 
66
        char *root, veth_param *veth_add, veth_param *veth_del, int state,
 
67
        int skip);
53
68
int add_veth_param(veth_param *list, veth_dev *dev);
 
69
void free_veth(list_head_t *head);
54
70
void free_veth_param(veth_param *dev);
55
71
int copy_veth_param(veth_param *dst, veth_param *src);
56
72
int merge_veth_list(list_head_t *old, list_head_t *add, list_head_t *del,
57
73
        veth_param *merged);
 
74
void generate_mac(int veid, char *dev_name, char *mac);
 
75
void free_veth_dev(veth_dev *dev);
 
76
veth_dev *find_veth_by_ifname_ve(list_head_t *head, char *name);
 
77
veth_dev *find_veth_configure(list_head_t *head);
 
78
int merge_veth_list(list_head_t *old, list_head_t *add, list_head_t *del,
 
79
        veth_param *merged);
 
80
int parse_hwaddr(const char *str, char *addr);
 
81
int check_veth_param(envid_t veid, veth_param *veth_old, veth_param *veth_new,
 
82
        veth_param *veth_del);
 
83
 
58
84
#endif  /* _VETH_H_ */