]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/network.h
use same ifndef/define format for all headers
[mirror_lxc.git] / src / lxc / network.h
CommitLineData
0ad19a3f 1/*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
9afe19d6 7 * Daniel Lezcano <daniel.lezcano at free.fr>
0ad19a3f 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
250b1eec 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0ad19a3f 22 */
f1a4a029
ÇO
23#ifndef __LXC_NETWORK_H
24#define __LXC_NETWORK_H
0ad19a3f 25
0ad19a3f 26/*
27 * Convert a string mac address to a socket structure
28 */
29extern int lxc_convert_mac(char *macaddr, struct sockaddr *sockaddr);
30
31/*
32 * Move a device between namespaces
33 */
d472214b 34extern int lxc_netdev_move_by_index(int ifindex, pid_t pid);
8befa924 35extern int lxc_netdev_move_by_name(char *ifname, pid_t pid);
0ad19a3f 36
37/*
38 * Delete a network device
39 */
b84f58b9
DL
40extern int lxc_netdev_delete_by_name(const char *name);
41extern int lxc_netdev_delete_by_index(int ifindex);
0ad19a3f 42
b9a5bb58 43/*
b84f58b9 44 * Change the device name
b9a5bb58 45 */
b84f58b9
DL
46extern int lxc_netdev_rename_by_name(const char *oldname, const char *newname);
47extern int lxc_netdev_rename_by_index(int ifindex, const char *newname);
b9a5bb58 48
8befa924
SH
49extern int netdev_set_flag(const char *name, int flag);
50
0ad19a3f 51/*
d472214b 52 * Set the device network up or down
0ad19a3f 53 */
d472214b
DL
54extern int lxc_netdev_up(const char *name);
55extern int lxc_netdev_down(const char *name);
0ad19a3f 56
75d09f83
DL
57/*
58 * Change the mtu size for the specified device
59 */
d472214b 60extern int lxc_netdev_set_mtu(const char *name, int mtu);
75d09f83 61
0ad19a3f 62/*
d472214b 63 * Create a virtual network devices
0ad19a3f 64 */
497353b6 65extern int lxc_veth_create(const char *name1, const char *name2);
e892973e 66extern int lxc_macvlan_create(const char *master, const char *name, int mode);
7c11d57a 67extern int lxc_vlan_create(const char *master, const char *name, unsigned short vid);
26c39028 68
0ad19a3f 69/*
70 * Activate forwarding
71 */
497353b6 72extern int lxc_ip_forward_on(const char *name, int family);
0ad19a3f 73
74/*
75 * Disable forwarding
76 */
497353b6 77extern int lxc_ip_forward_off(const char *name, int family);
0ad19a3f 78
79/*
80 * Set ip address
81 */
1f1b18e7
DL
82extern int lxc_ipv6_addr_add(int ifindex, struct in6_addr *addr,
83 struct in6_addr *mcast,
84 struct in6_addr *acast, int prefix);
85
86extern int lxc_ipv4_addr_add(int ifindex, struct in_addr *addr,
87 struct in_addr *bcast, int prefix);
0ad19a3f 88
19a26f82
MK
89/*
90 * Get ip address
91 */
92extern int lxc_ipv4_addr_get(int ifindex, struct in_addr **res);
93extern int lxc_ipv6_addr_get(int ifindex, struct in6_addr **res);
94
77dcf03a
GL
95/*
96 * Set a destination route to an interface
97 */
98extern int lxc_ipv4_dest_add(int ifindex, struct in_addr *dest);
99extern int lxc_ipv6_dest_add(int ifindex, struct in6_addr *dest);
100
f8fee0e2
MK
101/*
102 * Set default route.
103 */
104extern int lxc_ipv4_gateway_add(int ifindex, struct in_addr *gw);
105extern int lxc_ipv6_gateway_add(int ifindex, struct in6_addr *gw);
106
0ad19a3f 107/*
108 * Attach an interface to the bridge
109 */
497353b6 110extern int lxc_bridge_attach(const char *bridge, const char *ifname);
0ad19a3f 111
f79d43bb 112/*
0ad19a3f 113 * Create default gateway
114 */
497353b6
DL
115extern int lxc_route_create_default(const char *addr, const char *ifname,
116 int gateway);
0ad19a3f 117
118/*
119 * Delete default gateway
120 */
497353b6
DL
121extern int lxc_route_delete_default(const char *addr, const char *ifname,
122 int gateway);
0ad19a3f 123
124/*
125 * Activate neighbor proxying
126 */
497353b6 127extern int lxc_neigh_proxy_on(const char *name, int family);
0ad19a3f 128
129/*
130 * Disable neighbor proxying
131 */
497353b6 132extern int lxc_neigh_proxy_off(const char *name, int family);
0ad19a3f 133
a0265685
SG
134/*
135 * Generate a new unique network interface name
136 */
137extern char *lxc_mkifname(char *template);
138
72d0e1cb 139extern const char *lxc_net_type_to_str(int type);
8befa924 140extern int setup_private_host_hw_addr(char *veth1);
0130df54 141extern int netdev_get_mtu(int ifindex);
0ad19a3f 142#endif