aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:20:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:20:27 +0000
commit77990e170e992a745b7edde92fbb705247ab83e8 (patch)
tree5e686547c9bb6d8a752a00c08616a79e872cb8db /src/transport/plugin_transport_wlan.c
parent15f8a6f2e023e9da4b41153ecb3fafda2e23cfe7 (diff)
downloadgnunet-77990e170e992a745b7edde92fbb705247ab83e8.tar.gz
gnunet-77990e170e992a745b7edde92fbb705247ab83e8.zip
overhead reporting
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r--src/transport/plugin_transport_wlan.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 49fe101b7..d23608db9 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -260,6 +260,16 @@ struct FragmentMessage
260 */ 260 */
261 void *cont_cls; 261 void *cont_cls;
262 262
263 /**
264 * Size of original message
265 */
266 size_t size_payload;
267
268 /**
269 * Number of bytes used to transmit message
270 */
271 size_t size_on_wire;
272
263}; 273};
264 274
265 275
@@ -745,6 +755,7 @@ transmit_fragment (void *cls,
745 &radio_header->header, 755 &radio_header->header,
746 GNUNET_NO, 756 GNUNET_NO,
747 &fragment_transmission_done, fm); 757 &fragment_transmission_done, fm);
758 fm->size_on_wire += size;
748 if (NULL != fm->sh) 759 if (NULL != fm->sh)
749 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN message fragments sent"), 760 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN message fragments sent"),
750 1, GNUNET_NO); 761 1, GNUNET_NO);
@@ -804,7 +815,7 @@ fragmentmessage_timeout (void *cls,
804 fm->timeout_task = GNUNET_SCHEDULER_NO_TASK; 815 fm->timeout_task = GNUNET_SCHEDULER_NO_TASK;
805 if (NULL != fm->cont) 816 if (NULL != fm->cont)
806 { 817 {
807 fm->cont (fm->cont_cls, &fm->target, GNUNET_SYSERR); 818 fm->cont (fm->cont_cls, &fm->target, GNUNET_SYSERR, fm->size_payload, fm->size_on_wire);
808 fm->cont = NULL; 819 fm->cont = NULL;
809 } 820 }
810 free_fragment_message (fm); 821 free_fragment_message (fm);
@@ -818,6 +829,7 @@ fragmentmessage_timeout (void *cls,
818 * @param timeout how long can the message wait? 829 * @param timeout how long can the message wait?
819 * @param target peer that should receive the message 830 * @param target peer that should receive the message
820 * @param msg message to transmit 831 * @param msg message to transmit
832 * @param bytes of payload
821 * @param cont continuation to call once the message has 833 * @param cont continuation to call once the message has
822 * been transmitted (or if the transport is ready 834 * been transmitted (or if the transport is ready
823 * for the next transmission call; or if the 835 * for the next transmission call; or if the
@@ -829,6 +841,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
829 struct GNUNET_TIME_Relative timeout, 841 struct GNUNET_TIME_Relative timeout,
830 const struct GNUNET_PeerIdentity *target, 842 const struct GNUNET_PeerIdentity *target,
831 const struct GNUNET_MessageHeader *msg, 843 const struct GNUNET_MessageHeader *msg,
844 size_t payload_size,
832 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 845 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
833 846
834{ 847{
@@ -839,6 +852,8 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
839 fm = GNUNET_malloc (sizeof (struct FragmentMessage)); 852 fm = GNUNET_malloc (sizeof (struct FragmentMessage));
840 fm->macendpoint = endpoint; 853 fm->macendpoint = endpoint;
841 fm->target = *target; 854 fm->target = *target;
855 fm->size_payload = payload_size;
856 fm->size_on_wire = 0;
842 fm->timeout = GNUNET_TIME_relative_to_absolute (timeout); 857 fm->timeout = GNUNET_TIME_relative_to_absolute (timeout);
843 fm->cont = cont; 858 fm->cont = cont;
844 fm->cont_cls = cont_cls; 859 fm->cont_cls = cont_cls;
@@ -1079,6 +1094,7 @@ wlan_plugin_send (void *cls,
1079 to, 1094 to,
1080 &session->target, 1095 &session->target,
1081 &wlanheader->header, 1096 &wlanheader->header,
1097 msgbuf_size,
1082 cont, cont_cls); 1098 cont, cont_cls);
1083 return size; 1099 return size;
1084} 1100}
@@ -1177,7 +1193,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1177 mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT); 1193 mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT);
1178 if (NULL != fm->cont) 1194 if (NULL != fm->cont)
1179 { 1195 {
1180 fm->cont (fm->cont_cls, &fm->target, GNUNET_OK); 1196 fm->cont (fm->cont_cls, &fm->target, GNUNET_OK, fm->size_payload, fm->size_on_wire);
1181 fm->cont = NULL; 1197 fm->cont = NULL;
1182 } 1198 }
1183 free_fragment_message (fm); 1199 free_fragment_message (fm);