Session Refactoring to bring logic more near to specs (#590)
* Implement MessageCounters a defined and test
This commit moves the MessageCounter class into an own file and implements the required variants as defined by specification. It also adds tests
* Move MessageCounter into Session
As by specification the message counter should be handled by the respective session, so also move it there.
* Add Message Reception State implementation and tests
To detect duplicate messages the spec defined message Reception state which tracks messages and tests.
* Add message reception states into session
The message Reception state for the incoming messages is tracked by the sessions. So we add it there. The method "updateMessageCounter" throws an DuplicateMessageError in case of a duplicate.
* Remove some messagecounter leftovers in exchangemanager
* Adjust SecureSession creation to object style
* Refactor duplicate identifier for unspecificed node id
* Adjust testing for recent changes
* Refactor calculation of next session id
The logic to find the next available session id should wrap and search free spots - in worst case it should close the oldest unused session.
Additionally this commit moves the session id finding to the respective place where it is needed to prevent taking session ids that are then not ued because of errors.
* Allow multiple UnsecureSessions as defined by specs
Unsecure Sessions are created by their initiator Node Id ... od 0 if not specified. With this change UnsecureSessions also get a close callback for cleanup reasons only.
* Close unsecure sessions after usage
* remove unneeded typecase after changes
* Update session determination
* Add Message duplication handling
* Update Exchange handling to the specs
* Update CASE handling to handle more error cases correctly
* Close exchange after retransmissions
... if close is not already in progress
* remove debug logging
* [execute-chiptests-long] prepare changelog
* enhance tests
* Changelog
* Address review feedback