diff --git a/docs/manual/config/config_file_reference.rst b/docs/manual/config/config_file_reference.rst index 6280f1ed75..f006338727 100644 --- a/docs/manual/config/config_file_reference.rst +++ b/docs/manual/config/config_file_reference.rst @@ -818,7 +818,7 @@ The default value is: ``default`` //CycloneDDS/Domain/Internal ============================ -Children: :ref:`AccelerateRexmitBlockSize`, :ref:`AckDelay`, :ref:`AutoReschedNackDelay`, :ref:`BuiltinEndpointSet`, :ref:`BurstSize`, :ref:`ControlTopic`, :ref:`DefragReliableMaxSamples`, :ref:`DefragUnreliableMaxSamples`, :ref:`DeliveryQueueMaxSamples`, :ref:`EnableExpensiveChecks`, :ref:`ExtendedPacketInfo`, :ref:`GenerateKeyhash`, :ref:`HeartbeatInterval`, :ref:`LateAckMode`, :ref:`LivelinessMonitoring`, :ref:`MaxParticipants`, :ref:`MaxQueuedRexmitBytes`, :ref:`MaxQueuedRexmitMessages`, :ref:`MaxSampleSize`, :ref:`MeasureHbToAckLatency`, :ref:`MonitorPort`, :ref:`MultipleReceiveThreads`, :ref:`NackDelay`, :ref:`PreEmptiveAckDelay`, :ref:`PrimaryReorderMaxSamples`, :ref:`PrioritizeRetransmit`, :ref:`RediscoveryBlacklistDuration`, :ref:`RetransmitMerging`, :ref:`RetransmitMergingPeriod`, :ref:`RetryOnRejectBestEffort`, :ref:`SPDPResponseMaxDelay`, :ref:`SecondaryReorderMaxSamples`, :ref:`SocketReceiveBufferSize`, :ref:`SocketSendBufferSize`, :ref:`SquashParticipants`, :ref:`SynchronousDeliveryLatencyBound`, :ref:`SynchronousDeliveryPriorityThreshold`, :ref:`Test`, :ref:`UnicastResponseToSPDPMessages`, :ref:`UseMulticastIfMreqn`, :ref:`Watermarks`, :ref:`WriterLingerDuration` +Children: :ref:`AccelerateRexmitBlockSize`, :ref:`AckDelay`, :ref:`AutoReschedNackDelay`, :ref:`BuiltinEndpointSet`, :ref:`BurstSize`, :ref:`ControlTopic`, :ref:`DefragReliableMaxSamples`, :ref:`DefragUnreliableMaxSamples`, :ref:`DeliveryQueueMaxSamples`, :ref:`EnableExpensiveChecks`, :ref:`ExtendedPacketInfo`, :ref:`GenerateKeyhash`, :ref:`HeartbeatInterval`, :ref:`LateAckMode`, :ref:`LivelinessMonitoring`, :ref:`MaxParticipants`, :ref:`MaxQueuedRexmitBytes`, :ref:`MaxQueuedRexmitMessages`, :ref:`MaxSampleSize`, :ref:`MeasureHbToAckLatency`, :ref:`MonitorPort`, :ref:`MultipleReceiveThreads`, :ref:`NackDelay`, :ref:`PreEmptiveAckDelay`, :ref:`PrimaryReorderMaxSamples`, :ref:`PrioritizeRetransmit`, :ref:`RediscoveryBlacklistDuration`, :ref:`RetransmitMerging`, :ref:`RetransmitMergingPeriod`, :ref:`RetryOnRejectBestEffort`, :ref:`SPDPResponseMaxDelay`, :ref:`SecondaryReorderMaxSamples`, :ref:`SocketReceiveBufferSize`, :ref:`SocketSendBufferSize`, :ref:`SquashParticipants`, :ref:`SynchronousDeliveryLatencyBound`, :ref:`SynchronousDeliveryPriorityThreshold`, :ref:`Test`, :ref:`UseMulticastIfMreqn`, :ref:`Watermarks`, :ref:`WriterLingerDuration` The Internal elements deal with a variety of settings that are evolving and that are not necessarily fully supported. For the majority of the Internal settings the functionality is supported, but the right to change the way the options control the functionality is reserved. This includes renaming or moving options. @@ -1531,18 +1531,6 @@ This element controls the fraction of outgoing packets to drop, specified as sam The default value is: ``0`` -.. _`//CycloneDDS/Domain/Internal/UnicastResponseToSPDPMessages`: - -//CycloneDDS/Domain/Internal/UnicastResponseToSPDPMessages ----------------------------------------------------------- - -Boolean - -This element controls whether the response to a newly discovered participant is sent as a unicasted SPDP packet instead of rescheduling the periodic multicasted one. There is no known benefit to setting this to false. - -The default value is: ``true`` - - .. _`//CycloneDDS/Domain/Internal/UseMulticastIfMreqn`: //CycloneDDS/Domain/Internal/UseMulticastIfMreqn @@ -2603,7 +2591,7 @@ The default value is: ``false`` ------------------------------------ One of: -* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, shm, trace +* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, malformed, trace * Or empty This element enables individual logging categories. These are enabled in addition to those enabled by Tracing/Verbosity. Recognised categories are: @@ -2628,16 +2616,25 @@ This element enables individual logging categories. These are enabled in additio * traffic: periodic reporting of total outgoing data + * throttle: tracing of throttling events + * whc: tracing of writer history cache changes + * rhc: tracing of reader history cache changes + * tcp: tracing of TCP-specific activity * topic: tracing of topic definitions * plist: tracing of discovery parameter list interpretation + * content: tracing of sample contents + + * malformed: dump malformed full packet as warning + + -In addition, there is the keyword trace that enables all but radmin, topic, plist and whc. +In addition, there is the keyword trace that enables: fatal, error, warning, info, config, discovery, data, trace, timing, traffic, tcp, throttle, content.. The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is trace. The default value is: ```` @@ -2699,10 +2696,10 @@ The categorisation of tracing output is incomplete and hence most of the verbosi The default value is: ``none`` .. - generated from ddsi_config.h[eaf2059de5eccc422ae9ebd9bb3c40fd1d7545d3] + generated from ddsi_config.h[007a7968df8cbc42a122109bd139ac85bab0f6c9] generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] - generated from ddsi__cfgelems.h[fc5746cc2e55b4ab9daf9bd51bc263cf30ece564] - generated from ddsi_config.c[2d3406ce4db09358597689d7382f80185634eb69] + generated from ddsi__cfgelems.h[607a8f573eb5d87d6f93b1d9bce2947f29da56dc] + generated from ddsi_config.c[d4ef67f90737b1bf8ae94ad932774fa015e3a2cf] generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] diff --git a/docs/manual/options.md b/docs/manual/options.md index 2c80765dd3..756ef31c67 100644 --- a/docs/manual/options.md +++ b/docs/manual/options.md @@ -552,7 +552,7 @@ The default value is: `default` ### //CycloneDDS/Domain/Internal -Children: [AccelerateRexmitBlockSize](#cycloneddsdomaininternalacceleraterexmitblocksize), [AckDelay](#cycloneddsdomaininternalackdelay), [AutoReschedNackDelay](#cycloneddsdomaininternalautoreschednackdelay), [BuiltinEndpointSet](#cycloneddsdomaininternalbuiltinendpointset), [BurstSize](#cycloneddsdomaininternalburstsize), [ControlTopic](#cycloneddsdomaininternalcontroltopic), [DefragReliableMaxSamples](#cycloneddsdomaininternaldefragreliablemaxsamples), [DefragUnreliableMaxSamples](#cycloneddsdomaininternaldefragunreliablemaxsamples), [DeliveryQueueMaxSamples](#cycloneddsdomaininternaldeliveryqueuemaxsamples), [EnableExpensiveChecks](#cycloneddsdomaininternalenableexpensivechecks), [ExtendedPacketInfo](#cycloneddsdomaininternalextendedpacketinfo), [GenerateKeyhash](#cycloneddsdomaininternalgeneratekeyhash), [HeartbeatInterval](#cycloneddsdomaininternalheartbeatinterval), [LateAckMode](#cycloneddsdomaininternallateackmode), [LivelinessMonitoring](#cycloneddsdomaininternallivelinessmonitoring), [MaxParticipants](#cycloneddsdomaininternalmaxparticipants), [MaxQueuedRexmitBytes](#cycloneddsdomaininternalmaxqueuedrexmitbytes), [MaxQueuedRexmitMessages](#cycloneddsdomaininternalmaxqueuedrexmitmessages), [MaxSampleSize](#cycloneddsdomaininternalmaxsamplesize), [MeasureHbToAckLatency](#cycloneddsdomaininternalmeasurehbtoacklatency), [MonitorPort](#cycloneddsdomaininternalmonitorport), [MultipleReceiveThreads](#cycloneddsdomaininternalmultiplereceivethreads), [NackDelay](#cycloneddsdomaininternalnackdelay), [PreEmptiveAckDelay](#cycloneddsdomaininternalpreemptiveackdelay), [PrimaryReorderMaxSamples](#cycloneddsdomaininternalprimaryreordermaxsamples), [PrioritizeRetransmit](#cycloneddsdomaininternalprioritizeretransmit), [RediscoveryBlacklistDuration](#cycloneddsdomaininternalrediscoveryblacklistduration), [RetransmitMerging](#cycloneddsdomaininternalretransmitmerging), [RetransmitMergingPeriod](#cycloneddsdomaininternalretransmitmergingperiod), [RetryOnRejectBestEffort](#cycloneddsdomaininternalretryonrejectbesteffort), [SPDPResponseMaxDelay](#cycloneddsdomaininternalspdpresponsemaxdelay), [SecondaryReorderMaxSamples](#cycloneddsdomaininternalsecondaryreordermaxsamples), [SocketReceiveBufferSize](#cycloneddsdomaininternalsocketreceivebuffersize), [SocketSendBufferSize](#cycloneddsdomaininternalsocketsendbuffersize), [SquashParticipants](#cycloneddsdomaininternalsquashparticipants), [SynchronousDeliveryLatencyBound](#cycloneddsdomaininternalsynchronousdeliverylatencybound), [SynchronousDeliveryPriorityThreshold](#cycloneddsdomaininternalsynchronousdeliveryprioritythreshold), [Test](#cycloneddsdomaininternaltest), [UnicastResponseToSPDPMessages](#cycloneddsdomaininternalunicastresponsetospdpmessages), [UseMulticastIfMreqn](#cycloneddsdomaininternalusemulticastifmreqn), [Watermarks](#cycloneddsdomaininternalwatermarks), [WriterLingerDuration](#cycloneddsdomaininternalwriterlingerduration) +Children: [AccelerateRexmitBlockSize](#cycloneddsdomaininternalacceleraterexmitblocksize), [AckDelay](#cycloneddsdomaininternalackdelay), [AutoReschedNackDelay](#cycloneddsdomaininternalautoreschednackdelay), [BuiltinEndpointSet](#cycloneddsdomaininternalbuiltinendpointset), [BurstSize](#cycloneddsdomaininternalburstsize), [ControlTopic](#cycloneddsdomaininternalcontroltopic), [DefragReliableMaxSamples](#cycloneddsdomaininternaldefragreliablemaxsamples), [DefragUnreliableMaxSamples](#cycloneddsdomaininternaldefragunreliablemaxsamples), [DeliveryQueueMaxSamples](#cycloneddsdomaininternaldeliveryqueuemaxsamples), [EnableExpensiveChecks](#cycloneddsdomaininternalenableexpensivechecks), [ExtendedPacketInfo](#cycloneddsdomaininternalextendedpacketinfo), [GenerateKeyhash](#cycloneddsdomaininternalgeneratekeyhash), [HeartbeatInterval](#cycloneddsdomaininternalheartbeatinterval), [LateAckMode](#cycloneddsdomaininternallateackmode), [LivelinessMonitoring](#cycloneddsdomaininternallivelinessmonitoring), [MaxParticipants](#cycloneddsdomaininternalmaxparticipants), [MaxQueuedRexmitBytes](#cycloneddsdomaininternalmaxqueuedrexmitbytes), [MaxQueuedRexmitMessages](#cycloneddsdomaininternalmaxqueuedrexmitmessages), [MaxSampleSize](#cycloneddsdomaininternalmaxsamplesize), [MeasureHbToAckLatency](#cycloneddsdomaininternalmeasurehbtoacklatency), [MonitorPort](#cycloneddsdomaininternalmonitorport), [MultipleReceiveThreads](#cycloneddsdomaininternalmultiplereceivethreads), [NackDelay](#cycloneddsdomaininternalnackdelay), [PreEmptiveAckDelay](#cycloneddsdomaininternalpreemptiveackdelay), [PrimaryReorderMaxSamples](#cycloneddsdomaininternalprimaryreordermaxsamples), [PrioritizeRetransmit](#cycloneddsdomaininternalprioritizeretransmit), [RediscoveryBlacklistDuration](#cycloneddsdomaininternalrediscoveryblacklistduration), [RetransmitMerging](#cycloneddsdomaininternalretransmitmerging), [RetransmitMergingPeriod](#cycloneddsdomaininternalretransmitmergingperiod), [RetryOnRejectBestEffort](#cycloneddsdomaininternalretryonrejectbesteffort), [SPDPResponseMaxDelay](#cycloneddsdomaininternalspdpresponsemaxdelay), [SecondaryReorderMaxSamples](#cycloneddsdomaininternalsecondaryreordermaxsamples), [SocketReceiveBufferSize](#cycloneddsdomaininternalsocketreceivebuffersize), [SocketSendBufferSize](#cycloneddsdomaininternalsocketsendbuffersize), [SquashParticipants](#cycloneddsdomaininternalsquashparticipants), [SynchronousDeliveryLatencyBound](#cycloneddsdomaininternalsynchronousdeliverylatencybound), [SynchronousDeliveryPriorityThreshold](#cycloneddsdomaininternalsynchronousdeliveryprioritythreshold), [Test](#cycloneddsdomaininternaltest), [UseMulticastIfMreqn](#cycloneddsdomaininternalusemulticastifmreqn), [Watermarks](#cycloneddsdomaininternalwatermarks), [WriterLingerDuration](#cycloneddsdomaininternalwriterlingerduration) The Internal elements deal with a variety of settings that are evolving and that are not necessarily fully supported. For the majority of the Internal settings the functionality is supported, but the right to change the way the options control the functionality is reserved. This includes renaming or moving options. @@ -1051,14 +1051,6 @@ This element controls the fraction of outgoing packets to drop, specified as sam The default value is: `0` -#### //CycloneDDS/Domain/Internal/UnicastResponseToSPDPMessages -Boolean - -This element controls whether the response to a newly discovered participant is sent as a unicasted SPDP packet instead of rescheduling the periodic multicasted one. There is no known benefit to setting this to false. - -The default value is: `true` - - #### //CycloneDDS/Domain/Internal/UseMulticastIfMreqn Integer @@ -1809,7 +1801,7 @@ The default value is: `false` #### //CycloneDDS/Domain/Tracing/Category One of: -* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, shm, trace +* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, malformed, trace * Or empty This element enables individual logging categories. These are enabled in addition to those enabled by Tracing/Verbosity. Recognised categories are: @@ -1834,15 +1826,24 @@ This element enables individual logging categories. These are enabled in additio * traffic: periodic reporting of total outgoing data + * throttle: tracing of throttling events + * whc: tracing of writer history cache changes + * rhc: tracing of reader history cache changes + * tcp: tracing of TCP-specific activity * topic: tracing of topic definitions * plist: tracing of discovery parameter list interpretation -In addition, there is the keyword trace that enables all but radmin, topic, plist and whc. + * content: tracing of sample contents + + * malformed: dump malformed full packet as warning + + +In addition, there is the keyword trace that enables: fatal, error, warning, info, config, discovery, data, trace, timing, traffic, tcp, throttle, content.. The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is trace. The default value is: `` @@ -1889,10 +1890,10 @@ While none prevents any message from being written to a DDSI2 log file. The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful verbosity levels are config, fine and finest. The default value is: `none` - + - - + + diff --git a/etc/cyclonedds.rnc b/etc/cyclonedds.rnc index 8ff2bcb582..13525d3680 100644 --- a/etc/cyclonedds.rnc +++ b/etc/cyclonedds.rnc @@ -741,12 +741,6 @@ CycloneDDS configuration""" ] ] }? }? & [ a:documentation [ xml:lang="en" """ -

This element controls whether the response to a newly discovered participant is sent as a unicasted SPDP packet instead of rescheduling the periodic multicasted one. There is no known benefit to setting this to false.

-

The default value is: true

""" ] ] - element UnicastResponseToSPDPMessages { - xsd:boolean - }? - & [ a:documentation [ xml:lang="en" """

Do not use.

The default value is: 0

""" ] ] element UseMulticastIfMreqn { @@ -1264,15 +1258,20 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==
  • radmin: receive buffer administration
  • timing: periodic reporting of CPU loads per thread
  • traffic: periodic reporting of total outgoing data
  • +
  • throttle: tracing of throttling events
  • whc: tracing of writer history cache changes
  • +
  • rhc: tracing of reader history cache changes
  • tcp: tracing of TCP-specific activity
  • topic: tracing of topic definitions
  • -
  • plist: tracing of discovery parameter list interpretation
  • -

    In addition, there is the keyword trace that enables all but radmin, topic, plist and whc

    . +
  • plist: tracing of discovery parameter list interpretation
  • +
  • content: tracing of sample contents
  • +
  • malformed: dump malformed full packet as warning
  • + +

    In addition, there is the keyword trace that enables: fatal, error, warning, info, config, discovery, data, trace, timing, traffic, tcp, throttle, content.

    .

    The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is trace.

    The default value is: <empty>

    """ ] ] element Category { - xsd:token { pattern = "((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace))*)|" } + xsd:token { pattern = "((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace))*)|" } }? & [ a:documentation [ xml:lang="en" """

    This option specifies where the logging is printed to. Note that stdout and stderr are treated as special values, representing "standard out" and "standard error" respectively. No file is created unless logging categories are enabled using the Tracing/Verbosity or Tracing/EnabledCategory settings.

    @@ -1310,10 +1309,10 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==
    duration_inf = xsd:token { pattern = "inf|0|(\d+(\.\d*)?([Ee][\-+]?\d+)?|\.\d+([Ee][\-+]?\d+)?) *([num]?s|min|hr|day)" } memsize = xsd:token { pattern = "0|(\d+(\.\d*)?([Ee][\-+]?\d+)?|\.\d+([Ee][\-+]?\d+)?) *([kMG]i?)?B" } } -# generated from ddsi_config.h[eaf2059de5eccc422ae9ebd9bb3c40fd1d7545d3] +# generated from ddsi_config.h[007a7968df8cbc42a122109bd139ac85bab0f6c9] # generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] -# generated from ddsi__cfgelems.h[fc5746cc2e55b4ab9daf9bd51bc263cf30ece564] -# generated from ddsi_config.c[2d3406ce4db09358597689d7382f80185634eb69] +# generated from ddsi__cfgelems.h[607a8f573eb5d87d6f93b1d9bce2947f29da56dc] +# generated from ddsi_config.c[d4ef67f90737b1bf8ae94ad932774fa015e3a2cf] # generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] # generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] # generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] diff --git a/etc/cyclonedds.xsd b/etc/cyclonedds.xsd index 8b3ceb9ecc..7bb7f013b2 100644 --- a/etc/cyclonedds.xsd +++ b/etc/cyclonedds.xsd @@ -651,7 +651,6 @@ CycloneDDS configuration - @@ -1128,13 +1127,6 @@ CycloneDDS configuration <p>The default value is: <code>0</code></p> - - - -<p>This element controls whether the response to a newly discovered participant is sent as a unicasted SPDP packet instead of rescheduling the periodic multicasted one. There is no known benefit to setting this to <i>false</i>.</p> -<p>The default value is: <code>true</code></p> - - @@ -1892,17 +1884,22 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==<br> <li><i>radmin</i>: receive buffer administration</li> <li><i>timing</i>: periodic reporting of CPU loads per thread</li> <li><i>traffic</i>: periodic reporting of total outgoing data</li> +<li><i>throttle</i>: tracing of throttling events</li> <li><i>whc</i>: tracing of writer history cache changes</li> +<li><i>rhc</i>: tracing of reader history cache changes</li> <li><i>tcp</i>: tracing of TCP-specific activity</li> <li><i>topic</i>: tracing of topic definitions</li> -<li><i>plist</i>: tracing of discovery parameter list interpretation</li></ul> -<p>In addition, there is the keyword <i>trace</i> that enables all but <i>radmin</i>, <i>topic</i>, <i>plist</i> and <i>whc</i></p>. +<li><i>plist</i>: tracing of discovery parameter list interpretation</li> +<li><i>content</i>: tracing of sample contents</li> +<li><i>malformed</i>: dump malformed full packet as warning</li> +</ul> +<p>In addition, there is the keyword <i>trace</i> that enables: <i>fatal</i>, <i>error</i>, <i>warning</i>, <i>info</i>, <i>config</i>, <i>discovery</i>, <i>data</i>, <i>trace</i>, <i>timing</i>, <i>traffic</i>, <i>tcp</i>, <i>throttle</i>, <i>content</i>.</p>. <p>The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is <i>trace</i>.</p> <p>The default value is: <code>&lt;empty&gt;</code></p> - + @@ -1970,10 +1967,10 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==<br> - + - - + + diff --git a/examples/dynsub/print_sample.c b/examples/dynsub/print_sample.c index 2a5ab79228..8b0600d75c 100644 --- a/examples/dynsub/print_sample.c +++ b/examples/dynsub/print_sample.c @@ -180,8 +180,20 @@ static void print_sample1_to (const unsigned char *sample, const DDS_XTypes_Comp for (uint32_t i = 0; i < t->member_seq._length; i++) { const DDS_XTypes_CompleteStructMember *m = &t->member_seq._buffer[i]; - c1.key = c->key && m->common.member_flags & DDS_XTypes_IS_KEY; - print_sample1_ti (p, &m->common.member_type_id, &c1, sep, *m->detail.name ? m->detail.name : NULL, false); + if (m->common.member_flags & DDS_XTypes_IS_OPTIONAL) { + void const * const *p1 = (const void *) align (p, &c1, _Alignof (void *), sizeof (void *)); + if (*p1 == NULL) { + printf ("%s", sep); + if (*m->detail.name) printf ("\"%s\":", m->detail.name); + printf ("(nothing)"); + } else { + struct context c2 = { .valid_data = c->valid_data, .key = false, .offset = 0, .maxalign = 1 }; + print_sample1_ti (*p1, &m->common.member_type_id, &c2, sep, *m->detail.name ? m->detail.name : NULL, false); + } + } else { + c1.key = c->key && m->common.member_flags & DDS_XTypes_IS_KEY; + print_sample1_ti (p, &m->common.member_type_id, &c1, sep, *m->detail.name ? m->detail.name : NULL, false); + } sep = ","; } if (!is_base_type) printf ("}"); diff --git a/examples/dynsub/type_cache.c b/examples/dynsub/type_cache.c index da845709d0..57cb9e9ba4 100644 --- a/examples/dynsub/type_cache.c +++ b/examples/dynsub/type_cache.c @@ -345,6 +345,9 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a const DDS_XTypes_CompleteStructMember *m = &t->member_seq._buffer[i]; size_t a, s; build_typecache_ti (&m->common.member_type_id, &a, &s); + if (m->common.member_flags & DDS_XTypes_IS_OPTIONAL) { + a = _Alignof (void *); s = sizeof (void *); + } if (a > *align) *align = a; if (*size % a) diff --git a/examples/dynsub/variouspub.c b/examples/dynsub/variouspub.c index d5398d6b5e..e1773bcf31 100644 --- a/examples/dynsub/variouspub.c +++ b/examples/dynsub/variouspub.c @@ -85,6 +85,13 @@ static void *samples_c[] = { NULL }; +static int32_t long_4 = 4; +static void *samples_M1_O[] = { + &(M1_O){ .x = NULL }, + &(M1_O){ .x = &long_4 }, + NULL +}; + static struct tpentry { const char *name; const dds_topic_descriptor_t *descr; @@ -94,6 +101,7 @@ static struct tpentry { { "A", &A_desc, samples_a, offsetof (A, count) }, { "B", &B_desc, samples_b, offsetof (B, a.count) }, { "C", &C_desc, samples_c, offsetof (C, b.a.count) }, + { "M1::O", &M1_O_desc, samples_M1_O, SIZE_MAX }, { NULL, NULL, NULL, 0 } }; @@ -145,8 +153,12 @@ int main (int argc, char **argv) { dds_return_t ret = 0; void *sample = tpentry->samples[sample_idx]; - uint32_t *countp = (uint32_t *) ((unsigned char *) sample + tpentry->count_offset); - *countp = count++; + uint32_t * const countp = + (tpentry->count_offset != SIZE_MAX) + ? (uint32_t *) ((unsigned char *) sample + tpentry->count_offset) + : 0; + if (countp) + *countp = count++; if ((ret = dds_write (writer, sample)) < 0) { fprintf (stderr, "dds_write: %s\n", dds_strretcode (ret)); diff --git a/examples/dynsub/variouspub_types.idl b/examples/dynsub/variouspub_types.idl index 1cf5baba74..b9f79c4c16 100644 --- a/examples/dynsub/variouspub_types.idl +++ b/examples/dynsub/variouspub_types.idl @@ -20,3 +20,10 @@ struct C { @key short k; }; + +module M1 { + @appendable + struct O { + @optional long x; + }; +}; diff --git a/src/core/ddsi/defconfig.c b/src/core/ddsi/defconfig.c index 082bca3bed..f268c3b5ac 100644 --- a/src/core/ddsi/defconfig.c +++ b/src/core/ddsi/defconfig.c @@ -51,7 +51,6 @@ void ddsi_config_init_default (struct ddsi_config *cfg) cfg->defrag_unreliable_maxsamples = UINT32_C (4); cfg->defrag_reliable_maxsamples = UINT32_C (16); cfg->besmode = INT32_C (1); - cfg->unicast_response_to_spdp_messages = INT32_C (1); cfg->synchronous_delivery_latency_bound = INT64_C (9223372036854775807); cfg->retransmit_merging_period = INT64_C (5000000); cfg->const_hb_intv_sched = INT64_C (100000000); @@ -100,10 +99,10 @@ void ddsi_config_init_default (struct ddsi_config *cfg) cfg->ssl_min_version.minor = 3; #endif /* DDS_HAS_TCP_TLS */ } -/* generated from ddsi_config.h[eaf2059de5eccc422ae9ebd9bb3c40fd1d7545d3] */ +/* generated from ddsi_config.h[007a7968df8cbc42a122109bd139ac85bab0f6c9] */ /* generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] */ -/* generated from ddsi__cfgelems.h[fc5746cc2e55b4ab9daf9bd51bc263cf30ece564] */ -/* generated from ddsi_config.c[2d3406ce4db09358597689d7382f80185634eb69] */ +/* generated from ddsi__cfgelems.h[607a8f573eb5d87d6f93b1d9bce2947f29da56dc] */ +/* generated from ddsi_config.c[d4ef67f90737b1bf8ae94ad932774fa015e3a2cf] */ /* generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] */ /* generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] */ /* generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] */ diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_config.h b/src/core/ddsi/include/dds/ddsi/ddsi_config.h index 1b7295eb70..dad2180000 100644 --- a/src/core/ddsi/include/dds/ddsi/ddsi_config.h +++ b/src/core/ddsi/include/dds/ddsi/ddsi_config.h @@ -369,7 +369,6 @@ struct ddsi_config uint32_t rbuf_size; /* << size of a single receiver buffer */ enum ddsi_besmode besmode; int meas_hb_to_ack_latency; - int unicast_response_to_spdp_messages; int synchronous_delivery_priority_threshold; int64_t synchronous_delivery_latency_bound; diff --git a/src/core/ddsi/src/ddsi__cfgelems.h b/src/core/ddsi/src/ddsi__cfgelems.h index 5b3b453c0d..f6d08f5b9d 100644 --- a/src/core/ddsi/src/ddsi__cfgelems.h +++ b/src/core/ddsi/src/ddsi__cfgelems.h @@ -1262,14 +1262,6 @@ static struct cfgelem internal_cfgelems[] = { "and calculating round trip times. This is non-standard behaviour. The " "measured latencies are quite noisy and are currently not used " "anywhere.

    ")), - BOOL("UnicastResponseToSPDPMessages", NULL, 1, "true", - MEMBER(unicast_response_to_spdp_messages), - FUNCTIONS(0, uf_boolean, 0, pf_boolean), - DESCRIPTION( - "

    This element controls whether the response to a newly discovered " - "participant is sent as a unicasted SPDP packet instead of " - "rescheduling the periodic multicasted one. There is no known benefit " - "to setting this to false.

    ")), INT("SynchronousDeliveryPriorityThreshold", NULL, 1, "0", MEMBER(synchronous_delivery_priority_threshold), FUNCTIONS(0, uf_int, 0, pf_int), @@ -2013,13 +2005,19 @@ static struct cfgelem tracing_cfgelems[] = { "
  • radmin: receive buffer administration
  • \n" "
  • timing: periodic reporting of CPU loads per thread
  • \n" "
  • traffic: periodic reporting of total outgoing data
  • \n" + "
  • throttle: tracing of throttling events
  • \n" "
  • whc: tracing of writer history cache changes
  • \n" + "
  • rhc: tracing of reader history cache changes
  • \n" "
  • tcp: tracing of TCP-specific activity
  • \n" "
  • topic: tracing of topic definitions
  • \n" - "
  • plist: tracing of discovery parameter list interpretation
  • " + "
  • plist: tracing of discovery parameter list interpretation
  • \n" + "
  • content: tracing of sample contents
  • \n" + "
  • malformed: dump malformed full packet as warning
  • \n" "\n" - "

    In addition, there is the keyword trace that enables all " - "but radmin, topic, plist and whc

    .\n" + "

    In addition, there is the keyword trace that enables: " + "fatal, error, warning, info, config, " + "discovery, data, trace, timing, traffic, " + "tcp, throttle, content.

    .\n" "

    The categorisation of tracing output is incomplete and hence most " "of the verbosity levels and categories are not of much use in the " "current release. This is an ongoing process and here we describe the " @@ -2028,7 +2026,7 @@ static struct cfgelem tracing_cfgelems[] = { VALUES( "fatal","error","warning","info","config","discovery","data","radmin", "timing","traffic","topic","tcp","plist","whc","throttle","rhc", - "content","shm","trace" + "content","malformed","trace" )), ENUM("Verbosity", NULL, 1, "none", NOMEMBER, diff --git a/src/core/ddsi/src/ddsi__xmsg.h b/src/core/ddsi/src/ddsi__xmsg.h index 9b1c8c2220..9bcab56391 100644 --- a/src/core/ddsi/src/ddsi__xmsg.h +++ b/src/core/ddsi/src/ddsi__xmsg.h @@ -47,10 +47,12 @@ enum ddsi_xmsg_kind { }; /** @component rtps_submsg */ -struct ddsi_xmsgpool *ddsi_xmsgpool_new (void); +struct ddsi_xmsgpool *ddsi_xmsgpool_new (void) + ddsrt_attribute_warn_unused_result; /** @component rtps_submsg */ -void ddsi_xmsgpool_free (struct ddsi_xmsgpool *pool); +void ddsi_xmsgpool_free (struct ddsi_xmsgpool *pool) + ddsrt_nonnull_all; /** * @brief Allocates a new xmsg from the pool @@ -67,7 +69,8 @@ void ddsi_xmsgpool_free (struct ddsi_xmsgpool *pool); * @param kind the xmsg kind * @return struct ddsi_xmsg* */ -struct ddsi_xmsg *ddsi_xmsg_new (struct ddsi_xmsgpool *pool, const ddsi_guid_t *src_guid, struct ddsi_participant *pp, size_t expected_size, enum ddsi_xmsg_kind kind); +struct ddsi_xmsg *ddsi_xmsg_new (struct ddsi_xmsgpool *pool, const ddsi_guid_t *src_guid, struct ddsi_participant *pp, size_t expected_size, enum ddsi_xmsg_kind kind) + ddsrt_nonnull ((1, 2)) ddsrt_attribute_warn_unused_result; /** * @brief For sending to a particular destination (participant) @@ -76,12 +79,13 @@ struct ddsi_xmsg *ddsi_xmsg_new (struct ddsi_xmsgpool *pool, const ddsi_guid_t * * @param gv domain globals * @param m xmsg * @param gp guid prefix - * @param addr destination locator + * @param loc destination locator */ -void ddsi_xmsg_setdst1 (struct ddsi_domaingv *gv, struct ddsi_xmsg *m, const ddsi_guid_prefix_t *gp, const ddsi_xlocator_t *addr); +void ddsi_xmsg_setdst1 (struct ddsi_domaingv *gv, struct ddsi_xmsg *m, const ddsi_guid_prefix_t *gp, const ddsi_xlocator_t *loc); /** @component rtps_submsg */ -bool ddsi_xmsg_getdst1_prefix (struct ddsi_xmsg *m, ddsi_guid_prefix_t *gp); +bool ddsi_xmsg_getdst1_prefix (struct ddsi_xmsg *m, ddsi_guid_prefix_t *gp) + ddsrt_nonnull_all; /** * @brief For sending to a particular proxy reader @@ -93,7 +97,8 @@ bool ddsi_xmsg_getdst1_prefix (struct ddsi_xmsg *m, ddsi_guid_prefix_t *gp); * @param m xmsg * @param prd destination proxy reader */ -void ddsi_xmsg_setdst_prd (struct ddsi_xmsg *m, const struct ddsi_proxy_reader *prd); +void ddsi_xmsg_setdst_prd (struct ddsi_xmsg *m, const struct ddsi_proxy_reader *prd) + ddsrt_nonnull_all; /** @component rtps_submsg */ void ddsi_xmsg_setdst_pwr (struct ddsi_xmsg *m, const struct ddsi_proxy_writer *pwr); @@ -107,10 +112,12 @@ void ddsi_xmsg_setdst_pwr (struct ddsi_xmsg *m, const struct ddsi_proxy_writer * * @param msg xmsg * @param as address set */ -void ddsi_xmsg_setdst_addrset (struct ddsi_xmsg *msg, struct ddsi_addrset *as); +void ddsi_xmsg_setdst_addrset (struct ddsi_xmsg *msg, struct ddsi_addrset *as) + ddsrt_nonnull_all; /** @component rtps_submsg */ -int ddsi_xmsg_setmaxdelay (struct ddsi_xmsg *msg, int64_t maxdelay); +int ddsi_xmsg_setmaxdelay (struct ddsi_xmsg *msg, int64_t maxdelay) + ddsrt_nonnull_all; /** * @brief Sets the location of the destination readerId within the message @@ -124,7 +131,8 @@ int ddsi_xmsg_setmaxdelay (struct ddsi_xmsg *msg, int64_t maxdelay); * @param m xmsg * @param readerId reader entity id */ -void ddsi_xmsg_set_data_reader_id (struct ddsi_xmsg *m, ddsi_entityid_t *readerId); +void ddsi_xmsg_set_data_reader_id (struct ddsi_xmsg *m, ddsi_entityid_t *readerId) + ddsrt_nonnull_all; /** * @component rtps_submsg @@ -143,7 +151,8 @@ void ddsi_xmsg_set_data_reader_id (struct ddsi_xmsg *m, ddsi_entityid_t *readerI * @param madd xmsg to add * @returns Returns 1 if merge was successful, else 0. */ -int ddsi_xmsg_merge_rexmit_destinations_wrlock_held (struct ddsi_domaingv *gv, struct ddsi_xmsg *m, const struct ddsi_xmsg *madd); +int ddsi_xmsg_merge_rexmit_destinations_wrlock_held (struct ddsi_domaingv *gv, struct ddsi_xmsg *m, const struct ddsi_xmsg *madd) + ddsrt_nonnull_all; /** * @brief To set writer ids for updating last transmitted sequence number @@ -156,10 +165,12 @@ int ddsi_xmsg_merge_rexmit_destinations_wrlock_held (struct ddsi_domaingv *gv, s * @param wrguid writer guid * @param wrseq write sequence number */ -void ddsi_xmsg_setwriterseq (struct ddsi_xmsg *msg, const ddsi_guid_t *wrguid, ddsi_seqno_t wrseq); +void ddsi_xmsg_setwriterseq (struct ddsi_xmsg *msg, const ddsi_guid_t *wrguid, ddsi_seqno_t wrseq) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_setwriterseq_fragid (struct ddsi_xmsg *msg, const ddsi_guid_t *wrguid, ddsi_seqno_t wrseq, ddsi_fragment_number_t wrfragid); +void ddsi_xmsg_setwriterseq_fragid (struct ddsi_xmsg *msg, const ddsi_guid_t *wrguid, ddsi_seqno_t wrseq, ddsi_fragment_number_t wrfragid) + ddsrt_nonnull_all; /** * @brief Comparison function for retransmits @@ -171,104 +182,131 @@ void ddsi_xmsg_setwriterseq_fragid (struct ddsi_xmsg *msg, const ddsi_guid_t *wr * @param b xmsg to compare with * @return int */ -int ddsi_xmsg_compare_fragid (const struct ddsi_xmsg *a, const struct ddsi_xmsg *b); +int ddsi_xmsg_compare_fragid (const struct ddsi_xmsg *a, const struct ddsi_xmsg *b) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_free (struct ddsi_xmsg *msg); +void ddsi_xmsg_free (struct ddsi_xmsg *msg) + ddsrt_nonnull_all; /** @component rtps_submsg */ -size_t ddsi_xmsg_size (const struct ddsi_xmsg *m); +size_t ddsi_xmsg_size (const struct ddsi_xmsg *m) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void *ddsi_xmsg_payload (size_t *sz, struct ddsi_xmsg *m); +void *ddsi_xmsg_payload (size_t *sz, struct ddsi_xmsg *m) + ddsrt_nonnull_all ddsrt_attribute_returns_nonnull; /** @component rtps_submsg */ -void ddsi_xmsg_payload_to_plistsample (struct ddsi_plist_sample *dst, ddsi_parameterid_t keyparam, const struct ddsi_xmsg *m); +void ddsi_xmsg_payload_to_plistsample (struct ddsi_plist_sample *dst, ddsi_parameterid_t keyparam, const struct ddsi_xmsg *m) + ddsrt_nonnull_all; /** @component rtps_submsg */ -enum ddsi_xmsg_kind ddsi_xmsg_kind (const struct ddsi_xmsg *m); +enum ddsi_xmsg_kind ddsi_xmsg_kind (const struct ddsi_xmsg *m) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_guid_seq_fragid (const struct ddsi_xmsg *m, ddsi_guid_t *wrguid, ddsi_seqno_t *wrseq, ddsi_fragment_number_t *wrfragid); - +void ddsi_xmsg_guid_seq_fragid (const struct ddsi_xmsg *m, ddsi_guid_t *wrguid, ddsi_seqno_t *wrseq, ddsi_fragment_number_t *wrfragid) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void *ddsi_xmsg_submsg_from_marker (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker); +void *ddsi_xmsg_submsg_from_marker (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker) + ddsrt_nonnull_all ddsrt_attribute_returns_nonnull; /** @component rtps_submsg */ -void *ddsi_xmsg_append (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz); +void *ddsi_xmsg_append (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz) + ddsrt_nonnull ((1)) ddsrt_attribute_warn_unused_result; /** @component rtps_submsg */ -void ddsi_xmsg_shrink (struct ddsi_xmsg *m, struct ddsi_xmsg_marker marker, size_t sz); +void ddsi_xmsg_shrink (struct ddsi_xmsg *m, struct ddsi_xmsg_marker marker, size_t sz) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_serdata (struct ddsi_xmsg *m, struct ddsi_serdata *serdata, size_t off, size_t len, struct ddsi_writer *wr); - +void ddsi_xmsg_serdata (struct ddsi_xmsg *m, struct ddsi_serdata *serdata, size_t off, size_t len, struct ddsi_writer *wr) + ddsrt_nonnull_all; #ifdef DDS_HAS_SECURITY /** @component rtps_submsg */ -size_t ddsi_xmsg_submsg_size (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker); +size_t ddsi_xmsg_submsg_size (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_submsg_remove (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker); +void ddsi_xmsg_submsg_remove (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_submsg_replace (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker, unsigned char *new_submsg, size_t new_len); +void ddsi_xmsg_submsg_replace (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker, unsigned char *new_submsg, size_t new_len) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_submsg_append_refd_payload (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker); +void ddsi_xmsg_submsg_append_refd_payload (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_marker) + ddsrt_nonnull_all; #endif /* DDS_HAS_SECURITY */ - /** @component rtps_submsg */ -void ddsi_xmsg_submsg_setnext (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker); +void ddsi_xmsg_submsg_setnext (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_submsg_init (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker, ddsi_rtps_submessage_kind_t smkind); +void ddsi_xmsg_submsg_init (struct ddsi_xmsg *msg, struct ddsi_xmsg_marker marker, ddsi_rtps_submessage_kind_t smkind) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_add_timestamp (struct ddsi_xmsg *m, ddsrt_wctime_t t); +void ddsi_xmsg_add_timestamp (struct ddsi_xmsg *m, ddsrt_wctime_t t) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_add_entityid (struct ddsi_xmsg * m); +void ddsi_xmsg_add_entityid (struct ddsi_xmsg * m) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void *ddsi_xmsg_addpar_bo (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo); +void *ddsi_xmsg_addpar_bo (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo) + ddsrt_nonnull_all ddsrt_attribute_warn_unused_result; /** @component rtps_submsg */ -void *ddsi_xmsg_addpar (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len); +void *ddsi_xmsg_addpar (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len) + ddsrt_nonnull_all ddsrt_attribute_warn_unused_result; /** @component rtps_submsg */ -void ddsi_xmsg_addpar_keyhash (struct ddsi_xmsg *m, const struct ddsi_serdata *serdata, bool force_md5); +void ddsi_xmsg_addpar_keyhash (struct ddsi_xmsg *m, const struct ddsi_serdata *serdata, bool force_md5) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_addpar_statusinfo (struct ddsi_xmsg *m, unsigned statusinfo); +void ddsi_xmsg_addpar_statusinfo (struct ddsi_xmsg *m, unsigned statusinfo) + ddsrt_nonnull_all; /** @component rtps_submsg */ -void ddsi_xmsg_addpar_sentinel (struct ddsi_xmsg *m); -/** @component rtps_submsg */ -void ddsi_xmsg_addpar_sentinel_bo (struct ddsi_xmsg * m, enum ddsrt_byte_order_selector bo); +void ddsi_xmsg_addpar_sentinel (struct ddsi_xmsg *m) + ddsrt_nonnull_all; /** @component rtps_submsg */ -int ddsi_xmsg_addpar_sentinel_ifparam (struct ddsi_xmsg *m); - +void ddsi_xmsg_addpar_sentinel_bo (struct ddsi_xmsg * m, enum ddsrt_byte_order_selector bo) + ddsrt_nonnull_all; +/** @component rtps_submsg */ +int ddsi_xmsg_addpar_sentinel_ifparam (struct ddsi_xmsg *m) + ddsrt_nonnull_all; /** @component rtps_msg */ -int ddsi_xpack_addmsg (struct ddsi_xpack *xp, struct ddsi_xmsg *m, const uint32_t flags); +int ddsi_xpack_addmsg (struct ddsi_xpack *xp, struct ddsi_xmsg *m, const uint32_t flags) + ddsrt_nonnull_all; /** @component rtps_msg */ -int64_t ddsi_xpack_maxdelay (const struct ddsi_xpack *xp); +int64_t ddsi_xpack_maxdelay (const struct ddsi_xpack *xp) + ddsrt_nonnull_all; /** @component rtps_msg */ -unsigned ddsi_xpack_packetid (const struct ddsi_xpack *xp); +unsigned ddsi_xpack_packetid (const struct ddsi_xpack *xp) + ddsrt_nonnull_all; /** @component rtps_msg */ -void ddsi_xpack_sendq_stop (struct ddsi_domaingv *gv); +void ddsi_xpack_sendq_stop (struct ddsi_domaingv *gv) + ddsrt_nonnull_all; /** @component rtps_msg */ -void ddsi_xpack_sendq_fini (struct ddsi_domaingv *gv); +void ddsi_xpack_sendq_fini (struct ddsi_domaingv *gv) + ddsrt_nonnull_all; #if defined (__cplusplus) } diff --git a/src/core/ddsi/src/ddsi_config.c b/src/core/ddsi/src/ddsi_config.c index 73eeacbac8..0ee326451e 100644 --- a/src/core/ddsi/src/ddsi_config.c +++ b/src/core/ddsi/src/ddsi_config.c @@ -1007,10 +1007,10 @@ GENERIC_ENUM_CTYPE (shm_loglevel, enum ddsi_shm_loglevel) /* "trace" is special: it enables (nearly) everything */ static const char *tracemask_names[] = { - "fatal", "error", "warning", "info", "config", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "rhc", "content", "trace", NULL + "fatal", "error", "warning", "info", "config", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "rhc", "content", "malformed", "trace", NULL }; static const uint32_t tracemask_codes[] = { - DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_RHC, DDS_LC_CONTENT, DDS_LC_ALL + DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_RHC, DDS_LC_CONTENT, DDS_LC_MALFORMED, DDS_LC_ALL }; static enum update_result uf_tracemask (struct ddsi_cfgst *cfgst, UNUSED_ARG (void *parent), UNUSED_ARG (struct cfgelem const * const cfgelem), UNUSED_ARG (int first), const char *value) diff --git a/src/core/ddsi/src/ddsi_discovery_spdp.c b/src/core/ddsi/src/ddsi_discovery_spdp.c index 699974e596..caa1f12e73 100644 --- a/src/core/ddsi/src/ddsi_discovery_spdp.c +++ b/src/core/ddsi/src/ddsi_discovery_spdp.c @@ -486,17 +486,11 @@ static void respond_to_spdp (const struct ddsi_domaingv *gv, const ddsi_guid_t * int64_t delay = (int64_t) delay_norm * delay_max_ms / 1000; ddsrt_mtime_t tsched = ddsrt_mtime_add_duration (tnow, delay); GVTRACE (" %"PRId64, delay); - if (!pp->e.gv->config.unicast_response_to_spdp_messages) - /* pp can't reach gc_delete_participant => can safely reschedule */ - (void) ddsi_resched_xevent_if_earlier (pp->spdp_xevent, tsched); - else - { - struct ddsi_spdp_directed_xevent_cb_arg arg = { - .pp_guid = pp->e.guid, - .nrepeats = 4, .dest_proxypp_guid_prefix = dest_proxypp_guid->prefix - }; - ddsi_qxev_callback (gv->xevents, tsched, ddsi_spdp_directed_xevent_cb, &arg, sizeof (arg), false); - } + struct ddsi_spdp_directed_xevent_cb_arg arg = { + .pp_guid = pp->e.guid, + .nrepeats = 4, .dest_proxypp_guid_prefix = dest_proxypp_guid->prefix + }; + ddsi_qxev_callback (gv->xevents, tsched, ddsi_spdp_directed_xevent_cb, &arg, sizeof (arg), false); } ddsi_entidx_enum_participant_fini (&est); } diff --git a/src/core/ddsi/src/ddsi_receive.c b/src/core/ddsi/src/ddsi_receive.c index c4206c381f..d4e46219b4 100644 --- a/src/core/ddsi/src/ddsi_receive.c +++ b/src/core/ddsi/src/ddsi_receive.c @@ -2793,16 +2793,19 @@ static const char *submsg_name (ddsi_rtps_submessage_kind_t id, struct submsg_na return buffer->x; } -static void malformed_packet_received (const struct ddsi_domaingv *gv, const unsigned char *msg, const unsigned char *submsg, size_t len, ddsi_vendorid_t vendorid) +static void malformed_packet_received_shortmsg (const struct ddsi_domaingv *gv, const unsigned char *msg, const unsigned char *submsg, size_t len, ddsi_vendorid_t vendorid) { char tmp[1024]; size_t i, pos, smsize; - + struct submsg_name submsg_name_buffer; ddsi_rtps_submessage_kind_t smkind; const char *state0; const char *state1; - if (submsg == NULL || (submsg < msg || submsg >= msg + len)) { + // can safely subtract the two pointers after casting to uintptr_t, on all practical platforms + // this'll just give us a useful offset as long as submsg isn't a null pointer + const intptr_t offset = (intptr_t) ((uintptr_t) submsg - (uintptr_t) msg); + if (submsg == NULL || (submsg < msg || submsg > msg + len)) { // outside buffer shouldn't happen, but this is for dealing with junk, so better be careful smkind = DDSI_RTPS_SMID_PAD; state0 = ""; @@ -2818,19 +2821,20 @@ static void malformed_packet_received (const struct ddsi_domaingv *gv, const uns state1 = submsg_name (smkind, &submsg_name_buffer); } assert (submsg >= msg && submsg <= msg + len); - + const size_t clamped_offset = (offset < 0) ? 0 : ((size_t) offset > len) ? len : (size_t) offset; + /* Show beginning of message and of submessage (as hex dumps) */ - pos = (size_t) snprintf (tmp, sizeof (tmp), "malformed packet received from vendor %u.%u state %s%s <", vendorid.id[0], vendorid.id[1], state0, state1); - for (i = 0; i < 32 && i < len && msg + i < submsg && pos < sizeof (tmp); i++) + pos = (size_t) snprintf (tmp, sizeof (tmp), "malformed packet received from vendor %u.%u length %" PRIuSIZE " state %s%s <", vendorid.id[0], vendorid.id[1], len, state0, state1); + for (i = 0; i < 32 && i < len && i < clamped_offset && pos < sizeof (tmp); i++) pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, "%s%02x", (i > 0 && (i%4) == 0) ? " " : "", msg[i]); if (pos < sizeof (tmp)) - pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, " @0x%x ", (int) (submsg - msg)); - for (i = 0; i < 64 && i < len - (size_t) (submsg - msg) && pos < sizeof (tmp); i++) - pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, "%s%02x", (i > 0 && (i%4) == 0) ? " " : "", submsg[i]); + pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, " @%" PRIdPTR " ", offset); + for (i = 0; i < 64 && i < len - clamped_offset && pos < sizeof (tmp); i++) + pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, "%s%02x", (i > 0 && (i%4) == 0) ? " " : "", msg[clamped_offset + i]); if (pos < sizeof (tmp)) pos += (size_t) snprintf (tmp + pos, sizeof (tmp) - pos, "> (note: maybe partially bswap'd)"); assert (pos < (int) sizeof (tmp)); - + /* Partially decode header if we have enough bytes available */ smsize = len - (size_t) (submsg - msg); if (smsize >= DDSI_RTPS_SUBMESSAGE_HEADER_SIZE && pos < sizeof (tmp)) { @@ -2902,6 +2906,44 @@ static void malformed_packet_received (const struct ddsi_domaingv *gv, const uns GVWARNING ("%s\n", tmp); } +static void malformed_packet_received_fulldump (const struct ddsi_domaingv *gv, const unsigned char *msg, const unsigned char *submsg, size_t len, ddsi_vendorid_t vendorid, uint32_t logmask) +{ + GVLOG (logmask, "malformed packet: vendor %u.%u msg %p submsg %p length %" PRIuSIZE " contents:\n", vendorid.id[0], vendorid.id[1], (void *) msg, (void *) submsg, len); + for (size_t off16 = 0; off16 < len; off16 += 16) + { + GVLOG (logmask, "%c%04" PRIxSIZE " ", (msg + off16 <= submsg && (size_t) (submsg - (msg + off16)) < 16) ? '*' : ' ', off16); + char sep = ' '; + size_t off1; + for (off1 = 0; off1 < 16 && off16 + off1 < len; off1++) { + if (msg + off16 + off1 == submsg) + sep = '['; + else if (sep == '[') + sep = ']'; + else + sep =' '; + GVLOG (logmask, "%s%c%02x", (off1 == 8) ? " " : "", sep, msg[off16 + off1]); + } + for (; off1 < 16; off1++) { + GVLOG (logmask, "%s%c ", (off1 == 8) ? " " : "", (sep == '[') ? ']' : sep); + sep = ' '; + } + GVLOG (logmask, " |"); + for (off1 = 0; off1 < 16 && off16 + off1 < len; off1++) { + GVLOG (logmask, "%c", isprint (msg[off16 + off1]) ? msg[off16 + off1] : '.'); + } + GVLOG (logmask, "|\n"); + } +} + +static void malformed_packet_received (const struct ddsi_domaingv *gv, const unsigned char *msg, const unsigned char *submsg, size_t len, ddsi_vendorid_t vendorid) +{ + malformed_packet_received_shortmsg (gv, msg, submsg, len, vendorid); + if (gv->logconfig.c.mask & DDS_LC_MALFORMED) + malformed_packet_received_fulldump (gv, msg, submsg, len, vendorid, DDS_LC_WARNING); + else // dump it if we're writing a trace file, no matter the tracing options + malformed_packet_received_fulldump (gv, msg, submsg, len, vendorid, DDS_TRACE_MASK); +} + static struct ddsi_receiver_state *rst_cow_if_needed (int *rst_live, struct ddsi_rmsg *rmsg, struct ddsi_receiver_state *rst) { if (! *rst_live) diff --git a/src/core/ddsi/src/ddsi_xmsg.c b/src/core/ddsi/src/ddsi_xmsg.c index c63d937041..e0ae5a2fb6 100644 --- a/src/core/ddsi/src/ddsi_xmsg.c +++ b/src/core/ddsi/src/ddsi_xmsg.c @@ -225,6 +225,9 @@ void ddsi_xmsgpool_free (struct ddsi_xmsgpool *pool) (see below), transmits them, and releases them. */ +static void *ddsi_xmsg_append_impl (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz) + ddsrt_nonnull ((1)) ddsrt_attribute_returns_nonnull; + static void ddsi_xmsg_reinit (struct ddsi_xmsg *m, enum ddsi_xmsg_kind kind) { m->sz = 0; @@ -513,7 +516,7 @@ void ddsi_xmsg_submsg_replace(struct ddsi_xmsg *msg, struct ddsi_xmsg_marker sm_ /* Adjust the message size to the new sub-message. */ if (old_len < new_len) { - ddsi_xmsg_append(msg, NULL, new_len - old_len); + (void) ddsi_xmsg_append_impl (msg, NULL, new_len - old_len); } else if (old_len > new_len) { @@ -581,7 +584,7 @@ void *ddsi_xmsg_submsg_from_marker (struct ddsi_xmsg *msg, struct ddsi_xmsg_mark return msg->data->payload + marker.offset; } -void *ddsi_xmsg_append (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz) +static void *ddsi_xmsg_append_impl (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz) { static const size_t a = 4; @@ -612,6 +615,11 @@ void *ddsi_xmsg_append (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, si return p; } +void *ddsi_xmsg_append (struct ddsi_xmsg *m, struct ddsi_xmsg_marker *marker, size_t sz) +{ + return ddsi_xmsg_append_impl (m, marker, sz); +} + void ddsi_xmsg_shrink (struct ddsi_xmsg *m, struct ddsi_xmsg_marker marker, size_t sz) { assert (m != NULL); @@ -898,7 +906,7 @@ void ddsi_xmsg_setwriterseq_fragid (struct ddsi_xmsg *msg, const ddsi_guid_t *wr msg->kindspecific.data.wrfragid = wrfragid; } -void *ddsi_xmsg_addpar_bo (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo) +static void *ddsi_xmsg_addpar_bo_impl (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo) { const size_t len4 = (len + 3) & ~(size_t)3; /* must alloc a multiple of 4 */ ddsi_parameter_t *phdr; @@ -916,9 +924,14 @@ void *ddsi_xmsg_addpar_bo (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t l return p; } +void *ddsi_xmsg_addpar_bo (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo) +{ + return ddsi_xmsg_addpar_bo_impl (m, pid, len, bo); +} + void *ddsi_xmsg_addpar (struct ddsi_xmsg *m, ddsi_parameterid_t pid, size_t len) { - return ddsi_xmsg_addpar_bo(m, pid, len, DDSRT_BOSEL_NATIVE); + return ddsi_xmsg_addpar_bo_impl (m, pid, len, DDSRT_BOSEL_NATIVE); } void ddsi_xmsg_addpar_keyhash (struct ddsi_xmsg *m, const struct ddsi_serdata *serdata, bool force_md5) @@ -954,12 +967,12 @@ void ddsi_xmsg_addpar_statusinfo (struct ddsi_xmsg *m, unsigned statusinfo) void ddsi_xmsg_addpar_sentinel (struct ddsi_xmsg * m) { - ddsi_xmsg_addpar (m, DDSI_PID_SENTINEL, 0); + ddsi_xmsg_addpar_bo_impl (m, DDSI_PID_SENTINEL, 0, DDSRT_BOSEL_NATIVE); } void ddsi_xmsg_addpar_sentinel_bo (struct ddsi_xmsg * m, enum ddsrt_byte_order_selector bo) { - ddsi_xmsg_addpar_bo (m, DDSI_PID_SENTINEL, 0, bo); + ddsi_xmsg_addpar_bo_impl (m, DDSI_PID_SENTINEL, 0, bo); } int ddsi_xmsg_addpar_sentinel_ifparam (struct ddsi_xmsg * m) diff --git a/src/core/ddsi/tests/plist_leasedur.c b/src/core/ddsi/tests/plist_leasedur.c index e970efec70..b56711010c 100644 --- a/src/core/ddsi/tests/plist_leasedur.c +++ b/src/core/ddsi/tests/plist_leasedur.c @@ -168,7 +168,8 @@ CU_Test (ddsi_plist_leasedur, ser_spdp, .init = setup, .fini = teardown) struct ddsi_xmsg *m = ddsi_xmsg_new (gv.xmsgpool, &guid, NULL, 64, DDSI_XMSG_KIND_DATA); CU_ASSERT_FATAL (m != NULL); struct ddsi_xmsg_marker marker; - (void) ddsi_xmsg_append (m, &marker, 0); + void *x = ddsi_xmsg_append (m, &marker, 0); + (void) x; ddsi_plist_t plist; ddsi_plist_init_empty (&plist); @@ -199,7 +200,8 @@ CU_Test (ddsi_plist_leasedur, ser_others, .init = setup, .fini = teardown) struct ddsi_xmsg *m = ddsi_xmsg_new (gv.xmsgpool, &guid, NULL, 64, DDSI_XMSG_KIND_DATA); CU_ASSERT_FATAL (m != NULL); struct ddsi_xmsg_marker marker; - (void) ddsi_xmsg_append (m, &marker, 0); + void *x = ddsi_xmsg_append (m, &marker, 0); + (void) x; ddsi_plist_t plist; ddsi_plist_init_empty (&plist); diff --git a/src/ddsrt/include/dds/ddsrt/log.h b/src/ddsrt/include/dds/ddsrt/log.h index 53730aa12d..42f905f508 100644 --- a/src/ddsrt/include/dds/ddsrt/log.h +++ b/src/ddsrt/include/dds/ddsrt/log.h @@ -76,6 +76,8 @@ extern "C" { #define DDS_LC_RHC (65536u) /** Include content in traces. */ #define DDS_LC_CONTENT (131072u) +/** Output full dump of malformed messages as warnings */ +#define DDS_LC_MALFORMED (262144u) /** All common trace categories. */ #define DDS_LC_ALL \ (DDS_LC_FATAL | DDS_LC_ERROR | DDS_LC_WARNING | DDS_LC_INFO | \ diff --git a/src/security/core/tests/fsm.c b/src/security/core/tests/fsm.c index 28ac31336b..384dbabf8c 100644 --- a/src/security/core/tests/fsm.c +++ b/src/security/core/tests/fsm.c @@ -424,12 +424,12 @@ CU_Test(ddssec_fsm, create, .init = fsm_control_init, .fini = fsm_control_fini) CU_ASSERT (visited_auth == 0xff); ddsrt_mutex_unlock (&g_lock); - /* Check correct callback parameter passing (from fsm to user defined methods) */ - CU_ASSERT(correct_arg && correct_fsm); dds_security_fsm_free (fsm_auth); /* Check whether timeout callback has NOT been invoked */ + /* Check correct callback parameter passing (from fsm to user defined methods) */ ddsrt_mutex_lock (&g_lock); + CU_ASSERT (correct_arg && correct_fsm); CU_ASSERT (visited_timeout == 0); ddsrt_mutex_unlock (&g_lock); }