aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-07-15 11:45:15 +0000
committerBart Polot <bart@net.in.tum.de>2015-07-15 11:45:15 +0000
commita390c81a78fc3e4e611ef005ac02e2a28102a8fd (patch)
tree7ded71063245a6522e6e0d0aa2ca439ca75bc731 /src
parent0493854c02394176602a952d6716ff6631ac7cf2 (diff)
downloadgnunet-a390c81a78fc3e4e611ef005ac02e2a28102a8fd.tar.gz
gnunet-a390c81a78fc3e4e611ef005ac02e2a28102a8fd.zip
Detailed statistics
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c4
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c19
2 files changed, 19 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index e0a2039cb..cd36cf1af 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -2470,7 +2470,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
2470 /* Is this message for us? */ 2470 /* Is this message for us? */
2471 if (GCC_is_terminal (c, fwd)) 2471 if (GCC_is_terminal (c, fwd))
2472 { 2472 {
2473 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); 2473 GNUNET_STATISTICS_update (stats, "# received encrypted", 1, GNUNET_NO);
2474 2474
2475 if (NULL == c->t) 2475 if (NULL == c->t)
2476 { 2476 {
@@ -2546,7 +2546,7 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2546 if (GCC_is_terminal (c, fwd)) 2546 if (GCC_is_terminal (c, fwd))
2547 { 2547 {
2548 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n"); 2548 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n");
2549 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); 2549 GNUNET_STATISTICS_update (stats, "# received KX", 1, GNUNET_NO);
2550 if (NULL == c->t) 2550 if (NULL == c->t)
2551 { 2551 {
2552 GNUNET_break (0); 2552 GNUNET_break (0);
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 515f05a4d..04560ae53 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -2476,7 +2476,9 @@ handle_data (struct CadetTunnel *t,
2476 int fwd) 2476 int fwd)
2477{ 2477{
2478 struct CadetChannel *ch; 2478 struct CadetChannel *ch;
2479 char buf[128];
2479 size_t size; 2480 size_t size;
2481 uint16_t type;
2480 2482
2481 /* Check size */ 2483 /* Check size */
2482 size = ntohs (msg->header.size); 2484 size = ntohs (msg->header.size);
@@ -2487,8 +2489,11 @@ handle_data (struct CadetTunnel *t,
2487 GNUNET_break (0); 2489 GNUNET_break (0);
2488 return; 2490 return;
2489 } 2491 }
2490 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", 2492 type = ntohs (msg[1].header.type);
2491 GC_m2s (ntohs (msg[1].header.type))); 2493 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", GC_m2s (type));
2494 sprintf (buf, "# received payload of type %hu", type);
2495 GNUNET_STATISTICS_update (stats, buf, 1, GNUNET_NO);
2496
2492 2497
2493 /* Check channel */ 2498 /* Check channel */
2494 ch = GCT_get_channel (t, ntohl (msg->chid)); 2499 ch = GCT_get_channel (t, ntohl (msg->chid));
@@ -3005,9 +3010,13 @@ handle_decrypted (struct CadetTunnel *t,
3005 int fwd) 3010 int fwd)
3006{ 3011{
3007 uint16_t type; 3012 uint16_t type;
3013 char buf[256];
3008 3014
3009 type = ntohs (msgh->type); 3015 type = ntohs (msgh->type);
3010 LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GC_m2s (type), GCT_2s (t)); 3016 LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GC_m2s (type), GCT_2s (t));
3017 sprintf (buf, "# received encrypted of type %hu (%s)", type, GC_m2s (type));
3018 GNUNET_STATISTICS_update (stats, buf, 1, GNUNET_NO);
3019
3011 3020
3012 switch (type) 3021 switch (type)
3013 { 3022 {
@@ -3080,6 +3089,7 @@ GCT_handle_encrypted (struct CadetTunnel *t,
3080 { 3089 {
3081 const struct GNUNET_CADET_Encrypted *emsg; 3090 const struct GNUNET_CADET_Encrypted *emsg;
3082 3091
3092 GNUNET_STATISTICS_update (stats, "# received OTR", 1, GNUNET_NO);
3083 emsg = (const struct GNUNET_CADET_Encrypted *) msg; 3093 emsg = (const struct GNUNET_CADET_Encrypted *) msg;
3084 payload_size = size - sizeof (struct GNUNET_CADET_Encrypted); 3094 payload_size = size - sizeof (struct GNUNET_CADET_Encrypted);
3085 decrypted_size = t_decrypt_and_validate (t, cbuf, &emsg[1], payload_size, 3095 decrypted_size = t_decrypt_and_validate (t, cbuf, &emsg[1], payload_size,
@@ -3090,6 +3100,7 @@ GCT_handle_encrypted (struct CadetTunnel *t,
3090 { 3100 {
3091 const struct GNUNET_CADET_AX *emsg; 3101 const struct GNUNET_CADET_AX *emsg;
3092 3102
3103 GNUNET_STATISTICS_update (stats, "# received Axolotl", 1, GNUNET_NO);
3093 emsg = (const struct GNUNET_CADET_AX *) msg; 3104 emsg = (const struct GNUNET_CADET_AX *) msg;
3094 decrypted_size = t_ax_decrypt_and_validate (t, cbuf, emsg, size); 3105 decrypted_size = t_ax_decrypt_and_validate (t, cbuf, emsg, size);
3095 } 3106 }
@@ -3102,6 +3113,7 @@ GCT_handle_encrypted (struct CadetTunnel *t,
3102 if (-1 == decrypted_size) 3113 if (-1 == decrypted_size)
3103 { 3114 {
3104 GNUNET_break_op (0); 3115 GNUNET_break_op (0);
3116 GNUNET_STATISTICS_update (stats, "# unable to decrypt", 1, GNUNET_NO);
3105 LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong crypto on tunnel %s\n", GCT_2s (t)); 3117 LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong crypto on tunnel %s\n", GCT_2s (t));
3106 GCT_debug (t, GNUNET_ERROR_TYPE_WARNING); 3118 GCT_debug (t, GNUNET_ERROR_TYPE_WARNING);
3107 return; 3119 return;
@@ -3140,9 +3152,12 @@ GCT_handle_kx (struct CadetTunnel *t,
3140 const struct GNUNET_MessageHeader *message) 3152 const struct GNUNET_MessageHeader *message)
3141{ 3153{
3142 uint16_t type; 3154 uint16_t type;
3155 char buf[256];
3143 3156
3144 type = ntohs (message->type); 3157 type = ntohs (message->type);
3145 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx message received: %s\n", GC_m2s (type)); 3158 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx message received: %s\n", GC_m2s (type));
3159 sprintf (buf, "# received KX of type %hu (%s)", type, GC_m2s (type));
3160 GNUNET_STATISTICS_update (stats, buf, 1, GNUNET_NO);
3146 switch (type) 3161 switch (type)
3147 { 3162 {
3148 case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL: 3163 case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL: