Merge remote-tracking branch 'upstream/master' into security
This commit is contained in:
commit
2da100a3c7
35 changed files with 671 additions and 157 deletions
|
@ -187,17 +187,21 @@ typedef struct dds_builtintopic_guid
|
|||
}
|
||||
dds_builtintopic_guid_t;
|
||||
|
||||
/* "dds_builtintopic_guid_t" is a bit of a weird name for what everyone just calls a GUID,
|
||||
so let us try and switch to using the more logical one */
|
||||
typedef struct dds_builtintopic_guid dds_guid_t;
|
||||
|
||||
typedef struct dds_builtintopic_participant
|
||||
{
|
||||
dds_builtintopic_guid_t key;
|
||||
dds_guid_t key;
|
||||
dds_qos_t *qos;
|
||||
}
|
||||
dds_builtintopic_participant_t;
|
||||
|
||||
typedef struct dds_builtintopic_endpoint
|
||||
{
|
||||
dds_builtintopic_guid_t key;
|
||||
dds_builtintopic_guid_t participant_key;
|
||||
dds_guid_t key;
|
||||
dds_guid_t participant_key;
|
||||
dds_instance_handle_t participant_instance_handle;
|
||||
char *topic_name;
|
||||
char *type_name;
|
||||
|
@ -415,6 +419,26 @@ dds_get_mask(dds_entity_t condition, uint32_t *mask);
|
|||
DDS_EXPORT dds_return_t
|
||||
dds_get_instance_handle(dds_entity_t entity, dds_instance_handle_t *ihdl);
|
||||
|
||||
/**
|
||||
* @brief Returns the GUID that represents the entity in the network,
|
||||
* and therefore only supports participants, readers and writers.
|
||||
*
|
||||
* @param[in] entity Entity of which to get the instance handle.
|
||||
* @param[out] guid Where to store the GUID.
|
||||
*
|
||||
* @returns A dds_return_t indicating success or failure.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* Success.
|
||||
* @retval DDS_RETCODE_ILLEGAL_OPERATION
|
||||
* The operation is invoked on an inappropriate object.
|
||||
* @retval DDS_RETCODE_ERROR
|
||||
* An internal error has occurred.
|
||||
*/
|
||||
/* TODO: Check list of return codes is complete. */
|
||||
DDS_EXPORT dds_return_t
|
||||
dds_get_guid (dds_entity_t entity, dds_guid_t *guid);
|
||||
|
||||
/*
|
||||
All entities have a set of "status conditions" (following the DCPS
|
||||
spec), read peeks, take reads & resets (analogously to read & take
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "dds/ddsi/ddsi_pmd.h"
|
||||
#include "dds/ddsi/ddsi_xqos.h"
|
||||
#include "dds/ddsi/q_transmit.h"
|
||||
#include "dds/ddsi/q_bswap.h"
|
||||
|
||||
extern inline dds_entity *dds_entity_from_handle_link (struct dds_handle_link *hdllink);
|
||||
extern inline bool dds_entity_is_enabled (const dds_entity *e);
|
||||
|
@ -1285,6 +1286,36 @@ dds_return_t dds_get_instance_handle (dds_entity_t entity, dds_instance_handle_t
|
|||
return ret;
|
||||
}
|
||||
|
||||
dds_return_t dds_get_guid (dds_entity_t entity, dds_guid_t *guid)
|
||||
{
|
||||
dds_entity *e;
|
||||
dds_return_t ret;
|
||||
|
||||
if (guid == NULL)
|
||||
return DDS_RETCODE_BAD_PARAMETER;
|
||||
|
||||
if ((ret = dds_entity_pin (entity, &e)) != DDS_RETCODE_OK)
|
||||
return ret;
|
||||
switch (dds_entity_kind (e))
|
||||
{
|
||||
case DDS_KIND_PARTICIPANT:
|
||||
case DDS_KIND_READER:
|
||||
case DDS_KIND_WRITER: {
|
||||
DDSRT_STATIC_ASSERT (sizeof (dds_guid_t) == sizeof (ddsi_guid_t));
|
||||
ddsi_guid_t tmp = nn_ntoh_guid (e->m_guid);
|
||||
memcpy (guid, &tmp, sizeof (*guid));
|
||||
ret = DDS_RETCODE_OK;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = DDS_RETCODE_ILLEGAL_OPERATION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dds_entity_unpin(e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dds_return_t dds_entity_pin (dds_entity_t hdl, dds_entity **eptr)
|
||||
{
|
||||
dds_return_t hres;
|
||||
|
|
|
@ -175,7 +175,7 @@ static struct ddsi_serdata *serdata_builtin_to_topicless (const struct ddsi_serd
|
|||
return ddsi_serdata_ref (serdata_common);
|
||||
}
|
||||
|
||||
static void convkey (dds_builtintopic_guid_t *key, const ddsi_guid_t *guid)
|
||||
static void convkey (dds_guid_t *key, const ddsi_guid_t *guid)
|
||||
{
|
||||
ddsi_guid_t tmp;
|
||||
tmp = nn_hton_guid (*guid);
|
||||
|
|
|
@ -15,6 +15,7 @@ idlc_generate(RoundTrip RoundTrip.idl)
|
|||
idlc_generate(Space Space.idl)
|
||||
idlc_generate(TypesArrayKey TypesArrayKey.idl)
|
||||
idlc_generate(WriteTypes WriteTypes.idl)
|
||||
idlc_generate(InstanceHandleTypes InstanceHandleTypes.idl)
|
||||
|
||||
set(ddsc_test_sources
|
||||
"basic.c"
|
||||
|
@ -28,6 +29,7 @@ set(ddsc_test_sources
|
|||
"entity_status.c"
|
||||
"err.c"
|
||||
"instance_get_key.c"
|
||||
"instance_handle.c"
|
||||
"listener.c"
|
||||
"liveliness.c"
|
||||
"loan.c"
|
||||
|
@ -73,7 +75,7 @@ target_include_directories(
|
|||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/include/>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../ddsc/src>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../ddsi/include>")
|
||||
target_link_libraries(cunit_ddsc PRIVATE RoundTrip Space TypesArrayKey WriteTypes ddsc)
|
||||
target_link_libraries(cunit_ddsc PRIVATE RoundTrip Space TypesArrayKey WriteTypes InstanceHandleTypes ddsc)
|
||||
|
||||
# Setup environment for config-tests
|
||||
get_test_property(CUnit_ddsc_config_simple_udp ENVIRONMENT CUnit_ddsc_config_simple_udp_env)
|
||||
|
|
23
src/core/ddsc/tests/InstanceHandleTypes.idl
Normal file
23
src/core/ddsc/tests/InstanceHandleTypes.idl
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright(c) 2020 ADLINK Technology Limited and others
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||
* v. 1.0 which is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
module InstanceHandleTypes {
|
||||
struct A {
|
||||
unsigned long k; //@Key
|
||||
unsigned long v;
|
||||
};
|
||||
#pragma keylist A k
|
||||
struct C {
|
||||
octet k[4]; //@Key
|
||||
unsigned long v;
|
||||
};
|
||||
#pragma keylist C k
|
||||
};
|
|
@ -255,6 +255,28 @@ CU_Test(ddsc_entity, status, .init = create_entity, .fini = delete_entity)
|
|||
CU_ASSERT_EQUAL_FATAL(status1, DDS_RETCODE_OK);
|
||||
}
|
||||
|
||||
CU_Test(ddsc_entity, guid, .init = create_entity, .fini = delete_entity)
|
||||
{
|
||||
dds_return_t status;
|
||||
dds_guid_t guid, zero;
|
||||
memset(&zero, 0, sizeof(zero));
|
||||
|
||||
/* Don't check actual handle contents. That's a job
|
||||
* for the specific entity children, not for the generic part. */
|
||||
|
||||
/* Check getting Handle with bad parameters. */
|
||||
status = dds_get_guid (0, NULL);
|
||||
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_BAD_PARAMETER);
|
||||
status = dds_get_guid (entity, NULL);
|
||||
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_BAD_PARAMETER);
|
||||
status = dds_get_guid (0, &guid);
|
||||
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_BAD_PARAMETER);
|
||||
|
||||
/* Get Instance Handle, which should not be 0 for a participant. */
|
||||
status = dds_get_guid (entity, &guid);
|
||||
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_OK);
|
||||
CU_ASSERT_FATAL(memcmp(&guid, &zero, sizeof(guid)) != 0);
|
||||
}
|
||||
|
||||
CU_Test(ddsc_entity, instance_handle, .init = create_entity, .fini = delete_entity)
|
||||
{
|
||||
|
|
134
src/core/ddsc/tests/instance_handle.c
Normal file
134
src/core/ddsc/tests/instance_handle.c
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Copyright(c) 2020 ADLINK Technology Limited and others
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||
* v. 1.0 which is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "dds/dds.h"
|
||||
#include "dds/ddsrt/bswap.h"
|
||||
|
||||
#include "test_common.h"
|
||||
#include "InstanceHandleTypes.h"
|
||||
|
||||
static dds_entity_t dp, tp[3], rd[3], wr[3];
|
||||
|
||||
static void instance_handle_init (void)
|
||||
{
|
||||
char topicname[100];
|
||||
dds_qos_t *qos;
|
||||
dp = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
|
||||
CU_ASSERT_FATAL (dp > 0);
|
||||
|
||||
/* not strictly necessary to explicitly set KEEP_LAST (it is the default), nor to make
|
||||
it reliable (it is only used inside a process without any limits that might cause it
|
||||
to drop samples) */
|
||||
qos = dds_create_qos ();
|
||||
CU_ASSERT_FATAL (qos != NULL);
|
||||
dds_qset_history (qos, DDS_HISTORY_KEEP_LAST, 1);
|
||||
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_INFINITY);
|
||||
create_unique_topic_name ("instance_handle", topicname, sizeof (topicname));
|
||||
tp[0] = dds_create_topic (dp, &InstanceHandleTypes_A_desc, topicname, NULL, NULL);
|
||||
CU_ASSERT_FATAL (tp[0] > 0);
|
||||
create_unique_topic_name ("instance_handle", topicname, sizeof (topicname));
|
||||
tp[1] = dds_create_topic (dp, &InstanceHandleTypes_A_desc, topicname, NULL, NULL);
|
||||
CU_ASSERT_FATAL (tp[1] > 0);
|
||||
create_unique_topic_name ("instance_handle", topicname, sizeof (topicname));
|
||||
tp[2] = dds_create_topic (dp, &InstanceHandleTypes_C_desc, topicname, NULL, NULL);
|
||||
CU_ASSERT_FATAL (tp[2] > 0);
|
||||
dds_delete_qos (qos);
|
||||
for (size_t i = 0; i < 3; i++)
|
||||
{
|
||||
rd[i] = dds_create_reader (dp, tp[i], NULL, NULL);
|
||||
CU_ASSERT_FATAL (rd[i] > 0);
|
||||
wr[i] = dds_create_writer (dp, tp[i], NULL, NULL);
|
||||
CU_ASSERT_FATAL (wr[i] > 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void instance_handle_fini (void)
|
||||
{
|
||||
dds_return_t rc;
|
||||
rc = dds_delete (dp);
|
||||
CU_ASSERT_FATAL (rc == 0);
|
||||
}
|
||||
|
||||
CU_Test (ddsc_instance_handle, a, .init = instance_handle_init, .fini = instance_handle_fini)
|
||||
{
|
||||
/* By design, Cyclone maintains a global map of (topic class, X, key value) to instance handle,
|
||||
where the "topic class" is the implementation of the topic (e.g., "default" or "builtin"),
|
||||
"X" is dependent on the topic class but by design is a fixed constant for the default one,
|
||||
and key value, again by design, is taken as the serialised representation of the key value.
|
||||
|
||||
The point behind this model is that it allows one to use an instance handle obtained on
|
||||
one reader and use it to read the matching instance in another reader. So that bit of
|
||||
behaviour needs to be checked.
|
||||
|
||||
I'm not sure whether the "serialised" part should be included in the test, I don't think
|
||||
that's something that should be guaranteed in the API. However, it is worth verifying that
|
||||
it doesn't go off and do something weird. */
|
||||
InstanceHandleTypes_A a, b;
|
||||
InstanceHandleTypes_C c;
|
||||
dds_return_t rc;
|
||||
|
||||
for (uint32_t i = 1; i <= 5; i++)
|
||||
{
|
||||
a.k = i;
|
||||
a.v = i;
|
||||
b.k = i;
|
||||
b.v = 2 * a.k;
|
||||
const uint32_t a_k_be = ddsrt_toBE4u (a.k);
|
||||
memcpy (c.k, &a_k_be, sizeof (c.k));
|
||||
c.v = 3 * a.k;
|
||||
rc = dds_write (wr[0], &a);
|
||||
CU_ASSERT_FATAL (rc == 0);
|
||||
rc = dds_write (wr[1], &b);
|
||||
CU_ASSERT_FATAL (rc == 0);
|
||||
rc = dds_write (wr[2], &c);
|
||||
CU_ASSERT_FATAL (rc == 0);
|
||||
}
|
||||
|
||||
for (uint32_t i = 1; i <= 5; i++)
|
||||
{
|
||||
dds_sample_info_t siA, siB, siC;
|
||||
void *rawA = &a, *rawB = &b, *rawC = &c;
|
||||
|
||||
/* take one sample from A; no guarantee about the order in which the data is returned */
|
||||
rc = dds_take (rd[0], &rawA, &siA, 1, 1);
|
||||
CU_ASSERT_FATAL (rc == 1);
|
||||
CU_ASSERT_FATAL (siA.valid_data);
|
||||
CU_ASSERT_FATAL (1 <= a.k && a.k <= 5 && a.v == a.k);
|
||||
|
||||
/* take one sample from B using the instance handle just returned */
|
||||
rc = dds_take_instance (rd[1], &rawB, &siB, 1, 1, siA.instance_handle);
|
||||
CU_ASSERT_FATAL (rc == 1);
|
||||
CU_ASSERT_FATAL (siB.valid_data);
|
||||
CU_ASSERT_FATAL (siB.instance_handle == siA.instance_handle);
|
||||
CU_ASSERT_FATAL (b.k == a.k && b.v == 2 * a.k);
|
||||
|
||||
/* take one sample from C using the instance handle just returned, this should work
|
||||
even though C uses an array of octets as key */
|
||||
rc = dds_take_instance (rd[2], &rawC, &siC, 1, 1, siA.instance_handle);
|
||||
CU_ASSERT_FATAL (rc == 1);
|
||||
CU_ASSERT_FATAL (siC.valid_data);
|
||||
CU_ASSERT_FATAL (siC.instance_handle == siA.instance_handle);
|
||||
const uint32_t a_k_be = ddsrt_toBE4u (a.k);
|
||||
CU_ASSERT_FATAL (memcmp (c.k, &a_k_be, sizeof (c.k)) == 0 && c.v == 3 * a.k);
|
||||
}
|
||||
|
||||
/* there should be no data left */
|
||||
for (size_t i = 0; i < 3; i++)
|
||||
{
|
||||
dds_sample_info_t si;
|
||||
void *raw = NULL;
|
||||
rc = dds_take (rd[0], &raw, &si, 1, 1);
|
||||
CU_ASSERT_FATAL (rc == 0);
|
||||
}
|
||||
}
|
|
@ -102,6 +102,13 @@ DDSRT_STATIC_ASSERT (sizeof (struct nn_rmsg) == offsetof (struct nn_rmsg, chunk)
|
|||
#define NN_RMSG_PAYLOAD(m) ((unsigned char *) (m + 1))
|
||||
#define NN_RMSG_PAYLOADOFF(m, o) (NN_RMSG_PAYLOAD (m) + (o))
|
||||
|
||||
/* Align rmsg chunks to the larger of sizeof(void*) or 8.
|
||||
|
||||
Ideally, we would use C11's alignof(struct nn_rmsg); however, to avoid dependency on C11,
|
||||
we ensure rmsg chunks are at least aligned to sizeof(void *) or 8,
|
||||
whichever is larger. */
|
||||
#define ALIGNOF_RMSG (sizeof(void *) > 8 ? sizeof(void *) : 8)
|
||||
|
||||
struct receiver_state {
|
||||
ddsi_guid_prefix_t src_guid_prefix; /* 12 */
|
||||
ddsi_guid_prefix_t dst_guid_prefix; /* 12 */
|
||||
|
|
|
@ -562,7 +562,7 @@ static const struct cfgelem compatibility_cfgelems[] = {
|
|||
BLURB("<p>This element specifies whether QoS settings set to default values are explicitly published in the discovery protocol. Implementations are to use the default value for QoS settings not published, which allows a significant reduction of the amount of data that needs to be exchanged for the discovery protocol, but this requires all implementations to adhere to the default values specified by the specifications.</p>\n\
|
||||
<p>When interoperability is required with an implementation that does not follow the specifications in this regard, setting this option to true will help.</p>") },
|
||||
{ LEAF ("ManySocketsMode"), 1, "single", ABSOFF (many_sockets_mode), 0, uf_many_sockets_mode, 0, pf_many_sockets_mode,
|
||||
BLURB("<p>This option specifies whether a network socket will be created for each domain participant on a host. The specification seems to assume that each participant has a unique address, and setting this option will ensure this to be the case. This is not the defeault.</p>\n\
|
||||
BLURB("<p>This option specifies whether a network socket will be created for each domain participant on a host. The specification seems to assume that each participant has a unique address, and setting this option will ensure this to be the case. This is not the default.</p>\n\
|
||||
<p>Disabling it slightly improves performance and reduces network traffic somewhat. It also causes the set of port numbers needed by DDSI2E to become predictable, which may be useful for firewall and NAT configuration.</p>") },
|
||||
{ LEAF("AssumeRtiHasPmdEndpoints"), 1, "false", ABSOFF(assume_rti_has_pmd_endpoints), 0, uf_boolean, 0, pf_boolean,
|
||||
BLURB("<p>This option assumes ParticipantMessageData endpoints required by the liveliness protocol are present in RTI participants even when not properly advertised by the participant discovery protocol.</p>") },
|
||||
|
@ -674,7 +674,7 @@ static const struct cfgelem internal_cfgelems[] = {
|
|||
BLURB("<p>This setting determines the size of the time window in which a NACK of some sample is ignored because a retransmit of that sample has been multicasted too recently. This setting has no effect on unicasted retransmits.</p>\n\
|
||||
<p>See also Internal/RetransmitMerging.</p>") },
|
||||
{ LEAF_W_ATTRS("HeartbeatInterval", heartbeat_interval_attrs), 1, "100 ms", ABSOFF(const_hb_intv_sched), 0, uf_duration_inf, 0, pf_duration,
|
||||
BLURB("<p>This elemnents allows configuring the base interval for sending writer heartbeats and the bounds within it can vary.</p>") },
|
||||
BLURB("<p>This element allows configuring the base interval for sending writer heartbeats and the bounds within which it can vary.</p>") },
|
||||
{ LEAF("MaxQueuedRexmitBytes"), 1, "50 kB", ABSOFF(max_queued_rexmit_bytes), 0, uf_memsize, 0, pf_memsize,
|
||||
BLURB("<p>This setting limits the maximum number of bytes queued for retransmission. The default value of 0 is unlimited unless an AuxiliaryBandwidthLimit has been set, in which case it becomes NackDelay * AuxiliaryBandwidthLimit. It must be large enough to contain the largest sample that may need to be retransmitted.</p>") },
|
||||
{ LEAF("MaxQueuedRexmitMessages"), 1, "200", ABSOFF(max_queued_rexmit_msgs), 0, uf_uint, 0, pf_uint,
|
||||
|
@ -715,7 +715,7 @@ static const struct cfgelem internal_cfgelems[] = {
|
|||
{ LEAF("MaxSampleSize"), 1, "2147483647 B", ABSOFF(max_sample_size), 0, uf_memsize, 0, pf_memsize,
|
||||
BLURB("<p>This setting controls the maximum (CDR) serialised size of samples that DDSI2E will forward in either direction. Samples larger than this are discarded with a warning.</p>") },
|
||||
{ LEAF("WriteBatch"), 1, "false", ABSOFF(whc_batch), 0, uf_boolean, 0, pf_boolean,
|
||||
BLURB("<p>This element enables the batching of write operations. By default each write operation writes through the write cache and out onto the transport. Enabling write batching causes multiple small write operations to be aggregated within the write cache into a single larger write. This gives greater throughput at the expense of latency. Currently there is no mechanism for the write cache to automatically flush itself, so that if write batching is enabled, the application may havee to use the dds_write_flush function to ensure thta all samples are written.</p>") },
|
||||
BLURB("<p>This element enables the batching of write operations. By default each write operation writes through the write cache and out onto the transport. Enabling write batching causes multiple small write operations to be aggregated within the write cache into a single larger write. This gives greater throughput at the expense of latency. Currently there is no mechanism for the write cache to automatically flush itself, so that if write batching is enabled, the application may have to use the dds_write_flush function to ensure that all samples are written.</p>") },
|
||||
{ LEAF_W_ATTRS("LivelinessMonitoring", liveliness_monitoring_attrs), 1, "false", ABSOFF(liveliness_monitoring), 0, uf_boolean, 0, pf_boolean,
|
||||
BLURB("<p>This element controls whether or not implementation should internally monitor its own liveliness. If liveliness monitoring is enabled, stack traces can be dumped automatically when some thread appears to have stopped making progress.</p>") },
|
||||
{ LEAF("MonitorPort"), 1, "-1", ABSOFF(monitor_port), 0, uf_int, 0, pf_int,
|
||||
|
@ -760,7 +760,7 @@ static const struct cfgelem discovery_ports_cfgelems[] = {
|
|||
{ LEAF("DomainGain"), 1, "250", ABSOFF(ports.dg), 0, uf_uint, 0, pf_uint,
|
||||
BLURB("<p>This element specifies the domain gain, relating domain ids to sets of port numbers (refer to the DDSI 2.1 specification, section 9.6.1, constant DG).</p>") },
|
||||
{ LEAF("ParticipantGain"), 1, "2", ABSOFF(ports.pg), 0, uf_uint, 0, pf_uint,
|
||||
BLURB("<p>This element specifies the participant gain, relating p0, articipant index to sets of port numbers (refer to the DDSI 2.1 specification, section 9.6.1, constant PG).</p>") },
|
||||
BLURB("<p>This element specifies the participant gain, relating p0, participant index to sets of port numbers (refer to the DDSI 2.1 specification, section 9.6.1, constant PG).</p>") },
|
||||
{ LEAF("MulticastMetaOffset"), 1, "0", ABSOFF(ports.d0), 0, uf_uint, 0, pf_uint,
|
||||
BLURB("<p>This element specifies the port number for multicast meta traffic (refer to the DDSI 2.1 specification, section 9.6.1, constant d0).</p>") },
|
||||
{ LEAF("UnicastMetaOffset"), 1, "10", ABSOFF(ports.d1), 0, uf_uint, 0, pf_uint,
|
||||
|
@ -906,7 +906,7 @@ static const struct cfgelem tracing_cfgelems[] = {
|
|||
{ LEAF("AppendToFile"), 1, "false", ABSOFF(tracingAppendToFile), 0, uf_boolean, 0, pf_boolean,
|
||||
BLURB("<p>This option specifies whether the output is to be appended to an existing log file. The default is to create a new log file each time, which is generally the best option if a detailed log is generated.</p>") },
|
||||
{ LEAF("PacketCaptureFile"), 1, "", ABSOFF(pcap_file), 0, uf_string, ff_free, pf_string,
|
||||
BLURB("<p>This option specifies the file to which received and sent packets will be logged in the \"pcap\" format suitable for analysis using common networking tools, such as WireShark. IP and UDP headers are ficitious, in particular the destination address of received packets. The TTL may be used to distinguish between sent and received packets: it is 255 for sent packets and 128 for received ones. Currently IPv4 only.</p>") },
|
||||
BLURB("<p>This option specifies the file to which received and sent packets will be logged in the \"pcap\" format suitable for analysis using common networking tools, such as WireShark. IP and UDP headers are fictitious, in particular the destination address of received packets. The TTL may be used to distinguish between sent and received packets: it is 255 for sent packets and 128 for received ones. Currently IPv4 only.</p>") },
|
||||
END_MARKER
|
||||
};
|
||||
|
||||
|
|
|
@ -303,9 +303,11 @@ static void nn_rbuf_release (struct nn_rbuf *rbuf);
|
|||
#define RMSGTRACE(...) TRACE_CFG (rmsg, rmsg->chunk.rbuf->rbufpool->logcfg, __VA_ARGS__)
|
||||
#define RDATATRACE(rdata, ...) TRACE_CFG ((rdata)->rmsg, (rdata)->rmsg->chunk.rbuf->rbufpool->logcfg, __VA_ARGS__)
|
||||
|
||||
static uint32_t align8uint32 (uint32_t x)
|
||||
static uint32_t align_rmsg (uint32_t x)
|
||||
{
|
||||
return (x + 7u) & (uint32_t)-8;
|
||||
x += (uint32_t) ALIGNOF_RMSG - 1;
|
||||
x -= x % (uint32_t) ALIGNOF_RMSG;
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -553,15 +555,15 @@ struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbp)
|
|||
|
||||
void nn_rmsg_setsize (struct nn_rmsg *rmsg, uint32_t size)
|
||||
{
|
||||
uint32_t size8 = align8uint32 (size);
|
||||
RMSGTRACE ("rmsg_setsize(%p, %"PRIu32" => %"PRIu32")\n", (void *) rmsg, size, size8);
|
||||
uint32_t size8P = align_rmsg (size);
|
||||
RMSGTRACE ("rmsg_setsize(%p, %"PRIu32" => %"PRIu32")\n", (void *) rmsg, size, size8P);
|
||||
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
|
||||
ASSERT_RMSG_UNCOMMITTED (rmsg);
|
||||
assert (ddsrt_atomic_ld32 (&rmsg->refcount) == RMSG_REFCOUNT_UNCOMMITTED_BIAS);
|
||||
assert (rmsg->chunk.u.size == 0);
|
||||
assert (size8 <= rmsg->chunk.rbuf->max_rmsg_size);
|
||||
assert (size8P <= rmsg->chunk.rbuf->max_rmsg_size);
|
||||
assert (rmsg->lastchunk == &rmsg->chunk);
|
||||
rmsg->chunk.u.size = size8;
|
||||
rmsg->chunk.u.size = size8P;
|
||||
#if USE_VALGRIND
|
||||
VALGRIND_MEMPOOL_CHANGE (rmsg->chunk.rbuf->rbufpool, rmsg, rmsg, offsetof (struct nn_rmsg, chunk.u.payload) + rmsg->chunk.size);
|
||||
#endif
|
||||
|
@ -620,7 +622,7 @@ void nn_rmsg_commit (struct nn_rmsg *rmsg)
|
|||
ASSERT_RBUFPOOL_OWNER (chunk->rbuf->rbufpool);
|
||||
ASSERT_RMSG_UNCOMMITTED (rmsg);
|
||||
assert (chunk->u.size <= chunk->rbuf->max_rmsg_size);
|
||||
assert ((chunk->u.size % 8) == 0);
|
||||
assert ((chunk->u.size % ALIGNOF_RMSG) == 0);
|
||||
assert (ddsrt_atomic_ld32 (&rmsg->refcount) >= RMSG_REFCOUNT_UNCOMMITTED_BIAS);
|
||||
assert (ddsrt_atomic_ld32 (&rmsg->chunk.rbuf->n_live_rmsg_chunks) > 0);
|
||||
assert (ddsrt_atomic_ld32 (&chunk->rbuf->n_live_rmsg_chunks) > 0);
|
||||
|
@ -677,15 +679,15 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
|
|||
{
|
||||
struct nn_rmsg_chunk *chunk = rmsg->lastchunk;
|
||||
struct nn_rbuf *rbuf = chunk->rbuf;
|
||||
uint32_t size8 = align8uint32 (size);
|
||||
uint32_t size8P = align_rmsg (size);
|
||||
void *ptr;
|
||||
RMSGTRACE ("rmsg_alloc(%p, %"PRIu32" => %"PRIu32")\n", (void *) rmsg, size, size8);
|
||||
RMSGTRACE ("rmsg_alloc(%p, %"PRIu32" => %"PRIu32")\n", (void *) rmsg, size, size8P);
|
||||
ASSERT_RBUFPOOL_OWNER (rbuf->rbufpool);
|
||||
ASSERT_RMSG_UNCOMMITTED (rmsg);
|
||||
assert ((chunk->u.size % 8) == 0);
|
||||
assert (size8 <= rbuf->max_rmsg_size);
|
||||
assert ((chunk->u.size % ALIGNOF_RMSG) == 0);
|
||||
assert (size8P <= rbuf->max_rmsg_size);
|
||||
|
||||
if (chunk->u.size + size8 > rbuf->max_rmsg_size)
|
||||
if (chunk->u.size + size8P > rbuf->max_rmsg_size)
|
||||
{
|
||||
struct nn_rbufpool *rbp = rbuf->rbufpool;
|
||||
struct nn_rmsg_chunk *newchunk;
|
||||
|
@ -703,7 +705,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
|
|||
}
|
||||
|
||||
ptr = (unsigned char *) (chunk + 1) + chunk->u.size;
|
||||
chunk->u.size += size8;
|
||||
chunk->u.size += size8P;
|
||||
RMSGTRACE ("rmsg_alloc(%p, %"PRIu32") = %p\n", (void *) rmsg, size, ptr);
|
||||
#if USE_VALGRIND
|
||||
if (chunk == &rmsg->chunk) {
|
||||
|
|
|
@ -62,6 +62,10 @@ if(WITH_FREERTOS)
|
|||
set(system_name freertos)
|
||||
elseif(APPLE)
|
||||
set(system_name darwin)
|
||||
elseif(ANDROID)
|
||||
# FIXME: Not correct, but will do for the short-term. A better way would be
|
||||
# fallback to linux, and then posix.
|
||||
set(system_name linux)
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name)
|
||||
endif()
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#include <sys/sockio.h>
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* __APPLE__ || __FreeBSD__ */
|
||||
#endif /* LWIP_SOCKET */
|
||||
|
||||
dds_return_t
|
||||
|
@ -316,13 +316,13 @@ ddsrt_setsockopt(
|
|||
goto err_setsockopt;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
if (level == SOL_SOCKET && optname == SO_REUSEADDR &&
|
||||
setsockopt(sock, level, SO_REUSEPORT, optval, optlen) == -1)
|
||||
{
|
||||
goto err_setsockopt;
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* __APPLE__ || __FreeBSD__ */
|
||||
|
||||
return DDS_RETCODE_OK;
|
||||
err_setsockopt:
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
# Verify Maven is available
|
||||
find_package(Maven 3.0 REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE IDLC_G_SOURCES LIST_DIRECTORIES true *.g)
|
||||
file(GLOB_RECURSE IDLC_G4_SOURCES LIST_DIRECTORIES true *.g4)
|
||||
file(GLOB_RECURSE IDLC_JAVA_SOURCES LIST_DIRECTORIES true *.java)
|
||||
file(GLOB_RECURSE IDLC_ST_SOURCES LIST_DIRECTORIES true *.st?)
|
||||
file(GLOB_RECURSE IDLC_G_SOURCES LIST_DIRECTORIES false *.g)
|
||||
file(GLOB_RECURSE IDLC_G4_SOURCES LIST_DIRECTORIES false *.g4)
|
||||
file(GLOB_RECURSE IDLC_JAVA_SOURCES LIST_DIRECTORIES false *.java)
|
||||
file(GLOB_RECURSE IDLC_ST_SOURCES LIST_DIRECTORIES false *.st?)
|
||||
|
||||
set(IDLC_JAR "${CMAKE_CURRENT_BINARY_DIR}/target/idlc-jar-with-dependencies.jar")
|
||||
mark_as_advanced(IDLC_JAR)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class IdlcCmdOptions extends CmdOptions
|
|||
io.println (" -nostamp Do not timestamp generated code");
|
||||
io.println (" -lax Skip over structs containing unsupported datatypes");
|
||||
io.println (" -quiet Suppress console output other than error messages (default)");
|
||||
io.println (" -verbose Enable console ouptut other than error messages");
|
||||
io.println (" -verbose Enable console output other than error messages");
|
||||
io.println (" -map_wide Map the unsupported wchar and wstring types to char and string");
|
||||
io.println (" -map_longdouble Map the unsupported long double type to double");
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ static void qp_qos (const dds_qos_t *q, FILE *fp)
|
|||
qp_group_data (q, fp);
|
||||
}
|
||||
|
||||
static void print_key(FILE *fp, const char *label, const dds_builtintopic_guid_t *key)
|
||||
static void print_key(FILE *fp, const char *label, const dds_guid_t *key)
|
||||
{
|
||||
fprintf(fp, "%s", label);
|
||||
for(size_t j = 0; j < sizeof (key->v); j++) {
|
||||
|
|
|
@ -283,7 +283,7 @@ struct ppant {
|
|||
ddsrt_avl_node_t avlnode; /* embedded AVL node for handle index */
|
||||
ddsrt_fibheap_node_t fhnode; /* prio queue for timeout handling */
|
||||
dds_instance_handle_t handle; /* participant instance handle */
|
||||
dds_builtintopic_guid_t guid; /* participant GUID */
|
||||
dds_guid_t guid; /* participant GUID */
|
||||
char *hostname; /* hostname is taken from user_data QoS */
|
||||
uint32_t pid; /* pid is also taken from user_data QoS */
|
||||
dds_time_t tdisc; /* time at which it was discovered */
|
||||
|
@ -357,7 +357,7 @@ static void error3 (const char *fmt, ...)
|
|||
verrorx (3, fmt, ap);
|
||||
}
|
||||
|
||||
static char *make_guidstr (struct guidstr *buf, const dds_builtintopic_guid_t *guid)
|
||||
static char *make_guidstr (struct guidstr *buf, const dds_guid_t *guid)
|
||||
{
|
||||
snprintf (buf->str, sizeof (buf->str), "%02x%02x%02x%02x_%02x%02x%02x%02x_%02x%02x%02x%02x_%02x%02x%02x%02x",
|
||||
guid->v[0], guid->v[1], guid->v[2], guid->v[3],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue