Serialization Requirements

This section defines Software Low-Level Requirements (SW-LLR) for the SOME/IP payload serialization and deserialization engine. All multi-byte values use Big Endian (network byte order) encoding.

Overview

The serialization engine handles:

  1. Primitive types (integers, floats, booleans)

  2. Complex types (arrays, strings, structs)

  3. Buffer management and overflow protection

Primitive Type Serialization

Unsigned Integer Types

Requirement: Serialize uint8 Type REQ_SER_001
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_682, feat_req_someip_171

The software shall serialize uint8 values as a single byte without byte order conversion.

Rationale: Single-byte values have no endianness concern.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize uint16 Type REQ_SER_002
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall serialize uint16 values as 2 bytes in Big Endian byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize uint32 Type REQ_SER_003
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall serialize uint32 values as 4 bytes in Big Endian byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize uint64 Type REQ_SER_004
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_623, feat_req_someip_682

The software shall serialize uint64 values as 8 bytes in Big Endian byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize uint8 Type REQ_SER_005
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_682

The software shall deserialize uint8 values from a single byte without byte order conversion.

Rationale: Single-byte values have no endianness concern.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize uint16 Type REQ_SER_006
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall deserialize uint16 values from 2 bytes in Big Endian byte order to host byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize uint32 Type REQ_SER_007
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall deserialize uint32 values from 4 bytes in Big Endian byte order to host byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize uint64 Type REQ_SER_008
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_623, feat_req_someip_682

The software shall deserialize uint64 values from 8 bytes in Big Endian byte order to host byte order.

Rationale: SOME/IP uses Big Endian for multi-byte values.

Code Location: src/serialization/serializer.cpp

Signed Integer Types

Requirement: Serialize int8 Type REQ_SER_010
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_682

The software shall serialize int8 values as a single byte using two’s complement representation.

Rationale: Standard signed integer representation.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize int16 Type REQ_SER_011
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall serialize int16 values as 2 bytes in Big Endian byte order using two’s complement representation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize int32 Type REQ_SER_012
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall serialize int32 values as 4 bytes in Big Endian byte order using two’s complement representation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize int64 Type REQ_SER_013
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_623, feat_req_someip_682

The software shall serialize int64 values as 8 bytes in Big Endian byte order using two’s complement representation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize int8 Type REQ_SER_014
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_682

The software shall deserialize int8 values from a single byte using two’s complement interpretation.

Rationale: Standard signed integer representation.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize int16 Type REQ_SER_015
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall deserialize int16 values from 2 bytes in Big Endian byte order using two’s complement interpretation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize int32 Type REQ_SER_016
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_682

The software shall deserialize int32 values from 4 bytes in Big Endian byte order using two’s complement interpretation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize int64 Type REQ_SER_017
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224, feat_req_someip_623, feat_req_someip_682

The software shall deserialize int64 values from 8 bytes in Big Endian byte order using two’s complement interpretation.

Rationale: SOME/IP uses Big Endian and two’s complement for signed integers.

Code Location: src/serialization/serializer.cpp

Primitive Type Error Handling

Requirement: Error - uint8 Buffer Overflow on Serialize REQ_SER_001_E01
status: implemented
priority: high

The software shall return an error when serializing a uint8 value and the buffer has less than 1 byte remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint16 Buffer Overflow on Serialize REQ_SER_002_E01
status: implemented
priority: high

The software shall return an error when serializing a uint16 value and the buffer has less than 2 bytes remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint32 Buffer Overflow on Serialize REQ_SER_003_E01
status: implemented
priority: high

The software shall return an error when serializing a uint32 value and the buffer has less than 4 bytes remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint64 Buffer Overflow on Serialize REQ_SER_004_E01
status: implemented
priority: high

The software shall return an error when serializing a uint64 value and the buffer has less than 8 bytes remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint8 Insufficient Data on Deserialize REQ_SER_005_E01
status: implemented
priority: high

The software shall return an error when deserializing a uint8 value and the buffer has less than 1 byte remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint16 Insufficient Data on Deserialize REQ_SER_006_E01
status: implemented
priority: high

The software shall return an error when deserializing a uint16 value and the buffer has less than 2 bytes remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint32 Insufficient Data on Deserialize REQ_SER_007_E01
status: implemented
priority: high

The software shall return an error when deserializing a uint32 value and the buffer has less than 4 bytes remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - uint64 Insufficient Data on Deserialize REQ_SER_008_E01
status: implemented
priority: high

The software shall return an error when deserializing a uint64 value and the buffer has less than 8 bytes remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Boolean Type Serialization

Requirement: Serialize Boolean True REQ_SER_020
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_817

The software shall serialize boolean true as the byte value 0x01.

Rationale: Standard SOME/IP boolean encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize Boolean False REQ_SER_021
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_817

The software shall serialize boolean false as the byte value 0x00.

Rationale: Standard SOME/IP boolean encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Boolean False REQ_SER_022
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_817

The software shall deserialize byte value 0x00 as boolean false.

Rationale: Standard SOME/IP boolean encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Boolean True from 0x01 REQ_SER_023
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_817

The software shall deserialize byte value 0x01 as boolean true.

Rationale: Standard SOME/IP boolean encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Boolean True from Non-Zero Values REQ_SER_024
status: implemented
priority: medium
satisfies: feat_req_someip_172, feat_req_someip_817

The software shall deserialize byte values 0x02 through 0xFF as boolean true for interoperability.

Rationale: Robust parsing accepting any non-zero as true.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Boolean Buffer Overflow on Serialize REQ_SER_020_E01
status: implemented
priority: high

The software shall return an error when serializing a boolean value and the buffer has less than 1 byte remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Boolean Insufficient Data on Deserialize REQ_SER_022_E01
status: implemented
priority: high

The software shall return an error when deserializing a boolean value and the buffer has no remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Floating Point Serialization

Requirement: Serialize float32 Type REQ_SER_030
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224

The software shall serialize float32 values as 4 bytes in IEEE 754 single precision format with Big Endian byte order.

Rationale: SOME/IP uses IEEE 754 for floating point values.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize float64 Type REQ_SER_031
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224

The software shall serialize float64 values as 8 bytes in IEEE 754 double precision format with Big Endian byte order.

Rationale: SOME/IP uses IEEE 754 for floating point values.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize float32 Type REQ_SER_032
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224

The software shall deserialize float32 values from 4 bytes in IEEE 754 single precision format with Big Endian byte order.

Rationale: SOME/IP uses IEEE 754 for floating point values.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize float64 Type REQ_SER_033
status: implemented
priority: high
satisfies: feat_req_someip_172, feat_req_someip_224

The software shall deserialize float64 values from 8 bytes in IEEE 754 double precision format with Big Endian byte order.

Rationale: SOME/IP uses IEEE 754 for floating point values.

Code Location: src/serialization/serializer.cpp

Requirement: Preserve float32 Special Values REQ_SER_034
status: implemented
priority: high
satisfies: feat_req_someip_172

The software shall preserve IEEE 754 special values (NaN, positive infinity, negative infinity) during float32 serialization and deserialization.

Rationale: Special floating point values must be handled correctly.

Code Location: src/serialization/serializer.cpp

Requirement: Preserve float64 Special Values REQ_SER_035
status: implemented
priority: high
satisfies: feat_req_someip_172

The software shall preserve IEEE 754 special values (NaN, positive infinity, negative infinity) during float64 serialization and deserialization.

Rationale: Special floating point values must be handled correctly.

Code Location: src/serialization/serializer.cpp

Requirement: Error - float32 Buffer Overflow on Serialize REQ_SER_030_E01
status: implemented
priority: high

The software shall return an error when serializing a float32 value and the buffer has less than 4 bytes remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - float64 Buffer Overflow on Serialize REQ_SER_031_E01
status: implemented
priority: high

The software shall return an error when serializing a float64 value and the buffer has less than 8 bytes remaining capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - float32 Insufficient Data on Deserialize REQ_SER_032_E01
status: implemented
priority: high

The software shall return an error when deserializing a float32 value and the buffer has less than 4 bytes remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - float64 Insufficient Data on Deserialize REQ_SER_033_E01
status: implemented
priority: high

