ud3tn/include/bundle7/create.h
Felix Walter 6a16e94808 bundle: Switch all flags and length fields to 64bit and do not filter
- The standard defines 64 bits for all flags.
- Also see https://www.rfc-editor.org/rfc/rfc9171.html#section-4.2.3-6:
  "Bundle processing control flags that are unrecognized MUST be ignored,
  as future definitions of additional flags might not be integrated
  simultaneously into the Bundle Protocol implementations operating at
  all nodes."
- Similar for blocks:
  https://www.rfc-editor.org/rfc/rfc9171.html#section-4.2.4-2
- The primary block length is calculated internally based on the bundle
  length -- to prevent overflow, we use 64 bit here as well. (We might
  introduce additional checks in the future, but the input being CBOR
  with the validations in the BPv7 parser should already work to
  only allow a "sane" primary block length. For BPv6 we enforce still
  parsing only 16 bits for it.)
- Also define a bit mask for BPv6 flags (`BP_V6_FLAGS`)

Closes: #247, #237

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2026-03-19 18:58:07 +01:00

31 lines
1.3 KiB
C

// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
#ifndef BUNDLE7_CREATE_H_INCLUDED
#define BUNDLE7_CREATE_H_INCLUDED
#include "ud3tn/bundle.h"
#include <stddef.h>
#include <stdint.h>
/**
* Creates a local BPv7-bis bundle using the specified parameters.
*
* @param payload The binary payload data which should be encapsulated.
* Memory management will be taken over by the bundle handling
* functions. In case of errors, the memory is freed.
* @param payload_length The length of the payload data.
* @param source The source EID the created bundle originated from.
* @param destination The destination EID the bundle is addressed to.
* @param report_to The report-to EID (may be the Null Endpoint -- use `eid_get_null()` if unset).
* @param creation_time_ms The bundle creation timestamp (a DTN timestamp in milliseconds).
* @param sequence_number The bundle sequence number.
* @param lifetime_ms The bundle lifetime, in milliseconds.
* @param proc_flags Additional processing flags to be set for the bundle.
*/
struct bundle *bundle7_create_local(
void *payload, size_t payload_length,
const struct eid source, const struct eid destination, const struct eid report_to,
uint64_t creation_time_ms, uint64_t sequence_number,
uint64_t lifetime_ms, uint64_t proc_flags);
#endif // BUNDLE7_CREATE_H_INCLUDED