From 973f35d132f96de3191e7aea502d96cf645635b8 Mon Sep 17 00:00:00 2001 From: Felix Walter Date: Tue, 15 Apr 2025 13:18:52 +0200 Subject: [PATCH] Implement status report support in AAP 2.0 This enables AAP 2.0 clients to receive status reports with a new ADU flag (as we already deliver BIBE bundles). Moreover, it allows clients to set a report-to EID and sets all of the status report flags on newly created bundles in case a report-to EID is provided. Closes: #241 Signed-off-by: Felix Walter --- components/aap2/aap2.options | 1 + components/aap2/aap2.proto | 6 ++ components/aap2/aap2_agent.c | 21 ++++++- components/bundle6/create.c | 7 ++- components/bundle6/reports.c | 2 +- components/bundle7/create.c | 7 ++- components/bundle7/reports.c | 2 +- components/ud3tn/agent_util.c | 4 +- components/ud3tn/bundle.c | 3 + components/ud3tn/bundle_processor.c | 35 ++++++++--- generated/aap2/aap2.pb.h | 19 ++++-- include/bundle6/create.h | 3 +- include/bundle7/create.h | 3 +- include/ud3tn/bundle.h | 7 +++ .../ud3tn_utils/aap2/bin/aap2_receive.py | 8 ++- .../ud3tn_utils/aap2/bin/aap2_send.py | 6 ++ .../ud3tn_utils/aap2/generated/aap2_pb2.py | 60 +++++++++---------- test/unit/test_bundle6Create.c | 6 +- test/unit/test_bundle6Fragmentation.c | 1 + test/unit/test_bundle6ParserSerializer.c | 1 + test/unit/test_bundle7Create.c | 2 +- 21 files changed, 142 insertions(+), 62 deletions(-) diff --git a/components/aap2/aap2.options b/components/aap2/aap2.options index f83f93f..dae639d 100644 --- a/components/aap2/aap2.options +++ b/components/aap2/aap2.options @@ -5,6 +5,7 @@ aap2.ConnectionConfig.endpoint_id type:FT_POINTER aap2.ConnectionConfig.secret type:FT_POINTER aap2.Welcome.node_id type:FT_POINTER aap2.BundleADU.dst_eid type:FT_POINTER +aap2.BundleADU.report_to_eid type:FT_POINTER aap2.BundleADU.src_eid type:FT_POINTER aap2.BundleADU.adu_flags type:FT_STATIC max_count:2 aap2.Bundle.dst_eid type:FT_POINTER diff --git a/components/aap2/aap2.proto b/components/aap2/aap2.proto index ffd1269..36e13a3 100644 --- a/components/aap2/aap2.proto +++ b/components/aap2/aap2.proto @@ -143,6 +143,9 @@ enum BundleADUFlags { // appropriately. This can be used to securely implement clients that perform // administrative actions (e.g., configuring contacts in a BDM). BUNDLE_ADU_WITH_BDM_AUTH = 2; + + // The (incoming) bundle ADU is a bundle status report. + BUNDLE_ADU_STATUS_REPORT = 3; } // Message transmitting a bundle ADU into either direction. @@ -154,6 +157,9 @@ message BundleADU { string src_eid = 1; // The bundle destination EID. string dst_eid = 2; + // The report-to EID. NOTE: Only supported when sending bundles. + // If this field is set, µD3TN automatically requests all status reports. + string report_to_eid = 7; // The bundle creation time in milliseconds since the DTN epoch as defined // in RFC 9171. Optional when sending bundles (will be assigned by µD3TN). diff --git a/components/aap2/aap2_agent.c b/components/aap2/aap2_agent.c index 2fb1f4c..dd8f033 100644 --- a/components/aap2/aap2_agent.c +++ b/components/aap2/aap2_agent.c @@ -126,6 +126,7 @@ struct aap2_agent_command { struct bundle_adu_flags { bool bpdu; bool with_bdm_auth; + bool status_report; }; // forward declaration @@ -816,6 +817,16 @@ static aap2_ResponseStatus process_adu_msg( flags |= BUNDLE_FLAG_ADMINISTRATIVE_RECORD; } + // If status reporting is requested, we request everything by default. + if (msg->report_to_eid) + flags |= ( + BUNDLE_FLAG_REPORT_DELETION | + BUNDLE_FLAG_REPORT_DELIVERY | + BUNDLE_FLAG_REPORT_FORWARDING | + BUNDLE_FLAG_REPORT_RECEPTION | + BUNDLE_FLAG_REPORT_STATUS_TIME + ); + const uint64_t time_ms = hal_time_get_timestamp_ms(); const uint64_t seqnum = allocate_sequence_number( config, @@ -830,6 +841,7 @@ static aap2_ResponseStatus process_adu_msg( payload_length, config->registered_eid, msg->dst_eid, + msg->report_to_eid, time_ms, seqnum, config->parent->lifetime_ms, flags @@ -840,6 +852,7 @@ static aap2_ResponseStatus process_adu_msg( payload_length, config->registered_eid, msg->dst_eid, + msg->report_to_eid, time_ms, seqnum, config->parent->lifetime_ms, @@ -1048,6 +1061,10 @@ static size_t set_adu_flags( flags_field[count++] = ( aap2_BundleADUFlags_BUNDLE_ADU_WITH_BDM_AUTH ); + if (flags.status_report) + flags_field[count++] = ( + aap2_BundleADUFlags_BUNDLE_ADU_STATUS_REPORT + ); return count; } @@ -1056,14 +1073,16 @@ static int send_bundle_from_queue(struct aap2_agent_comm_config *const config, struct bundle_adu data) { struct bundle_adu_flags flags = { - .bpdu = (data.proc_flags == BUNDLE_FLAG_ADMINISTRATIVE_RECORD), + .bpdu = data.type == BUNDLE_ADU_BPDU, .with_bdm_auth = data.bdm_auth_validated, + .status_report = data.type == BUNDLE_ADU_STATUS_REPORT, }; aap2_AAPMessage msg = aap2_AAPMessage_init_default; msg.which_msg = aap2_AAPMessage_adu_tag; msg.msg.adu.dst_eid = data.destination; msg.msg.adu.src_eid = data.source; + msg.msg.adu.report_to_eid = ""; msg.msg.adu.payload_length = data.length; msg.msg.adu.creation_timestamp_ms = data.bundle_creation_timestamp_ms; msg.msg.adu.sequence_number = data.bundle_sequence_number; diff --git a/components/bundle6/create.c b/components/bundle6/create.c index bb21cc6..0140457 100644 --- a/components/bundle6/create.c +++ b/components/bundle6/create.c @@ -12,7 +12,7 @@ struct bundle *bundle6_create_local( void *payload, size_t payload_length, - const char *source, const char *destination, + const char *source, const char *destination, const char *report_to, uint64_t creation_time_ms, uint64_t sequence_number, uint64_t lifetime_ms, enum bundle_proc_flags proc_flags) { @@ -50,7 +50,10 @@ struct bundle *bundle6_create_local( if (bundle->destination == NULL || strchr(destination, ':') == NULL) goto fail; - bundle->report_to = strdup("dtn:none"); + if (report_to) + bundle->report_to = strdup(report_to); + else + bundle->report_to = strdup("dtn:none"); bundle->current_custodian = strdup("dtn:none"); bundle->payload_block->data = payload; diff --git a/components/bundle6/reports.c b/components/bundle6/reports.c index 4cc95d9..dd0f881 100644 --- a/components/bundle6/reports.c +++ b/components/bundle6/reports.c @@ -31,7 +31,7 @@ static struct bundle *encapsulate_record( struct bundle *result = bundle6_create_local( payload, payload_len, - source_eid, dest_eid, + source_eid, dest_eid, NULL, timestamp_ms, 1, exp_time_ms - timestamp_ms, BUNDLE_FLAG_ADMINISTRATIVE_RECORD); diff --git a/components/bundle7/create.c b/components/bundle7/create.c index d2f9eca..d25fc49 100644 --- a/components/bundle7/create.c +++ b/components/bundle7/create.c @@ -14,7 +14,7 @@ struct bundle *bundle7_create_local( void *payload, size_t payload_length, - const char *source, const char *destination, + const char *source, const char *destination, const char *report_to, uint64_t creation_time_ms, uint64_t sequence_number, uint64_t lifetime_ms, enum bundle_proc_flags proc_flags) { @@ -53,7 +53,10 @@ struct bundle *bundle7_create_local( if (bundle->destination == NULL) goto fail; // bundle_free takes care of source - bundle->report_to = strdup("dtn:none"); + if (report_to) + bundle->report_to = strdup(report_to); + else + bundle->report_to = strdup("dtn:none"); if (bundle->report_to == NULL) goto fail; // bundle_free takes care of source and destination diff --git a/components/bundle7/reports.c b/components/bundle7/reports.c index 39d8c05..2d059d0 100644 --- a/components/bundle7/reports.c +++ b/components/bundle7/reports.c @@ -246,7 +246,7 @@ struct bundle *bundle7_generate_status_report( } return bundle7_create_local( - compress, written, source, bundle->report_to, + compress, written, source, bundle->report_to, NULL, timestamp_ms, 1, exp_time_ms - timestamp_ms, BUNDLE_FLAG_ADMINISTRATIVE_RECORD); } diff --git a/components/ud3tn/agent_util.c b/components/ud3tn/agent_util.c index f84e8e7..e969a7d 100644 --- a/components/ud3tn/agent_util.c +++ b/components/ud3tn/agent_util.c @@ -47,12 +47,12 @@ struct bundle *agent_create_bundle(const uint8_t bp_version, if (bp_version == 6) result = bundle6_create_local( - payload, payload_length, source_eid, destination, + payload, payload_length, source_eid, destination, NULL, creation_timestamp_ms, sequence_number, lifetime_ms, flags); else result = bundle7_create_local( - payload, payload_length, source_eid, destination, + payload, payload_length, source_eid, destination, NULL, creation_timestamp_ms, sequence_number, lifetime_ms, flags); diff --git a/components/ud3tn/bundle.c b/components/ud3tn/bundle.c index cd6ddd9..394a9fc 100644 --- a/components/ud3tn/bundle.c +++ b/components/ud3tn/bundle.c @@ -571,6 +571,9 @@ struct bundle_adu bundle_adu_init(const struct bundle *bundle) bundle_adu.bundle_creation_timestamp_ms = bundle->creation_timestamp_ms; bundle_adu.bundle_sequence_number = bundle->sequence_number; bundle_adu.bdm_auth_validated = bundle->bdm_auth_validated; + // NOTE: NORMAL is always assumed, also for admin. records. Otherwise, + // we would need to parse them here. + bundle_adu.type = BUNDLE_ADU_NORMAL; return bundle_adu; } diff --git a/components/ud3tn/bundle_processor.c b/components/ud3tn/bundle_processor.c index cc6174f..086dd77 100644 --- a/components/ud3tn/bundle_processor.c +++ b/components/ud3tn/bundle_processor.c @@ -1308,10 +1308,12 @@ static void bundle_attempt_reassembly( static void bundle_deliver_adu(const struct bp_context *const ctx, struct bundle_adu adu) { - struct bundle_administrative_record *record; + const char *agent_id = NULL; if (HAS_FLAG(adu.proc_flags, BUNDLE_FLAG_ADMINISTRATIVE_RECORD)) { - record = parse_administrative_record( + + bool forward_to_agent = false; + struct bundle_administrative_record *record = parse_administrative_record( adu.protocol_version, adu.payload, adu.length @@ -1345,19 +1347,26 @@ static void bundle_deliver_adu(const struct bp_context *const ctx, struct bundle ); adu.proc_flags = BUNDLE_FLAG_ADMINISTRATIVE_RECORD; - const char *agent_id = ( + agent_id = ( get_eid_scheme(ctx->local_eid) == EID_SCHEME_DTN ? "bibe" : "2925" ); - ASSERT(agent_id != NULL); LOGF_DEBUG( "BundleProcessor: Received BIBE bundle -> \"%s\"; len(PL) = %d B", agent_id, adu.length ); - agent_forward(ctx->agent_manager, agent_id, adu, ctx); + adu.type = BUNDLE_ADU_BPDU; + forward_to_agent = true; + } else if (record != NULL && + record->type == BUNDLE_AR_STATUS_REPORT) { + LOG_DEBUG("BundleProcessor: Received valid local status report, attempting delivery to agent."); + // NOTE: This *may* return NULL if not registered. + agent_id = get_agent_id(ctx, adu.destination); + adu.type = BUNDLE_ADU_STATUS_REPORT; + forward_to_agent = true; } else if (record != NULL) { LOGF_DEBUG( "BundleProcessor: Received administrative record of unknown type %u, discarding.", @@ -1370,12 +1379,22 @@ static void bundle_deliver_adu(const struct bp_context *const ctx, struct bundle } free_administrative_record(record); + if (!forward_to_agent) + return; + } else { + agent_id = get_agent_id(ctx, adu.destination); + } + + if (agent_id == NULL) { + LOGF_DEBUG( + "BundleProcessor: Received ADU not destined for any registered EID (from = %s, to = %s), dropping.", + adu.source, + adu.destination + ); + bundle_adu_free_members(adu); return; } - const char *agent_id = get_agent_id(ctx, adu.destination); - - ASSERT(agent_id != NULL); LOGF_DEBUG( "BundleProcessor: Received local bundle -> \"%s\"; len(PL) = %d B", agent_id, diff --git a/generated/aap2/aap2.pb.h b/generated/aap2/aap2.pb.h index bfafcd0..0dcee4c 100644 --- a/generated/aap2/aap2.pb.h +++ b/generated/aap2/aap2.pb.h @@ -37,7 +37,9 @@ typedef enum _aap2_BundleADUFlags { ADU, it has been ensured by µD3TN that the sender has been authenticated appropriately. This can be used to securely implement clients that perform administrative actions (e.g., configuring contacts in a BDM). */ - aap2_BundleADUFlags_BUNDLE_ADU_WITH_BDM_AUTH = 2 + aap2_BundleADUFlags_BUNDLE_ADU_WITH_BDM_AUTH = 2, + /* The (incoming) bundle ADU is a bundle status report. */ + aap2_BundleADUFlags_BUNDLE_ADU_STATUS_REPORT = 3 } aap2_BundleADUFlags; /* The reason why a DispatchEvent was triggered. */ @@ -166,6 +168,9 @@ typedef struct _aap2_BundleADU { /* Flags defining specific behavior for the bundle ADU, e.g., for BIBE. */ pb_size_t adu_flags_count; aap2_BundleADUFlags adu_flags[2]; + /* The report-to EID. NOTE: Only supported when sending bundles. + If this field is set, µD3TN automatically requests all status reports. */ + char *report_to_eid; } aap2_BundleADU; /* Message informing a BDM Client about a received or newly-created @@ -346,8 +351,8 @@ extern "C" { #define _aap2_AuthType_ARRAYSIZE ((aap2_AuthType)(aap2_AuthType_AUTH_TYPE_FIB_AND_DISPATCH+1)) #define _aap2_BundleADUFlags_MIN aap2_BundleADUFlags_BUNDLE_ADU_NORMAL -#define _aap2_BundleADUFlags_MAX aap2_BundleADUFlags_BUNDLE_ADU_WITH_BDM_AUTH -#define _aap2_BundleADUFlags_ARRAYSIZE ((aap2_BundleADUFlags)(aap2_BundleADUFlags_BUNDLE_ADU_WITH_BDM_AUTH+1)) +#define _aap2_BundleADUFlags_MAX aap2_BundleADUFlags_BUNDLE_ADU_STATUS_REPORT +#define _aap2_BundleADUFlags_ARRAYSIZE ((aap2_BundleADUFlags)(aap2_BundleADUFlags_BUNDLE_ADU_STATUS_REPORT+1)) #define _aap2_DispatchReason_MIN aap2_DispatchReason_DISPATCH_REASON_UNSPECIFIED #define _aap2_DispatchReason_MAX aap2_DispatchReason_DISPATCH_REASON_TX_SUCCEEDED @@ -388,7 +393,7 @@ extern "C" { #define aap2_AAPMessage_init_default {0, {aap2_Welcome_init_default}} #define aap2_Welcome_init_default {NULL} #define aap2_ConnectionConfig_init_default {0, _aap2_AuthType_MIN, NULL, NULL, 0} -#define aap2_BundleADU_init_default {NULL, NULL, 0, 0, 0, 0, {_aap2_BundleADUFlags_MIN, _aap2_BundleADUFlags_MIN}} +#define aap2_BundleADU_init_default {NULL, NULL, 0, 0, 0, 0, {_aap2_BundleADUFlags_MIN, _aap2_BundleADUFlags_MIN}, NULL} #define aap2_Bundle_init_default {NULL, NULL, 0, 0, 0, 0, 0, 0} #define aap2_BundleDispatchInfo_init_default {0, 0, 0, 0, 0, NULL, NULL, 0} #define aap2_DispatchEvent_init_default {false, aap2_Bundle_init_default, _aap2_DispatchReason_MIN, false, aap2_BundleDispatchInfo_init_default} @@ -400,7 +405,7 @@ extern "C" { #define aap2_AAPMessage_init_zero {0, {aap2_Welcome_init_zero}} #define aap2_Welcome_init_zero {NULL} #define aap2_ConnectionConfig_init_zero {0, _aap2_AuthType_MIN, NULL, NULL, 0} -#define aap2_BundleADU_init_zero {NULL, NULL, 0, 0, 0, 0, {_aap2_BundleADUFlags_MIN, _aap2_BundleADUFlags_MIN}} +#define aap2_BundleADU_init_zero {NULL, NULL, 0, 0, 0, 0, {_aap2_BundleADUFlags_MIN, _aap2_BundleADUFlags_MIN}, NULL} #define aap2_Bundle_init_zero {NULL, NULL, 0, 0, 0, 0, 0, 0} #define aap2_BundleDispatchInfo_init_zero {0, 0, 0, 0, 0, NULL, NULL, 0} #define aap2_DispatchEvent_init_zero {false, aap2_Bundle_init_zero, _aap2_DispatchReason_MIN, false, aap2_BundleDispatchInfo_init_zero} @@ -423,6 +428,7 @@ extern "C" { #define aap2_BundleADU_sequence_number_tag 4 #define aap2_BundleADU_payload_length_tag 5 #define aap2_BundleADU_adu_flags_tag 6 +#define aap2_BundleADU_report_to_eid_tag 7 #define aap2_Bundle_src_eid_tag 1 #define aap2_Bundle_dst_eid_tag 2 #define aap2_Bundle_creation_timestamp_ms_tag 3 @@ -497,7 +503,8 @@ X(a, POINTER, SINGULAR, STRING, dst_eid, 2) \ X(a, STATIC, SINGULAR, UINT64, creation_timestamp_ms, 3) \ X(a, STATIC, SINGULAR, UINT64, sequence_number, 4) \ X(a, STATIC, SINGULAR, UINT64, payload_length, 5) \ -X(a, STATIC, REPEATED, UENUM, adu_flags, 6) +X(a, STATIC, REPEATED, UENUM, adu_flags, 6) \ +X(a, POINTER, SINGULAR, STRING, report_to_eid, 7) #define aap2_BundleADU_CALLBACK NULL #define aap2_BundleADU_DEFAULT NULL diff --git a/include/bundle6/create.h b/include/bundle6/create.h index d0c09c4..7e8dd0f 100644 --- a/include/bundle6/create.h +++ b/include/bundle6/create.h @@ -16,6 +16,7 @@ * @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, or NULL, if not set. * @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. @@ -23,7 +24,7 @@ */ struct bundle *bundle6_create_local( void *payload, size_t payload_length, - const char *source, const char *destination, + const char *source, const char *destination, const char *report_to, uint64_t creation_time_ms, uint64_t sequence_number, uint64_t lifetime_ms, enum bundle_proc_flags proc_flags); diff --git a/include/bundle7/create.h b/include/bundle7/create.h index 7295418..e2cc95d 100644 --- a/include/bundle7/create.h +++ b/include/bundle7/create.h @@ -16,6 +16,7 @@ * @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, or NULL, if not set. * @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. @@ -23,7 +24,7 @@ */ struct bundle *bundle7_create_local( void *payload, size_t payload_length, - const char *source, const char *destination, + const char *source, const char *destination, const char *report_to, uint64_t creation_time_ms, uint64_t sequence_number, uint64_t lifetime_ms, enum bundle_proc_flags proc_flags); diff --git a/include/ud3tn/bundle.h b/include/ud3tn/bundle.h index d1d16c7..c5002b7 100644 --- a/include/ud3tn/bundle.h +++ b/include/ud3tn/bundle.h @@ -382,6 +382,12 @@ enum bundle_routing_priority { BUNDLE_RPRIO_MAX }; +enum bundle_adu_type { + BUNDLE_ADU_NORMAL = 0, + BUNDLE_ADU_BPDU = 1, + BUNDLE_ADU_STATUS_REPORT = 2, +}; + /** * A structure that can be leveraged to represent a bundle ADU for exchange * with connected bundle applications. The most important feature is that an @@ -398,6 +404,7 @@ struct bundle_adu { uint64_t bundle_creation_timestamp_ms; uint64_t bundle_sequence_number; bool bdm_auth_validated; + enum bundle_adu_type type; }; diff --git a/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_receive.py b/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_receive.py index f8ecfb1..af5105e 100644 --- a/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_receive.py +++ b/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_receive.py @@ -60,6 +60,7 @@ def run_aap_recv(aap2_client, max_count, output, verify_pl, newline): enc = False err = False + sr = False if BundleADUFlags.BUNDLE_ADU_BPDU in adu_msg.adu_flags: payload = cbor2.loads(bundle_data) @@ -68,12 +69,13 @@ def run_aap_recv(aap2_client, max_count, output, verify_pl, newline): enc = True else: payload = bundle_data + sr = BundleADUFlags.BUNDLE_ADU_STATUS_REPORT in adu_msg.adu_flags if not err: - enc = " encapsulated" if enc else "" logger.info( - "Received%s bundle from '%s', payload len = %d", - enc, + "Received%s %s from '%s', payload len = %d", + " encapsulated" if enc else "", + "Status Report" if sr else "Bundle", msg.adu.src_eid, len(payload), ) diff --git a/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_send.py b/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_send.py index b6489be..10a2864 100644 --- a/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_send.py +++ b/python-ud3tn-utils/ud3tn_utils/aap2/bin/aap2_send.py @@ -79,6 +79,11 @@ def main(): nargs="?", help="the payload of the created bundle, (default: read from STDIN)", ) + parser.add_argument( + "-r", "--report-to", + default=None, + help="the report-to EID of the created bundle; enables status reports", + ) parser.add_argument( "--bdm-auth", action="store_true", @@ -144,6 +149,7 @@ def main(): aap2_client.send_adu( BundleADU( dst_eid=args.dest_eid, + report_to_eid=args.report_to, payload_length=len(payload), adu_flags=flags, ), diff --git a/python-ud3tn-utils/ud3tn_utils/aap2/generated/aap2_pb2.py b/python-ud3tn-utils/ud3tn_utils/aap2/generated/aap2_pb2.py index 08182b7..8593b45 100644 --- a/python-ud3tn-utils/ud3tn_utils/aap2/generated/aap2_pb2.py +++ b/python-ud3tn-utils/ud3tn_utils/aap2/generated/aap2_pb2.py @@ -24,25 +24,25 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\naap2.proto\x12\x04\x61\x61p2\"\xf0\x01\n\nAAPMessage\x12 \n\x07welcome\x18\x01 \x01(\x0b\x32\r.aap2.WelcomeH\x00\x12(\n\x06\x63onfig\x18\x02 \x01(\x0b\x32\x16.aap2.ConnectionConfigH\x00\x12\x1e\n\x03\x61\x64u\x18\x03 \x01(\x0b\x32\x0f.aap2.BundleADUH\x00\x12-\n\x0e\x64ispatch_event\x18\x04 \x01(\x0b\x32\x13.aap2.DispatchEventH\x00\x12\x1a\n\x04link\x18\x05 \x01(\x0b\x32\n.aap2.LinkH\x00\x12$\n\tkeepalive\x18\x06 \x01(\x0b\x32\x0f.aap2.KeepaliveH\x00\x42\x05\n\x03msg\"\x1a\n\x07Welcome\x12\x0f\n\x07node_id\x18\x01 \x01(\t\"\x8c\x01\n\x10\x43onnectionConfig\x12\x15\n\ris_subscriber\x18\x01 \x01(\x08\x12!\n\tauth_type\x18\x02 \x01(\x0e\x32\x0e.aap2.AuthType\x12\x0e\n\x06secret\x18\x03 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\x04 \x01(\t\x12\x19\n\x11keepalive_seconds\x18\x05 \x01(\r\"\xa6\x01\n\tBundleADU\x12\x0f\n\x07src_eid\x18\x01 \x01(\t\x12\x0f\n\x07\x64st_eid\x18\x02 \x01(\t\x12\x1d\n\x15\x63reation_timestamp_ms\x18\x03 \x01(\x04\x12\x17\n\x0fsequence_number\x18\x04 \x01(\x04\x12\x16\n\x0epayload_length\x18\x05 \x01(\x04\x12\'\n\tadu_flags\x18\x06 \x03(\x0e\x32\x14.aap2.BundleADUFlags\"\xc2\x01\n\x06\x42undle\x12\x0f\n\x07src_eid\x18\x01 \x01(\t\x12\x0f\n\x07\x64st_eid\x18\x02 \x01(\t\x12\x1d\n\x15\x63reation_timestamp_ms\x18\x03 \x01(\x04\x12\x17\n\x0fsequence_number\x18\x04 \x01(\x04\x12\x16\n\x0epayload_length\x18\x05 \x01(\x04\x12\x17\n\x0f\x66ragment_offset\x18\x06 \x01(\x04\x12\x18\n\x10total_adu_length\x18\x07 \x01(\x04\x12\x13\n\x0blifetime_ms\x18\x08 \x01(\x04\"\xfa\x01\n\x12\x42undleDispatchInfo\x12\x17\n\x0fserialized_size\x18\x01 \x01(\x04\x12\x1b\n\x13min_frag_size_first\x18\x02 \x01(\x04\x12\x1a\n\x12min_frag_size_last\x18\x03 \x01(\x04\x12\x18\n\x10\x64ispatch_time_ms\x18\x04 \x01(\x04\x12\x1a\n\x12\x65xpiration_time_ms\x18\x05 \x01(\x04\x12\x1d\n\x15\x64ispatched_to_node_id\x18\x06 \x01(\t\x12\x1e\n\x16\x64ispatched_to_cla_addr\x18\x07 \x01(\t\x12\x1d\n\x15max_bundle_size_bytes\x18\x08 \x01(\x04\"\x8d\x01\n\rDispatchEvent\x12\x1c\n\x06\x62undle\x18\x01 \x01(\x0b\x32\x0c.aap2.Bundle\x12$\n\x06reason\x18\x02 \x01(\x0e\x32\x14.aap2.DispatchReason\x12\x38\n\x16\x61\x64\x64itional_information\x18\x03 \x01(\x0b\x32\x18.aap2.BundleDispatchInfo\"t\n\x04Link\x12 \n\x06status\x18\x01 \x01(\x0e\x32\x10.aap2.LinkStatus\x12\x14\n\x0cpeer_node_id\x18\x02 \x01(\t\x12\x15\n\rpeer_cla_addr\x18\x03 \x01(\t\x12\x1d\n\x04\x66lag\x18\x04 \x01(\x0e\x32\x0f.aap2.LinkFlags\"\x0b\n\tKeepalive\"\x91\x01\n\x0b\x41\x41PResponse\x12-\n\x0fresponse_status\x18\x01 \x01(\x0e\x32\x14.aap2.ResponseStatus\x12-\n\x0f\x64ispatch_result\x18\x02 \x01(\x0b\x32\x14.aap2.DispatchResult\x12$\n\x0e\x62undle_headers\x18\x03 \x01(\x0b\x32\x0c.aap2.Bundle\"\x99\x01\n\x0e\x44ispatchResult\x12\x34\n\tnext_hops\x18\x01 \x03(\x0b\x32!.aap2.DispatchResult.NextHopEntry\x1aQ\n\x0cNextHopEntry\x12\x0f\n\x07node_id\x18\x01 \x01(\t\x12\x17\n\x0f\x66ragment_offset\x18\x02 \x01(\x04\x12\x17\n\x0f\x66ragment_length\x18\x03 \x01(\x04*{\n\x08\x41uthType\x12\x15\n\x11\x41UTH_TYPE_DEFAULT\x10\x00\x12\x19\n\x15\x41UTH_TYPE_FIB_CONTROL\x10\x01\x12\x1d\n\x19\x41UTH_TYPE_BUNDLE_DISPATCH\x10\x02\x12\x1e\n\x1a\x41UTH_TYPE_FIB_AND_DISPATCH\x10\x03*Z\n\x0e\x42undleADUFlags\x12\x15\n\x11\x42UNDLE_ADU_NORMAL\x10\x00\x12\x13\n\x0f\x42UNDLE_ADU_BPDU\x10\x01\x12\x1c\n\x18\x42UNDLE_ADU_WITH_BDM_AUTH\x10\x02*\xdf\x01\n\x0e\x44ispatchReason\x12\x1f\n\x1b\x44ISPATCH_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x44ISPATCH_REASON_NO_FIB_ENTRY\x10\x01\x12!\n\x1d\x44ISPATCH_REASON_LINK_INACTIVE\x10\x02\x12&\n\"DISPATCH_REASON_CLA_ENQUEUE_FAILED\x10\x03\x12\x1d\n\x19\x44ISPATCH_REASON_TX_FAILED\x10\x04\x12 \n\x1c\x44ISPATCH_REASON_TX_SUCCEEDED\x10\x05*u\n\nLinkStatus\x12\x1b\n\x17LINK_STATUS_UNSPECIFIED\x10\x00\x12\x12\n\x0eLINK_STATUS_UP\x10\x03\x12\x14\n\x10LINK_STATUS_DOWN\x10\x04\x12 \n\x1cLINK_STATUS_DROP_CLA_MAPPING\x10\x05*5\n\tLinkFlags\x12\x12\n\x0eLINK_FLAG_NONE\x10\x00\x12\x14\n\x10LINK_FLAG_DIRECT\x10\x01*\x85\x02\n\x0eResponseStatus\x12\x1f\n\x1bRESPONSE_STATUS_UNSPECIFIED\x10\x00\x12\x1b\n\x17RESPONSE_STATUS_SUCCESS\x10\x01\x12\x17\n\x13RESPONSE_STATUS_ACK\x10\x02\x12\x19\n\x15RESPONSE_STATUS_ERROR\x10\x08\x12\x1b\n\x17RESPONSE_STATUS_TIMEOUT\x10\t\x12#\n\x1fRESPONSE_STATUS_INVALID_REQUEST\x10\n\x12\x1d\n\x19RESPONSE_STATUS_NOT_FOUND\x10\x0b\x12 \n\x1cRESPONSE_STATUS_UNAUTHORIZED\x10\x0c\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\naap2.proto\x12\x04\x61\x61p2\"\xf0\x01\n\nAAPMessage\x12 \n\x07welcome\x18\x01 \x01(\x0b\x32\r.aap2.WelcomeH\x00\x12(\n\x06\x63onfig\x18\x02 \x01(\x0b\x32\x16.aap2.ConnectionConfigH\x00\x12\x1e\n\x03\x61\x64u\x18\x03 \x01(\x0b\x32\x0f.aap2.BundleADUH\x00\x12-\n\x0e\x64ispatch_event\x18\x04 \x01(\x0b\x32\x13.aap2.DispatchEventH\x00\x12\x1a\n\x04link\x18\x05 \x01(\x0b\x32\n.aap2.LinkH\x00\x12$\n\tkeepalive\x18\x06 \x01(\x0b\x32\x0f.aap2.KeepaliveH\x00\x42\x05\n\x03msg\"\x1a\n\x07Welcome\x12\x0f\n\x07node_id\x18\x01 \x01(\t\"\x8c\x01\n\x10\x43onnectionConfig\x12\x15\n\ris_subscriber\x18\x01 \x01(\x08\x12!\n\tauth_type\x18\x02 \x01(\x0e\x32\x0e.aap2.AuthType\x12\x0e\n\x06secret\x18\x03 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\x04 \x01(\t\x12\x19\n\x11keepalive_seconds\x18\x05 \x01(\r\"\xbd\x01\n\tBundleADU\x12\x0f\n\x07src_eid\x18\x01 \x01(\t\x12\x0f\n\x07\x64st_eid\x18\x02 \x01(\t\x12\x15\n\rreport_to_eid\x18\x07 \x01(\t\x12\x1d\n\x15\x63reation_timestamp_ms\x18\x03 \x01(\x04\x12\x17\n\x0fsequence_number\x18\x04 \x01(\x04\x12\x16\n\x0epayload_length\x18\x05 \x01(\x04\x12\'\n\tadu_flags\x18\x06 \x03(\x0e\x32\x14.aap2.BundleADUFlags\"\xc2\x01\n\x06\x42undle\x12\x0f\n\x07src_eid\x18\x01 \x01(\t\x12\x0f\n\x07\x64st_eid\x18\x02 \x01(\t\x12\x1d\n\x15\x63reation_timestamp_ms\x18\x03 \x01(\x04\x12\x17\n\x0fsequence_number\x18\x04 \x01(\x04\x12\x16\n\x0epayload_length\x18\x05 \x01(\x04\x12\x17\n\x0f\x66ragment_offset\x18\x06 \x01(\x04\x12\x18\n\x10total_adu_length\x18\x07 \x01(\x04\x12\x13\n\x0blifetime_ms\x18\x08 \x01(\x04\"\xfa\x01\n\x12\x42undleDispatchInfo\x12\x17\n\x0fserialized_size\x18\x01 \x01(\x04\x12\x1b\n\x13min_frag_size_first\x18\x02 \x01(\x04\x12\x1a\n\x12min_frag_size_last\x18\x03 \x01(\x04\x12\x18\n\x10\x64ispatch_time_ms\x18\x04 \x01(\x04\x12\x1a\n\x12\x65xpiration_time_ms\x18\x05 \x01(\x04\x12\x1d\n\x15\x64ispatched_to_node_id\x18\x06 \x01(\t\x12\x1e\n\x16\x64ispatched_to_cla_addr\x18\x07 \x01(\t\x12\x1d\n\x15max_bundle_size_bytes\x18\x08 \x01(\x04\"\x8d\x01\n\rDispatchEvent\x12\x1c\n\x06\x62undle\x18\x01 \x01(\x0b\x32\x0c.aap2.Bundle\x12$\n\x06reason\x18\x02 \x01(\x0e\x32\x14.aap2.DispatchReason\x12\x38\n\x16\x61\x64\x64itional_information\x18\x03 \x01(\x0b\x32\x18.aap2.BundleDispatchInfo\"t\n\x04Link\x12 \n\x06status\x18\x01 \x01(\x0e\x32\x10.aap2.LinkStatus\x12\x14\n\x0cpeer_node_id\x18\x02 \x01(\t\x12\x15\n\rpeer_cla_addr\x18\x03 \x01(\t\x12\x1d\n\x04\x66lag\x18\x04 \x01(\x0e\x32\x0f.aap2.LinkFlags\"\x0b\n\tKeepalive\"\x91\x01\n\x0b\x41\x41PResponse\x12-\n\x0fresponse_status\x18\x01 \x01(\x0e\x32\x14.aap2.ResponseStatus\x12-\n\x0f\x64ispatch_result\x18\x02 \x01(\x0b\x32\x14.aap2.DispatchResult\x12$\n\x0e\x62undle_headers\x18\x03 \x01(\x0b\x32\x0c.aap2.Bundle\"\x99\x01\n\x0e\x44ispatchResult\x12\x34\n\tnext_hops\x18\x01 \x03(\x0b\x32!.aap2.DispatchResult.NextHopEntry\x1aQ\n\x0cNextHopEntry\x12\x0f\n\x07node_id\x18\x01 \x01(\t\x12\x17\n\x0f\x66ragment_offset\x18\x02 \x01(\x04\x12\x17\n\x0f\x66ragment_length\x18\x03 \x01(\x04*{\n\x08\x41uthType\x12\x15\n\x11\x41UTH_TYPE_DEFAULT\x10\x00\x12\x19\n\x15\x41UTH_TYPE_FIB_CONTROL\x10\x01\x12\x1d\n\x19\x41UTH_TYPE_BUNDLE_DISPATCH\x10\x02\x12\x1e\n\x1a\x41UTH_TYPE_FIB_AND_DISPATCH\x10\x03*x\n\x0e\x42undleADUFlags\x12\x15\n\x11\x42UNDLE_ADU_NORMAL\x10\x00\x12\x13\n\x0f\x42UNDLE_ADU_BPDU\x10\x01\x12\x1c\n\x18\x42UNDLE_ADU_WITH_BDM_AUTH\x10\x02\x12\x1c\n\x18\x42UNDLE_ADU_STATUS_REPORT\x10\x03*\xdf\x01\n\x0e\x44ispatchReason\x12\x1f\n\x1b\x44ISPATCH_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x44ISPATCH_REASON_NO_FIB_ENTRY\x10\x01\x12!\n\x1d\x44ISPATCH_REASON_LINK_INACTIVE\x10\x02\x12&\n\"DISPATCH_REASON_CLA_ENQUEUE_FAILED\x10\x03\x12\x1d\n\x19\x44ISPATCH_REASON_TX_FAILED\x10\x04\x12 \n\x1c\x44ISPATCH_REASON_TX_SUCCEEDED\x10\x05*u\n\nLinkStatus\x12\x1b\n\x17LINK_STATUS_UNSPECIFIED\x10\x00\x12\x12\n\x0eLINK_STATUS_UP\x10\x03\x12\x14\n\x10LINK_STATUS_DOWN\x10\x04\x12 \n\x1cLINK_STATUS_DROP_CLA_MAPPING\x10\x05*5\n\tLinkFlags\x12\x12\n\x0eLINK_FLAG_NONE\x10\x00\x12\x14\n\x10LINK_FLAG_DIRECT\x10\x01*\x85\x02\n\x0eResponseStatus\x12\x1f\n\x1bRESPONSE_STATUS_UNSPECIFIED\x10\x00\x12\x1b\n\x17RESPONSE_STATUS_SUCCESS\x10\x01\x12\x17\n\x13RESPONSE_STATUS_ACK\x10\x02\x12\x19\n\x15RESPONSE_STATUS_ERROR\x10\x08\x12\x1b\n\x17RESPONSE_STATUS_TIMEOUT\x10\t\x12#\n\x1fRESPONSE_STATUS_INVALID_REQUEST\x10\n\x12\x1d\n\x19RESPONSE_STATUS_NOT_FOUND\x10\x0b\x12 \n\x1cRESPONSE_STATUS_UNAUTHORIZED\x10\x0c\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'aap2_pb2', _globals) if not _descriptor._USE_C_DESCRIPTORS: DESCRIPTOR._loaded_options = None - _globals['_AUTHTYPE']._serialized_start=1632 - _globals['_AUTHTYPE']._serialized_end=1755 - _globals['_BUNDLEADUFLAGS']._serialized_start=1757 - _globals['_BUNDLEADUFLAGS']._serialized_end=1847 - _globals['_DISPATCHREASON']._serialized_start=1850 - _globals['_DISPATCHREASON']._serialized_end=2073 - _globals['_LINKSTATUS']._serialized_start=2075 - _globals['_LINKSTATUS']._serialized_end=2192 - _globals['_LINKFLAGS']._serialized_start=2194 - _globals['_LINKFLAGS']._serialized_end=2247 - _globals['_RESPONSESTATUS']._serialized_start=2250 - _globals['_RESPONSESTATUS']._serialized_end=2511 + _globals['_AUTHTYPE']._serialized_start=1655 + _globals['_AUTHTYPE']._serialized_end=1778 + _globals['_BUNDLEADUFLAGS']._serialized_start=1780 + _globals['_BUNDLEADUFLAGS']._serialized_end=1900 + _globals['_DISPATCHREASON']._serialized_start=1903 + _globals['_DISPATCHREASON']._serialized_end=2126 + _globals['_LINKSTATUS']._serialized_start=2128 + _globals['_LINKSTATUS']._serialized_end=2245 + _globals['_LINKFLAGS']._serialized_start=2247 + _globals['_LINKFLAGS']._serialized_end=2300 + _globals['_RESPONSESTATUS']._serialized_start=2303 + _globals['_RESPONSESTATUS']._serialized_end=2564 _globals['_AAPMESSAGE']._serialized_start=21 _globals['_AAPMESSAGE']._serialized_end=261 _globals['_WELCOME']._serialized_start=263 @@ -50,21 +50,21 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['_CONNECTIONCONFIG']._serialized_start=292 _globals['_CONNECTIONCONFIG']._serialized_end=432 _globals['_BUNDLEADU']._serialized_start=435 - _globals['_BUNDLEADU']._serialized_end=601 - _globals['_BUNDLE']._serialized_start=604 - _globals['_BUNDLE']._serialized_end=798 - _globals['_BUNDLEDISPATCHINFO']._serialized_start=801 - _globals['_BUNDLEDISPATCHINFO']._serialized_end=1051 - _globals['_DISPATCHEVENT']._serialized_start=1054 - _globals['_DISPATCHEVENT']._serialized_end=1195 - _globals['_LINK']._serialized_start=1197 - _globals['_LINK']._serialized_end=1313 - _globals['_KEEPALIVE']._serialized_start=1315 - _globals['_KEEPALIVE']._serialized_end=1326 - _globals['_AAPRESPONSE']._serialized_start=1329 - _globals['_AAPRESPONSE']._serialized_end=1474 - _globals['_DISPATCHRESULT']._serialized_start=1477 - _globals['_DISPATCHRESULT']._serialized_end=1630 - _globals['_DISPATCHRESULT_NEXTHOPENTRY']._serialized_start=1549 - _globals['_DISPATCHRESULT_NEXTHOPENTRY']._serialized_end=1630 + _globals['_BUNDLEADU']._serialized_end=624 + _globals['_BUNDLE']._serialized_start=627 + _globals['_BUNDLE']._serialized_end=821 + _globals['_BUNDLEDISPATCHINFO']._serialized_start=824 + _globals['_BUNDLEDISPATCHINFO']._serialized_end=1074 + _globals['_DISPATCHEVENT']._serialized_start=1077 + _globals['_DISPATCHEVENT']._serialized_end=1218 + _globals['_LINK']._serialized_start=1220 + _globals['_LINK']._serialized_end=1336 + _globals['_KEEPALIVE']._serialized_start=1338 + _globals['_KEEPALIVE']._serialized_end=1349 + _globals['_AAPRESPONSE']._serialized_start=1352 + _globals['_AAPRESPONSE']._serialized_end=1497 + _globals['_DISPATCHRESULT']._serialized_start=1500 + _globals['_DISPATCHRESULT']._serialized_end=1653 + _globals['_DISPATCHRESULT_NEXTHOPENTRY']._serialized_start=1572 + _globals['_DISPATCHRESULT_NEXTHOPENTRY']._serialized_end=1653 # @@protoc_insertion_point(module_scope) diff --git a/test/unit/test_bundle6Create.c b/test/unit/test_bundle6Create.c index b28361e..b3848f9 100644 --- a/test/unit/test_bundle6Create.c +++ b/test/unit/test_bundle6Create.c @@ -32,7 +32,7 @@ TEST(bundle6Create, create_bundle) struct bundle *b = bundle6_create_local( payload, sizeof(test_payload), - "dtn:sourceeid", "dtn:desteid", + "dtn:sourceeid", "dtn:desteid", NULL, creation_timestamp_ms, 1, 42000, BUNDLE_FLAG_REPORT_DELIVERY); @@ -77,12 +77,12 @@ TEST(bundle6Create, fail_bundle_creation) // NOTE that bundle6_create_local takes over freeing the payload! TEST_ASSERT_NULL(bundle6_create_local( malloc(1), 1, - "dtnsource", "dtn:dest", + "dtnsource", "dtn:dest", NULL, hal_time_get_timestamp_ms(), 1, 42, 0 )); TEST_ASSERT_NULL(bundle6_create_local( malloc(1), 1, - "dtn:source", "dtndest", + "dtn:source", "dtndest", NULL, hal_time_get_timestamp_ms(), 1, 42, 0 )); } diff --git a/test/unit/test_bundle6Fragmentation.c b/test/unit/test_bundle6Fragmentation.c index bc9ae3e..c987f3f 100644 --- a/test/unit/test_bundle6Fragmentation.c +++ b/test/unit/test_bundle6Fragmentation.c @@ -27,6 +27,7 @@ TEST_SETUP(bundle6Fragment) sizeof(test_payload), "dtn:sourceeid", "dtn:desteid", + NULL, creation_timestamp_s * 1000, 1, 42 * 1000, BUNDLE_FLAG_REPORT_DELIVERY | BUNDLE_V6_FLAG_CUSTODY_TRANSFER_REQUESTED diff --git a/test/unit/test_bundle6ParserSerializer.c b/test/unit/test_bundle6ParserSerializer.c index b05b48d..84e550a 100644 --- a/test/unit/test_bundle6ParserSerializer.c +++ b/test/unit/test_bundle6ParserSerializer.c @@ -31,6 +31,7 @@ TEST_SETUP(bundle6ParserSerializer) sizeof(test_payload), "dtn:sourceeid", "dtn:desteid", + NULL, creation_timestamp_s * 1000, 1, 42 * 1000, BUNDLE_FLAG_REPORT_DELIVERY | BUNDLE_V6_FLAG_CUSTODY_TRANSFER_REQUESTED diff --git a/test/unit/test_bundle7Create.c b/test/unit/test_bundle7Create.c index 9899f7a..0edb6ac 100644 --- a/test/unit/test_bundle7Create.c +++ b/test/unit/test_bundle7Create.c @@ -34,7 +34,7 @@ TEST(bundle7Create, create_bundle) struct bundle *b = bundle7_create_local( payload, sizeof(test_payload), - "dtn:sourceeid", "dtn:desteid", + "dtn:sourceeid", "dtn:desteid", NULL, creation_timestamp_ms, 1, 42000, BUNDLE_FLAG_REPORT_DELIVERY);