aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-07 10:53:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-07 10:53:18 +0000
commit026bfdef366253645c5bea8bed130a0f6900be77 (patch)
treea8fc608b8fa8ac1b360aabc69ab5b470150b8a7a /src/core
parent5cb9a34c4c5c6182552beb8b36adebdeaa6c6548 (diff)
downloadgnunet-026bfdef366253645c5bea8bed130a0f6900be77.tar.gz
gnunet-026bfdef366253645c5bea8bed130a0f6900be77.zip
hxing
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core-new.c127
-rw-r--r--src/core/gnunet-service-core.h5
-rw-r--r--src/core/gnunet-service-core_typemap.c5
3 files changed, 9 insertions, 128 deletions
diff --git a/src/core/gnunet-service-core-new.c b/src/core/gnunet-service-core-new.c
index 94783ecee..d094817a0 100644
--- a/src/core/gnunet-service-core-new.c
+++ b/src/core/gnunet-service-core-new.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -22,25 +22,9 @@
22 * @file core/gnunet-service-core.c 22 * @file core/gnunet-service-core.c
23 * @brief high-level P2P messaging 23 * @brief high-level P2P messaging
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * Type map implementation:
27 * - track type maps for neighbours (can wait)
28 * - only notify clients about peers with matching type maps (can wait)
29 *
30 * Considerations for later:
31 * - check that hostkey used by transport (for HELLOs) is the
32 * same as the hostkey that we are using!
33 */ 25 */
34#include "platform.h" 26#include "platform.h"
35#include <zlib.h>
36#include "gnunet_constants.h"
37#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
38#include "gnunet_hello_lib.h"
39#include "gnunet_peerinfo_service.h"
40#include "gnunet_protocols.h"
41#include "gnunet_signatures.h"
42#include "gnunet_statistics_service.h"
43#include "gnunet_transport_service.h"
44#include "gnunet-service-core.h" 28#include "gnunet-service-core.h"
45#include "gnunet-service-core_clients.h" 29#include "gnunet-service-core_clients.h"
46#include "gnunet-service-core_kx.h" 30#include "gnunet-service-core_kx.h"
@@ -49,115 +33,6 @@
49#include "gnunet-service-core_typemap.h" 33#include "gnunet-service-core_typemap.h"
50 34
51 35
52#define DEBUG_HANDSHAKE GNUNET_EXTRA_LOGGING
53
54#define DEBUG_CORE_QUOTA GNUNET_EXTRA_LOGGING
55
56/**
57 * Receive and send buffer windows grow over time. For
58 * how long can 'unused' bandwidth accumulate before we
59 * need to cap it? (specified in seconds).
60 */
61#define MAX_WINDOW_TIME_S (5 * 60)
62
63/**
64 * How many messages do we queue up at most for optional
65 * notifications to a client? (this can cause notifications
66 * about outgoing messages to be dropped).
67 */
68#define MAX_NOTIFY_QUEUE 1024
69
70/**
71 * Minimum bandwidth (out) to assign to any connected peer.
72 * Should be rather low; values larger than DEFAULT_BW_IN_OUT make no
73 * sense.
74 */
75#define MIN_BANDWIDTH_PER_PEER GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT
76
77/**
78 * After how much time past the "official" expiration time do
79 * we discard messages? Should not be zero since we may
80 * intentionally defer transmission until close to the deadline
81 * and then may be slightly past the deadline due to inaccuracy
82 * in sleep and our own CPU consumption.
83 */
84#define PAST_EXPIRATION_DISCARD_TIME GNUNET_TIME_UNIT_SECONDS
85
86/**
87 * What is the maximum delay for a SET_KEY message?
88 */
89#define MAX_SET_KEY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
90
91/**
92 * How long do we wait for SET_KEY confirmation initially?
93 */
94#define INITIAL_SET_KEY_RETRY_FREQUENCY GNUNET_TIME_relative_multiply (MAX_SET_KEY_DELAY, 1)
95
96/**
97 * What is the maximum delay for a PING message?
98 */
99#define MAX_PING_DELAY GNUNET_TIME_relative_multiply (MAX_SET_KEY_DELAY, 2)
100
101/**
102 * What is the maximum delay for a PONG message?
103 */
104#define MAX_PONG_DELAY GNUNET_TIME_relative_multiply (MAX_PING_DELAY, 2)
105
106/**
107 * What is the minimum frequency for a PING message?
108 */
109#define MIN_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
110
111/**
112 * How often do we recalculate bandwidth quotas?
113 */
114#define QUOTA_UPDATE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
115
116/**
117 * What is the priority for a SET_KEY message?
118 */
119#define SET_KEY_PRIORITY 0xFFFFFF
120
121/**
122 * What is the priority for a PING message?
123 */
124#define PING_PRIORITY 0xFFFFFF
125
126/**
127 * What is the priority for a PONG message?
128 */
129#define PONG_PRIORITY 0xFFFFFF
130
131/**
132 * How many messages do we queue per peer at most? Must be at
133 * least two.
134 */
135#define MAX_PEER_QUEUE_SIZE 16
136
137/**
138 * How many non-mandatory messages do we queue per client at most?
139 */
140#define MAX_CLIENT_QUEUE_SIZE 32
141
142/**
143 * What is the maximum age of a message for us to consider
144 * processing it? Note that this looks at the timestamp used
145 * by the other peer, so clock skew between machines does
146 * come into play here. So this should be picked high enough
147 * so that a little bit of clock skew does not prevent peers
148 * from connecting to us.
149 */
150#define MAX_MESSAGE_AGE GNUNET_TIME_UNIT_DAYS
151
152
153
154/**
155 * Number of bytes (at the beginning) of "struct EncryptedMessage"
156 * that are NOT encrypted.
157 */
158#define ENCRYPTED_HEADER_SIZE (offsetof(struct EncryptedMessage, sequence_number))
159
160
161/** 36/**
162 * Our identity. 37 * Our identity.
163 */ 38 */
diff --git a/src/core/gnunet-service-core.h b/src/core/gnunet-service-core.h
index 5153640ea..9068e7c3d 100644
--- a/src/core/gnunet-service-core.h
+++ b/src/core/gnunet-service-core.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -26,8 +26,11 @@
26#ifndef GNUNET_SERVICE_CORE_H 26#ifndef GNUNET_SERVICE_CORE_H
27#define GNUNET_SERVICE_CORE_H 27#define GNUNET_SERVICE_CORE_H
28 28
29#include "gnunet_statistics_service.h"
29 30
30 31
32#define DEBUG_CORE GNUNET_EXTRA_LOGGING
33
31/** 34/**
32 * Opaque handle to a client. 35 * Opaque handle to a client.
33 */ 36 */
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c
index 079611de6..0ef9a6236 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -26,7 +26,10 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_transport_service.h" 28#include "gnunet_transport_service.h"
29#include "gnunet_service_core.h" 29#include "gnunet-service-core.h"
30#include "gnunet-service-core_sessions.h"
31#include "gnunet-service-core_typemap.h"
32#include <zlib.h>
30 33
31 34
32/** 35/**