The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
if.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku
2  * (c) Copyright 2004 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
3  *
4  * This source code is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * This source code is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * Please refer to the GNU Public License for more details.
13  *
14  * You should have received a copy of the GNU Public License along with
15  * this source code; if not, write to:
16  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef IF_H
20 #define IF_H
21 
22 #include <net/if.h>
23 #include "inet.h"
24 
25 #define MAX_INTERFACES 16 /* The maximum number of network
26  interfaces, which can be used
27  by Netsukuku */
28 
29 typedef struct {
30  char dev_name[IFNAMSIZ]; /* If name */
31  int dev_idx; /* If index */
32 } interface;
33 
34 /* from linux/ipv6.h */
35 struct in6_ifreq {
36  struct in6_addr ifr6_addr;
37  uint32_t ifr6_prefixlen;
39 };
40 
41 
42 int ifs_get_pos(interface *ifs, int ifs_n, interface *dev);
43 interface *ifs_find_idx(interface *ifs, int ifs_n, int dev_idx);
44 int ifs_find_devname(interface *ifs, int ifs_n, char *dev_name);
45 void ifs_del(interface *ifs, int *ifs_n, int if_pos);
46 void ifs_del_byname(interface *ifs, int *ifs_n, char *dev_name);
47 void ifs_del_all_name(interface *ifs, int *ifs_n, char *dev_name);
48 const char *get_dev(int *dev_idx);
49 int set_dev_up(char *dev);
50 int set_dev_down(char *dev);
51 int set_flags(char *dev, u_int flags, u_int mask);
52 int set_all_ifs(interface *ifs, int ifs_n, int (*set_func)(char *dev));
53 int if_init_all(char *ifs_name[MAX_INTERFACES], int ifs_n, interface *new_ifs, int *new_ifs_n);
54 void if_close_all(void);
55 int set_all_dev_ip(inet_prefix ip, interface *ifs, int ifs_n);
56 int set_dev_ip(inet_prefix ip, char *dev);
57 int get_dev_ip(inet_prefix *ip, int family, char *dev);
58 int ip_addr_flush(int family, char *dev, int scope);
59 int ip_addr_flush_all_ifs(interface *ifs, int ifs_n, int family, int scope);
60 
61 #endif /*IF_H*/
int ip_addr_flush(int family, char *dev, int scope)
Definition: if.c:553
int ip_addr_flush_all_ifs(interface *ifs, int ifs_n, int family, int scope)
Definition: if.c:615
void ifs_del_all_name(interface *ifs, int *ifs_n, char *dev_name)
Definition: if.c:116
interface * ifs_find_idx(interface *ifs, int ifs_n, int dev_idx)
Definition: if.c:54
uint32_t ifr6_prefixlen
Definition: if.h:37
int set_all_dev_ip(inet_prefix ip, interface *ifs, int ifs_n)
Definition: if.c:379
int ifs_get_pos(interface *ifs, int ifs_n, interface *dev)
Definition: if.c:140
int ifr6_ifindex
Definition: if.h:38
void ifs_del(interface *ifs, int *ifs_n, int if_pos)
Definition: if.c:84
struct in6_addr ifr6_addr
Definition: if.h:36
int set_dev_down(char *dev)
Definition: if.c:232
int get_dev_ip(inet_prefix *ip, int family, char *dev)
Definition: if.c:394
int if_init_all(char *ifs_name[16], int ifs_n, interface *new_ifs, int *new_ifs_n)
Definition: if.c:267
Definition: inet.h:73
int set_all_ifs(interface *ifs, int ifs_n, int(*set_func)(char *dev))
Definition: if.c:248
void if_close_all(void)
Definition: if.c:315
Definition: if.h:29
#define MAX_INTERFACES
Definition: if.h:25
int set_dev_up(char *dev)
Definition: if.c:223
int ifs_find_devname(interface *ifs, int ifs_n, char *dev_name)
Definition: if.c:65
int dev_idx
Definition: if.h:31
int set_dev_ip(inet_prefix ip, char *dev)
Definition: if.c:327
int scope
Definition: if.c:38
const char * get_dev(int *dev_idx)
Definition: if.c:155
Definition: if.h:35
int set_flags(char *dev, u_int flags, u_int mask)
Definition: if.c:195
int family
Definition: if.c:34
void ifs_del_byname(interface *ifs, int *ifs_n, char *dev_name)
Definition: if.c:100
int flags
Definition: if.c:39