The software shall return an error when deserializing a float64 value and the buffer has less than 8 bytes remaining data.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Array Serialization

Fixed Length Arrays

Requirement: Serialize Fixed-Length Array REQ_SER_040
status: implemented
priority: high
satisfies: feat_req_someip_241, feat_req_someip_243, feat_req_someip_240, feat_req_someip_242, feat_req_someip_694

The software shall serialize fixed-length arrays as N consecutive elements, where N is the fixed array size.

Rationale: Fixed arrays have known size at compile time.

Code Location: src/serialization/serializer.cpp

Requirement: Calculate Fixed-Length Array Size REQ_SER_041
status: implemented
priority: high
satisfies: feat_req_someip_241, feat_req_someip_243, feat_req_someip_244, feat_req_someip_247

The software shall calculate fixed-length array size as N multiplied by the size of each element.

Rationale: Array size calculation for buffer management.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Fixed-Length Array REQ_SER_042
status: implemented
priority: high
satisfies: feat_req_someip_241, feat_req_someip_243

The software shall deserialize fixed-length arrays by reading N consecutive elements.

Rationale: Fixed arrays have known size at compile time.

Code Location: src/serialization/serializer.cpp

Dynamic Length Arrays

Requirement: Serialize Dynamic Array Length Field REQ_SER_043
status: implemented
priority: high
satisfies: feat_req_someip_254, feat_req_someip_257, feat_req_someip_581, feat_req_someip_253, feat_req_someip_261

The software shall serialize the length field of dynamic arrays as a 4-byte value in Big Endian byte order.

Rationale: Dynamic arrays require a length field.

Code Location: src/serialization/serializer.cpp

Requirement: Dynamic Array Length Field Precedes Data REQ_SER_044
status: implemented
priority: high
satisfies: feat_req_someip_254, feat_req_someip_255, feat_req_someip_256, feat_req_someip_258, feat_req_someip_673, feat_req_someip_674

The software shall serialize the array length field immediately before the array element data.

Rationale: Length is needed before parsing elements.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize Empty Dynamic Array REQ_SER_045
status: implemented
priority: high
satisfies: feat_req_someip_254, feat_req_someip_696

The software shall serialize empty dynamic arrays with a length field value of 0 and no element data.

Rationale: Empty arrays are valid and common.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Dynamic Array Length REQ_SER_046
status: implemented
priority: high
satisfies: feat_req_someip_254, feat_req_someip_257

The software shall read the 4-byte length field first when deserializing a dynamic array.

Rationale: Length determines how many elements to read.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Dynamic Array Elements REQ_SER_047
status: implemented
priority: high
satisfies: feat_req_someip_254, feat_req_someip_257

The software shall deserialize array elements according to the count specified in the length field.

Rationale: Parse the correct number of elements.

Code Location: src/serialization/serializer.cpp

Array Error Handling

Requirement: Error - Array Exceeds Buffer on Serialize REQ_SER_040_E01
status: implemented
priority: high

The software shall return an error when serializing an array that would exceed the remaining buffer capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Array Length Field Overflow REQ_SER_043_E01
status: implemented
priority: high

The software shall return an error when the array size would exceed the maximum value representable in the 4-byte length field.

Rationale: Prevent length field overflow.

Error Handling: Return ARRAY_TOO_LARGE error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Insufficient Data for Array Length REQ_SER_046_E01
status: implemented
priority: high

The software shall return an error when deserializing a dynamic array and there are less than 4 bytes remaining for the length field.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Insufficient Data for Array Elements REQ_SER_047_E01
status: implemented
priority: high

The software shall return an error when deserializing a dynamic array and the remaining buffer is smaller than the declared array size.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Array Element Count Mismatch REQ_SER_047_E02
status: implemented
priority: medium

The software shall return an error when the array length field value is not evenly divisible by the element size.

Rationale: Ensures complete elements in array data.

Error Handling: Return MALFORMED_DATA error code.

Code Location: src/serialization/serializer.cpp

String Serialization

Requirement: Serialize String UTF-8 Encoding REQ_SER_050
status: implemented
priority: high
satisfies: feat_req_someip_233, feat_req_someip_234, feat_req_someip_235, feat_req_someip_687, feat_req_someip_236, feat_req_someip_665

The software shall serialize strings using UTF-8 encoding.

Rationale: SOME/IP specifies UTF-8 for string encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize String Length Field REQ_SER_051
status: implemented
priority: high
satisfies: feat_req_someip_237, feat_req_someip_582, feat_req_someip_800

The software shall serialize the string length field as a 4-byte value that includes the BOM (3 bytes) and null terminator (1 byte) in addition to the string content.

Rationale: Length field represents total byte count.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize String BOM REQ_SER_052
status: implemented
priority: high
satisfies: feat_req_someip_662, feat_req_someip_800

The software shall prepend the UTF-8 Byte Order Mark (0xEF 0xBB 0xBF) at the start of serialized strings.

Rationale: BOM indicates UTF-8 encoding.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize String Null Terminator REQ_SER_053
status: implemented
priority: high
satisfies: feat_req_someip_233, feat_req_someip_687

The software shall append a null terminator (0x00) at the end of serialized strings.

Rationale: Null termination for C-style string compatibility.

Code Location: src/serialization/serializer.cpp

Requirement: Serialize Empty String REQ_SER_054
status: implemented
priority: medium
satisfies: feat_req_someip_237

The software shall serialize empty strings with length field value 4 (BOM + terminator), followed by the BOM and null terminator.

Rationale: Empty strings still require BOM and terminator.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize String Length REQ_SER_055
status: implemented
priority: high
satisfies: feat_req_someip_237, feat_req_someip_562, feat_req_someip_582

The software shall read the 4-byte length field first when deserializing a string.

Rationale: Length determines string byte count.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize String Content REQ_SER_056
status: implemented
priority: high
satisfies: feat_req_someip_237

The software shall extract the string content by removing the BOM and null terminator after reading the raw bytes.

Rationale: Application receives clean string data.

Code Location: src/serialization/serializer.cpp

String Error Handling

Requirement: Error - String Missing Null Terminator REQ_SER_053_E01
status: implemented
priority: high

The software shall return an error when deserializing a string that does not end with a null terminator.

Rationale: Malformed string detection.

Error Handling: Return MALFORMED_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - String Invalid UTF-8 Sequence REQ_SER_050_E01
status: implemented
priority: medium

The software shall detect invalid UTF-8 sequences during string deserialization and handle according to configuration (error or replace).

Rationale: UTF-8 validation for data integrity.

Error Handling: Return INVALID_ENCODING error or replace with replacement character.

Code Location: src/serialization/serializer.cpp

Requirement: Error - String Buffer Overflow on Serialize REQ_SER_050_E02
status: implemented
priority: high

The software shall return an error when serializing a string that would exceed the remaining buffer capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - String Insufficient Data on Deserialize REQ_SER_055_E01
status: implemented
priority: high

The software shall return an error when deserializing a string and the remaining buffer is smaller than the declared string length.

Rationale: Prevent buffer overread.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Struct Serialization

Requirement: Serialize Struct Members Sequentially REQ_SER_060
status: implemented
priority: high
satisfies: feat_req_someip_230, feat_req_someip_575, feat_req_someip_167, feat_req_someip_229, feat_req_someip_652

The software shall serialize struct members sequentially in their declaration order.

Rationale: Deterministic serialization order.

Code Location: src/serialization/serializer.cpp

Requirement: No Implicit Padding in Structs REQ_SER_061
status: implemented
priority: high
satisfies: feat_req_someip_574, feat_req_someip_231, feat_req_someip_671

The software shall not insert implicit padding bytes between struct members during serialization.

Rationale: SOME/IP structs are packed by default.

Code Location: src/serialization/serializer.cpp

Requirement: Explicit Alignment Configuration REQ_SER_062
status: implemented
priority: medium
satisfies: feat_req_someip_169, feat_req_someip_711

The software shall support explicit alignment configuration, adding padding bytes only when alignment is explicitly specified.

Rationale: Some use cases require aligned access.

Code Location: src/serialization/serializer.cpp

Requirement: Deserialize Struct Members Sequentially REQ_SER_063
status: implemented
priority: high
satisfies: feat_req_someip_168, feat_req_someip_230

