def relayGapHistogram(self, histo, removeTokens=False, interpolate=True, when="rcv", decay_by=0): """Specify histogram that encodes the delay distribution The delay distribution represents the probability of sending a single additional padding packet after a given delay following a padding packet that originated at this hop. In both cases, the padding packet is sent in the direction of the client. Parameters ---------- histo : list Contains delay distribution of sending an IGNORE cell after sending an IGNORE cell. labels : list Millisecond labels for the bins (with "infinity" bin to allow encoding the probability of not sending any padding packet in response to this packet). removeTokens : bool If True, follow Adaptive Padding token removal rules. If False, histograms are immutable. interpolate : bool If True, randomize the delay uniformly between bin labels If False, use bin labels as exact delay values. when : str If "rcv", this histogram applies to locally-inserted padding packets that were initially sent in response to client-originated data. If "snd", this histogram applies to packets sent in response to locally-inserted padding packets sent in response to upstream data. Note that this means that implementations must maintain this metadata as internal state as the system transitions from BURST_HISTOGRAM initiated padding into GAP_HISTOGRAM initiated padding. decay_by: int To add to the "Infinity" bin after each successive padding packet is sent. Used to create an increasing likelihood of hitting the termination condition with each successive padding packet. """ histo = cast_dictionary_to_type(histo, float) self._gapHistoProbdist[when] = hist.new(histo, interpolate=bool(interpolate), removeTokens=bool(removeTokens), decay_by=decay_by) self._deferGapCallback[when] = self._gapHistoProbdist[when].removeToken
def relayBurstHistogram(self, histo, removeTokens=False, interpolate=True, when="rcv", decay_by=0): """Specify histogram encoding the delay distribution. The delay distribution represents the probability of sending a single padding packet after a given delay in response to either an upstream cell, or a client-originating cell. Parameters ---------- histo : list Contains delay distribution of sending an IGNORE cell after sending an IGNORE cell. labels : list Millisecond labels for the bins (with "infinity" bin to allow encoding the probability of not sending any padding packet in response to this packet). removeTokens : bool If True, follow Adaptive Padding token removal rules. If False, histograms are immutable. interpolate : bool If True, randomize the delay uniformly between bin labels If False, use bin labels as exact delay values. when : str If set to "rcv", this histogram governs the probability of sending a padding packet after some delay in response to a packet originating from the other PT end. If set to "snd", this histogram governs padding packets that are transmitted after a packet arrives from upstream. In both cases, the padding packet is sent in the direction of the client. """ histo = cast_dictionary_to_type(histo, float) self._burstHistoProbdist[when] = hist.new(histo, interpolate=bool(interpolate), removeTokens=bool(removeTokens)) self._deferBurstCallback[when] = self._burstHistoProbdist[when].removeToken