Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Refactored the Binary Encoding implementations #37

Merged
merged 15 commits into from
Nov 20, 2017

Conversation

dmarszk
Copy link
Member

@dmarszk dmarszk commented Oct 30, 2017

This pull request has been created to allow early review of binary encoding refactor.
It will be modified with further patches.

This set of changes corrects baseline binary encoding implementations, allowing reuse of them by the transport bindings, thus reducing amount of encoding code within transport binding implementations (most notably SPP, ZMTP, TCPIP).

Outline of the changes:

  1. All binary encoding variants have been merged into a single project, with 4 modules:
    1.1. Base Binary Encoding (inherits from GEN encoding)
    1.2. Fixed Binary Encoding (inherits from Base)
    1.3. Variable Binary Encoding (inherits from Base)
    1.4. Split Binary Encoding (inherits from Variable)
  2. Implemented binary encoding time handler (BinaryTimeHandler) class, allowing derived binary encodings to easily override time encoding behaviour. The default time handler implements CDS with P-field assumed to be "01000000" for Time (16-bit days since CCSDS Epoch + 32-bit ms in a day) and "01000010" for FineTime (16-bit days since CCSDS Epoch + 32-bit ms in a day + 32-bit picoseconds in a ms).
  3. Created generic BaseBinaryStreamFactory class, simplifying derived implementations StreamFactory source code [COMMENT NEEDED: I think I might have overengineered this one, given that only Split and Variable encodings are using this mechanisms now]
  4. Implemented optional 16-bit length field encoding in Fixed Binary Encoding, configurable through esa.mo.mal.encoder.binary.fixed.shortLengthField property. This is a deviation from the standard, used in OPS-SAT mission and originally implemented in binary encoder for SPP.
  5. Greatly reduced amount of encoding code in the transport binding implementations, leaving only transport-specific bits (e.g. special time encoding [SPP], or header encoding [ZMTP]) [TODO: Test the changes to SPP]

Added missing constructors allowing effective subclassing
…Holder

It allows reusing the class in helper functions of subclasses
* UOctet is always encoded on 1 byte
* String length is unsigned
* Long and ULong is always encoded as VarInt
It will contain all code specific to variable binary encoding
All classes are prefixed with the word
"Base" and abstract.
They are contained within esa.mo.mal.encoder.binary.base
package.
* Removed BinaryListDecoder
  now BinaryDecoder also implements MALListDecoder interface
* Extended functionality of BaseBinaryStreamFactory allowing
  simpler overriding of the produced stream types by child
  classes.
* BinaryStreamHolder and BinaryBufferHolder
  are prefixed according to respective binary encoding
  variant (Base, Fixed, Variable, Split)
@dmarszk dmarszk force-pushed the binary_encoding_refactor branch 4 times, most recently from e5b3d85 to 03e4368 Compare November 3, 2017 16:24
* Base Binary Encoding implementation is now almost fully abstract,
  ensuring the Fixed and Variable encoding code is not mixed up
* Split Binary Encoding is now based on the Variable Binary Encoding
* Patched BigInt (ULong) encoding in Fixed Binary Encoding
Now time encoding can be easily overriden by
overriding the StreamFactory class.

By default encoders come with Binary Time Handler,
encoding Time on 6 and FineTime on 10 bytes.
It corresponds to "01000000" and "01000010"
P-Field value, respectively for Time and FineTime.

Future extensions could include more generic
Time Handler, configurable with various P-Field
values during runtime.
* Added getStreamHolder, getBufferHolder, and getTimeHandler methods
* Made protected constructors public, allowing external classes to
  construct an enc/decoder reusing internals from other enc/decoder instance

Transports like SPP use it to dynamically change header encoder
Removed reimplementations of binary encoders.
Only SPPVarBinary and SPPFixedBinary factories are needed now,
to override timeHandler and preserve backwards compatibility
with configuration properties used with SPP-based applications
Removed custom implementation of TCPIP Fixed Binary Encoding
Moved TCPIPMessageDecoterFactory from encoding package
to the transport package (removing encoding package)
@dmarszk dmarszk changed the title [WIP] DO NOT MERGE (will be rebased) Refactored the Binary Encoding implementations Refactored the Binary Encoding implementations Nov 9, 2017
@SamCooper SamCooper merged commit d0d9477 into esa:master Nov 20, 2017
@gbonnefille
Copy link
Contributor

gbonnefille commented Nov 20, 2017

Please, as the CCSDS_MAL_ENCODING_BINARY was hugely refactored, can you bump the version of the module in the POM?
Idem with CCSDS_MAL_TRANSPORT_TCPIP.

@dmarszk dmarszk deleted the binary_encoding_refactor branch August 14, 2018 13:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants