3 * OLSR ad-hoc routing table management protocol
4 * Copyright (C) 2003 Andreas Tønnesen (andreto@ifi.uio.no)
6 * This file is part of the olsr.org OLSR daemon.
8 * olsr.org is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * olsr.org is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with olsr.org; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef _OLSR_INTERFACE
29 #define _OLSR_INTERFACE
31 #include "olsr_protocol.h"
33 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
36 #define IPV6_ADDR_ANY 0x0000U
38 #define IPV6_ADDR_UNICAST 0x0001U
39 #define IPV6_ADDR_MULTICAST 0x0002U
40 #define IPV6_ADDR_ANYCAST 0x0004U
42 #define IPV6_ADDR_LOOPBACK 0x0010U
43 #define IPV6_ADDR_LINKLOCAL 0x0020U
44 #define IPV6_ADDR_SITELOCAL 0x0040U
46 #define IPV6_ADDR_COMPATv4 0x0080U
48 #define IPV6_ADDR_SCOPE_MASK 0x00f0U
50 #define IPV6_ADDR_MAPPED 0x1000U
51 #define IPV6_ADDR_RESERVED 0x2000U
56 *A struct containing all necessary information about each
57 *interface participating in the OLSD routing
62 struct sockaddr int_addr; /* address */
63 struct sockaddr int_netmask; /* netmask */
64 struct sockaddr int_broadaddr; /* broadcast address */
66 struct sockaddr_in6 int6_addr; /* Address */
67 struct sockaddr_in6 int6_multaddr; /* Multicast */
69 union olsr_ip_addr ip_addr;
70 int olsr_socket; /* The broadcast socket for this interface */
71 int int_metric; /* metric of interface */
72 int int_flags; /* see below */
73 char *int_name; /* from kernel if structure */
74 int if_index; /* Kernels index of this interface */
75 int if_nr; /* This interfaces index internally*/
76 int is_wireless; /* wireless interface or not*/
77 olsr_u16_t olsr_seqnum; /* Olsr message seqno */
78 struct interface *int_next;
90 struct interface *interf;
94 struct if_name *if_names;
98 #define IFF_PASSIVE 0x200000 /* can't tell if up/down */
99 #define IFF_INTERFACE 0x400000 /* hardware interface */
103 /* Ifchange functions */
107 int (*function)(struct interface *, int);
111 struct ifchgf *ifchgf_list;
113 /* Ifchange actions */
115 #define IFCHG_IF_ADD 1
116 #define IFCHG_IF_REMOVE 2
117 #define IFCHG_IF_UPDATE 3
119 /* Variables needed to set up new sockets */
120 extern int precedence;
125 /* The interface linked-list */
126 struct interface *ifnet;
128 /* Datastructures to use when creating new sockets */
129 struct sockaddr_in addrsock;
130 struct sockaddr_in6 addrsock6;
139 if_ifwithaddr(union olsr_ip_addr *);
142 get_ipv6_address(char *, struct sockaddr_in6 *, int);
148 add_ifchgf(int (*f)(struct interface *, int));
151 del_ifchgf(int (*f)(struct interface *, int));