The software shall deserialize struct members sequentially in their expected order.

Rationale: Match serialization order.

Code Location: src/serialization/serializer.cpp

Struct Error Handling

Requirement: Error - Incomplete Struct Data REQ_SER_060_E01
status: implemented
priority: high

The software shall return an error when deserializing a struct and the buffer ends before all members have been read.

Rationale: Prevent incomplete struct deserialization.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Struct Buffer Overflow on Serialize REQ_SER_060_E02
status: implemented
priority: high

The software shall return an error when serializing a struct that would exceed the remaining buffer capacity.

Rationale: Prevent buffer overflow.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Buffer Management

Requirement: Pre-Check Buffer Capacity REQ_SER_070
status: implemented
priority: high
satisfies: feat_req_someip_168

The software shall check buffer capacity before serializing any value to ensure sufficient space is available.

Rationale: Prevents partial writes and buffer overflow.

Code Location: src/serialization/serializer.cpp

Requirement: Return Error on Buffer Overflow REQ_SER_071
status: implemented
priority: high
satisfies: feat_req_someip_168

The software shall return an appropriate error code when a serialization operation would exceed buffer capacity.

Rationale: Consistent error handling for overflow conditions.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: No Partial Writes on Overflow REQ_SER_072
status: implemented
priority: high
satisfies: feat_req_someip_168

The software shall not modify the buffer when a serialization operation would cause an overflow.

Rationale: Atomic operation semantics; buffer remains valid on error.

Error Handling: Return error without modifying buffer.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Null Buffer Pointer REQ_SER_070_E01
status: implemented
priority: high

The software shall return an error when a null buffer pointer is provided for serialization or deserialization.

Rationale: Prevents null pointer dereference.

Error Handling: Return INVALID_ARGUMENT error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Zero Capacity Buffer REQ_SER_070_E02
status: implemented
priority: high

The software shall return an error when a buffer with zero capacity is provided for serialization.

Rationale: Zero-capacity buffer cannot hold any data.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Track Buffer Position REQ_SER_073
status: implemented
priority: high
satisfies: feat_req_someip_168

The software shall track the current position in the buffer during sequential serialization and deserialization operations.

Rationale: Enables sequential value access.

Code Location: src/serialization/serializer.cpp

Requirement: Get Remaining Buffer Capacity REQ_SER_074
status: implemented
priority: medium
satisfies: feat_req_someip_168

The software shall provide a method to query the remaining buffer capacity (total size minus current position).

Rationale: Enables pre-checking before serialization.

Code Location: src/serialization/serializer.cpp

Requirement: Reset Buffer Position REQ_SER_075
status: implemented
priority: medium
satisfies: feat_req_someip_168

The software shall provide a method to reset the buffer position to the beginning for re-reading.

Rationale: Enables re-parsing of buffer contents.

Code Location: src/serialization/serializer.cpp

Alignment Support

Requirement: Align to Boundary REQ_SER_080
status: implemented
priority: medium
satisfies: feat_req_someip_169, feat_req_someip_711

The software shall support aligning the buffer position to a specified boundary by adding padding bytes.

Rationale: Some data types may require alignment.

Code Location: src/serialization/serializer.cpp

Requirement: Alignment Padding Value REQ_SER_081
status: implemented
priority: low
satisfies: feat_req_someip_169, feat_req_someip_711

The software shall use zero (0x00) as the value for alignment padding bytes.

Rationale: Deterministic padding content.

Code Location: src/serialization/serializer.cpp

Requirement: Skip Padding on Deserialize REQ_SER_082
status: implemented
priority: medium
satisfies: feat_req_someip_169, feat_req_someip_711

The software shall skip alignment padding bytes when deserializing aligned data structures.

Rationale: Padding bytes are not part of actual data.

Code Location: src/serialization/serializer.cpp

Enumeration Serialization

Requirement: Serialize Enumeration Type REQ_SER_090
status: implemented
priority: high
satisfies: feat_req_someip_651, feat_req_someip_650, feat_req_someip_692, feat_req_someip_693

