private void UpdateFlow(ref ConversationInput input, ref FlowValue flow) { flow.FirstSeen = Math.Min(flow.FirstSeen, input.FrameTicks); flow.LastSeen = Math.Max(flow.LastSeen, input.FrameTicks); flow.Packets++; flow.Octets += (ulong)input.FrameSize; }
public override void CopyUpdater(ref ConversationKey key, ref ConversationInput input, ref ConversationValue oldValue, ref ConversationValue newValue) { newValue = new ConversationValue(oldValue.FrameAddresses.Length * 2) { FrameCount = oldValue.FrameCount, ForwardFlow = oldValue.ForwardFlow, ReverseFlow = oldValue.ReverseFlow, }; Array.Copy(oldValue.FrameAddresses, newValue.FrameAddresses, oldValue.FrameCount); UpdateEntry(ref key, ref input, ref newValue); }
public override bool InPlaceUpdater(ref ConversationKey key, ref ConversationInput input, ref ConversationValue value) { if (value.FrameCount < value.FrameAddresses.Length) { UpdateEntry(ref key, ref input, ref value); return(true); } else { return(false); } }
private void UpdateEntry(ref ConversationKey key, ref ConversationInput input, ref ConversationValue value) { if (Equals(key.FlowKey, input.FrameKey)) { UpdateFlow(ref input, ref value.ForwardFlow); } else { UpdateFlow(ref input, ref value.ReverseFlow); } value.FrameAddresses[value.FrameCount] = input.FrameAddress; value.FrameCount++; }
public override void InitialUpdater(ref ConversationKey key, ref ConversationInput input, ref ConversationValue value) { value = new ConversationValue(32) { FrameCount = 1, ForwardFlow = new FlowValue { FirstSeen = input.FrameTicks, LastSeen = input.FrameTicks, Packets = 1, Octets = (ulong)input.FrameSize } }; value.FrameAddresses[0] = input.FrameAddress; }
/// <summary> /// Updates the conversation with the provided frame metadata. /// </summary> /// <param name="client">The client of the conversation store used to update the conversation record.</param> /// <param name="flowKey">The flow key of the conversation.</param> /// <param name="input">The information to update the conversation.</param> /// <returns>true if the conversation was update; false if new conversation was created.</returns> private bool UpdateConversationWithFrame(ConversationsStore.KeyValueStoreClient client, ref FlowKey flowKey, ref ConversationInput input) { var conversationKey = GetConversationKey(flowKey); return(client.Update(ref conversationKey, ref input)); }
public override void ConcurrentReader(ref ConversationKey key, ref ConversationInput input, ref ConversationValue value, ref ConversationOutput dst) { dst.Key = key; dst.Value = value; }