/* * Active Router Transport Protocol (ARTP) implementation * Copyright (c) 2004, Tomas Rebok * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the "BSD License" which is * distributed with the software in the file LICENSE. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD * License for more details. */ /** @file * @c ARTP's configuraton file. * @author Tomas Rebok * @date 2004 */ #ifndef ARTP_CONFIG_H #define ARTP_CONFIG_H 1 /** defined macros that affects the protocol's behavior a lot */ /** Constant that define the ARTP's version. */ #define ARTP_VERSION 1 /** Link idle computing. * This macro says how to compute time when we want to decrease congestion * window size when connection is idle more than computed time. * * @param rto * actual retransmit timeout */ #define LINK_IDLE(rto) (2 * (rto)) /** Initial congestion window size * * @param mss * actual maximum segment size */ #define INITIAL_WINDOW_SIZE(mss) (3 * (mss)) /** Congestion window change after incoming acknowledgement. * This macro says how to change congestion window size when any * acknowledgement came. * * @param mss * current maximum segment size * * @param old_cwnd * old size of congestion window */ #define CWND_ACK(mss, old_cwnd) ((mss) * (mss)) / (old_cwnd) /** Congestion window multiplier after packet loss. * This constant defines multiplier when retransmission took place (packet loss * was detected). */ #define CWND_DOWN_MULTIPLIER 0.7 /** Congestion window change after packet loss. * This macro says how to compute new congestion window size after * retransmission of any packet. * * @param mss * current maximum segment size * * @param old_cwnd * old size of congestion window */ #define CWND_RETRANS(mss, old_cwnd) \ (CWND_DOWN_MULTIPLIER * (old_cwnd) >= INITIAL_WINDOW_SIZE(mss)) \ ? CWND_DOWN_MULTIPLIER * (old_cwnd) \ : INITIAL_WINDOW_SIZE(mss); /** Retransmit timeout computing. * This macro says how to compute packets' retransmit timeout after incoming * ackwnowledgement packet. * * @param srtt * actual smooth round trip time * * @param init_resend_time * initial retransmit timeout */ #define RTO_COMPUTE(srtt, init_resend_time) \ (srtt > 0) ? (4 * (srtt)) : init_resend_time /** Latest acknowledgement packet send time. * This macro says how to compute time when given acknowledgement packet has to * be sent (lately). * * @param srtt * actual smooth round trip time */ #define LATEST_ACKS_SEND(srtt) ((srtt) / 2.0) /** Smooth round trip time computing constant. */ #define SRTT_ALPHA 0.875 /** Smooth round trip time computing. * This macro says how to compute smooth round trip time when actual round * trip time and old smooth round trip time are given. * * @param rtt * actual round trip time * * @param old_srtt * old value of smooth round trip time */ #define SRTT_COMPUTE(rtt, old_srtt) \ ((old_srtt) == 0) ? rtt \ : (SRTT_ALPHA * (old_srtt)) + ((1 - SRTT_ALPHA) * (rtt)); /** Time stamp delta computing constant (see below) */ #define TS_DELTA_ALPHA 0.875 /** Timestamp delta computing. * This macro says how to compute the difference between our time and our * partner's time (timestamp delta). * * @param current_time * actual time * * @param sent_time * sent time of given acknowledgement packet * * @param srtt * actual smooth round trip time * * @param old_ts_delta * old value of timestamp delta */ #define TS_DELTA_COMPUTE(current_time, sent_time, srtt, old_ts_delta) \ ((old_ts_delta) == 0) ? (current_time) - ((sent_time) + (srtt) / 2.0) \ : (TS_DELTA_ALPHA * (old_ts_delta)) + \ ((1 - TS_DELTA_ALPHA) * ((current_time) \ - ((sent_time) + (srtt) / 2.0))) /* NOTE: Instead of smooth computing we can use absolute computing as showed * here. * * #define TS_DELTA_COMPUTE(current_time, sent_time, srtt, old_ts_delta) \ (current_time) - ((sent_time) + (srtt) / 2.0) */ /** Maximal incoming ARTP packet size */ #define MAX_ARTP_PACKET_SIZE 2048 /** Maximal count of sequence numbers in one item of structure for searching * duplicities. */ #define DUPPLE_SEQ_COUNT 100000 /** Maximal read line length from config file */ #define MAX_CONFIG_LINE_LENGTH 1000 #endif /* vim: set ts=4 : */