The software shall serialize enumeration values based on unsigned integer datatypes (uint8, uint16, uint32, uint64) as defined by the interface specification.

Rationale: Enumerations map symbolic names to integer wire values per the interface definition.

Code Location: src/serialization/serializer.cpp (serialize_uint8/16/32/64 used for enum backing types)

Requirement: Deserialize Undefined Enumeration Values REQ_SER_091
status: implemented
priority: medium
satisfies: feat_req_someip_799

The software shall support sending and receiving undefined enumeration values unless configured otherwise.

Rationale: Accepting undefined enum values enables forward compatibility with newer interface versions.

Code Location: src/serialization/serializer.cpp

Bitfield Serialization

Requirement: Serialize Bitfield as Basic Type REQ_SER_092
status: draft
priority: medium
satisfies: feat_req_someip_689, feat_req_someip_688

The software shall transport bitfields as basic datatypes uint8, uint16, or uint32.

Rationale: Bitfields pack multiple boolean or small-range values into compact integer types.

Code Location: src/serialization/serializer.cpp (serialize_uint8/16/32)

Requirement: Bitfield Name Definition Support REQ_SER_093
status: draft
priority: medium
satisfies: feat_req_someip_690, feat_req_someip_691

The software shall support interface-specified names for each bit and the values each bit can take within a bitfield.

Rationale: Named bits make bitfield interfaces self-documenting and less error-prone.

Code Location: include/serialization/serializer.h

Union/Variant Serialization

Requirement: Union Serialize with Type Field REQ_SER_094a
status: draft
priority: high
satisfies: feat_req_someip_263, feat_req_someip_264, feat_req_someip_262

The software shall serialize unions by writing a type identifier field that indicates the active member type, followed by the member data serialized according to its declared type.

Rationale: The type field allows the receiver to identify which union member is active.

Code Location: src/serialization/serializer.cpp

Requirement: Union Deserialize with Type Dispatch REQ_SER_094b
status: draft
priority: high
satisfies: feat_req_someip_273, feat_req_someip_274, feat_req_someip_275

The software shall deserialize unions by reading the type field first, then dispatching to the appropriate deserializer based on the type identifier.

Rationale: Type-based dispatch ensures the correct deserializer is used for the active member.

Code Location: src/serialization/serializer.cpp

Requirement: Union Padding for Uniform Size REQ_SER_094c
status: draft
priority: medium
satisfies: feat_req_someip_276, feat_req_someip_277, feat_req_someip_278, feat_req_someip_289, feat_req_someip_299

The software shall pad union members to the largest member size when the union is configured for uniform sizing. The padding bytes shall be zero.

Rationale: Uniform padding enables fixed-offset access regardless of active member.

Code Location: src/serialization/serializer.cpp

Requirement: Union Length Field Configuration REQ_SER_095
status: draft
priority: high
satisfies: feat_req_someip_272, feat_req_someip_563, feat_req_someip_566, feat_req_someip_571, feat_req_someip_300

The software shall support configurable union length fields of 0, 8, 16, or 32 bits. Default is 32 bits. A length of 0 means no length field. The length field does not include itself or the type field.

Rationale: Configurable length fields support varying union serialization formats across interfaces.

Code Location: src/serialization/serializer.cpp

Requirement: Union Type Field Configuration REQ_SER_096
status: draft
priority: high
satisfies: feat_req_someip_564, feat_req_someip_565, feat_req_someip_573

The software shall support configurable union type fields of 8, 16, or 32 bits. Default is 32 bits. The order of length and type fields shall be configurable.

Rationale: Configurable type fields and ordering support interface-specific union formats.

Code Location: src/serialization/serializer.cpp

Requirement: Union Zero-Length Same-Size Constraint REQ_SER_097
status: draft
priority: medium
satisfies: feat_req_someip_572, feat_req_someip_583

The software shall enforce that when the union length field is 0 bits, all types must have the same length. If types have different lengths, the implementation shall warn and pad shorter elements with zeros.

Rationale: Zero-length unions with different-sized members need padding to maintain fixed size.

Code Location: src/serialization/serializer.cpp

Optional Parameter Serialization

Requirement: Optional Parameter as Array REQ_SER_098
status: implemented
priority: medium
satisfies: feat_req_someip_252, feat_req_someip_251, feat_req_someip_170

