]>
Commit | Line | Data |
---|---|---|
0ad19a3f | 1 | /* |
2 | * lxc: linux Container library | |
3 | * | |
4 | * (C) Copyright IBM Corp. 2007, 2008 | |
5 | * | |
6 | * Authors: | |
7 | * Daniel Lezcano <dlezcano at fr.ibm.com> | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2.1 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | */ | |
23 | #ifndef _network_h | |
24 | #define _network_h | |
25 | ||
0ad19a3f | 26 | /* |
27 | * Convert a string mac address to a socket structure | |
28 | */ | |
29 | extern int lxc_convert_mac(char *macaddr, struct sockaddr *sockaddr); | |
30 | ||
31 | /* | |
32 | * Move a device between namespaces | |
33 | */ | |
d472214b | 34 | extern int lxc_netdev_move_by_index(int ifindex, pid_t pid); |
0ad19a3f | 35 | |
36 | /* | |
37 | * Delete a network device | |
38 | */ | |
b84f58b9 DL |
39 | extern int lxc_netdev_delete_by_name(const char *name); |
40 | extern int lxc_netdev_delete_by_index(int ifindex); | |
0ad19a3f | 41 | |
b9a5bb58 | 42 | /* |
b84f58b9 | 43 | * Change the device name |
b9a5bb58 | 44 | */ |
b84f58b9 DL |
45 | extern int lxc_netdev_rename_by_name(const char *oldname, const char *newname); |
46 | extern int lxc_netdev_rename_by_index(int ifindex, const char *newname); | |
b9a5bb58 | 47 | |
0ad19a3f | 48 | /* |
d472214b | 49 | * Set the device network up or down |
0ad19a3f | 50 | */ |
d472214b DL |
51 | extern int lxc_netdev_up(const char *name); |
52 | extern int lxc_netdev_down(const char *name); | |
0ad19a3f | 53 | |
75d09f83 DL |
54 | /* |
55 | * Change the mtu size for the specified device | |
56 | */ | |
d472214b | 57 | extern int lxc_netdev_set_mtu(const char *name, int mtu); |
75d09f83 | 58 | |
0ad19a3f | 59 | /* |
d472214b | 60 | * Create a virtual network devices |
0ad19a3f | 61 | */ |
497353b6 | 62 | extern int lxc_veth_create(const char *name1, const char *name2); |
e892973e | 63 | extern int lxc_macvlan_create(const char *master, const char *name, int mode); |
26c39028 JHS |
64 | extern int lxc_vlan_create(const char *master, const char *name, ushort vid); |
65 | ||
0ad19a3f | 66 | /* |
67 | * Activate forwarding | |
68 | */ | |
497353b6 | 69 | extern int lxc_ip_forward_on(const char *name, int family); |
0ad19a3f | 70 | |
71 | /* | |
72 | * Disable forwarding | |
73 | */ | |
497353b6 | 74 | extern int lxc_ip_forward_off(const char *name, int family); |
0ad19a3f | 75 | |
76 | /* | |
77 | * Set ip address | |
78 | */ | |
1f1b18e7 DL |
79 | extern int lxc_ipv6_addr_add(int ifindex, struct in6_addr *addr, |
80 | struct in6_addr *mcast, | |
81 | struct in6_addr *acast, int prefix); | |
82 | ||
83 | extern int lxc_ipv4_addr_add(int ifindex, struct in_addr *addr, | |
84 | struct in_addr *bcast, int prefix); | |
0ad19a3f | 85 | |
86 | /* | |
87 | * Attach an interface to the bridge | |
88 | */ | |
497353b6 | 89 | extern int lxc_bridge_attach(const char *bridge, const char *ifname); |
0ad19a3f | 90 | |
0ad19a3f | 91 | /* |
92 | * Create default gateway | |
93 | */ | |
497353b6 DL |
94 | extern int lxc_route_create_default(const char *addr, const char *ifname, |
95 | int gateway); | |
0ad19a3f | 96 | |
97 | /* | |
98 | * Delete default gateway | |
99 | */ | |
497353b6 DL |
100 | extern int lxc_route_delete_default(const char *addr, const char *ifname, |
101 | int gateway); | |
0ad19a3f | 102 | |
103 | /* | |
104 | * Activate neighbor proxying | |
105 | */ | |
497353b6 | 106 | extern int lxc_neigh_proxy_on(const char *name, int family); |
0ad19a3f | 107 | |
108 | /* | |
109 | * Disable neighbor proxying | |
110 | */ | |
497353b6 | 111 | extern int lxc_neigh_proxy_off(const char *name, int family); |
0ad19a3f | 112 | |
113 | #endif |