]>
Commit | Line | Data |
---|---|---|
5734509c PJ |
1 | /* |
2 | * This file is free software: you may copy, redistribute and/or modify it | |
3 | * under the terms of the GNU General Public License as published by the | |
4 | * Free Software Foundation, either version 2 of the License, or (at your | |
5 | * option) any later version. | |
6 | * | |
7 | * This file is distributed in the hope that it will be useful, but | |
8 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
10 | * General Public License for more details. | |
11 | * | |
12 | * You should have received a copy of the GNU General Public License | |
13 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 | * | |
15 | * This file incorporates work covered by the following copyright and | |
16 | * permission notice: | |
17 | * | |
18 | Copyright (c) 2007, 2008 by Juliusz Chroboczek | |
19 | ||
20 | Permission is hereby granted, free of charge, to any person obtaining a copy | |
21 | of this software and associated documentation files (the "Software"), to deal | |
22 | in the Software without restriction, including without limitation the rights | |
23 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
24 | copies of the Software, and to permit persons to whom the Software is | |
25 | furnished to do so, subject to the following conditions: | |
26 | ||
27 | The above copyright notice and this permission notice shall be included in | |
28 | all copies or substantial portions of the Software. | |
29 | ||
30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
36 | THE SOFTWARE. | |
37 | */ | |
38 | ||
39 | #define REQUEST_TIMEOUT 65000 | |
52d54422 | 40 | #define RESEND_MAX 3 |
5734509c PJ |
41 | |
42 | #define RESEND_REQUEST 1 | |
43 | #define RESEND_UPDATE 2 | |
44 | ||
45 | struct resend { | |
46 | unsigned char kind; | |
47 | unsigned char max; | |
48 | unsigned short delay; | |
49 | struct timeval time; | |
50 | unsigned char prefix[16]; | |
51 | unsigned char plen; | |
52 | unsigned short seqno; | |
53 | unsigned char id[8]; | |
54 | struct interface *ifp; | |
55 | struct resend *next; | |
56 | }; | |
57 | ||
58 | extern struct timeval resend_time; | |
59 | ||
60 | struct resend *find_request(const unsigned char *prefix, unsigned char plen, | |
61 | struct resend **previous_return); | |
62 | void flush_resends(struct neighbour *neigh); | |
63 | int record_resend(int kind, const unsigned char *prefix, unsigned char plen, | |
64 | unsigned short seqno, const unsigned char *id, | |
65 | struct interface *ifp, int delay); | |
66 | int unsatisfied_request(const unsigned char *prefix, unsigned char plen, | |
67 | unsigned short seqno, const unsigned char *id); | |
68 | int request_redundant(struct interface *ifp, | |
69 | const unsigned char *prefix, unsigned char plen, | |
70 | unsigned short seqno, const unsigned char *id); | |
71 | int satisfy_request(const unsigned char *prefix, unsigned char plen, | |
72 | unsigned short seqno, const unsigned char *id, | |
73 | struct interface *ifp); | |
74 | ||
75 | void expire_resend(void); | |
76 | void recompute_resend_time(void); | |
77 | void do_resend(void); |