The software shall serialize optional parameters as arrays with 0 to 1 elements.

Rationale: Modeling optionals as 0-1 arrays reuses existing array serialization infrastructure.

Code Location: src/serialization/serializer.cpp (serialize_array with 0-1 elements)

Multidimensional Array Serialization

Requirement: Multidimensional Array Row-Major Order REQ_SER_099
status: draft
priority: medium
satisfies: feat_req_someip_246, feat_req_someip_245

The software shall serialize multidimensional arrays following the C++ row-major memory layout order.

Rationale: Row-major order matches C++ memory layout for zero-copy compatibility.

Code Location: src/serialization/serializer.cpp

Requirement: Multidimensional Dynamic Array Length Fields REQ_SER_100
status: draft
priority: medium
satisfies: feat_req_someip_259, feat_req_someip_260

The software shall use multiple length fields for multidimensional dynamic arrays. Maximum length per dimension shall be defined by the interface specification for static buffer allocation.

Rationale: Per-dimension length fields support ragged multidimensional arrays.

Code Location: src/serialization/serializer.cpp

Requirement: Dynamic Array Length Field Configuration REQ_SER_101
status: implemented
priority: medium
satisfies: feat_req_someip_621

The software shall support configurable dynamic array length fields of 0, 8, 16, or 32 bits as defined by the interface specification.

Rationale: Configurable length field size balances overhead vs maximum array capacity.

Code Location: src/serialization/serializer.cpp (deserialize_dynamic_array length prefix)

Advanced String Serialization

Requirement: UTF-16 String Support REQ_SER_102
status: draft
priority: medium
satisfies: feat_req_someip_234, feat_req_someip_639, feat_req_someip_640, feat_req_someip_641, feat_req_someip_642

The software shall support UTF-16BE and UTF-16LE string encodings. UTF-16 strings shall be zero-terminated with at least two 0x00 bytes, have even length, and ignore the last byte if odd-length.

Rationale: UTF-16 support enables compatibility with interfaces requiring 16-bit character encoding.

Code Location: src/serialization/serializer.cpp

Requirement: String BOM Validation REQ_SER_103
status: draft
priority: medium
satisfies: feat_req_someip_662, feat_req_someip_666

The software shall validate the Byte Order Mark (BOM) against the interface specification and handle BOM mismatches as errors.

Rationale: BOM validation ensures the receiver interprets string encoding correctly.

Code Location: src/serialization/serializer.cpp

Requirement: Fixed-Length String Handling REQ_SER_104
status: draft
priority: medium
satisfies: feat_req_someip_232, feat_req_someip_233, feat_req_someip_239

The software shall serialize fixed-length strings with null-termination and BOM. If alignment is specified, strings shall be padded with null characters to meet the alignment.

Rationale: Fixed-length strings provide deterministic buffer sizes for safety-critical systems.

Code Location: src/serialization/serializer.cpp

Requirement: String Encoding Specification REQ_SER_105
status: implemented
priority: medium
satisfies: feat_req_someip_235, feat_req_someip_238

The software shall serialize strings using the encoding specified in the interface specification (UTF-8, UTF-16BE, or UTF-16LE).

Rationale: Encoding specification ensures sender and receiver agree on character interpretation.

Code Location: src/serialization/serializer.cpp

Struct Length Field

Requirement: Struct Length Field Support REQ_SER_106
status: draft
priority: medium
satisfies: feat_req_someip_600, feat_req_someip_601, feat_req_someip_602

The software shall support an optional length field of 8, 16, or 32 bits prepended to a struct as defined by the interface specification. If not specified, no length field is used. Extra bytes beyond the known struct length shall be skipped.

Rationale: Struct length fields enable receivers to skip unknown trailing members for forward compatibility.

Code Location: src/serialization/serializer.cpp

Serialization Warnings

Requirement: Misaligned Struct Warning REQ_SER_107
status: draft
priority: low
satisfies: feat_req_someip_577, feat_req_someip_671

The software’s code generation toolchain shall warn about misaligned structs but shall not fail code generation.

