/
mip6_mncore.h
180 lines (160 loc) · 7.71 KB
/
mip6_mncore.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/* $KAME: mip6_mncore.h,v 1.3 2003/06/03 06:44:36 keiichi Exp $ */
/*
* Copyright (C) 2003 WIDE Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1999, 2000 and 2001 Ericsson Radio Systems AB
* All rights reserved.
*
* Authors: Conny Larsson <Conny.Larsson@era.ericsson.se>
* Mattias Pettersson <Mattias.Pettersson@era.ericsson.se>
*
*/
#ifndef _MIP6_MNCORE_H_
#define _MIP6_MNCORE_H_
/* buffer for storing a consequtive sequence of sub-options. */
struct mip6_buffer {
int off; /* Offset in buffer */
u_int8_t *buf; /* Must be at least IPV6_MMTU */
};
#define MIP6_BUFFER_SIZE 1500 /* XXX 1500 ? */
#define IP6OPT_HALEN 16 /* Length of HA option */
#ifdef _KERNEL
extern struct mip6_ha_list mip6_ha_list;
extern struct mip6_prefix_list mip6_prefix_list;
extern struct mip6_subnet_list mip6_subnet_list;
extern struct mip6_unuse_hoa_list mip6_unuse_hoa;
extern struct mip6_preferred_ifnames mip6_preferred_ifnames;
/* Mobile IPv6 mobile node functions. */
/* initialization. */
void mip6_mn_init(void);
void mip6_bu_init(void);
void mip6_halist_init(void);
void mip6_prefix_init(void);
void mip6_subnet_init(void);
/* movement processing. */
int mip6_prelist_update(struct sockaddr_in6 *, union nd_opts *,
struct nd_defrouter *, struct mbuf *);
void mip6_probe_routers(void);
int mip6_process_movement(void);
int mip6_process_pfxlist_status_change(struct sockaddr_in6 *);
int mip6_select_coa2(void);
int mip6_detach_haddrs(struct hif_softc *);
int mip6_ifa_need_dad(struct in6_ifaddr *);
int mip6_route_optimize(struct mbuf *);
/* binding update entry processing. */
int mip6_bu_list_remove_all(struct mip6_bu_list *, int);
struct mip6_bu *mip6_bu_list_find_home_registration(struct mip6_bu_list *,
struct sockaddr_in6 *);
struct mip6_bu *mip6_bu_list_find_withpaddr(struct mip6_bu_list *,
struct sockaddr_in6 *, struct sockaddr_in6 *);
int mip6_home_registration2(struct mip6_bu *);
int mip6_bu_encapcheck(const struct mbuf *, int, int, void *);
int mip6_bu_fsm(struct mip6_bu *, int, void *);
int mip6_bu_send_hoti(struct mip6_bu *);
int mip6_bu_send_coti(struct mip6_bu *);
int mip6_bu_send_bu(struct mip6_bu *);
int mip6_bu_send_cbu(struct mip6_bu *);
/* home agent list processing. */
struct mip6_ha *mip6_ha_create(struct sockaddr_in6 *, struct sockaddr_in6 *,
u_int8_t, u_int16_t, int32_t);
int mip6_ha_list_insert(struct mip6_ha_list *, struct mip6_ha *mha);
int mip6_ha_list_remove(struct mip6_ha_list*, struct mip6_ha *mha);
struct mip6_ha *mip6_ha_list_find_withaddr(struct mip6_ha_list *,
struct sockaddr_in6 *);
int mip6_ha_list_update_hainfo(struct mip6_ha_list *, struct nd_defrouter *,
struct nd_opt_homeagent_info *);
int mip6_ha_list_update_withndpr(struct mip6_ha_list *, struct sockaddr_in6 *,
struct nd_prefix *);
int mip6_ha_list_update_gaddr(struct mip6_ha_list*, struct sockaddr_in6 *,
struct sockaddr_in6 *);
/* prefix list processing. */
struct mip6_prefix *mip6_prefix_create(struct sockaddr_in6 *, u_int8_t,
u_int32_t, u_int32_t);
int mip6_prefix_list_insert(struct mip6_prefix_list *, struct mip6_prefix *);
int mip6_prefix_list_remove(struct mip6_prefix_list *,
struct mip6_prefix *mpfx);
struct mip6_prefix *mip6_prefix_list_find(struct mip6_prefix *);
int mip6_prefix_haddr_assign(struct mip6_prefix *, struct hif_softc *);
/* subnet list processing. */
struct mip6_subnet *mip6_subnet_create(void);
int mip6_subnet_delete(struct mip6_subnet *);
int mip6_subnet_list_insert(struct mip6_subnet_list *, struct mip6_subnet *);
int mip6_subnet_list_remove(struct mip6_subnet_list *, struct mip6_subnet *);
struct mip6_subnet *mip6_subnet_list_find_withprefix(struct mip6_subnet_list *,
struct sockaddr_in6 *, u_int8_t);
struct mip6_subnet *mip6_subnet_list_find_withhaaddr(struct mip6_subnet_list *,
struct sockaddr_in6 *);
struct mip6_subnet *mip6_subnet_list_find_withmpfx(struct mip6_subnet_list *,
struct mip6_prefix *);
/* subnet_ha list processing. */
struct mip6_subnet_ha *mip6_subnet_ha_create(struct mip6_ha *);
int mip6_subnet_ha_list_insert(struct mip6_subnet_ha_list *,
struct mip6_subnet_ha *);
struct mip6_subnet_ha *mip6_subnet_ha_list_find_preferable(
struct mip6_subnet_ha_list *);
struct mip6_subnet_ha *mip6_subnet_ha_list_find_withmha(
struct mip6_subnet_ha_list *, struct mip6_ha *);
struct mip6_subnet_ha *mip6_subnet_ha_list_find_withhaaddr(
struct mip6_subnet_ha_list *, struct sockaddr_in6 *haaddr);
/* subnet_prefix list processing. */
struct mip6_subnet_prefix *mip6_subnet_prefix_create(struct mip6_prefix *);
int mip6_subnet_prefix_list_insert(struct mip6_subnet_prefix_list *,
struct mip6_subnet_prefix *);
int mip6_subnet_prefix_list_remove(struct mip6_subnet_prefix_list *,
struct mip6_subnet_prefix *);
struct mip6_subnet_prefix *mip6_subnet_prefix_list_find_withprefix(
struct mip6_subnet_prefix_list *, struct sockaddr_in6 *, u_int8_t);
struct mip6_subnet_prefix *mip6_subnet_prefix_list_find_withmpfx(
struct mip6_subnet_prefix_list *, struct mip6_prefix *mpfx);
struct mip6_prefix *mip6_prefix_list_find_withhaddr(struct mip6_prefix_list *,
struct sockaddr_in6 *haddr);
int32_t mip6_subnet_prefix_list_get_minimum_lifetime(
struct mip6_subnet_prefix_list *);
/* IPv6 extention header processing. */
int mip6_haddr_destopt_create(struct ip6_dest **, struct sockaddr_in6 *,
struct sockaddr_in6 *, struct hif_softc *);
int mip6_addr_exchange(struct mbuf *, struct mbuf *);
/* Mobility Header processing. */
int mip6_ip6mh_input(struct mbuf *, struct ip6m_home_test *, int);
int mip6_ip6mc_input(struct mbuf *, struct ip6m_careof_test *, int);
int mip6_ip6ma_input(struct mbuf *, struct ip6m_binding_ack *, int);
int mip6_ip6me_input(struct mbuf *, struct ip6m_binding_error *, int);
int mip6_ip6mhi_create(struct ip6_mobility **, struct mip6_bu *);
int mip6_ip6mci_create(struct ip6_mobility **, struct mip6_bu *);
int mip6_ip6mu_create(struct ip6_mobility **, struct sockaddr_in6 *,
struct sockaddr_in6 *, struct hif_softc *);
/* ICMPv6 processing. */
int mip6_icmp6_input(struct mbuf *, int, int);
int mip6_icmp6_dhaad_req_output(struct hif_softc *);
int mip6_icmp6_mp_sol_output(struct mip6_prefix *, struct mip6_ha *);
#ifdef MIP6_DEBUG
void mip6_bu_print(struct mip6_bu *);
#endif /* MIP6_DEBUG */
void mip6_ha_print(struct mip6_ha *);
#endif /* _KERNEL */
#endif /* _MIP6_MNCORE_H_ */