The Netsukuku Project
0.0.9
An Alternative routing method
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
rehook.h
Go to the documentation of this file.
1
/* This file is part of Netsukuku
2
* (c) Copyright 2005 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 REHOOK_H
20
#define REHOOK_H
21
22
int
rehook_mutex
;
/* The can be only one rehook at the same time */
23
24
/*
25
* REHOOK_PER_INSTANCE the is total number of rehooks allowed in
26
* REHOOK_INSTANCE_TIME(level) seconds. After REHOOK_INSTANCE_TIME(level)
27
* seconds have passed since the first rehook, REHOOK_WAIT_TIME(level) seconds
28
* must be waited before rehooking again.
29
* `level' is the level where the rehook is taking place.
30
* REHOOK_WAIT_TIME is calculated in this way:
31
* ((8<<level) - (1<<level)) * 60
32
*/
33
#define REHOOK_PER_INSTANCE 8
34
#define REHOOK_INSTANCE_TIME(level) (REHOOK_PER_INSTANCE*(level)*60)
35
#define REHOOK_WAIT_TIME(level) (( (8<<(level)) - (1<<(level)) ) * 60)
36
37
38
time_t
last_instance_rehook
;
/* When the first rehook of the latest
39
instance occurred */
40
int
total_rehooks
;
/* Number of rehooks made in the current
41
instance.
42
It cannot be > REHOOK_PER_INSTANCE */
43
44
45
46
#define CHALLENGE_THRESHOLD (1<<16)
/* When the gnode X, which must
47
rehook, has a gnode_count >= (1<<16)
48
it sends a new challenge. */
49
50
/* `rk_gnode_ip' is the ip that will be used if we cannot rehook directly to
51
* any gnode: a new gnode is created with the ip equal to `rk_gnode_ip'. */
52
inet_prefix
rk_gnode_ip
;
53
54
/* * * Functions declaration * * */
55
void
rehook_init
(
void
);
56
void
new_rehook
(
map_gnode
*
gnode
,
int
gid
,
int
level
,
int
gnode_count
);
57
int
rehook
(
map_gnode
*hook_gnode,
int
hook_level);
58
59
#endif
/*REHOOK_H*/
total_rehooks
int total_rehooks
Definition:
rehook.h:40
rehook_init
void rehook_init(void)
Definition:
rehook.c:61
rehook_mutex
int rehook_mutex
Definition:
rehook.h:22
inet_prefix
Definition:
inet.h:73
rehook
int rehook(map_gnode *hook_gnode, int hook_level)
Definition:
rehook.c:354
rehook_argv::gid
int gid
Definition:
rehook.c:53
rehook_argv::gnode_count
int gnode_count
Definition:
rehook.c:56
rehook_argv::gnode
map_gnode * gnode
Definition:
rehook.c:54
rehook_argv::level
int level
Definition:
rehook.c:55
rk_gnode_ip
inet_prefix rk_gnode_ip
Definition:
rehook.h:52
last_instance_rehook
time_t last_instance_rehook
Definition:
rehook.h:38
map_gnode
Definition:
gmap.h:37
new_rehook
void new_rehook(map_gnode *gnode, int gid, int level, int gnode_count)
Definition:
rehook.c:268
src
rehook.h
Generated on Wed Feb 19 2014 16:28:40 for The Netsukuku Project by
1.8.6