Rationale: Warnings alert developers to potential performance issues without blocking code generation.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Enum Value Out of Defined Range REQ_SER_090_E01
status: implemented
priority: medium

The software shall handle serialization of enum values outside the defined range according to configuration.

Rationale: Out-of-range enum values may indicate data corruption or version mismatch.

Error Handling: If strict mode: return INVALID_VALUE. If lenient: serialize as underlying integer.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Union Unknown Type ID REQ_SER_094_E01
status: draft
priority: high

The software shall return an error when deserializing a union with an unknown type identifier.

Rationale: Unknown type IDs prevent correct deserialization of the union data.

Error Handling: Return INVALID_TYPE_ID error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Union Data Size Mismatch REQ_SER_094_E02
status: draft
priority: high

The software shall return an error when the union data size does not match the expected size for the declared type.

Rationale: Size mismatch indicates data corruption or version incompatibility.

Error Handling: Return MALFORMED_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - String Length Exceeds Buffer REQ_SER_051_E01
status: implemented
priority: high

The software shall return an error when a string’s declared length exceeds the remaining buffer data.

Rationale: Prevents buffer overread from malicious or corrupted length fields.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Dynamic Array Length Exceeds Maximum REQ_SER_043_E02
status: implemented
priority: medium

The software shall reject dynamic arrays whose declared length exceeds a configurable maximum to prevent excessive memory allocation.

Rationale: Unbounded allocation from untrusted length fields is a denial-of-service vector.

Error Handling: Return ARRAY_TOO_LARGE error code without allocating memory.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Fixed Array Size Mismatch REQ_SER_042_E01
status: implemented
priority: high

The software shall return an error when the remaining buffer is insufficient for the expected fixed-array size.

Rationale: Incomplete fixed arrays cannot be partially deserialized.

Error Handling: Return INSUFFICIENT_DATA error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Alignment Exceeds Buffer REQ_SER_080_E01
status: implemented
priority: medium

The software shall return an error when alignment padding would exceed the buffer capacity.

Rationale: Alignment must respect buffer boundaries.

Error Handling: Return BUFFER_OVERFLOW error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Signed Integer Overflow Detection REQ_SER_010_E01
status: implemented
priority: medium

The software shall detect and handle signed integer values that exceed the range of the target type.

Rationale: Overflow in signed integers produces implementation-defined behavior.

Error Handling: Truncate to valid range or return OVERFLOW error based on configuration.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Float NaN Comparison REQ_SER_034_E01
status: implemented
priority: medium

The software shall preserve NaN bit patterns through serialization without treating NaN as equal to any value.

Rationale: NaN has special comparison semantics that must be preserved.

Error Handling: No error; preserve bit pattern faithfully.

Code Location: src/serialization/serializer.cpp

Requirement: Error - String Embedded Null REQ_SER_056_E01
status: implemented
priority: medium

The software shall handle strings with embedded null bytes according to configuration.

Rationale: Embedded nulls can cause string truncation in C-style string handling.

Error Handling: Truncate at first null (default) or preserve full length based on config.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Nested Array Depth Limit REQ_SER_040_E02
status: implemented
priority: medium

The software shall limit array nesting depth to prevent stack overflow during recursive serialization.

Rationale: Unbounded recursion from deeply nested structures causes stack overflow.

Error Handling: Return NESTING_TOO_DEEP error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Deserialization Position Beyond Buffer REQ_SER_073_E01
status: implemented
priority: high

The software shall reject read operations when the internal position is beyond the buffer boundary.

Rationale: Position beyond buffer indicates a programming error.

Error Handling: Return INVALID_STATE error code.

Code Location: src/serialization/serializer.cpp

Requirement: Error - Multiple Alignment Overflows REQ_SER_080_E02
status: implemented
priority: medium

The software shall prevent integer overflow when calculating alignment positions.

Rationale: Repeated alignment could overflow the position counter.

Error Handling: Check for overflow before adding padding.

Code Location: src/serialization/serializer.cpp

Traceability

Implementation Files

  • include/serialization/serializer.h - Serializer/Deserializer interfaces

  • src/serialization/serializer.cpp - Serialization implementation

Test Files

  • tests/test_serialization.cpp - Serialization unit tests