Exact bounded SENSOR02 capture evidence, independent of TIFF byte order. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <string.h>

Go to the source code of this file.
Data Structures | |
| struct | sensor_capture |
Macros | |
| #define | SENSOR_CAPTURE_BYTES 104U |
| #define | SENSOR_CAPTURE_TAG 0xc7a1U |
Functions | |
| static void | sensor_capture_put (unsigned char *data, uint64_t value, size_t bytes) |
| Write a fixed-width little-endian integer. | |
| static uint64_t | sensor_capture_get (const unsigned char *data, size_t bytes) |
| Read a fixed-width little-endian integer. | |
| static int64_t | sensor_capture_signed (uint64_t value) |
| Interpret a 64-bit wire field as a signed two's-complement value. | |
| static bool | sensor_capture_valid (const struct sensor_capture *record) |
| Check the structural constraints shared by the wire encoder and decoder. | |
| static bool | sensor_capture_encode (const struct sensor_capture *record, unsigned char *data, size_t capacity) |
| Encode a SENSOR02 record in the fixed on-disk layout. | |
| static bool | sensor_capture_decode (struct sensor_capture *record, const unsigned char *data, size_t size) |
| Decode a complete SENSOR02 record. | |
Detailed Description
Exact bounded SENSOR02 capture evidence, independent of TIFF byte order.
See docs/exif.md for byte offsets. Structural validity does not qualify exposure timing; the arbiter checks current boot, JPEG dimensions and freshness.
Definition in file sensor_capture.h.
Macro Definition Documentation
◆ SENSOR_CAPTURE_BYTES
| #define SENSOR_CAPTURE_BYTES 104U |
Definition at line 30 of file sensor_capture.h.
◆ SENSOR_CAPTURE_TAG
| #define SENSOR_CAPTURE_TAG 0xc7a1U |
Definition at line 31 of file sensor_capture.h.
Function Documentation
◆ sensor_capture_decode()
|
inlinestatic |
Decode a complete SENSOR02 record.
- Parameters
-
[out] record Destination for the decoded fields. data Serialized source record. size Exact source length in bytes.
- Returns
- True on success; false leaves the destination unchanged.
Check version and length before indexing the data, then validate a temporary record before assigning it to the caller's destination.
Definition at line 136 of file sensor_capture.h.
◆ sensor_capture_encode()
|
inlinestatic |
Encode a SENSOR02 record in the fixed on-disk layout.
- Parameters
-
record Validated source record; must not overlap data.[out] data Destination byte buffer. capacity Available bytes in data.
- Returns
- True on success; false leaves the destination unchanged.
Validate before the first write, then emit the magic and fields at fixed offsets without copying struct padding.
Definition at line 109 of file sensor_capture.h.
◆ sensor_capture_get()
|
inlinestatic |
Read a fixed-width little-endian integer.
- Parameters
-
data Readable storage of at least bytesoctets.bytes Field width from 1 to 8, validated by the caller.
- Returns
- The value zero-extended to 64 bits.
Assemble bytes rather than loading a native integer, since fields can start at unaligned offsets.
Definition at line 61 of file sensor_capture.h.
◆ sensor_capture_put()
|
inlinestatic |
Write a fixed-width little-endian integer.
- Parameters
-
[out] data Writable storage for bytesoctets.value Integer whose least significant bytes are written. bytes Field width from 1 to 8, validated by the caller.
Explicit byte offsets keep the record independent of alignment and host byte order.
Definition at line 48 of file sensor_capture.h.
◆ sensor_capture_signed()
|
inlinestatic |
Interpret a 64-bit wire field as a signed two's-complement value.
- Parameters
-
value Decoded unsigned bit pattern.
- Returns
- Signed value represented by the same bits.
For negative values, convert the complement first so the cast never receives a value outside the signed range.
Definition at line 75 of file sensor_capture.h.
◆ sensor_capture_valid()
|
inlinestatic |
Check the structural constraints shared by the wire encoder and decoder.
- Parameters
-
record Nullable capture record.
- Returns
- True for JPEG-sized dimensions and a terminated lowercase UUID-shaped boot ID.
This checks syntax and dimensions, not whether the boot ID and timing actually belong to the current capture.
Definition at line 87 of file sensor_capture.h.