mirror of
https://gitlab.com/d3tn/ud3tn.git
synced 2026-08-13 12:33:27 +02:00
In outgoing status reports, previously, we did not send timestamps, even in case they were requested for BPv7 bundles. This refactors the corresponding functions to generate status reports, so we assign the proper timestamp depending on the status flag. Note that we never supported sending a status report capturing multiple events at once -- only the BPv7 SR serializer supports the generation. Signed-off-by: Felix Walter <felix.walter@d3tn.com>
41 lines
1.4 KiB
C
41 lines
1.4 KiB
C
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
|
#ifndef BUNDLE7_REPORTS_INCLUDED
|
|
#define BUNDLE7_REPORTS_INCLUDED
|
|
|
|
#include "ud3tn/bundle.h" // struct bundle, struct bundle_status_report
|
|
#include "ud3tn/eid.h" // struct eid
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
/**
|
|
* Generates a BPv7 administrative record bundle of type
|
|
* "Bundle status report" for the given bundle that can be sent
|
|
* to the Report-To EID.
|
|
*
|
|
* @param bundle Bundle for which the status report should be created
|
|
* @param prototype a structure containing the type, reason, and timestamps for the status report
|
|
* to be sent (note that this struct is only read, not modified)
|
|
* @param source source EID for the status report bundle
|
|
* @param report_creation_timestamp_ms the DTN time when the SR was generated
|
|
*
|
|
* @return a bundle representing the SR, or NULL on error
|
|
*/
|
|
struct bundle *bundle7_generate_status_report(
|
|
const struct bundle *const bundle,
|
|
const struct bundle_status_report *prototype,
|
|
const struct eid source,
|
|
uint64_t report_creation_timestamp_ms);
|
|
|
|
|
|
/**
|
|
* Parses the payload block of the a BPv7-bis administrative record
|
|
*/
|
|
struct bundle_administrative_record *bundle7_parse_administrative_record(
|
|
const uint8_t *const data, const size_t length);
|
|
|
|
|
|
void free_record_fields(struct bundle_administrative_record *record);
|
|
|
|
#endif /* BUNDLE7_REPORTS_INCLUDED */
|