Table-driven parameter list handling
The old parameter list parsing was a mess of custom code with tons of duplicated checks, even though parameter list parsing really is a fairly straightforward affair. This commit changes it to a mostly table-driven implementation, where the vast majority of the settings are handled by a generic deserializer and the irregular ones (like reliability, locators) are handled by custom functions. The crazy ones (IPv4 address and port rely on additional state and are completely special-cased). Given these tables, the serialization, finalisation, validation, merging, unalias'ing can all be handled by a very small amount of custom code and an appropriately defined generic function for the common cases. This also makes it possible to have all QoS validation in place, and so removes the need for the specialized implementations for the various entity kinds in the upper layer. QoS inapplicable to an entity were previously ignored, allowing one to have invalid values set in a QoS object when creating an entity, provided that the invalid values are irrelevant to that entity. Whether this is a good thing or not is debatable, but certainly it is a good thing to avoid copying in inapplicable QoS settings. That in turn means the behaviour of the API can remain the same. It does turn out that the code used to return "inconsistent QoS" also for invalid values. That has now been rectified, and it returns "inconsistent QoS" or "bad parameter" as appropriate. Tests have been updated accordingly. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
8ae81db490
commit
3322fc086d
36 changed files with 2367 additions and 2735 deletions
|
@ -13,7 +13,7 @@
|
|||
#define DDSI_SERDATA_DEFAULT_H
|
||||
|
||||
#include "dds/ddsrt/endian.h"
|
||||
#include "dds/ddsi/q_plist.h" /* for nn_prismtech_writer_info */
|
||||
#include "dds/ddsi/q_protocol.h" /* for nn_parameterid_t */
|
||||
#include "dds/ddsi/q_freelist.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/ddsi_serdata.h"
|
||||
|
|
|
@ -46,22 +46,16 @@ extern "C" {
|
|||
#define PP_STATUSINFO ((uint64_t)1 << 22)
|
||||
#define PP_ORIGINAL_WRITER_INFO ((uint64_t)1 << 23)
|
||||
#define PP_ENDPOINT_GUID ((uint64_t)1 << 24)
|
||||
#define PP_PRISMTECH_WRITER_INFO ((uint64_t)1 << 25)
|
||||
#define PP_PRISMTECH_PARTICIPANT_VERSION_INFO ((uint64_t)1 << 26)
|
||||
#define PP_PRISMTECH_NODE_NAME ((uint64_t)1 << 27)
|
||||
#define PP_PRISMTECH_EXEC_NAME ((uint64_t)1 << 28)
|
||||
#define PP_PRISMTECH_PROCESS_ID ((uint64_t)1 << 29)
|
||||
#define PP_PRISMTECH_SERVICE_TYPE ((uint64_t)1 << 30)
|
||||
#define PP_PRISMTECH_WATCHDOG_SCHEDULING ((uint64_t)1 << 31)
|
||||
#define PP_PRISMTECH_LISTENER_SCHEDULING ((uint64_t)1 << 32)
|
||||
#define PP_PRISMTECH_BUILTIN_ENDPOINT_SET ((uint64_t)1 << 33)
|
||||
#define PP_PRISMTECH_TYPE_DESCRIPTION ((uint64_t)1 << 34)
|
||||
#define PP_COHERENT_SET ((uint64_t)1 << 37)
|
||||
#define PP_PRISMTECH_EOTINFO ((uint64_t)1 << 38)
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
#define PP_READER_FAVOURS_SSM ((uint64_t)1 << 39)
|
||||
#endif
|
||||
#define PP_RTI_TYPECODE ((uint64_t)1 << 40)
|
||||
/* Security extensions. */
|
||||
#define PP_IDENTITY_TOKEN ((uint64_t)1 << 41)
|
||||
#define PP_PERMISSIONS_TOKEN ((uint64_t)1 << 42)
|
||||
|
@ -93,14 +87,14 @@ struct nn_locators_one {
|
|||
};
|
||||
|
||||
typedef struct nn_locators {
|
||||
int n;
|
||||
uint32_t n;
|
||||
struct nn_locators_one *first;
|
||||
struct nn_locators_one *last;
|
||||
} nn_locators_t;
|
||||
|
||||
typedef unsigned nn_ipv4address_t;
|
||||
typedef uint32_t nn_ipv4address_t;
|
||||
|
||||
typedef unsigned nn_port_t;
|
||||
typedef uint32_t nn_port_t;
|
||||
|
||||
typedef struct nn_keyhash {
|
||||
unsigned char value[16];
|
||||
|
@ -109,15 +103,15 @@ typedef struct nn_keyhash {
|
|||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
typedef struct nn_reader_favours_ssm {
|
||||
unsigned state; /* default is false */
|
||||
uint32_t state; /* default is false */
|
||||
} nn_reader_favours_ssm_t;
|
||||
#endif
|
||||
|
||||
typedef struct nn_prismtech_participant_version_info
|
||||
{
|
||||
unsigned version;
|
||||
unsigned flags;
|
||||
unsigned unused[3];
|
||||
uint32_t version;
|
||||
uint32_t flags;
|
||||
uint32_t unused[3];
|
||||
char *internals;
|
||||
} nn_prismtech_participant_version_info_t;
|
||||
|
||||
|
@ -126,16 +120,9 @@ typedef struct nn_prismtech_eotgroup_tid {
|
|||
uint32_t transactionId;
|
||||
} nn_prismtech_eotgroup_tid_t;
|
||||
|
||||
typedef struct nn_prismtech_eotinfo {
|
||||
uint32_t transactionId;
|
||||
uint32_t n;
|
||||
nn_prismtech_eotgroup_tid_t *tids;
|
||||
} nn_prismtech_eotinfo_t;
|
||||
|
||||
typedef struct nn_plist {
|
||||
uint64_t present;
|
||||
uint64_t aliased;
|
||||
int unalias_needs_bswap;
|
||||
|
||||
dds_qos_t qos;
|
||||
|
||||
|
@ -150,7 +137,7 @@ typedef struct nn_plist {
|
|||
|
||||
unsigned char expects_inline_qos;
|
||||
nn_count_t participant_manual_liveliness_count;
|
||||
unsigned participant_builtin_endpoints;
|
||||
uint32_t participant_builtin_endpoints;
|
||||
dds_duration_t participant_lease_duration;
|
||||
/* nn_content_filter_property_t content_filter_property; */
|
||||
nn_guid_t participant_guid;
|
||||
|
@ -160,21 +147,18 @@ typedef struct nn_plist {
|
|||
nn_entityid_t participant_entityid;
|
||||
nn_entityid_t group_entityid;
|
||||
#endif
|
||||
unsigned builtin_endpoint_set;
|
||||
unsigned prismtech_builtin_endpoint_set;
|
||||
uint32_t builtin_endpoint_set;
|
||||
uint32_t prismtech_builtin_endpoint_set;
|
||||
/* int type_max_size_serialized; */
|
||||
char *entity_name;
|
||||
nn_keyhash_t keyhash;
|
||||
unsigned statusinfo;
|
||||
uint32_t statusinfo;
|
||||
nn_prismtech_participant_version_info_t prismtech_participant_version_info;
|
||||
char *node_name;
|
||||
char *exec_name;
|
||||
unsigned char is_service;
|
||||
unsigned service_type;
|
||||
unsigned process_id;
|
||||
uint32_t process_id;
|
||||
char *type_description;
|
||||
nn_sequence_number_t coherent_set_seqno;
|
||||
nn_prismtech_eotinfo_t eotinfo;
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
nn_reader_favours_ssm_t reader_favours_ssm;
|
||||
#endif
|
||||
|
@ -192,8 +176,9 @@ typedef struct nn_plist_src {
|
|||
size_t bufsz;
|
||||
} nn_plist_src_t;
|
||||
|
||||
void nn_plist_init_tables (void);
|
||||
DDS_EXPORT void nn_plist_init_empty (nn_plist_t *dest);
|
||||
DDS_EXPORT void nn_plist_mergein_missing (nn_plist_t *a, const nn_plist_t *b);
|
||||
DDS_EXPORT void nn_plist_mergein_missing (nn_plist_t *a, const nn_plist_t *b, uint64_t pmask, uint64_t qmask);
|
||||
DDS_EXPORT void nn_plist_copy (nn_plist_t *dst, const nn_plist_t *src);
|
||||
DDS_EXPORT nn_plist_t *nn_plist_dup (const nn_plist_t *src);
|
||||
|
||||
|
@ -234,6 +219,9 @@ DDS_EXPORT nn_plist_t *nn_plist_dup (const nn_plist_t *src);
|
|||
* @retval DDS_RETCODE_OK
|
||||
* All parameters valid (or ignored), dest and *nextafterplist have been set
|
||||
* accordingly.
|
||||
* @retval DDS_INCONSISTENT_POLICY
|
||||
* All individual settings are valid, but there are inconsistencies between
|
||||
* dependent settings.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* Input contained invalid data; dest is cleared, *nextafterplist is NULL.
|
||||
* @retval DDS_RETCODE_UNSUPPORTED
|
||||
|
@ -245,20 +233,6 @@ DDS_EXPORT void nn_plist_fini (nn_plist_t *ps);
|
|||
DDS_EXPORT void nn_plist_addtomsg (struct nn_xmsg *m, const nn_plist_t *ps, uint64_t pwanted, uint64_t qwanted);
|
||||
DDS_EXPORT void nn_plist_init_default_participant (nn_plist_t *plist);
|
||||
|
||||
DDS_EXPORT dds_return_t validate_history_qospolicy (const dds_history_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_durability_qospolicy (const dds_durability_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_resource_limits_qospolicy (const dds_resource_limits_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_history_and_resource_limits (const dds_history_qospolicy_t *qh, const dds_resource_limits_qospolicy_t *qr);
|
||||
DDS_EXPORT dds_return_t validate_durability_service_qospolicy (const dds_durability_service_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_liveliness_qospolicy (const dds_liveliness_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_destination_order_qospolicy (const dds_destination_order_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_ownership_qospolicy (const dds_ownership_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_ownership_strength_qospolicy (const dds_ownership_strength_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_presentation_qospolicy (const dds_presentation_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_transport_priority_qospolicy (const dds_transport_priority_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_reader_data_lifecycle (const dds_reader_data_lifecycle_qospolicy_t *q);
|
||||
DDS_EXPORT dds_return_t validate_duration (const dds_duration_t d);
|
||||
|
||||
struct nn_rmsg;
|
||||
struct nn_rsample_info;
|
||||
struct nn_rdata;
|
||||
|
|
|
@ -390,14 +390,6 @@ typedef struct ParticipantMessageData {
|
|||
#define PID_IDENTITY_TOKEN 0x1001u
|
||||
#define PID_PERMISSIONS_TOKEN 0x1002u
|
||||
|
||||
#define PID_RTI_TYPECODE (PID_VENDORSPECIFIC_FLAG | 0x4u)
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
/* To indicate whether a reader favours the use of SSM. Iff the
|
||||
reader favours SSM, it will use SSM if available. */
|
||||
#define PID_READER_FAVOURS_SSM 0x72u
|
||||
#endif
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
/* To indicate whether a reader favours the use of SSM. Iff the
|
||||
reader favours SSM, it will use SSM if available. */
|
||||
|
|
|
@ -20,8 +20,14 @@ struct dds_qos;
|
|||
|
||||
int partitions_match_p (const struct dds_qos *a, const struct dds_qos *b);
|
||||
|
||||
/* Returns -1 on success, or QoS id of first mismatch (>=0) */
|
||||
/* perform reader/writer QoS (and topic name, type name, partition) matching;
|
||||
mask can be used to exclude some of these (including topic name and type
|
||||
name, so be careful!)
|
||||
|
||||
reason will be set to the policy id of one of the mismatching QoS, or to
|
||||
DDS_INVALID_QOS_POLICY_ID if there is no mismatch or if the mismatch is
|
||||
in topic or type name (those are not really QoS and don't have a policy id) */
|
||||
bool qos_match_mask_p (const dds_qos_t *rd, const dds_qos_t *wr, uint64_t mask, dds_qos_policy_id_t *reason) ddsrt_nonnull_all;
|
||||
bool qos_match_p (const struct dds_qos *rd, const struct dds_qos *wr, dds_qos_policy_id_t *reason) ddsrt_nonnull ((1, 2));
|
||||
|
||||
#if defined (__cplusplus)
|
||||
|
|
|
@ -28,8 +28,6 @@ struct proxy_reader;
|
|||
struct proxy_writer;
|
||||
|
||||
struct nn_prismtech_participant_version_info;
|
||||
struct nn_prismtech_writer_info;
|
||||
struct nn_prismtech_eotinfo;
|
||||
struct nn_xmsgpool;
|
||||
struct nn_xmsg_data;
|
||||
struct nn_xmsg;
|
||||
|
@ -139,7 +137,6 @@ void nn_xmsg_addpar_reader_data_lifecycle (struct nn_xmsg *m, nn_parameterid_t p
|
|||
void nn_xmsg_addpar_liveliness (struct nn_xmsg *m, nn_parameterid_t pid, const dds_liveliness_qospolicy_t *rq);
|
||||
|
||||
void nn_xmsg_addpar_parvinfo (struct nn_xmsg *m, nn_parameterid_t pid, const struct nn_prismtech_participant_version_info *pvi);
|
||||
void nn_xmsg_addpar_eotinfo (struct nn_xmsg *m, nn_parameterid_t pid, const struct nn_prismtech_eotinfo *txnid);
|
||||
void nn_xmsg_addpar_sentinel (struct nn_xmsg *m);
|
||||
int nn_xmsg_addpar_sentinel_ifparam (struct nn_xmsg *m);
|
||||
|
||||
|
|
|
@ -211,7 +211,6 @@ typedef struct dds_ignorelocal_qospolicy {
|
|||
#define QP_PRISMTECH_READER_LIFESPAN ((uint64_t)1 << 24)
|
||||
#define QP_PRISMTECH_SUBSCRIPTION_KEYS ((uint64_t)1 << 25)
|
||||
#define QP_PRISMTECH_ENTITY_FACTORY ((uint64_t)1 << 27)
|
||||
#define QP_RTI_TYPECODE ((uint64_t)1 << 29)
|
||||
#define QP_CYCLONE_IGNORELOCAL ((uint64_t)1 << 30)
|
||||
|
||||
/* Partition QoS is not RxO according to the specification (DDS 1.2,
|
||||
|
@ -264,8 +263,6 @@ struct dds_qos {
|
|||
/*x xR*/dds_subscription_keys_qospolicy_t subscription_keys;
|
||||
/*x xR*/dds_reader_lifespan_qospolicy_t reader_lifespan;
|
||||
/* x */dds_ignorelocal_qospolicy_t ignorelocal;
|
||||
|
||||
/* X*/ddsi_octetseq_t rti_typecode;
|
||||
};
|
||||
|
||||
struct nn_xmsg;
|
||||
|
@ -280,7 +277,8 @@ DDS_EXPORT void nn_xqos_init_default_topic (dds_qos_t *xqos);
|
|||
DDS_EXPORT void nn_xqos_copy (dds_qos_t *dst, const dds_qos_t *src);
|
||||
DDS_EXPORT void nn_xqos_unalias (dds_qos_t *xqos);
|
||||
DDS_EXPORT void nn_xqos_fini (dds_qos_t *xqos);
|
||||
DDS_EXPORT void nn_xqos_mergein_missing (dds_qos_t *a, const dds_qos_t *b);
|
||||
DDS_EXPORT dds_return_t nn_xqos_valid (const dds_qos_t *xqos);
|
||||
DDS_EXPORT void nn_xqos_mergein_missing (dds_qos_t *a, const dds_qos_t *b, uint64_t mask);
|
||||
DDS_EXPORT uint64_t nn_xqos_delta (const dds_qos_t *a, const dds_qos_t *b, uint64_t mask);
|
||||
DDS_EXPORT void nn_xqos_addtomsg (struct nn_xmsg *m, const dds_qos_t *xqos, uint64_t wanted);
|
||||
DDS_EXPORT void nn_log_xqos (uint32_t cat, const dds_qos_t *xqos);
|
||||
|
|
|
@ -1085,7 +1085,7 @@ static struct proxy_participant *implicitly_create_proxypp (const nn_guid_t *ppg
|
|||
tmp_plist = *privpp->plist;
|
||||
tmp_plist.present = PP_PARTICIPANT_GUID | PP_PRISMTECH_PARTICIPANT_VERSION_INFO;
|
||||
tmp_plist.participant_guid = *ppguid;
|
||||
nn_plist_mergein_missing (&pp_plist, &tmp_plist);
|
||||
nn_plist_mergein_missing (&pp_plist, &tmp_plist, ~(uint64_t)0, ~(uint64_t)0);
|
||||
ddsrt_mutex_unlock (&privpp->e.lock);
|
||||
|
||||
pp_plist.prismtech_participant_version_info.flags &= ~NN_PRISMTECH_FL_PARTICIPANT_IS_DDSI2;
|
||||
|
@ -1146,11 +1146,11 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
|
|||
xqos = &datap->qos;
|
||||
is_writer = is_writer_entityid (datap->endpoint_guid.entityid);
|
||||
if (!is_writer)
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_rd);
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_rd, ~(uint64_t)0);
|
||||
else if (vendor_is_eclipse_or_prismtech(vendorid))
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_wr);
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_wr, ~(uint64_t)0);
|
||||
else
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_wr_nad);
|
||||
nn_xqos_mergein_missing (xqos, &gv.default_xqos_wr_nad, ~(uint64_t)0);
|
||||
|
||||
/* After copy + merge, should have at least the ones present in the
|
||||
input. Also verify reliability and durability are present,
|
||||
|
@ -1434,8 +1434,7 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
|
|||
{
|
||||
nn_plist_addtomsg (mpayload, pp->plist,
|
||||
PP_PRISMTECH_NODE_NAME | PP_PRISMTECH_EXEC_NAME | PP_PRISMTECH_PROCESS_ID |
|
||||
PP_PRISMTECH_WATCHDOG_SCHEDULING | PP_PRISMTECH_LISTENER_SCHEDULING |
|
||||
PP_PRISMTECH_SERVICE_TYPE | PP_ENTITY_NAME,
|
||||
PP_ENTITY_NAME,
|
||||
QP_PRISMTECH_ENTITY_FACTORY);
|
||||
}
|
||||
nn_xmsg_addpar_sentinel (mpayload);
|
||||
|
|
|
@ -457,7 +457,7 @@ dds_return_t new_participant_guid (const nn_guid_t *ppguid, unsigned flags, cons
|
|||
pp->lease_duration = config.lease_duration;
|
||||
pp->plist = ddsrt_malloc (sizeof (*pp->plist));
|
||||
nn_plist_copy (pp->plist, plist);
|
||||
nn_plist_mergein_missing (pp->plist, &gv.default_plist_pp);
|
||||
nn_plist_mergein_missing (pp->plist, &gv.default_plist_pp, ~(uint64_t)0, ~(uint64_t)0);
|
||||
|
||||
if (dds_get_log_mask() & DDS_LC_DISCOVERY)
|
||||
{
|
||||
|
@ -2684,7 +2684,7 @@ static void new_writer_guid_common_init (struct writer *wr, const struct ddsi_se
|
|||
|
||||
wr->xqos = ddsrt_malloc (sizeof (*wr->xqos));
|
||||
nn_xqos_copy (wr->xqos, xqos);
|
||||
nn_xqos_mergein_missing (wr->xqos, &gv.default_xqos_wr);
|
||||
nn_xqos_mergein_missing (wr->xqos, &gv.default_xqos_wr, ~(uint64_t)0);
|
||||
assert (wr->xqos->aliased == 0);
|
||||
set_topic_type_name (wr->xqos, topic);
|
||||
|
||||
|
@ -3222,7 +3222,7 @@ static dds_return_t new_reader_guid
|
|||
/* Copy QoS, merging in defaults */
|
||||
rd->xqos = ddsrt_malloc (sizeof (*rd->xqos));
|
||||
nn_xqos_copy (rd->xqos, xqos);
|
||||
nn_xqos_mergein_missing (rd->xqos, &gv.default_xqos_rd);
|
||||
nn_xqos_mergein_missing (rd->xqos, &gv.default_xqos_rd, ~(uint64_t)0);
|
||||
assert (rd->xqos->aliased == 0);
|
||||
set_topic_type_name (rd->xqos, topic);
|
||||
|
||||
|
@ -3660,7 +3660,7 @@ int update_proxy_participant_plist_locked (struct proxy_participant *proxypp, co
|
|||
nn_plist_t *new_plist;
|
||||
|
||||
new_plist = nn_plist_dup (datap);
|
||||
nn_plist_mergein_missing (new_plist, proxypp->plist);
|
||||
nn_plist_mergein_missing (new_plist, proxypp->plist, ~(uint64_t)0, ~(uint64_t)0);
|
||||
nn_plist_fini (proxypp->plist);
|
||||
ddsrt_free (proxypp->plist);
|
||||
proxypp->plist = new_plist;
|
||||
|
@ -3694,8 +3694,7 @@ int update_proxy_participant_plist (struct proxy_participant *proxypp, const str
|
|||
tmp = *datap;
|
||||
tmp.present &=
|
||||
PP_PRISMTECH_NODE_NAME | PP_PRISMTECH_EXEC_NAME | PP_PRISMTECH_PROCESS_ID |
|
||||
PP_PRISMTECH_WATCHDOG_SCHEDULING | PP_PRISMTECH_LISTENER_SCHEDULING |
|
||||
PP_PRISMTECH_SERVICE_TYPE | PP_ENTITY_NAME;
|
||||
PP_ENTITY_NAME;
|
||||
tmp.qos.present &= QP_PRISMTECH_ENTITY_FACTORY;
|
||||
update_proxy_participant_plist_locked (proxypp, &tmp, source, timestamp);
|
||||
break;
|
||||
|
@ -3993,7 +3992,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
|
|||
DDS_LOG(DDS_LC_DISCOVERY, "new_proxy_group("PGUIDFMT"): setting name (%s) and qos\n", PGUID (*guid), name);
|
||||
pgroup->name = ddsrt_strdup (name);
|
||||
pgroup->xqos = nn_xqos_dup (xqos);
|
||||
nn_xqos_mergein_missing (pgroup->xqos, is_sub ? &gv.default_xqos_sub : &gv.default_xqos_pub);
|
||||
nn_xqos_mergein_missing (pgroup->xqos, is_sub ? &gv.default_xqos_sub : &gv.default_xqos_pub, ~(uint64_t)0);
|
||||
}
|
||||
out:
|
||||
ddsrt_mutex_unlock (&proxypp->e.lock);
|
||||
|
|
|
@ -850,10 +850,11 @@ int rtps_init (void)
|
|||
uint32_t port_data_uc = 0;
|
||||
bool mc_available = true;
|
||||
|
||||
gv.tstart = now (); /* wall clock time, used in logs */
|
||||
|
||||
ddsi_plugin_init ();
|
||||
ddsi_iid_init ();
|
||||
|
||||
gv.tstart = now (); /* wall clock time, used in logs */
|
||||
nn_plist_init_tables ();
|
||||
|
||||
gv.disc_conn_uc = NULL;
|
||||
gv.data_conn_uc = NULL;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -64,66 +64,65 @@ int partitions_match_p (const dds_qos_t *a, const dds_qos_t *b)
|
|||
}
|
||||
}
|
||||
|
||||
static bool qos_match_internal_p (const dds_qos_t *rd, const dds_qos_t *wr, dds_qos_policy_id_t *reason) ddsrt_nonnull_all;
|
||||
|
||||
static bool qos_match_internal_p (const dds_qos_t *rd, const dds_qos_t *wr, dds_qos_policy_id_t *reason)
|
||||
bool qos_match_mask_p (const dds_qos_t *rd, const dds_qos_t *wr, uint64_t mask, dds_qos_policy_id_t *reason)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
unsigned musthave = (QP_RXO_MASK | QP_PARTITION | QP_TOPIC_NAME | QP_TYPE_NAME);
|
||||
unsigned musthave = (QP_RXO_MASK | QP_PARTITION | QP_TOPIC_NAME | QP_TYPE_NAME) & mask;
|
||||
assert ((rd->present & musthave) == musthave);
|
||||
assert ((wr->present & musthave) == musthave);
|
||||
#endif
|
||||
mask &= rd->present & wr->present;
|
||||
*reason = DDS_INVALID_QOS_POLICY_ID;
|
||||
if (strcmp (rd->topic_name, wr->topic_name) != 0)
|
||||
if ((mask & QP_TOPIC_NAME) && strcmp (rd->topic_name, wr->topic_name) != 0)
|
||||
return false;
|
||||
if (strcmp (rd->type_name, wr->type_name) != 0)
|
||||
if ((mask & QP_TYPE_NAME) && strcmp (rd->type_name, wr->type_name) != 0)
|
||||
return false;
|
||||
|
||||
if (rd->reliability.kind > wr->reliability.kind) {
|
||||
if ((mask & QP_RELIABILITY) && rd->reliability.kind > wr->reliability.kind) {
|
||||
*reason = DDS_RELIABILITY_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->durability.kind > wr->durability.kind) {
|
||||
if ((mask & QP_DURABILITY) && rd->durability.kind > wr->durability.kind) {
|
||||
*reason = DDS_DURABILITY_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->presentation.access_scope > wr->presentation.access_scope) {
|
||||
if ((mask & QP_PRESENTATION) && rd->presentation.access_scope > wr->presentation.access_scope) {
|
||||
*reason = DDS_PRESENTATION_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->presentation.coherent_access > wr->presentation.coherent_access) {
|
||||
if ((mask & QP_PRESENTATION) && rd->presentation.coherent_access > wr->presentation.coherent_access) {
|
||||
*reason = DDS_PRESENTATION_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->presentation.ordered_access > wr->presentation.ordered_access) {
|
||||
if ((mask & QP_PRESENTATION) && rd->presentation.ordered_access > wr->presentation.ordered_access) {
|
||||
*reason = DDS_PRESENTATION_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->deadline.deadline < wr->deadline.deadline) {
|
||||
if ((mask & QP_DEADLINE) && rd->deadline.deadline < wr->deadline.deadline) {
|
||||
*reason = DDS_DEADLINE_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->latency_budget.duration < wr->latency_budget.duration) {
|
||||
if ((mask & QP_LATENCY_BUDGET) && rd->latency_budget.duration < wr->latency_budget.duration) {
|
||||
*reason = DDS_LATENCYBUDGET_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->ownership.kind != wr->ownership.kind) {
|
||||
if ((mask & QP_OWNERSHIP) && rd->ownership.kind != wr->ownership.kind) {
|
||||
*reason = DDS_OWNERSHIP_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->liveliness.kind > wr->liveliness.kind) {
|
||||
if ((mask & QP_LIVELINESS) && rd->liveliness.kind > wr->liveliness.kind) {
|
||||
*reason = DDS_LIVELINESS_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->liveliness.lease_duration < wr->liveliness.lease_duration) {
|
||||
if ((mask & QP_LIVELINESS) && rd->liveliness.lease_duration < wr->liveliness.lease_duration) {
|
||||
*reason = DDS_LIVELINESS_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (rd->destination_order.kind > wr->destination_order.kind) {
|
||||
if ((mask & QP_DESTINATION_ORDER) && rd->destination_order.kind > wr->destination_order.kind) {
|
||||
*reason = DDS_DESTINATIONORDER_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
if (!partitions_match_p (rd, wr)) {
|
||||
if ((mask & QP_PARTITION) && !partitions_match_p (rd, wr)) {
|
||||
*reason = DDS_PARTITION_QOS_POLICY_ID;
|
||||
return false;
|
||||
}
|
||||
|
@ -133,5 +132,5 @@ static bool qos_match_internal_p (const dds_qos_t *rd, const dds_qos_t *wr, dds_
|
|||
bool qos_match_p (const dds_qos_t *rd, const dds_qos_t *wr, dds_qos_policy_id_t *reason)
|
||||
{
|
||||
dds_qos_policy_id_t dummy;
|
||||
return qos_match_internal_p (rd, wr, reason ? reason : &dummy);
|
||||
return qos_match_mask_p (rd, wr, ~(uint64_t)0, reason ? reason : &dummy);
|
||||
}
|
||||
|
|
|
@ -1952,7 +1952,7 @@ static int deliver_user_data (const struct nn_rsample_info *sampleinfo, const st
|
|||
src.encoding = (msg->smhdr.flags & SMFLAG_ENDIANNESS) ? PL_CDR_LE : PL_CDR_BE;
|
||||
src.buf = NN_RMSG_PAYLOADOFF (fragchain->rmsg, qos_offset);
|
||||
src.bufsz = NN_RDATA_PAYLOAD_OFF (fragchain) - qos_offset;
|
||||
if ((plist_ret = nn_plist_init_frommsg (&qos, NULL, PP_STATUSINFO | PP_KEYHASH | PP_COHERENT_SET | PP_PRISMTECH_EOTINFO, 0, &src)) < 0)
|
||||
if ((plist_ret = nn_plist_init_frommsg (&qos, NULL, PP_STATUSINFO | PP_KEYHASH | PP_COHERENT_SET, 0, &src)) < 0)
|
||||
{
|
||||
if (plist_ret != DDS_RETCODE_UNSUPPORTED)
|
||||
DDS_WARNING ("data(application, vendor %u.%u): "PGUIDFMT" #%"PRId64": invalid inline qos\n",
|
||||
|
@ -1980,9 +1980,7 @@ static int deliver_user_data (const struct nn_rsample_info *sampleinfo, const st
|
|||
}
|
||||
|
||||
/* Generate the DDS_SampleInfo (which is faked to some extent
|
||||
because we don't actually have a data reader); also note that
|
||||
the PRISMTECH_WRITER_INFO thing is completely meaningless to
|
||||
us */
|
||||
because we don't actually have a data reader) */
|
||||
struct ddsi_tkmap_instance * tk;
|
||||
if ((tk = ddsi_tkmap_lookup_instance_ref(payload)) != NULL)
|
||||
{
|
||||
|
|
|
@ -1029,19 +1029,6 @@ void nn_xmsg_addpar_parvinfo (struct nn_xmsg *m, nn_parameterid_t pid, const str
|
|||
memcpy(ps->contents, pvi->internals, slen);
|
||||
}
|
||||
|
||||
void nn_xmsg_addpar_eotinfo (struct nn_xmsg *m, nn_parameterid_t pid, const struct nn_prismtech_eotinfo *txnid)
|
||||
{
|
||||
uint32_t *pu, i;
|
||||
pu = nn_xmsg_addpar (m, pid, 2 * sizeof (uint32_t) + txnid->n * sizeof (txnid->tids[0]));
|
||||
pu[0] = txnid->transactionId;
|
||||
pu[1] = txnid->n;
|
||||
for (i = 0; i < txnid->n; i++)
|
||||
{
|
||||
pu[2*i + 2] = toBE4u (txnid->tids[i].writer_entityid.u);
|
||||
pu[2*i + 3] = txnid->tids[i].transactionId;
|
||||
}
|
||||
}
|
||||
|
||||
/* XMSG_CHAIN ----------------------------------------------------------
|
||||
|
||||
Xpacks refer to xmsgs and need to release these after having been
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue