Commit 5fdc3229 authored by Andreas Schmidt's avatar Andreas Schmidt

~= refactor

parent 018162d6
......@@ -24,7 +24,7 @@ local pf_data = ProtoField.new("Data", "prrt.data", ftypes.BYTES, base.NONE)
local pf_data_length = ProtoField.uint32("prrt.data.length", "Length")
local pf_data_btl_pace = ProtoField.uint32("prrt.data.btl_pace", "Bottleneck Pace")
local pf_data_timestamp = ProtoField.uint32("prrt.data.timestamp", "Timestamp")
local pf_data_groupRTprop = ProtoField.uint32("prrt.data.grouprtprop", "Group RTprop")
local pf_data_RTprop = ProtoField.uint32("prrt.data.RTprop", "RTprop")
local pf_data_packettimeout = ProtoField.uint32("prrt.data.packettimeout", "Packet Timeout")
local pf_data_btlDatarate = ProtoField.uint32("prrt.data.btl_datarate", "Bottleneck Datarate")
......@@ -36,7 +36,6 @@ local pf_red_n = ProtoField.uint8("prrt.redundancy.n", "n")
local pf_red_k = ProtoField.uint8("prrt.redundancy.k", "k")
local pf_fb = ProtoField.new("Feedback", "prrt.feedback", ftypes.BYTES, base.NONE)
local pf_fb_groupRTT = ProtoField.uint32("prrt.feedback.groupRTT", "Group RTT")
local pf_fb_ftt = ProtoField.uint32("prrt.feedback.FTT", "FTT")
local pf_fb_btlPace = ProtoField.uint32("prrt.feedback.btlPace", "Bottleneck pace")
local pf_fb_erasurecount = ProtoField.uint16("prrt.feedback.erasureCount", "Erasure count")
......@@ -59,7 +58,7 @@ prrt_proto.fields = {
pf_data_length,
pf_data_btl_pace,
pf_data_timestamp,
pf_data_groupRTprop,
pf_data_RTprop,
pf_data_packettimeout,
pf_data_btlDatarate,
......@@ -71,7 +70,6 @@ prrt_proto.fields = {
pf_red_k,
pf_fb,
pf_fb_groupRTT,
pf_fb_ftt,
pf_fb_btlPace,
pf_fb_erasurecount,
......@@ -122,7 +120,7 @@ local function dissect_data(buffer, pinfo, root)
tree:add(pf_data_btl_pace, buffer:range(0,4))
tree:add(pf_data_length, buffer:range(4,4))
tree:add(pf_data_timestamp, buffer:range(8,4))
tree:add(pf_data_groupRTprop, buffer:range(12,4))
tree:add(pf_data_RTprop, buffer:range(12,4))
tree:add(pf_data_packettimeout, buffer:range(16,4))
tree:add(pf_data_btlDatarate, buffer:range(20,4))
......@@ -146,17 +144,16 @@ end
local function dissect_feedback(buffer, pinfo, root)
local tree = root:add(pf_fb, buffer:range(0))
tree:add(pf_fb_groupRTT, buffer:range(0,4))
tree:add(pf_fb_ftt, buffer:range(4,4))
tree:add(pf_fb_btlPace, buffer:range(8,4))
tree:add(pf_fb_erasurecount, buffer:range(12,2))
tree:add(pf_fb_packetcount, buffer:range(14,2))
tree:add(pf_fb_gaplength, buffer:range(16,2))
tree:add(pf_fb_gapcount, buffer:range(18,2))
tree:add(pf_fb_burstlength, buffer:range(20,2))
tree:add(pf_fb_burstcount, buffer:range(22,2))
tree:add(pf_fb_acktype, buffer:range(24,1))
tree:add(pf_fb_ackSeqN, buffer:range(25, 2))
tree:add(pf_fb_ftt, buffer:range(0,4))
tree:add(pf_fb_btlPace, buffer:range(4,4))
tree:add(pf_fb_erasurecount, buffer:range(8,2))
tree:add(pf_fb_packetcount, buffer:range(10,2))
tree:add(pf_fb_gaplength, buffer:range(12,2))
tree:add(pf_fb_gapcount, buffer:range(14,2))
tree:add(pf_fb_burstlength, buffer:range(16,2))
tree:add(pf_fb_burstcount, buffer:range(18,2))
tree:add(pf_fb_acktype, buffer:range(20,1))
tree:add(pf_fb_ackSeqN, buffer:range(21, 2))
local label = "[F]"
tree:set_text(label)
......
......@@ -88,9 +88,8 @@ static bool send_feedback(PrrtSocket *sock_ptr,
PrrtLossStatistics stats = sock_ptr->lossStatistics;
int group_RTT = 0; // TODO: To be determined.
uint32_t local_bottleneck_pace = MAX(PrrtPace_get_effective(sock_ptr->appDeliverPace), PrrtPace_get_effective(sock_ptr->prrtReceivePace));
PrrtPacket *feedback_pkt_ptr = PrrtPacket_create_feedback_packet(0, sock_ptr->sequenceNumberFeedback++, group_RTT,
PrrtPacket *feedback_pkt_ptr = PrrtPacket_create_feedback_packet(0, sock_ptr->sequenceNumberFeedback++,
stats.gapLength, stats.gapCount, stats.burstLength,
stats.burstCount, forwardTripTime,
stats.erasureCount, stats.packetCount,
......@@ -123,7 +122,7 @@ static void handle_data_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
PrrtPacketDataPayload *payload = packet->payload;
prrtTimestamp_t sentTimestamp = payload->timestamp;
sock_ptr->lastSentTimestamp = sentTimestamp;
PrrtClock_update(&sock_ptr->clock, sentTimestamp, payload->groupRTprop_us);
//PrrtClock_update(&sock_ptr->clock, sentTimestamp, payload->RTprop_us);
debug(DEBUG_DATARECEIVER, "Timeout: %lu", payload->packetTimeout_us);
PrrtPacketTimeout *packetTimeout = PrrtPacketTimeout_create(packet);
......
......@@ -240,7 +240,7 @@ void PrrtDataTransmitter_transmit(PrrtSocket *sock_ptr, PrrtPacket *packet) {
packet->index = (uint8_t) (packet->sequenceNumber - sock_ptr->receiveBlock->baseSequenceNumber);
PrrtPacketDataPayload *payload = packet->payload;
payload->groupRTprop_us = PrrtSocket_get_rtprop_fwd(sock_ptr);
payload->RTprop_us = PrrtSocket_get_rtprop_fwd(sock_ptr);
PrrtPacket *packetToSend = PrrtPacket_copy(packet);
debug(DEBUG_DATATRANSMITTER, "Send: %i", packet->sequenceNumber);
......
......@@ -81,7 +81,7 @@ PrrtSocket *PrrtSocket_create(prrtByteCount_t maximum_payload_size, prrtTimedelt
check_mem(s);
s->nextSendTime = 0;
s->pacingEnabled = true;
s->pacingEnabled = false;
s->maximum_payload_size = maximum_payload_size;
s->isHardwareTimestamping = false;
s->interfaceName = NULL;
......
......@@ -40,7 +40,7 @@ int PrrtPacket_print(PrrtPacket *packet_ptr) {
PrrtPacketDataPayload *payload = packet_ptr->payload;
printf("| %61u |\n", payload->timestamp);
printf("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n");
printf("| %61u |\n", payload->groupRTprop_us);
printf("| %61u |\n", payload->RTprop_us);
printf("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n");
printf("| %61u |\n", payload->packetTimeout_us);
printf("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n");
......@@ -55,8 +55,6 @@ int PrrtPacket_print(PrrtPacket *packet_ptr) {
PrrtPacketFeedbackPayload *payload = packet_ptr->payload;
printf("| %61u |\n", payload->groupRTT_us);
printf("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n");
printf("| %61u |\n", payload->forwardTripTimestamp_us);
printf("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n");
printf("| %29u | %29u |\n", payload->erasureCount, payload->packetCount);
......@@ -182,7 +180,6 @@ void *encode_redundancy_header(void *buf_ptr, const void *payload) {
void *encode_feedback_header(void *buf_ptr, const void *payload) {
const PrrtPacketFeedbackPayload *feedbackPayload = payload;
PrrtPacketField_encode(feedbackPayload, buf_ptr, prrtTimedelta_t, groupRTT_us, htonl);
PrrtPacketField_encode(feedbackPayload, buf_ptr, prrtTimestamp_t, forwardTripTimestamp_us, htonl);
PrrtPacketField_encode(feedbackPayload, buf_ptr, prrtTimedelta_t, btl_pace, htonl);
PrrtPacketField_encode(feedbackPayload, buf_ptr, prrtSequenceNumber_t, erasureCount, htons);
......@@ -203,7 +200,7 @@ void *encode_data_header(void *buf_ptr, const void *payload) {
PrrtPacketField_encode(data_payload, buf_ptr, prrtTimedelta_t, btl_pace, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtPacketLength_t, dataLength, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtTimestamp_t, timestamp, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtTimedelta_t, groupRTprop_us, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtTimedelta_t, RTprop_us, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtTimestamp_t, packetTimeout_us, htonl);
PrrtPacketField_encode(data_payload, buf_ptr, prrtDeliveryRate_t, btl_datarate, htonl);
......@@ -283,7 +280,6 @@ void *decode_redundancy_header(void *dstBuffer, const void *srcBuffer) {
void *decode_feedback_header(void *dstBuffer, const void *srcBuffer) {
PrrtPacketFeedbackPayload *feedback_payload = (PrrtPacketFeedbackPayload *) srcBuffer;
PrrtPacketField_decode(feedback_payload, dstBuffer, prrtTimedelta_t, groupRTT_us, ntohl);
PrrtPacketField_decode(feedback_payload, dstBuffer, prrtTimestamp_t, forwardTripTimestamp_us, ntohl);
PrrtPacketField_decode(feedback_payload, dstBuffer, prrtTimedelta_t, btl_pace, ntohl);
PrrtPacketField_decode(feedback_payload, dstBuffer, prrtSequenceNumber_t, erasureCount, ntohs);
......@@ -304,7 +300,7 @@ void *decode_data_header(void *dstBuffer, const void *srcBuffer) {
PrrtPacketField_decode(data_payload, dstBuffer, prrtTimedelta_t, btl_pace, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtPacketLength_t, dataLength, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtTimestamp_t, timestamp, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtTimedelta_t, groupRTprop_us, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtTimedelta_t, RTprop_us, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtTimedelta_t, packetTimeout_us, ntohl);
PrrtPacketField_decode(data_payload, dstBuffer, prrtDeliveryRate_t, btl_datarate, ntohl);
......@@ -339,7 +335,6 @@ PrrtPacket *PrrtPacket_create_data_packet(uint8_t priority, const void *payloadP
dataPayload->dataLength = dataLength;
dataPayload->timestamp = PrrtClock_get_current_time_us();
dataPayload->packetTimeout_us = dataPayload->timestamp + targetDelay;
dataPayload->groupRTprop_us = 0;
PrrtPacket_copy_buffer_to_payload(packet, payloadPointer, PRRT_PACKET_DATA_HEADER_SIZE)
return packet;
......@@ -397,7 +392,7 @@ PrrtPacket *PrrtPacket_create_redundancy_packet(uint8_t priority, void *payloadP
}
PrrtPacket *
PrrtPacket_create_feedback_packet(uint8_t priority, prrtSequenceNumber_t sequenceNumber, prrtTimedelta_t groupRTT,
PrrtPacket_create_feedback_packet(uint8_t priority, prrtSequenceNumber_t sequenceNumber,
prrtSequenceNumber_t gapLength, prrtSequenceNumber_t gapCount,
prrtSequenceNumber_t burstLength, prrtSequenceNumber_t burstCount,
prrtTimestamp_t forwardTripTime, prrtSequenceNumber_t erasureCount,
......@@ -410,7 +405,6 @@ PrrtPacket_create_feedback_packet(uint8_t priority, prrtSequenceNumber_t sequenc
check_mem(payload);
packet->payload = payload;
payload->btl_pace = btl_pace;
payload->groupRTT_us = groupRTT;
payload->forwardTripTimestamp_us = forwardTripTime;
payload->erasureCount = erasureCount;
payload->packetCount = packetCount;
......
......@@ -71,7 +71,7 @@ typedef struct prrtPacket {
typedef struct prrtPacketDataPayload {
prrtPacketLength_t dataLength;
prrtTimestamp_t timestamp;
prrtTimedelta_t groupRTprop_us;
prrtTimedelta_t RTprop_us;
prrtTimestamp_t packetTimeout_us;
prrtDeliveryRate_t btl_datarate;
prrtTimedelta_t btl_pace;
......@@ -101,7 +101,6 @@ typedef struct prrtPacketRedundancyPayload {
sizeof(uint8_t) )
typedef struct prrtPacketFeedbackPayload {
prrtTimedelta_t groupRTT_us;
prrtTimestamp_t forwardTripTimestamp_us;
prrtTimedelta_t btl_pace;
prrtSequenceNumber_t erasureCount;
......@@ -149,7 +148,7 @@ PrrtPacket *PrrtPacket_reconstruct_data_packet(PrrtPacketDataPayload *payload, p
prrtSequenceNumber_t sequenceNumber);
PrrtPacket *
PrrtPacket_create_feedback_packet(uint8_t priority, prrtSequenceNumber_t sequenceNumber, prrtTimedelta_t groupRTT,
PrrtPacket_create_feedback_packet(uint8_t priority, prrtSequenceNumber_t sequenceNumber,
prrtSequenceNumber_t gapLength, prrtSequenceNumber_t gapCount,
prrtSequenceNumber_t burstLength, prrtSequenceNumber_t burstCount,
prrtTimestamp_t forwardTripTime, prrtSequenceNumber_t erasureCount,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment