aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-09-18 19:10:12 +0000
committerChristian Grothoff <christian@grothoff.org>2010-09-18 19:10:12 +0000
commit3756b235a8ef6a680a1bc7197c1ce45d778af09c (patch)
treeec506ec28427cfc7813711b938fccbbbb6d1d728 /src/include
parentd24bc034571753884f63bdb9c45ec53ef289121c (diff)
downloadgnunet-3756b235a8ef6a680a1bc7197c1ce45d778af09c.tar.gz
gnunet-3756b235a8ef6a680a1bc7197c1ce45d778af09c.zip
plane hacking
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/gnunet_block_lib.h25
-rw-r--r--src/include/gnunet_dht_service.h17
-rw-r--r--src/include/gnunet_load_lib.h106
-rw-r--r--src/include/gnunet_protocols.h5
5 files changed, 137 insertions, 17 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 4e7fb8b7b..70fd97bd0 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -36,6 +36,7 @@ gnunetinclude_HEADERS = \
36 gnunet_fs_service.h \ 36 gnunet_fs_service.h \
37 gnunet_getopt_lib.h \ 37 gnunet_getopt_lib.h \
38 gnunet_hello_lib.h \ 38 gnunet_hello_lib.h \
39 gnunet_load_lib.h \
39 gnunet_nat_lib.h \ 40 gnunet_nat_lib.h \
40 gnunet_network_lib.h \ 41 gnunet_network_lib.h \
41 gnunet_os_lib.h \ 42 gnunet_os_lib.h \
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 5154a3c08..bdbaeade5 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -50,39 +50,46 @@ enum GNUNET_BLOCK_Type
50 /** 50 /**
51 * Data block (leaf) in the CHK tree. 51 * Data block (leaf) in the CHK tree.
52 */ 52 */
53 GNUNET_BLOCK_TYPE_DBLOCK = 1, 53 GNUNET_BLOCK_TYPE_FS_DBLOCK = 1,
54 54
55 /** 55 /**
56 * Inner block in the CHK tree. 56 * Inner block in the CHK tree.
57 */ 57 */
58 GNUNET_BLOCK_TYPE_IBLOCK = 2, 58 GNUNET_BLOCK_TYPE_FS_IBLOCK = 2,
59 59
60 /** 60 /**
61 * Type of a block representing a keyword search result. 61 * Type of a block representing a keyword search result.
62 */ 62 */
63 GNUNET_BLOCK_TYPE_KBLOCK = 3, 63 GNUNET_BLOCK_TYPE_FS_KBLOCK = 3,
64 64
65 /** 65 /**
66 * Type of a block that is used to advertise content in a namespace. 66 * Type of a block that is used to advertise content in a namespace.
67 */ 67 */
68 GNUNET_BLOCK_TYPE_SBLOCK = 4, 68 GNUNET_BLOCK_TYPE_FS_SBLOCK = 4,
69 69
70 /** 70 /**
71 * Type of a block representing a block to be encoded on demand from disk. 71 * Type of a block representing a block to be encoded on demand from disk.
72 * Should never appear on the network directly. 72 * Should never appear on the network directly.
73 */ 73 */
74 GNUNET_BLOCK_TYPE_ONDEMAND = 5, 74 GNUNET_BLOCK_TYPE_FS_ONDEMAND = 5,
75 75
76 /** 76 /**
77 * Type of a block that is used to advertise a namespace. 77 * Type of a block that is used to advertise a namespace.
78 */ 78 */
79 GNUNET_BLOCK_TYPE_NBLOCK = 6, 79 GNUNET_BLOCK_TYPE_FS_NBLOCK = 6,
80 80
81 GNUNET_BLOCK_TYPE_TEST = 9999 81 /**
82 82 * Type of a block that contains a HELLO for a peer (for
83 }; 83 * DHT find-peer operations).
84 */
85 GNUNET_BLOCK_TYPE_DHT_HELLO = 7,
84 86
87 /**
88 * Block for testing.
89 */
90 GNUNET_BLOCK_TYPE_TEST = 8
85 91
92 };
86 93
87 94
88/** 95/**
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index ca1bebe09..a95cfafe6 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -28,6 +28,7 @@
28#define GNUNET_DHT_SERVICE_H 28#define GNUNET_DHT_SERVICE_H
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_block_lib.h"
31#include "gnunet_hello_lib.h" 32#include "gnunet_hello_lib.h"
32 33
33#ifdef __cplusplus 34#ifdef __cplusplus
@@ -112,7 +113,7 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle);
112void 113void
113GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, 114GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
114 const GNUNET_HashCode * key, 115 const GNUNET_HashCode * key,
115 uint32_t type, 116 enum GNUNET_BLOCK_Type type,
116 uint32_t size, 117 uint32_t size,
117 const char *data, 118 const char *data,
118 struct GNUNET_TIME_Absolute exp, 119 struct GNUNET_TIME_Absolute exp,
@@ -133,11 +134,11 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
133 * @param data pointer to the result data 134 * @param data pointer to the result data
134 */ 135 */
135typedef void (*GNUNET_DHT_GetIterator)(void *cls, 136typedef void (*GNUNET_DHT_GetIterator)(void *cls,
136 struct GNUNET_TIME_Absolute exp, 137 struct GNUNET_TIME_Absolute exp,
137 const GNUNET_HashCode * key, 138 const GNUNET_HashCode * key,
138 uint32_t type, 139 enum GNUNET_BLOCK_Type type,
139 uint32_t size, 140 uint32_t size,
140 const void *data); 141 const void *data);
141 142
142 143
143 144
@@ -147,7 +148,7 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls,
147 * @param handle handle to the DHT service 148 * @param handle handle to the DHT service
148 * @param timeout timeout for this request to be sent to the 149 * @param timeout timeout for this request to be sent to the
149 * service (this is NOT a timeout for receiving responses) 150 * service (this is NOT a timeout for receiving responses)
150 * @param type expected type of the response object (GNUNET_BLOCK_TYPE_*) 151 * @param type expected type of the response object (GNUNET_BLOCK_TYPE_FS_*)
151 * @param key the key to look up 152 * @param key the key to look up
152 * @param iter function to call on each result 153 * @param iter function to call on each result
153 * @param iter_cls closure for iter 154 * @param iter_cls closure for iter
@@ -160,7 +161,7 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls,
160struct GNUNET_DHT_GetHandle * 161struct GNUNET_DHT_GetHandle *
161GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, 162GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
162 struct GNUNET_TIME_Relative timeout, 163 struct GNUNET_TIME_Relative timeout,
163 uint32_t type, 164 enum GNUNET_BLOCK_Type type,
164 const GNUNET_HashCode * key, 165 const GNUNET_HashCode * key,
165 GNUNET_DHT_GetIterator iter, 166 GNUNET_DHT_GetIterator iter,
166 void *iter_cls, 167 void *iter_cls,
diff --git a/src/include/gnunet_load_lib.h b/src/include/gnunet_load_lib.h
new file mode 100644
index 000000000..7af00ccd3
--- /dev/null
+++ b/src/include/gnunet_load_lib.h
@@ -0,0 +1,106 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/gnunet_load_lib.h
23 * @brief functions related to load calculations
24 * @author Christian Grothoff
25 */
26
27#ifndef GNUNET_LOAD_LIB_H
28#define GNUNET_LOAD_LIB_H
29
30#ifdef __cplusplus
31extern "C"
32{
33#if 0 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38#include "gnunet_common.h"
39#include "gnunet_time_lib.h"
40
41/**
42 * Opaque load handle.
43 */
44struct GNUNET_LOAD_Value;
45
46/**
47 * Create a new load value.
48 *
49 * @return the new load value
50 */
51struct GNUNET_LOAD_Value *
52GNUNET_LOAD_value_init (void);
53
54
55/**
56 * Free a load value.
57 *
58 * @param lv value to free
59 */
60#define GNUNET_LOAD_value_free(lv) GNUNET_free (lv)
61
62
63/**
64 * Get the current load.
65 *
66 * @param load load handle
67 * @return zero for below-average load, otherwise
68 * number of std. devs we are above average;
69 * 100 if the latest updates were so large
70 * that we could not do proper calculations
71 */
72double
73GNUNET_LOAD_get_load (const struct GNUNET_LOAD_Value *load);
74
75
76/**
77 * Get the average value given to update so far.
78 *
79 * @param load load handle
80 * @return zero if update was never called
81 */
82double
83GNUNET_LOAD_get_average (const struct GNUNET_LOAD_Value *load);
84
85
86/**
87 * Update the current load.
88 *
89 * @param load to update
90 * @param data latest measurement value (for example, delay)
91 */
92void
93GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load,
94 uint64_t data);
95
96
97#if 0 /* keep Emacsens' auto-indent happy */
98{
99#endif
100#ifdef __cplusplus
101}
102#endif
103
104/* ifndef GNUNET_LOAD_LIB_H */
105#endif
106/* end of gnunet_load_lib.h */
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 611c56b61..784964b49 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -514,6 +514,11 @@ extern "C"
514 */ 514 */
515#define GNUNET_MESSAGE_TYPE_FS_PUT 138 515#define GNUNET_MESSAGE_TYPE_FS_PUT 138
516 516
517/**
518 * Peer asks us to stop migrating content towards it for a while.
519 */
520#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP 139
521
517 522
518/** 523/**
519 * DHT Message Types 524 * DHT Message Types