diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-11 05:22:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-11 05:22:06 +0000 |
commit | 4acd295ad6076d3c33f62d40324106d3308850ca (patch) | |
tree | 0a5b7b0a76bcb14a6283d517b8017a2fc8d520e1 /src | |
parent | 28bb4d6295b3db88677c6a75767252f1aaaf8d2d (diff) | |
download | gnunet-4acd295ad6076d3c33f62d40324106d3308850ca.tar.gz gnunet-4acd295ad6076d3c33f62d40324106d3308850ca.zip |
API clean up
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core.h | 13 | ||||
-rw-r--r-- | src/core/core_api.c | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 9 | ||||
-rw-r--r-- | src/core/test_core_api.c | 11 | ||||
-rw-r--r-- | src/core/test_core_api_start_only.c | 7 | ||||
-rw-r--r-- | src/include/gnunet_core_service.h | 9 |
6 files changed, 16 insertions, 37 deletions
diff --git a/src/core/core.h b/src/core/core.h index ebdac0aaa..647d18698 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -112,24 +112,15 @@ struct ConnectNotifyMessage | |||
112 | struct GNUNET_MessageHeader header; | 112 | struct GNUNET_MessageHeader header; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Available bandwidth to this peer; zero for disconnect. | 115 | * Always zero. |
116 | * [TODO: currently set to hard-coded constant and hence | ||
117 | * not really useful, right?] | ||
118 | */ | 116 | */ |
119 | uint32_t bpm_available GNUNET_PACKED; | 117 | uint32_t reserved GNUNET_PACKED; |
120 | 118 | ||
121 | /** | 119 | /** |
122 | * Identity of the connecting peer. | 120 | * Identity of the connecting peer. |
123 | */ | 121 | */ |
124 | struct GNUNET_PeerIdentity peer; | 122 | struct GNUNET_PeerIdentity peer; |
125 | 123 | ||
126 | /** | ||
127 | * Time of our last interaction with the peer; close | ||
128 | * to "now" for connect messages. | ||
129 | * [TODO: is this useful?] | ||
130 | */ | ||
131 | struct GNUNET_TIME_AbsoluteNBO last_activity; | ||
132 | |||
133 | }; | 124 | }; |
134 | 125 | ||
135 | 126 | ||
diff --git a/src/core/core_api.c b/src/core/core_api.c index 931ffe97e..1e37c91c2 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -446,6 +446,8 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
446 | break; | 446 | break; |
447 | } | 447 | } |
448 | cnm = (const struct ConnectNotifyMessage *) msg; | 448 | cnm = (const struct ConnectNotifyMessage *) msg; |
449 | h->connects (h->cls, | ||
450 | &cnm->peer); | ||
449 | break; | 451 | break; |
450 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: | 452 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: |
451 | if (NULL == h->disconnects) | 453 | if (NULL == h->disconnects) |
@@ -459,6 +461,8 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
459 | break; | 461 | break; |
460 | } | 462 | } |
461 | cnm = (const struct ConnectNotifyMessage *) msg; | 463 | cnm = (const struct ConnectNotifyMessage *) msg; |
464 | h->disconnects (h->cls, | ||
465 | &cnm->peer); | ||
462 | break; | 466 | break; |
463 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND: | 467 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND: |
464 | if (msize < | 468 | if (msize < |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 6d022a3d6..b07c42744 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -989,8 +989,7 @@ handle_client_init (void *cls, | |||
989 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 989 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
990 | "Sending `%s' message to client.\n", "NOTIFY_CONNECT"); | 990 | "Sending `%s' message to client.\n", "NOTIFY_CONNECT"); |
991 | #endif | 991 | #endif |
992 | cnm.bpm_available = htonl (n->bpm_out); | 992 | cnm.reserved = htonl (0); |
993 | cnm.last_activity = GNUNET_TIME_absolute_hton (n->last_activity); | ||
994 | cnm.peer = n->peer; | 993 | cnm.peer = n->peer; |
995 | send_to_client (c, &cnm.header, GNUNET_NO); | 994 | send_to_client (c, &cnm.header, GNUNET_NO); |
996 | n = n->next; | 995 | n = n->next; |
@@ -2997,9 +2996,8 @@ handle_transport_notify_connect (void *cls, | |||
2997 | schedule_quota_update (n); | 2996 | schedule_quota_update (n); |
2998 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 2997 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
2999 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 2998 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
3000 | cnm.bpm_available = htonl (n->bpm_out); | 2999 | cnm.reserved = htonl (0); |
3001 | cnm.peer = *peer; | 3000 | cnm.peer = *peer; |
3002 | cnm.last_activity = GNUNET_TIME_absolute_hton (now); | ||
3003 | send_to_all_clients (&cnm.header, GNUNET_YES); | 3001 | send_to_all_clients (&cnm.header, GNUNET_YES); |
3004 | } | 3002 | } |
3005 | 3003 | ||
@@ -3079,9 +3077,8 @@ handle_transport_notify_disconnect (void *cls, | |||
3079 | neighbour_count--; | 3077 | neighbour_count--; |
3080 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 3078 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
3081 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); | 3079 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); |
3082 | cnm.bpm_available = htonl (0); | 3080 | cnm.reserved = htonl (0); |
3083 | cnm.peer = *peer; | 3081 | cnm.peer = *peer; |
3084 | cnm.last_activity = GNUNET_TIME_absolute_hton (n->last_activity); | ||
3085 | send_to_all_clients (&cnm.header, GNUNET_YES); | 3082 | send_to_all_clients (&cnm.header, GNUNET_YES); |
3086 | free_neighbour (n); | 3083 | free_neighbour (n); |
3087 | } | 3084 | } |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index d52b24a4f..e8b7fbe3b 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -90,21 +90,18 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
90 | 90 | ||
91 | static void | 91 | static void |
92 | connect_notify (void *cls, | 92 | connect_notify (void *cls, |
93 | const struct GNUNET_PeerIdentity *peer, | 93 | const struct GNUNET_PeerIdentity *peer) |
94 | unsigned int bpm, struct GNUNET_TIME_Absolute last_activity) | ||
95 | { | 94 | { |
96 | GNUNET_assert ((ok == 5) || (ok == 6)); | 95 | GNUNET_assert ((ok == 5) || (ok == 6)); |
97 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 96 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
98 | "Encrypted connection established to peer `%4s' (%u bpm)\n", | 97 | "Encrypted connection established to peer `%4s'\n", |
99 | GNUNET_i2s (peer), bpm); | 98 | GNUNET_i2s (peer)); |
100 | } | 99 | } |
101 | 100 | ||
102 | 101 | ||
103 | static void | 102 | static void |
104 | disconnect_notify (void *cls, | 103 | disconnect_notify (void *cls, |
105 | const struct GNUNET_PeerIdentity *peer, | 104 | const struct GNUNET_PeerIdentity *peer) |
106 | unsigned int bpm, | ||
107 | struct GNUNET_TIME_Absolute last_activity) | ||
108 | { | 105 | { |
109 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 106 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
110 | "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer)); | 107 | "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer)); |
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index dc4bfea98..5c24c339c 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -71,17 +71,14 @@ static int ok; | |||
71 | 71 | ||
72 | static void | 72 | static void |
73 | connect_notify (void *cls, | 73 | connect_notify (void *cls, |
74 | const struct GNUNET_PeerIdentity *peer, | 74 | const struct GNUNET_PeerIdentity *peer) |
75 | unsigned int bpm, struct GNUNET_TIME_Absolute last_activity) | ||
76 | { | 75 | { |
77 | } | 76 | } |
78 | 77 | ||
79 | 78 | ||
80 | static void | 79 | static void |
81 | disconnect_notify (void *cls, | 80 | disconnect_notify (void *cls, |
82 | const struct GNUNET_PeerIdentity *peer, | 81 | const struct GNUNET_PeerIdentity *peer) |
83 | unsigned int bpm, | ||
84 | struct GNUNET_TIME_Absolute last_activity) | ||
85 | { | 82 | { |
86 | } | 83 | } |
87 | 84 | ||
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index be8f4baa0..a096569ef 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -56,17 +56,10 @@ struct GNUNET_CORE_Handle; | |||
56 | * | 56 | * |
57 | * @param cls closure | 57 | * @param cls closure |
58 | * @param peer peer identity this notification is about | 58 | * @param peer peer identity this notification is about |
59 | * @param bpm how much bandwidth is available | ||
60 | * (for sending) to this peer | ||
61 | * @param last_activity when did we last | ||
62 | * receive anything from this peer? | ||
63 | */ | 59 | */ |
64 | typedef void (*GNUNET_CORE_ClientEventHandler) (void *cls, | 60 | typedef void (*GNUNET_CORE_ClientEventHandler) (void *cls, |
65 | const struct | 61 | const struct |
66 | GNUNET_PeerIdentity * peer, | 62 | GNUNET_PeerIdentity * peer); |
67 | unsigned int bpm, | ||
68 | struct GNUNET_TIME_Absolute | ||
69 | last_activity); | ||
70 | 63 | ||
71 | 64 | ||
72 | /** | 65 | /** |