Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s

This commit is contained in:
torsten committed 2026-10-23 16:13:31 +00:00
1 parent 48129fdab2
commit 48d9b9bd49
3700 files changed
+2132394

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_ADDRSET_H
#define DDSI_ADDRSET_H
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_locator.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_addrset;
struct ddsi_domaingv;
typedef void (*ddsi_addrset_forall_fun_t) (const ddsi_xlocator_t *loc, void *arg);
/** @component locators */
bool ddsi_addrset_empty (const struct ddsi_addrset *as)
ddsrt_nonnull_all;
/** @component locators */
void ddsi_addrset_forall (struct ddsi_addrset *as, ddsi_addrset_forall_fun_t f, void *arg)
ddsrt_nonnull ((1,2));
/** @component locators */
DDS_EXPORT struct ddsi_addrset *ddsi_ref_addrset (struct ddsi_addrset *as);
/** @component locators */
DDS_EXPORT void ddsi_unref_addrset (struct ddsi_addrset *as);
/** @component locators */
DDS_EXPORT struct ddsi_addrset *ddsi_new_addrset (void)
ddsrt_attribute_warn_unused_result;
/** @component locators */
DDS_EXPORT void ddsi_add_locator_to_addrset (const struct ddsi_domaingv *gv, struct ddsi_addrset *as, const ddsi_locator_t *loc)
ddsrt_nonnull_all;
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ADDRSET_H */
+63
View File
@@ -0,0 +1,63 @@
// Copyright(c) 2019 to 2021 ZettaScale Technology 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
#ifndef DDSI_BUILTIN_TOPIC_IF_H
#define DDSI_BUILTIN_TOPIC_IF_H
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_entity_common;
struct ddsi_tkmap_instance;
struct ddsi_sertype;
struct ddsi_guid;
struct ddsi_topic_definition;
struct ddsi_builtin_topic_interface {
void *arg;
bool (*builtintopic_is_builtintopic) (const struct ddsi_sertype *type, void *arg);
bool (*builtintopic_is_visible) (const struct ddsi_guid *guid, ddsi_vendorid_t vendorid, void *arg);
struct ddsi_tkmap_instance * (*builtintopic_get_tkmap_entry) (const struct ddsi_guid *guid, void *arg);
void (*builtintopic_write_endpoint) (const struct ddsi_entity_common *e, ddsrt_wctime_t timestamp, bool alive, void *arg);
void (*builtintopic_write_topic) (const struct ddsi_topic_definition *tpd, ddsrt_wctime_t timestamp, bool alive, void *arg);
};
/** @component builtintopic_if */
inline bool ddsi_builtintopic_is_visible (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_guid *guid, ddsi_vendorid_t vendorid) {
return btif ? btif->builtintopic_is_visible (guid, vendorid, btif->arg) : false;
}
/** @component builtintopic_if */
inline bool ddsi_builtintopic_is_builtintopic (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_sertype *type) {
return btif ? btif->builtintopic_is_builtintopic (type, btif->arg) : false;
}
/** @component builtintopic_if */
inline struct ddsi_tkmap_instance *ddsi_builtintopic_get_tkmap_entry (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_guid *guid) {
return btif ? btif->builtintopic_get_tkmap_entry (guid, btif->arg) : NULL;
}
/** @component builtintopic_if */
inline void ddsi_builtintopic_write_endpoint (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_entity_common *e, ddsrt_wctime_t timestamp, bool alive) {
if (btif) btif->builtintopic_write_endpoint (e, timestamp, alive, btif->arg);
}
/** @component builtintopic_if */
inline void ddsi_builtintopic_write_topic (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_topic_definition *tpd, ddsrt_wctime_t timestamp, bool alive) {
if (btif) btif->builtintopic_write_topic (tpd, timestamp, alive, btif->arg);
}
#if defined (__cplusplus)
}
#endif
#endif
+464
View File
@@ -0,0 +1,464 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_CONFIG_H
#define DDSI_CONFIG_H
#include <stdio.h>
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/sched.h"
#include "dds/ddsrt/random.h"
#include "dds/ddsi/ddsi_portmapping.h"
#include "dds/ddsi/ddsi_locator.h"
#include "dds/ddsi/ddsi_xqos.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_config;
enum ddsi_standards_conformance {
DDSI_SC_PEDANTIC,
DDSI_SC_STRICT,
DDSI_SC_LAX
};
#define DDSI_SC_PEDANTIC_P(config) ((config).standards_conformance <= DDSI_SC_PEDANTIC)
#define DDSI_SC_STRICT_P(config) ((config).standards_conformance <= DDSI_SC_STRICT)
enum ddsi_besmode {
DDSI_BESMODE_FULL,
DDSI_BESMODE_WRITERS,
DDSI_BESMODE_MINIMAL
};
enum ddsi_retransmit_merging {
DDSI_REXMIT_MERGE_NEVER,
DDSI_REXMIT_MERGE_ADAPTIVE,
DDSI_REXMIT_MERGE_ALWAYS
};
enum ddsi_boolean_default {
DDSI_BOOLDEF_DEFAULT,
DDSI_BOOLDEF_FALSE,
DDSI_BOOLDEF_TRUE
};
/* deprecated shm log level */
enum ddsi_shm_loglevel {
DDSI_SHM_OFF = 0,
DDSI_SHM_FATAL,
DDSI_SHM_ERROR,
DDSI_SHM_WARN,
DDSI_SHM_INFO,
DDSI_SHM_DEBUG,
DDSI_SHM_VERBOSE
};
#define DDSI_PARTICIPANT_INDEX_AUTO -1
#define DDSI_PARTICIPANT_INDEX_NONE -2
#define DDSI_PARTICIPANT_INDEX_DEFAULT -3
/* ddsi_config_listelem must be an overlay for all used listelem types */
struct ddsi_config_listelem {
struct ddsi_config_listelem *next;
};
#ifdef DDS_HAS_NETWORK_PARTITIONS
struct ddsi_networkpartition_address {
struct ddsi_networkpartition_address *next;
ddsi_locator_t loc;
};
struct ddsi_config_networkpartition_listelem {
struct ddsi_config_networkpartition_listelem *next;
char *name;
char *address_string;
char *interface_names;
struct ddsi_networkpartition_address *uc_addresses;
struct ddsi_networkpartition_address *asm_addresses;
#ifdef DDSRT_HAVE_SSM
struct ddsi_networkpartition_address *ssm_addresses;
#endif
};
struct ddsi_config_ignoredpartition_listelem {
struct ddsi_config_ignoredpartition_listelem *next;
char *DCPSPartitionTopic;
};
struct ddsi_config_partitionmapping_listelem {
struct ddsi_config_partitionmapping_listelem *next;
char *networkPartition;
char *DCPSPartitionTopic;
struct ddsi_config_networkpartition_listelem *partition;
};
#endif /* DDS_HAS_NETWORK_PARTITIONS */
struct ddsi_config_maybe_int32 {
int isdefault;
int32_t value;
};
struct ddsi_config_maybe_uint32 {
int isdefault;
uint32_t value;
};
struct ddsi_config_maybe_duration {
int isdefault;
dds_duration_t value;
};
struct ddsi_config_uint32_array {
uint32_t n;
uint32_t *xs;
};
struct ddsi_config_thread_properties_listelem {
struct ddsi_config_thread_properties_listelem *next;
char *name;
ddsrt_sched_t sched_class;
struct ddsi_config_maybe_int32 schedule_priority;
struct ddsi_config_maybe_uint32 stack_size;
struct ddsi_config_uint32_array affinity;
};
struct ddsi_config_peer_listelem
{
struct ddsi_config_peer_listelem *next;
char *peer;
struct ddsi_config_maybe_duration prune_delay;
};
struct ddsi_config_prune_deleted_ppant {
int64_t delay;
int enforce_delay;
};
/* allow multicast bits (default depends on network type): */
#define DDSI_AMC_FALSE 0u
#define DDSI_AMC_SPDP 1u
#define DDSI_AMC_ASM 2u
#ifdef DDSRT_HAVE_SSM
#define DDSI_AMC_SSM 4u
#define DDSI_AMC_TRUE (DDSI_AMC_SPDP | DDSI_AMC_ASM | DDSI_AMC_SSM)
#else
#define DDSI_AMC_TRUE (DDSI_AMC_SPDP | DDSI_AMC_ASM)
#endif
#define DDSI_AMC_DEFAULT 0x80000000u
/* FIXME: this should be fully dynamic ... but this is easier for a quick hack */
enum ddsi_transport_selector {
DDSI_TRANS_DEFAULT, /* actually UDP, but this is so we can tell what has been set */
DDSI_TRANS_UDP,
DDSI_TRANS_UDP6,
DDSI_TRANS_TCP,
DDSI_TRANS_TCP6,
DDSI_TRANS_RAWETH,
DDSI_TRANS_NONE /* FIXME: see FIXME above ... :( */
};
enum ddsi_many_sockets_mode {
DDSI_MSM_NO_UNICAST,
DDSI_MSM_SINGLE_UNICAST,
DDSI_MSM_MANY_UNICAST
};
#ifdef DDS_HAS_SECURITY
struct ddsi_plugin_library_properties {
char *library_path;
char *library_init;
char *library_finalize;
};
struct ddsi_authentication_properties {
char *identity_certificate;
char *identity_ca;
char *private_key;
char *password;
char *trusted_ca_dir;
char *crl;
int include_optional_fields;
};
struct ddsi_access_control_properties {
char *permissions;
char *permissions_ca;
char *governance;
};
struct ddsi_config_omg_security {
struct ddsi_authentication_properties authentication_properties;
struct ddsi_access_control_properties access_control_properties;
struct ddsi_plugin_library_properties authentication_plugin;
struct ddsi_plugin_library_properties access_control_plugin;
struct ddsi_plugin_library_properties cryptography_plugin;
};
struct ddsi_config_omg_security_listelem {
struct ddsi_config_omg_security_listelem *next;
struct ddsi_config_omg_security cfg;
};
#endif /* DDS_HAS_SECURITY */
#ifdef DDS_HAS_TCP_TLS
struct ddsi_config_ssl_min_version {
int major;
int minor;
};
#endif
struct ddsi_config_socket_buf_size {
struct ddsi_config_maybe_uint32 min, max;
};
struct ddsi_config_network_interface {
int automatic;
char *name;
char *address;
int prefer_multicast;
int presence_required;
enum ddsi_boolean_default multicast;
struct ddsi_config_maybe_int32 priority;
uint32_t allow_multicast; // no need for a "maybe" type: DDSI_AMC_DEFAULT takes care of that
};
struct ddsi_config_network_interface_listelem {
struct ddsi_config_network_interface_listelem *next;
struct ddsi_config_network_interface cfg;
};
enum ddsi_config_entity_naming_mode {
DDSI_ENTITY_NAMING_DEFAULT_EMPTY,
DDSI_ENTITY_NAMING_DEFAULT_FANCY
};
struct ddsi_config_psmx {
char *type;
char *library;
char *config;
struct ddsi_config_maybe_int32 priority;
};
struct ddsi_config_psmx_listelem {
struct ddsi_config_psmx_listelem *next;
struct ddsi_config_psmx cfg;
};
/* Expensive checks (compiled in when NDEBUG not defined, enabled only if flag set in xchecks) */
#define DDSI_XCHECK_WHC 1u
#define DDSI_XCHECK_RHC 2u
#define DDSI_XCHECK_XEV 4u
/**
* @brief Default-initialize a configuration (unstable)
* @component config
*
* @param[out] cfg The configuration struct to be initialized.
*/
DDS_EXPORT void ddsi_config_init_default (struct ddsi_config *cfg);
struct ddsi_config
{
int valid;
uint32_t tracemask;
uint32_t enabled_xchecks;
char *pcap_file;
/* interfaces */
struct ddsi_config_network_interface_listelem *network_interfaces;
struct ddsi_config_psmx_listelem *psmx_instances;
/* deprecated interface support */
char *depr_networkAddressString;
int depr_prefer_multicast;
char *depr_assumeMulticastCapable;
char **networkRecvAddressStrings;
uint32_t allowMulticast;
char *externalAddressString;
char *externalMaskString;
FILE *tracefp;
char *tracefile;
int tracingAppendToFile;
enum ddsi_transport_selector transport_selector;
enum ddsi_boolean_default compat_use_ipv6;
enum ddsi_boolean_default compat_tcp_enable;
int dontRoute;
int enableMulticastLoopback;
uint32_t domainId;
struct ddsi_config_maybe_uint32 extDomainId; // domain id advertised in discovery
char *domainTag;
int participantIndex;
int maxAutoParticipantIndex;
char *spdpMulticastAddressString;
char *defaultMulticastAddressString;
struct ddsi_config_maybe_duration spdp_interval;
int64_t spdp_response_delay_max;
int64_t spdp_prune_delay_initial;
int64_t spdp_prune_delay_discovered;
int64_t lease_duration;
int64_t const_hb_intv_sched;
int64_t const_hb_intv_sched_min;
int64_t const_hb_intv_sched_max;
int64_t const_hb_intv_min;
enum ddsi_retransmit_merging retransmit_merging;
int64_t retransmit_merging_period;
int squash_participants;
int liveliness_monitoring;
int noprogress_log_stacktraces;
int64_t liveliness_monitoring_interval;
int prioritize_retransmit;
enum ddsi_boolean_default multiple_recv_threads;
unsigned recv_thread_stop_maxretries;
unsigned primary_reorder_maxsamples;
unsigned secondary_reorder_maxsamples;
unsigned delivery_queue_maxsamples;
uint16_t fragment_size;
uint32_t max_msg_size;
uint32_t max_rexmit_msg_size;
uint32_t init_transmit_extra_pct;
uint32_t max_rexmit_burst_size;
uint32_t max_frags_in_rexmit_of_sample;
int publish_uc_locators; /* Publish discovery unicast locators */
int enable_uc_locators; /* If false, don't even try to create a unicast socket */
#ifdef DDS_HAS_TOPIC_DISCOVERY
int enable_topic_discovery_endpoints;
#endif
/* TCP transport configuration */
int tcp_nodelay;
int tcp_port;
int64_t tcp_read_timeout;
int64_t tcp_write_timeout;
int tcp_use_peeraddr_for_unicast;
#ifdef DDS_HAS_TCP_TLS
/* SSL support for TCP */
int ssl_enable;
int ssl_verify;
int ssl_verify_client;
int ssl_self_signed;
char * ssl_keystore;
char * ssl_rand_file;
char * ssl_key_pass;
char * ssl_ciphers;
struct ddsi_config_ssl_min_version ssl_min_version;
#endif
#ifdef DDS_HAS_NETWORK_PARTITIONS
struct ddsi_config_networkpartition_listelem *networkPartitions;
unsigned nof_networkPartitions;
struct ddsi_config_ignoredpartition_listelem *ignoredPartitions;
struct ddsi_config_partitionmapping_listelem *partitionMappings;
#endif /* DDS_HAS_NETWORK_PARTITIONS */
enum ddsi_boolean_default add_localhost_to_peers;
struct ddsi_config_peer_listelem *peers;
struct ddsi_config_thread_properties_listelem *thread_properties;
/* debug/test/undoc features: */
int xmit_lossiness; /**<< fraction of packets to drop on xmit, in units of 1e-3 */
uint32_t rmsg_chunk_size; /**<< size of a chunk in the receive buffer */
uint32_t rbuf_size; /* << size of a single receiver buffer */
enum ddsi_besmode besmode;
int meas_hb_to_ack_latency;
int synchronous_delivery_priority_threshold;
int64_t synchronous_delivery_latency_bound;
/* Write cache */
int whc_batch;
uint32_t whc_lowwater_mark;
uint32_t whc_highwater_mark;
struct ddsi_config_maybe_uint32 whc_init_highwater_mark;
int whc_adaptive;
unsigned defrag_unreliable_maxsamples;
unsigned defrag_reliable_maxsamples;
unsigned accelerate_rexmit_block_size;
int64_t responsiveness_timeout;
uint32_t max_participants;
int64_t writer_linger_duration;
int multicast_ttl;
struct ddsi_config_socket_buf_size socket_rcvbuf_size;
struct ddsi_config_socket_buf_size socket_sndbuf_size;
int64_t ack_delay;
int64_t nack_delay;
int64_t preemptive_ack_delay;
int64_t auto_resched_nack_delay;
int64_t ds_grace_period;
uint32_t max_queued_rexmit_bytes;
unsigned max_queued_rexmit_msgs;
int late_ack_mode;
int retry_on_reject_besteffort;
int generate_keyhash;
uint32_t max_sample_size;
int extended_packet_info;
/* compability options */
enum ddsi_standards_conformance standards_conformance;
int explicitly_publish_qos_set_to_default;
enum ddsi_many_sockets_mode many_sockets_mode;
int assume_rti_has_pmd_endpoints;
struct ddsi_portmapping ports;
int monitor_port;
int enable_control_topic;
int initial_deaf;
int initial_mute;
int64_t initial_deaf_mute_reset;
int use_multicast_if_mreqn;
struct ddsi_config_prune_deleted_ppant prune_deleted_ppant;
int redundant_networking;
#ifdef DDS_HAS_SECURITY
struct ddsi_config_omg_security_listelem *omg_security_configuration;
#endif
/* deprecated shm options */
int enable_shm;
char *shm_locator;
char *iceoryx_service;
enum ddsi_shm_loglevel shm_log_lvl;
enum ddsi_config_entity_naming_mode entity_naming_mode;
ddsrt_prng_seed_t entity_naming_seed;
#if defined (__cplusplus)
public:
ddsi_config() {
ddsi_config_init_default (this);
}
#endif
};
/** @component config */
struct ddsi_cfgst *ddsi_config_init (const char *config, struct ddsi_config *cfg, uint32_t domid) ddsrt_nonnull((1,2));
/** @component config */
DDS_EXPORT void ddsi_config_fini (struct ddsi_cfgst *cfgst);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_CONFIG_H */
+110
View File
@@ -0,0 +1,110 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_DEADLINE_H
#define DDSI_DEADLINE_H
#include "dds/ddsrt/circlist.h"
#include "dds/ddsrt/time.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_xevent.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef ddsrt_mtime_t (*deadline_missed_cb_t)(void *hc, ddsrt_mtime_t tnow);
struct ddsi_deadline_adm {
struct ddsrt_circlist list; /* linked list for deadline missed */
struct ddsi_xevent *evt; /* xevent that triggers when deadline expires for an instance */
deadline_missed_cb_t deadline_missed_cb; /* callback for deadline missed; this cb can use ddsi_deadline_next_missed_locked to get next instance that has a missed deadline */
size_t list_offset; /* offset of deadline_adm element in whc or rhc */
size_t elem_offset; /* offset of deadline_elem element in whc or rhc instance */
dds_duration_t dur; /* deadline duration */
};
struct deadline_elem {
struct ddsrt_circlist_elem e;
ddsrt_mtime_t t_deadline;
ddsrt_mtime_t t_last_update;
uint32_t deadlines_missed;
};
/** @component deadline_qos */
void ddsi_deadline_init (const struct ddsi_domaingv *gv, struct ddsi_deadline_adm *deadline_adm, size_t list_offset, size_t elem_offset, deadline_missed_cb_t deadline_missed_cb);
/** @component deadline_qos */
void ddsi_deadline_stop (const struct ddsi_deadline_adm *deadline_adm);
/** @component deadline_qos */
void ddsi_deadline_clear (struct ddsi_deadline_adm *deadline_adm);
/** @component deadline_qos */
void ddsi_deadline_fini (const struct ddsi_deadline_adm *deadline_adm);
/** @component deadline_qos */
uint32_t ddsi_deadline_compute_deadlines_missed (ddsrt_mtime_t tnow, const struct deadline_elem *deadline_elem, dds_duration_t deadline_dur);
/** @component deadline_qos */
ddsrt_mtime_t ddsi_deadline_next_missed_locked (struct ddsi_deadline_adm *deadline_adm, ddsrt_mtime_t tnow, void **instance);
/** @component deadline_qos */
void ddsi_deadline_register_instance_real (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tnow);
/** @component deadline_qos */
void ddsi_deadline_reregister_instance_real (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tprev, ddsrt_mtime_t tnow);
/** @component deadline_qos */
void ddsi_deadline_unregister_instance_real (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem);
/** @component deadline_qos */
void ddsi_deadline_renew_instance_real (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem);
/** @component deadline_qos */
inline void ddsi_deadline_register_instance_locked (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tnow)
{
if (deadline_adm->dur != DDS_INFINITY)
ddsi_deadline_register_instance_real (deadline_adm, elem, tnow);
}
/** @component deadline_qos */
inline void ddsi_deadline_reregister_instance_locked (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tnow)
{
if (deadline_adm->dur != DDS_INFINITY)
ddsi_deadline_reregister_instance_real (deadline_adm, elem, elem->t_last_update, tnow);
}
/** @component deadline_qos */
inline void ddsi_deadline_unregister_instance_locked (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem)
{
if (deadline_adm->dur != DDS_INFINITY)
{
assert (elem->t_deadline.v != DDS_NEVER);
ddsi_deadline_unregister_instance_real (deadline_adm, elem);
}
}
/** @component deadline_qos */
inline void ddsi_deadline_renew_instance_locked (struct ddsi_deadline_adm *deadline_adm, struct deadline_elem *elem)
{
if (deadline_adm->dur != DDS_INFINITY)
{
assert (elem->t_deadline.v != DDS_NEVER);
ddsi_deadline_renew_instance_real (deadline_adm, elem);
}
}
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_DEADLINE_H */
+60
View File
@@ -0,0 +1,60 @@
// Copyright(c) 2020 ZettaScale Technology 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
#ifndef DDSI_DELIVER_LOCALLY_H
#define DDSI_DELIVER_LOCALLY_H
#include <stdint.h>
#include <stdbool.h>
#include "dds/export.h"
#include "dds/ddsrt/retcode.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_domaingv;
struct ddsi_tkmap_instance;
struct ddsi_sertype;
struct ddsi_serdata;
struct ddsi_entity_index;
struct ddsi_reader;
struct ddsi_entity_common;
struct ddsi_writer_info;
struct ddsi_local_reader_ary;
typedef struct ddsi_serdata * (*deliver_locally_makesample_t) (struct ddsi_tkmap_instance **tk, struct ddsi_domaingv *gv, struct ddsi_sertype const * const type, void *vsourceinfo);
typedef struct ddsi_reader * (*deliver_locally_first_reader_t) (struct ddsi_entity_index *entity_index, struct ddsi_entity_common *source_entity, ddsrt_avl_iter_t *it);
typedef struct ddsi_reader * (*deliver_locally_next_reader_t) (struct ddsi_entity_index *entity_index, ddsrt_avl_iter_t *it);
/** return:
- DDS_RETCODE_OK to try again immediately
- DDS_RETCODE_TRY_AGAIN to complete restart the operation later
- anything else: error to be returned from deliver_locally_xxx */
typedef dds_return_t (*deliver_locally_on_failure_fastpath_t) (struct ddsi_entity_common *source_entity, bool source_entity_locked, struct ddsi_local_reader_ary *fastpath_rdary, void *vsourceinfo);
struct ddsi_deliver_locally_ops {
deliver_locally_makesample_t makesample;
deliver_locally_first_reader_t first_reader;
deliver_locally_next_reader_t next_reader;
deliver_locally_on_failure_fastpath_t on_failure_fastpath;
};
/** @component local_delivery */
dds_return_t ddsi_deliver_locally_allinsync (struct ddsi_domaingv *gv, struct ddsi_entity_common *source_entity, bool source_entity_locked, struct ddsi_local_reader_ary *fastpath_rdary, const struct ddsi_writer_info *wrinfo, const struct ddsi_deliver_locally_ops *ops, void *vsourceinfo);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_DELIVER_LOCALLY_H */
+347
View File
@@ -0,0 +1,347 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_DOMAINGV_H
#define DDSI_DOMAINGV_H
#include <stdio.h>
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/sockets.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/random.h"
#include "dds/ddsi/ddsi_plist.h"
#include "dds/ddsi/ddsi_nwinterfaces.h"
#include "dds/ddsi/ddsi_protocol.h"
#include "dds/ddsi/ddsi_sockwaitset.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_xmsgpool;
struct ddsi_dqueue;
struct ddsi_reorder;
struct ddsi_defrag;
struct ddsi_addrset;
struct ddsi_xeventq;
struct ddsi_gcreq_queue;
struct ddsi_entity_index;
struct ddsi_lease;
struct ddsi_tran_conn;
struct ddsi_tran_listener;
struct ddsi_tran_factory;
struct ddsi_debug_monitor;
struct ddsi_tkmap;
struct dds_security_context;
struct dds_security_match_index;
struct ddsi_hsadmin;
struct spdp_admin;
struct ddsi_config_in_addr_node {
ddsi_locator_t loc;
struct ddsi_config_in_addr_node *next;
};
enum ddsi_recvips_mode {
DDSI_RECVIPS_MODE_ALL, /* all MC capable interfaces */
DDSI_RECVIPS_MODE_ANY, /* kernel-default interface */
DDSI_RECVIPS_MODE_PREFERRED, /* selected interface only */
DDSI_RECVIPS_MODE_NONE, /* no interfaces at all */
DDSI_RECVIPS_MODE_SOME /* explicit list of interfaces; only one requiring recvips */
};
enum ddsi_recv_thread_mode {
DDSI_RTM_SINGLE,
DDSI_RTM_MANY
};
struct ddsi_recv_thread_arg {
enum ddsi_recv_thread_mode mode;
struct ddsi_rbufpool *rbpool;
struct ddsi_domaingv *gv;
union {
struct {
const ddsi_locator_t *loc;
struct ddsi_tran_conn *conn;
} single;
struct {
struct ddsi_sock_waitset *ws;
} many;
} u;
};
struct ddsi_deleted_participants_admin;
struct ddsi_domaingv {
volatile int terminate;
volatile int deaf;
volatile int mute;
struct ddsrt_log_cfg logconfig;
struct ddsi_config config;
struct ddsi_tkmap * m_tkmap;
/* Hash tables for participants, readers, writers, proxy
participants, proxy readers and proxy writers by GUID. */
struct ddsi_entity_index *entity_index;
/* Timed events admin */
struct ddsi_xeventq *xevents;
/* Queue for garbage collection requests */
struct ddsi_gcreq_queue *gcreq_queue;
/* Lease junk */
ddsrt_mutex_t leaseheap_lock;
ddsrt_fibheap_t leaseheap;
/* Transport factories & selected factory */
struct ddsi_tran_factory *ddsi_tran_factories;
struct ddsi_tran_factory *m_factory;
/* Connections for multicast discovery & data, and those that correspond
to the one DDSI participant index that the DDSI service uses. The
DCPS participant of DDSI itself will be mirrored in a DDSI
participant, and in multi-socket mode that one gets its own
socket. */
struct ddsi_tran_conn * disc_conn_mc;
struct ddsi_tran_conn * data_conn_mc;
struct ddsi_tran_conn * disc_conn_uc;
struct ddsi_tran_conn * data_conn_uc;
/* Connection used for all output (for connectionless transports), this
used to simply be data_conn_uc, but:
- Windows has a quirk that makes multicast delivery within a machine
utterly unreliable if the transmitting socket is bound to 0.0.0.0
(despite all sockets having multicast interfaces set correctly),
but apparently only in the presence of sockets transmitting to the
same multicast group that have been bound to non-0.0.0.0 ...
- At least Fast-RTPS and Connext fail to honour the set of advertised
addresses and substitute 127.0.0.1 for the advertised IP address and
expect it to work.
- Fast-RTPS (at least) binds the socket it uses for transmitting
multicasts to non-0.0.0.0
So binding to 0.0.0.0 means the unicasts from Fast-RTPS & Connext will
arrive but the multicasts from Cyclone get dropped often on Windows
when trying to interoperate; and binding to the IP address means
unicast messages from the others fail to arrive (because they fail to
arrive).
The only work around is to use a separate socket for sending. It is
rather sad that Cyclone needs to work around the bugs of the others,
but it seems the only way to get the users what they expect. */
#define MAX_XMIT_CONNS 4
struct ddsi_tran_conn * xmit_conns[MAX_XMIT_CONNS];
ddsi_xlocator_t intf_xlocators[MAX_XMIT_CONNS];
/* TCP listener */
struct ddsi_tran_listener * listener;
/* In many sockets mode, the receive threads maintain a local array
with participant GUIDs and sockets, participant_set_generation is
used to notify them. */
ddsrt_atomic_uint32_t participant_set_generation;
/* nparticipants is used primarily for limiting the number of active
participants, but also during shutdown to determine when it is
safe to stop the GC thread. */
ddsrt_mutex_t participant_set_lock;
ddsrt_cond_t participant_set_cond;
uint32_t nparticipants;
/* For participants without (some) built-in writers, we fall back to
this participant, which is the first one created with all
built-in writers present. It MUST be created before any in need
of it pops up! */
struct ddsi_participant *privileged_pp;
ddsrt_mutex_t privileged_pp_lock;
/* For tracking (recently) deleted participants */
struct ddsi_deleted_participants_admin *deleted_participants;
/* GUID to be used in next call to new_participant; also protected
by privileged_pp_lock */
struct ddsi_guid ppguid_base;
/* number of selected interfaces. */
int n_interfaces;
struct ddsi_network_interface interfaces[MAX_XMIT_CONNS];
/* whether we're using a link-local address (and therefore
only listening to multicasts on that interface) */
int using_link_local_intf;
/* Addressing: actual own (preferred) IP address, IP address
advertised in discovery messages (so that an external IP address on
a NAT may be advertised), and the DDSI multi-cast address. */
enum ddsi_recvips_mode recvips_mode;
struct ddsi_config_in_addr_node *recvips;
ddsi_locator_t extmask;
/* Locators */
ddsi_locator_t loc_spdp_mc;
ddsi_locator_t loc_meta_mc;
ddsi_locator_t loc_meta_uc;
ddsi_locator_t loc_default_mc;
ddsi_locator_t loc_default_uc;
/*
Initial discovery address set, and the current discovery address
set. These are the addresses that SPDP pings get sent to.
*/
struct spdp_admin *spdp_schedule;
ddsrt_mutex_t lock;
/* Receive thread. (We can only has one for now, cos of the signal
trigger socket.) Receive buffer pool is per receive thread,
it is only a global variable because it needs to be freed way later
than the receive thread itself terminates */
#define MAX_RECV_THREADS 3
uint32_t n_recv_threads;
struct recv_thread {
const char *name;
struct ddsi_thread_state *thrst;
struct ddsi_recv_thread_arg arg;
} recv_threads[MAX_RECV_THREADS];
/* Listener thread for connection based transports */
struct ddsi_thread_state *listen_ts;
/* Flag cleared when stopping (receive threads). FIXME. */
ddsrt_atomic_uint32_t rtps_keepgoing;
/* Start time of the DDSI service, for logging relative time stamps,
should I ever so desire. */
ddsrt_wctime_t tstart;
/* Default QoSs for participant, readers and writers (needed for
eliminating default values in outgoing discovery packets, and for
supplying values for missing QoS settings in incoming discovery
packets); plus the actual QoSs needed for the builtin
endpoints. */
dds_qos_t default_local_xqos_pp;
dds_qos_t spdp_endpoint_xqos;
dds_qos_t builtin_endpoint_xqos_rd;
dds_qos_t builtin_endpoint_xqos_wr;
#ifdef DDS_HAS_TYPE_DISCOVERY
dds_qos_t builtin_volatile_xqos_rd;
dds_qos_t builtin_volatile_xqos_wr;
#endif
#ifdef DDS_HAS_SECURITY
dds_qos_t builtin_secure_volatile_xqos_rd;
dds_qos_t builtin_secure_volatile_xqos_wr;
dds_qos_t builtin_stateless_xqos_rd;
dds_qos_t builtin_stateless_xqos_wr;
#endif
/* SPDP packets get very special treatment (they're the only packets
we accept from writers we don't know) and have their very own
do-nothing defragmentation and reordering thingummies, as well as a
global mutex to in lieu of the proxy writer lock. */
ddsrt_mutex_t spdp_lock;
struct ddsi_defrag *spdp_defrag;
struct ddsi_reorder *spdp_reorder;
/* Built-in stuff other than SPDP gets funneled through the builtins
delivery queue; currently just SEDP and PMD */
struct ddsi_dqueue *builtins_dqueue;
struct ddsi_debug_monitor *debmon;
uint32_t networkQueueId;
struct ddsi_thread_state *channel_reader_thrst;
/* Application data gets its own delivery queue */
struct ddsi_dqueue *user_dqueue;
/* Transmit side: pool for transmit queue*/
struct ddsi_xmsgpool *xmsgpool;
struct ddsi_sertype *spdp_type; /* key = participant GUID */
struct ddsi_sertype *sedp_reader_type; /* key = endpoint GUID */
struct ddsi_sertype *sedp_writer_type; /* key = endpoint GUID */
struct ddsi_sertype *sedp_topic_type; /* key = topic GUID */
struct ddsi_sertype *pmd_type; /* participant message data */
#ifdef DDS_HAS_TYPE_DISCOVERY
struct ddsi_sertype *tl_svc_request_type; /* TypeLookup service request, no key */
struct ddsi_sertype *tl_svc_reply_type; /* TypeLookup service reply, no key */
#endif
#ifdef DDS_HAS_SECURITY
struct ddsi_sertype *spdp_secure_type; /* key = participant GUID */
struct ddsi_sertype *sedp_reader_secure_type; /* key = endpoint GUID */
struct ddsi_sertype *sedp_writer_secure_type; /* key = endpoint GUID */
struct ddsi_sertype *pmd_secure_type; /* participant message data */
struct ddsi_sertype *pgm_stateless_type; /* participant generic message */
struct ddsi_sertype *pgm_volatile_type; /* participant generic message */
#endif
ddsrt_mutex_t sendq_lock;
ddsrt_cond_t sendq_cond;
unsigned sendq_length;
struct ddsi_xpack *sendq_head;
struct ddsi_xpack *sendq_tail;
int sendq_stop;
struct ddsi_thread_state *sendq_ts;
bool sendq_running;
ddsrt_mutex_t sendq_running_lock;
/* File for dumping captured packets, NULL if disabled */
FILE *pcap_fp;
ddsrt_mutex_t pcap_lock;
struct ddsi_builtin_topic_interface *builtin_topic_interface;
struct ddsi_mcgroup_membership *mship;
ddsrt_mutex_t sertypes_lock;
struct ddsrt_hh *sertypes;
#ifdef DDS_HAS_TYPELIB
ddsrt_mutex_t typelib_lock;
ddsrt_avl_tree_t typelib;
ddsrt_avl_tree_t typedeps;
ddsrt_avl_tree_t typedeps_reverse;
ddsrt_cond_t typelib_resolved_cond;
#endif
#ifdef DDS_HAS_TOPIC_DISCOVERY
ddsrt_mutex_t topic_defs_lock;
struct ddsrt_hh *topic_defs;
#endif
ddsrt_mutex_t new_topic_lock;
ddsrt_cond_t new_topic_cond;
uint32_t new_topic_version;
/* security globals */
#ifdef DDS_HAS_SECURITY
struct dds_security_context *security_context;
struct ddsi_hsadmin *hsadmin;
bool handshake_include_optional;
#endif
/* naming */
ddsrt_mutex_t naming_lock;
ddsrt_prng_t naming_rng;
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_DOMAINGV_H */
+145
View File
@@ -0,0 +1,145 @@
// Copyright(c) 2023 ZettaScale Technology 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
#ifndef DDSI_DYNAMIC_TYPE_H
#define DDSI_DYNAMIC_TYPE_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_typewrap.h"
#include "dds/ddsi/ddsi_domaingv.h"
#if defined (__cplusplus)
extern "C" {
#endif
#ifdef DDS_HAS_TYPELIB
struct ddsi_dynamic_type_struct_member_param {
uint32_t id;
const char *name;
uint32_t index;
bool is_key;
};
struct ddsi_dynamic_type_union_member_param {
uint32_t id;
const char *name;
uint32_t index;
bool is_default;
uint32_t n_labels;
int32_t *labels;
};
struct ddsi_dynamic_type_enum_literal_param {
const char *name;
bool is_auto_value;
int32_t value;
bool is_default;
};
struct ddsi_dynamic_type_bitmask_field_param {
const char *name;
bool is_auto_position;
uint16_t position;
};
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_struct (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name, struct ddsi_type **base_type);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_union (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name, struct ddsi_type **discriminant_type);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_sequence (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name, struct ddsi_type **element_type, uint32_t bound);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_array (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name, struct ddsi_type **element_type, uint32_t num_bounds, const uint32_t *bounds);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_enum (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_bitmask (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_alias (struct ddsi_domaingv *gv, struct ddsi_type **type, const char *type_name, struct ddsi_type **aliased_type);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_string8 (struct ddsi_domaingv *gv, struct ddsi_type **type, uint32_t bound);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_string16 (struct ddsi_domaingv *gv, struct ddsi_type **type, uint32_t bound);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_create_primitive (struct ddsi_domaingv *gv, struct ddsi_type **type, dds_dynamic_type_kind_t kind);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_set_extensibility (struct ddsi_type *type, enum dds_dynamic_type_extensibility extensibility);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_set_bitbound (struct ddsi_type *type, uint16_t bit_bound);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_set_nested (struct ddsi_type *type, bool is_nested);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_set_autoid (struct ddsi_type *type, enum dds_dynamic_type_autoid value);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_add_struct_member (struct ddsi_type *type, struct ddsi_type **member_type, struct ddsi_dynamic_type_struct_member_param params);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_add_union_member (struct ddsi_type *type, struct ddsi_type **member_type, struct ddsi_dynamic_type_union_member_param params);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_add_enum_literal (struct ddsi_type *type, struct ddsi_dynamic_type_enum_literal_param params);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_add_bitmask_field (struct ddsi_type *type, struct ddsi_dynamic_type_bitmask_field_param params);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_member_set_key (struct ddsi_type *type, uint32_t member_id, bool is_key);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_member_set_optional (struct ddsi_type *type, uint32_t member_id, bool is_optional);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_struct_member_set_external (struct ddsi_type *type, uint32_t member_id, bool is_external);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_union_member_set_external (struct ddsi_type *type, uint32_t member_id, bool is_external);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_member_set_must_understand (struct ddsi_type *type, uint32_t member_id, bool is_must_understand);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_member_set_hashid (struct ddsi_type *type, uint32_t member_id, const char *hash_member_name);
/** @component dynamic_type_support */
dds_return_t ddsi_dynamic_type_register (struct ddsi_type **type_c, struct ddsi_type **type_m, ddsi_typeinfo_t **type_info);
/** @component dynamic_type_support */
struct ddsi_type * ddsi_dynamic_type_dup (const struct ddsi_type *src);
/** @component dynamic_type_support */
bool ddsi_dynamic_type_is_constructing (const struct ddsi_type *type);
#endif /* DDS_HAS_TYPELIB */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_DYNAMIC_TYPE_H */
+239
View File
@@ -0,0 +1,239 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_ENDPOINT_H
#define DDSI_ENDPOINT_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_hbcontrol.h"
#include "dds/dds.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_participant;
struct ddsi_type_pair;
struct ddsi_writer_info;
struct ddsi_entity_common;
struct ddsi_endpoint_common;
struct ddsi_ldur_fhnode;
struct ddsi_entity_index;
struct dds_qos;
/* Liveliness changed is more complicated than just add/remove. Encode the event
in ddsi_status_cb_data_t::extra and ignore ddsi_status_cb_data_t::add */
enum ddsi_liveliness_changed_data_extra {
DDSI_LIVELINESS_CHANGED_ADD_ALIVE,
DDSI_LIVELINESS_CHANGED_ADD_NOT_ALIVE,
DDSI_LIVELINESS_CHANGED_REMOVE_NOT_ALIVE,
DDSI_LIVELINESS_CHANGED_REMOVE_ALIVE,
DDSI_LIVELINESS_CHANGED_ALIVE_TO_NOT_ALIVE,
DDSI_LIVELINESS_CHANGED_NOT_ALIVE_TO_ALIVE
};
struct ddsi_psmx_locators_set {
uint32_t length;
struct ddsi_locator *locators;
};
struct ddsi_endpoint_common {
struct ddsi_participant *pp;
ddsi_guid_t group_guid;
struct ddsi_psmx_locators_set psmx_locators;
#ifdef DDS_HAS_TYPELIB
struct ddsi_type_pair *type_pair;
#endif
};
enum ddsi_writer_state {
WRST_OPERATIONAL, /* normal situation */
WRST_INTERRUPT, /* will be deleted, unblock throttle_writer but do not do anything further */
WRST_LINGERING, /* writer deletion has been requested but still has unack'd data */
WRST_DELETING /* writer is actually being deleted (removed from hash table) */
};
typedef ddsrt_atomic_uint64_t seq_xmit_t;
struct ddsi_writer
{
struct ddsi_entity_common e;
struct ddsi_endpoint_common c;
ddsi_status_cb_t status_cb;
void * status_cb_entity;
ddsrt_cond_t throttle_cond; /* used to trigger a transmit thread blocked in throttle_writer() or wait_for_acks() */
ddsi_seqno_t seq; /* last sequence number (transmitted seqs are 1 ... seq, 0 when nothing published yet) */
seq_xmit_t seq_xmit; /* last sequence number actually transmitted */
ddsi_seqno_t min_local_readers_reject_seq; /* mimum of local_readers->last_deliv_seq */
ddsi_count_t hbcount; /* last hb seq number */
ddsi_count_t hbfragcount; /* last hb frag seq number */
int throttling; /* non-zero when some thread is waiting for the WHC to shrink */
struct ddsi_hbcontrol hbcontrol; /* controls heartbeat timing, piggybacking */
struct dds_qos *xqos;
enum ddsi_writer_state state;
unsigned reliable: 1; /* iff 1, writer is reliable <=> heartbeat_xevent != NULL */
unsigned handle_as_transient_local: 1; /* controls whether data is retained in WHC */
unsigned force_md5_keyhash: 1; /* iff 1, when keyhash has to be hashed, no matter the size */
unsigned retransmitting: 1; /* iff 1, this writer is currently retransmitting */
unsigned alive: 1; /* iff 1, the writer is alive (lease for this writer is not expired); field may be modified only when holding both wr->e.lock and wr->c.pp->e.lock */
unsigned test_ignore_acknack : 1; /* iff 1, the writer ignores all arriving ACKNACK messages */
unsigned test_suppress_retransmit : 1; /* iff 1, the writer does not respond to retransmit requests */
unsigned test_suppress_heartbeat : 1; /* iff 1, the writer suppresses all periodic heartbeats */
unsigned test_suppress_flush_on_sync_heartbeat : 1; /* iff 1, the writer never flushes because of a piggy-backed heartbeat */
unsigned test_drop_outgoing_data : 1; /* iff 1, the writer drops outgoing data, forcing the readers to request a retransmit */
#ifdef DDSRT_HAVE_SSM
unsigned supports_ssm: 1;
struct ddsi_addrset *ssm_as;
#endif
uint32_t alive_vclock; /* virtual clock counting transitions between alive/not-alive */
const struct ddsi_sertype * type; /* type of the data written by this writer */
struct ddsi_addrset *as; /* set of addresses to publish to */
struct ddsi_xevent *heartbeat_xevent; /* timed event for "periodically" publishing heartbeats when unack'd data present, NULL <=> unreliable */
struct ddsi_ldur_fhnode *lease_duration; /* fibheap node to keep lease duration for this writer, NULL in case of automatic liveliness with inifite duration */
struct ddsi_whc *whc; /* WHC tracking history, T-L durability service history + samples by sequence number for retransmit */
uint32_t whc_low, whc_high; /* watermarks for WHC in bytes (counting only unack'd data) */
ddsrt_etime_t t_rexmit_start;
ddsrt_etime_t t_rexmit_end; /* time of last 1->0 transition of "retransmitting" */
ddsrt_etime_t t_whc_high_upd; /* time "whc_high" was last updated for controlled ramp-up of throughput */
uint32_t init_burst_size_limit; /* derived from reader's receive_buffer_size */
uint32_t rexmit_burst_size_limit; /* derived from reader's receive_buffer_size */
uint32_t num_readers; /* total number of matching PROXY readers */
uint32_t num_reliable_readers; /* number of matching reliable PROXY readers */
uint32_t num_readers_requesting_keyhash; /* also +1 for protected keys and config override for generating keyhash */
ddsrt_avl_tree_t readers; /* all matching PROXY readers, see struct ddsi_wr_prd_match */
ddsrt_avl_tree_t local_readers; /* all matching LOCAL readers, see struct ddsi_wr_rd_match */
#ifdef DDS_HAS_NETWORK_PARTITIONS
const struct ddsi_config_networkpartition_listelem *network_partition;
#endif
uint32_t num_acks_received; /* cum received ACKNACKs with no request for retransmission */
uint32_t num_nacks_received; /* cum received ACKNACKs that did request retransmission */
uint32_t throttle_count; /* cum times transmitting was throttled (whc hitting high-level mark) */
uint32_t throttle_tracing;
uint32_t rexmit_count; /* cum samples retransmitted (counting events; 1 sample can be counted many times) */
uint32_t rexmit_lost_count; /* cum samples lost but retransmit requested (also counting events) */
uint64_t rexmit_bytes; /* cum bytes queued for retransmit */
uint64_t time_throttled; /* cum time in throttled state */
uint64_t time_retransmit; /* cum time in retransmitting state */
struct ddsi_xeventq *evq; /* timed event queue to be used by this writer */
struct ddsi_local_reader_ary rdary; /* LOCAL readers for fast-pathing; if not fast-pathed, fall back to scanning local_readers */
struct ddsi_lease *lease; /* for liveliness administration (writer can only become inactive when using manual liveliness) */
#ifdef DDS_HAS_SECURITY
struct ddsi_writer_sec_attributes *sec_attr;
#endif
};
struct ddsi_local_orphan_writer {
struct ddsi_writer wr;
};
struct ddsi_reader
{
struct ddsi_entity_common e;
struct ddsi_endpoint_common c;
ddsi_status_cb_t status_cb;
void * status_cb_entity;
struct ddsi_rhc * rhc; /* reader history, tracks registrations and data */
struct dds_qos *xqos;
unsigned reliable: 1; /* 1 iff reader is reliable */
unsigned handle_as_transient_local: 1; /* 1 iff reader wants historical data from proxy writers */
unsigned request_keyhash: 1; /* really controlled by the sertype */
#ifdef DDSRT_HAVE_SSM
unsigned favours_ssm: 1; /* iff 1, this reader favours SSM */
#endif
ddsi_count_t init_acknack_count; /* initial value for "count" (i.e. ACK seq num) for newly matched proxy writers */
#ifdef DDS_HAS_NETWORK_PARTITIONS
struct ddsi_networkpartition_address *uc_as;
struct ddsi_networkpartition_address *mc_as;
#endif
const struct ddsi_sertype * type; /* type of the data read by this reader */
uint32_t num_writers; /* total number of matching PROXY writers */
ddsrt_avl_tree_t writers; /* all matching PROXY writers, see struct ddsi_rd_pwr_match */
ddsrt_avl_tree_t local_writers; /* all matching LOCAL writers, see struct ddsi_rd_wr_match */
#ifdef DDS_HAS_SECURITY
struct ddsi_reader_sec_attributes *sec_attr;
#endif
};
struct ddsi_generic_endpoint
{
struct ddsi_entity_common e;
struct ddsi_endpoint_common c;
};
DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_wr_readers_treedef;
DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_wr_local_readers_treedef;
DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_rd_writers_treedef;
DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_rd_local_writers_treedef;
/** @component ddsi_endpoint */
int ddsi_is_builtin_endpoint (ddsi_entityid_t id, ddsi_vendorid_t vendorid);
struct dds_ktopic;
// writer
/** @component ddsi_endpoint */
struct ddsi_local_orphan_writer *ddsi_new_local_orphan_writer (struct ddsi_domaingv *gv, ddsi_entityid_t entityid, const char *topic_name, struct ddsi_sertype *type, const struct dds_qos *xqos, struct ddsi_whc *whc);
/** @component ddsi_endpoint */
void ddsi_delete_local_orphan_writer (struct ddsi_local_orphan_writer *wr);
/** @component ddsi_endpoint */
dds_return_t ddsi_generate_writer_guid (struct ddsi_guid *wrguid, struct ddsi_participant *participant, const struct ddsi_sertype *sertype);
/** @component ddsi_endpoint */
dds_return_t ddsi_new_writer (struct ddsi_writer **wr_out, const struct ddsi_guid *guid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct ddsi_whc *whc, ddsi_status_cb_t status_cb, void *status_entity, struct ddsi_psmx_locators_set *psmx_locators);
/** @component ddsi_endpoint */
void ddsi_update_writer_qos (struct ddsi_writer *wr, const struct dds_qos *xqos);
/** @component ddsi_endpoint */
void ddsi_make_writer_info (struct ddsi_writer_info *wrinfo, const struct ddsi_entity_common *e, const struct dds_qos *xqos, uint32_t statusinfo);
/** @component ddsi_endpoint */
void ddsi_make_writer_info_params (struct ddsi_writer_info *wrinfo, const ddsi_guid_t *wr_guid, int32_t ownership_strength, bool autodispose_unregistered_instances, uint64_t iid, uint32_t statusinfo, dds_duration_t lifespan_duration);
/** @component ddsi_endpoint */
dds_return_t ddsi_writer_wait_for_acks (struct ddsi_writer *wr, const ddsi_guid_t *rdguid, dds_time_t abstimeout);
/** @component ddsi_endpoint */
dds_return_t ddsi_unblock_throttled_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid);
/** @component ddsi_endpoint */
dds_return_t ddsi_delete_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid);
/** @component ddsi_endpoint */
struct ddsi_reader *ddsi_writer_first_in_sync_reader (struct ddsi_entity_index *entity_index, struct ddsi_entity_common *wrcmn, ddsrt_avl_iter_t *it);
/** @component ddsi_endpoint */
struct ddsi_reader *ddsi_writer_next_in_sync_reader (struct ddsi_entity_index *entity_index, ddsrt_avl_iter_t *it);
/** @component ddsi_endpoint */
dds_return_t ddsi_generate_reader_guid (struct ddsi_guid *rdguid, struct ddsi_participant *participant, const struct ddsi_sertype *sertype);
/** @component ddsi_endpoint */
dds_return_t ddsi_new_reader (struct ddsi_reader **rd_out, const struct ddsi_guid *guid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct ddsi_rhc *rhc, ddsi_status_cb_t status_cb, void * status_entity, struct ddsi_psmx_locators_set *psmx_locators);
/** @component ddsi_endpoint */
void ddsi_update_reader_qos (struct ddsi_reader *rd, const struct dds_qos *xqos);
/** @component ddsi_endpoint */
dds_return_t ddsi_delete_reader (struct ddsi_domaingv *gv, const struct ddsi_guid *guid);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ENDPOINT_H */
+67
View File
@@ -0,0 +1,67 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_ENDPOINT_MATCH_H
#define DDSI_ENDPOINT_MATCH_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_lat_estim.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_writer;
struct ddsi_reader;
struct ddsi_entity_common;
struct dds_qos;
/** @component endpoint_matching */
dds_return_t ddsi_writer_get_matched_subscriptions (struct ddsi_writer *wr, uint64_t *rds, size_t nrds);
/** @component endpoint_matching */
dds_return_t ddsi_reader_get_matched_publications (struct ddsi_reader *rd, uint64_t *wrs, size_t nwrs);
/** @brief Lookup the instance handle of a matching reader and return it, it's qos and participant
* @component endpoint_matching
*
* @note Thread state must be "awake", returned pointers are aliases; lifetime ends on leaving the "awake" state; contents may not be modified.
*
* @param[in] wr writer for which to lookup ih in the setting of matching readers
* @param[in] ih instance handle of a reader
* @param[out] rdc pointer to the common entity data of the reader
* @param[out] rdqos pointer to the QoS of the reader
* @param[out] ppc participant, may be null for an orphan reader
* @return true iff ih corresponds to a matched reader, output parameters are undefined if not
*/
bool ddsi_writer_find_matched_reader (struct ddsi_writer *wr, uint64_t ih, const struct ddsi_entity_common **rdc, const struct dds_qos **rdqos, const struct ddsi_entity_common **ppc);
/** @brief Lookup the instance handle of a matching writer and return it, it's qos and participant
* @component endpoint_matching
*
* @note Thread state must be "awake", returned pointers are aliases; lifetime ends on leaving the "awake" state; contents may not be modified.
*
* @param[in] rd reader for which to lookup ih in the setting of matching writers
* @param[in] ih instance handle of a writer
* @param[out] wrc pointer to the common entity data of the writer
* @param[out] wrqos pointer to the QoS of the writer
* @param[out] ppc participant, may be null for an orphan writer
* @return true iff ih corresponds to a matched writer, output parameters are undefined if not
*/
bool ddsi_reader_find_matched_writer (struct ddsi_reader *rd, uint64_t ih, const struct ddsi_entity_common **wrc, const struct dds_qos **wrqos, const struct ddsi_entity_common **ppc);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ENDPOINT_MATCH_H */
+105
View File
@@ -0,0 +1,105 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_ENTITY_H
#define DDSI_ENTITY_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsi/ddsi_protocol.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_rsample_info;
struct ddsi_rdata;
struct ddsi_tkmap_instance;
struct ddsi_local_reader_ary;
enum ddsi_entity_kind {
DDSI_EK_PARTICIPANT,
DDSI_EK_PROXY_PARTICIPANT,
DDSI_EK_TOPIC,
DDSI_EK_WRITER,
DDSI_EK_PROXY_WRITER,
DDSI_EK_READER,
DDSI_EK_PROXY_READER
};
typedef struct ddsi_status_cb_data
{
int raw_status_id;
uint32_t extra;
uint64_t handle;
bool add;
} ddsi_status_cb_data_t;
typedef void (*ddsi_status_cb_t) (void *entity, const ddsi_status_cb_data_t *data);
typedef struct ddsi_type_pair
#ifdef DDS_HAS_TYPELIB
{
struct ddsi_type *minimal;
struct ddsi_type *complete;
}
#endif
ddsi_type_pair_t;
struct ddsi_entity_common {
enum ddsi_entity_kind kind;
ddsi_guid_t guid;
ddsrt_wctime_t tupdate; /* timestamp of last update */
uint64_t iid;
struct ddsi_tkmap_instance *tk;
ddsrt_mutex_t lock;
bool onlylocal;
struct ddsi_domaingv *gv;
ddsrt_avl_node_t all_entities_avlnode;
/* QoS changes always lock the entity itself, and additionally
(and within the scope of the entity lock) acquire qos_lock
while manipulating the QoS. So any thread that needs to read
the QoS without acquiring the entity's lock can still do so
(e.g., the materialisation of samples for built-in topics
when connecting a reader to a writer for a built-in topic).
qos_lock lock order across entities in is in increasing
order of entity addresses cast to uintptr_t. */
ddsrt_mutex_t qos_lock;
};
struct ddsi_local_reader_ary {
ddsrt_mutex_t rdary_lock; /* mutations only ever happen when (proxy) writer lock also held (excepting careful hacks in tests) */
unsigned valid: 1; /* always true until (proxy-)writer is being deleted; !valid => !fastpath_ok */
unsigned fastpath_ok: 1; /* if not ok, fall back to using GUIDs (gives access to the reader-writer match data for handling readers that bumped into resource limits, hence can flip-flop, unlike "valid") */
uint32_t n_readers;
struct ddsi_reader **rdary; /* for efficient delivery, null-pointer terminated, grouped by topic */
};
/** @component ddsi_generic_entity */
ddsi_entityid_t ddsi_to_entityid (unsigned u);
/** @component ddsi_generic_entity */
ddsi_vendorid_t ddsi_get_entity_vendorid (const struct ddsi_entity_common *e);
/** @component ddsi_generic_entity */
uint64_t ddsi_get_entity_instanceid (const struct ddsi_domaingv *gv, const struct ddsi_guid *guid);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ENTITY_H */
+113
View File
@@ -0,0 +1,113 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_ENTITY_INDEX_H
#define DDSI_ENTITY_INDEX_H
#include "dds/ddsi/ddsi_thread.h"
#include "dds/ddsi/ddsi_topic.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_endpoint.h"
#include "dds/ddsi/ddsi_proxy_endpoint.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_entity_index;
struct ddsi_guid;
struct ddsi_domaingv;
struct ddsi_entity_enum
{
struct ddsi_entity_index *entidx;
enum ddsi_entity_kind kind;
struct ddsi_entity_common *cur;
#ifndef NDEBUG
ddsi_vtime_t vtime;
#endif
};
/* Readers & writers are both in a GUID- and in a GID-keyed table. If
they are in the GID-based one, they are also in the GUID-based one,
but not the way around, for two reasons:
- firstly, there are readers & writers that do not have a GID
(built-in endpoints, fictitious transient data readers),
- secondly, they are inserted first in the GUID-keyed one, and then
in the GID-keyed one.
The GID is used solely for the interface with the OpenSplice
kernel, all internal state and protocol handling is done using the
GUID. So all this means is that, e.g., a writer being deleted
becomes invisible to the network reader slightly before it
disappears in the protocol handling, or that a writer might exist
at the protocol level slightly before the network reader can use it
to transmit data. */
/** @component entity_index */
void *ddsi_entidx_lookup_guid_untyped (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
void *ddsi_entidx_lookup_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid, enum ddsi_entity_kind kind) ddsrt_nonnull_all;
/** @component entity_index */
struct ddsi_participant *ddsi_entidx_lookup_participant_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
DDS_EXPORT struct ddsi_writer *ddsi_entidx_lookup_writer_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
struct ddsi_reader *ddsi_entidx_lookup_reader_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
struct ddsi_proxy_participant *ddsi_entidx_lookup_proxy_participant_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
struct ddsi_proxy_writer *ddsi_entidx_lookup_proxy_writer_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/** @component entity_index */
struct ddsi_proxy_reader *ddsi_entidx_lookup_proxy_reader_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all;
/* Enumeration of entries in the hash table:
- "next" visits at least all entries that were in the hash table at
the time of calling init and that have not subsequently been
removed;
- "next" may visit an entry more than once, but will do so only
because of rare events (i.e., resize or so);
- the order in which entries are visited is arbitrary;
- the caller must call init() before it may call next(); it must
call fini() before it may call init() again. */
/** @component entity_index */
void ddsi_entidx_enum_init (struct ddsi_entity_enum *st, const struct ddsi_entity_index *ei, enum ddsi_entity_kind kind) ddsrt_nonnull_all;
/** @component entity_index */
void *ddsi_entidx_enum_next (struct ddsi_entity_enum *st) ddsrt_nonnull_all;
/** @component entity_index */
void ddsi_entidx_enum_fini (struct ddsi_entity_enum *st) ddsrt_nonnull_all;
#ifdef DDS_HAS_TOPIC_DISCOVERY
/** @component entity_index */
struct ddsi_topic *ddsi_entidx_lookup_topic_guid (const struct ddsi_entity_index *ei, const struct ddsi_guid *guid);
#endif
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ENTITY_INDEX_H */
+37
View File
@@ -0,0 +1,37 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
/* Feature macros:
- SSM: support for source-specific multicast
requires: NETWORK_PARTIITONS
also requires platform support; SSM is silently disabled if the
platform doesn't support it
- IPV6: support for IPV6
requires: platform support (which itself is not part of DDSI)
- NETWORK_PARTITIONS: support for multiple network partitions
*/
#include "dds/features.h"
#ifdef DDSRT_HAVE_SSM
#ifndef DDS_HAS_NETWORK_PARTITIONS
#error "SSM requires NETWORK_PARTITIONS"
#endif
#include "dds/ddsrt/sockets.h"
#ifndef DDSRT_HAVE_SSM
#error "DDSRT_HAVE_SSM should be defined"
#elif ! DDSRT_HAVE_SSM
#undef DDSRT_HAVE_SSM
#endif
#endif
+99
View File
@@ -0,0 +1,99 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_FREELIST_H
#define DDSI_FREELIST_H
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/sync.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define DDSI_FREELIST_NONE 1
#define DDSI_FREELIST_ATOMIC_LIFO 2
#define DDSI_FREELIST_DOUBLE 3
#define DDSI_FREELIST_TYPE DDSI_FREELIST_DOUBLE
#ifndef DDSI_FREELIST_TYPE
#if DDSRT_HAVE_ATOMIC_LIFO
#define DDSI_FREELIST_TYPE DDSI_FREELIST_ATOMIC_LIFO
#else
#define DDSI_FREELIST_TYPE DDSI_FREELIST_DOUBLE
#endif
#endif
#if DDSI_FREELIST_TYPE == DDSI_FREELIST_NONE
struct ddsi_freelist {
char dummy;
};
#elif DDSI_FREELIST_TYPE == DDSI_FREELIST_ATOMIC_LIFO
struct ddsi_freelist {
ddsrt_atomic_lifo_t x;
ddsrt_atomic_uint32_t count;
uint32_t max;
size_t linkoff;
};
#elif DDSI_FREELIST_TYPE == DDSI_FREELIST_DOUBLE
#define NN_FREELIST_NPAR 4
#define NN_FREELIST_NPAR_LG2 2
#define NN_FREELIST_MAGSIZE 256
struct ddsi_freelist_m {
void *x[NN_FREELIST_MAGSIZE];
void *next;
};
struct ddsi_freelist1 {
ddsrt_mutex_t lock;
uint32_t count;
struct ddsi_freelist_m *m;
};
struct ddsi_freelist {
struct ddsi_freelist1 inner[NN_FREELIST_NPAR];
ddsrt_atomic_uint32_t cc;
ddsrt_mutex_t lock;
struct ddsi_freelist_m *mlist;
struct ddsi_freelist_m *emlist;
uint32_t count;
uint32_t max;
size_t linkoff;
};
#endif
/** @component ddsi_freelist */
void ddsi_freelist_init (struct ddsi_freelist *fl, uint32_t max, size_t linkoff);
/** @component ddsi_freelist */
void ddsi_freelist_fini (struct ddsi_freelist *fl, void (*free) (void *elem));
/** @component ddsi_freelist */
bool ddsi_freelist_push (struct ddsi_freelist *fl, void *elem);
/** @component ddsi_freelist */
void *ddsi_freelist_pushmany (struct ddsi_freelist *fl, void *first, void *last, uint32_t n);
/** @component ddsi_freelist */
void *ddsi_freelist_pop (struct ddsi_freelist *fl);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_FREELIST_H */
+44
View File
@@ -0,0 +1,44 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_GC_H
#define DDSI_GC_H
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_gcreq;
struct ddsi_gcreq_queue;
typedef void (*ddsi_gcreq_cb_t) (struct ddsi_gcreq *gcreq);
/** @component garbage_collector */
DDS_EXPORT struct ddsi_gcreq *ddsi_gcreq_new (struct ddsi_gcreq_queue *gcreq_queue, ddsi_gcreq_cb_t cb);
/** @component garbage_collector */
DDS_EXPORT void ddsi_gcreq_free (struct ddsi_gcreq *gcreq);
/** @component garbage_collector */
DDS_EXPORT void ddsi_gcreq_enqueue (struct ddsi_gcreq *gcreq);
/** @component garbage_collector */
DDS_EXPORT void * ddsi_gcreq_get_arg (struct ddsi_gcreq *gcreq);
/** @component garbage_collector */
DDS_EXPORT void ddsi_gcreq_set_arg (struct ddsi_gcreq *gcreq, void *arg);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_GC_H */
+57
View File
@@ -0,0 +1,57 @@
// Copyright(c) 2019 ZettaScale Technology 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
#ifndef DDSI_GUID_H
#define DDSI_GUID_H
#include <stdint.h>
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef union ddsi_guid_prefix {
unsigned char s[12];
uint32_t u[3];
} ddsi_guid_prefix_t;
typedef union ddsi_entityid {
uint32_t u;
} ddsi_entityid_t;
typedef struct ddsi_guid {
ddsi_guid_prefix_t prefix;
ddsi_entityid_t entityid;
} ddsi_guid_t;
/** @component misc */
DDS_EXPORT ddsi_guid_t ddsi_hton_guid (ddsi_guid_t g);
/** @component misc */
DDS_EXPORT ddsi_guid_t ddsi_ntoh_guid (ddsi_guid_t g);
/** @component misc */
ddsi_guid_prefix_t ddsi_hton_guid_prefix (ddsi_guid_prefix_t p);
/** @component misc */
ddsi_guid_prefix_t ddsi_ntoh_guid_prefix (ddsi_guid_prefix_t p);
/** @component misc */
ddsi_entityid_t ddsi_hton_entityid (ddsi_entityid_t e);
/** @component misc */
ddsi_entityid_t ddsi_ntoh_entityid (ddsi_entityid_t e);
#if defined (__cplusplus)
}
#endif
#endif
+49
View File
@@ -0,0 +1,49 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_HBCONTROL_H
#define DDSI_HBCONTROL_H
#include "dds/features.h"
#include "dds/ddsrt/time.h"
#if defined (__cplusplus)
extern "C" {
#endif
/// @brief State information used in deciding when/what kind of a heartbeat to send (per writer)
///
/// Heartbeats inform readers of the range of sequence numbers available from the writer and serve the dual
/// purpose of (1) allowing the reader to detect message loss, and (2) allowing the reader to request a retransmit.
///
/// Because readers are not allowed to request a retransmit unless they received a heartbeat, we make an
/// effort to a embed heartbeat in an outgoing RTPS message (~ a packet) if a preceding RTPS message
/// also contained data from the writer. Its sole purpose is to allow it to request a retransmit.
struct ddsi_hbcontrol {
ddsrt_mtime_t t_of_last_write; ///< Time of most recent write
ddsrt_mtime_t t_of_last_hb; ///< Time of last heartbeat sent
ddsrt_mtime_t t_of_last_ackhb; ///< Time of last heartbeat sent that requires a response
ddsrt_mtime_t tsched; ///< Time at which next asynchronous heartbeat is scheduled
uint32_t hbs_since_last_write; ///< Number of heartbeats sent since last write
uint32_t last_packetid; ///< Last RTPS message id containing a heartbeat from this writer
};
/// @brief Encoding for possible ways of adding heartbeats to messages
enum ddsi_hbcontrol_ack_required {
DDSI_HBC_ACK_REQ_NO, ///< Heartbeat does not require a response (FINAL flag set)
DDSI_HBC_ACK_REQ_YES, ///< Heartbeat requires a response, may continue packing
DDSI_HBC_ACK_REQ_YES_AND_FLUSH ///< Heartbeat requires a response, must send immediately
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_HBCONTROL_H */
+39
View File
@@ -0,0 +1,39 @@
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
#ifndef _DDS_IID_H_
#define _DDS_IID_H_
#include "dds/export.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/sync.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_iid {
ddsrt_atomic_uint64_t counter;
uint32_t key[4];
};
/** @component instance_id */
void ddsi_iid_init (void);
/** @component instance_id */
void ddsi_iid_fini (void);
/** @component instance_id */
uint64_t ddsi_iid_gen (void);
#if defined (__cplusplus)
}
#endif
#endif
+47
View File
@@ -0,0 +1,47 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_INIT_H
#define DDSI_INIT_H
#include <stdbool.h>
#include "dds/export.h"
#include "dds/ddsi/ddsi_psmx.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_cfgst;
struct ddsi_domaingv;
/** @component ddsi_init */
int ddsi_config_prep (struct ddsi_domaingv *gv, struct ddsi_cfgst *cfgst);
/** @component ddsi_init */
int ddsi_init (struct ddsi_domaingv *gv, struct ddsi_psmx_instance_locators *psmx_locators);
/** @component ddsi_init */
int ddsi_start (struct ddsi_domaingv *gv);
/** @component ddsi_init */
void ddsi_stop (struct ddsi_domaingv *gv);
/** @component ddsi_init */
void ddsi_fini (struct ddsi_domaingv *gv);
/** @component ddsi_generic_entity */
void ddsi_set_deafmute (struct ddsi_domaingv *gv, bool deaf, bool mute, int64_t reset_after);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_INIT_H */
@@ -0,0 +1,30 @@
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
#ifndef DDSI_INVERSE_UINT32_SET_H
#define DDSI_INVERSE_UINT32_SET_H
#include "dds/ddsrt/avl.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_inverse_uint32_set {
ddsrt_avl_tree_t ids;
uint32_t cursor;
uint32_t min, max;
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_INVERSE_UINT32_SET_H */
+26
View File
@@ -0,0 +1,26 @@
// Copyright(c) 2020 ZettaScale Technology 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
#ifndef DDSI_KEYHASH_H
#define DDSI_KEYHASH_H
#if defined (__cplusplus)
extern "C" {
#endif
typedef struct ddsi_keyhash {
unsigned char value[16];
} ddsi_keyhash_t;
#if defined (__cplusplus)
}
#endif
#endif
+35
View File
@@ -0,0 +1,35 @@
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
#ifndef DDSI_LAT_ESTIM_H
#define DDSI_LAT_ESTIM_H
#include "dds/ddsi/ddsi_log.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define DDSI_LAT_ESTIM_MEDIAN_WINSZ 7
struct ddsi_lat_estim {
/* median filtering with a small window in an attempt to remove the
worst outliers */
int index;
float window[DDSI_LAT_ESTIM_MEDIAN_WINSZ];
/* simple alpha filtering for smoothing */
float smoothed;
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_LAT_ESTIM_H */
+37
View File
@@ -0,0 +1,37 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_LEASE_H
#define DDSI_LEASE_H
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsrt/time.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_entity_common;
struct ddsi_lease {
ddsrt_fibheap_node_t heapnode;
ddsrt_fibheap_node_t pp_heapnode;
ddsrt_etime_t tsched; /* access guarded by leaseheap_lock */
ddsrt_atomic_uint64_t tend; /* really an ddsrt_etime_t */
dds_duration_t tdur; /* constant (renew depends on it) */
struct ddsi_entity_common *entity; /* constant */
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_LEASE_H */
+71
View File
@@ -0,0 +1,71 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_LIFESPAN_H
#define DDSI_LIFESPAN_H
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsrt/time.h"
#include "dds/ddsi/ddsi_domaingv.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef ddsrt_mtime_t (*ddsi_sample_expired_cb_t)(void *hc, ddsrt_mtime_t tnow);
struct ddsi_lifespan_adm {
ddsrt_fibheap_t ls_exp_heap; /* heap for sample expiration (lifespan) */
struct ddsi_xevent *evt; /* xevent that triggers for sample with earliest expiration */
ddsi_sample_expired_cb_t sample_expired_cb; /* callback for expired sample; this cb can use ddsi_lifespan_next_expired_locked to get next expired sample */
size_t fh_offset; /* offset of lifespan_adm element in whc or rhc */
size_t fhn_offset; /* offset of lifespan_fhnode element in whc or rhc node (sample) */
};
struct ddsi_lifespan_fhnode {
ddsrt_fibheap_node_t heapnode;
ddsrt_mtime_t t_expire;
};
/** @component lifespan_qos */
void ddsi_lifespan_init (const struct ddsi_domaingv *gv, struct ddsi_lifespan_adm *lifespan_adm, size_t fh_offset, size_t fh_node_offset, ddsi_sample_expired_cb_t sample_expired_cb);
/** @component lifespan_qos */
void ddsi_lifespan_fini (const struct ddsi_lifespan_adm *lifespan_adm);
/** @component lifespan_qos */
ddsrt_mtime_t ddsi_lifespan_next_expired_locked (const struct ddsi_lifespan_adm *lifespan_adm, ddsrt_mtime_t tnow, void **sample);
/** @component lifespan_qos */
void ddsi_lifespan_register_sample_real (struct ddsi_lifespan_adm *lifespan_adm, struct ddsi_lifespan_fhnode *node);
/** @component lifespan_qos */
void ddsi_lifespan_unregister_sample_real (struct ddsi_lifespan_adm *lifespan_adm, struct ddsi_lifespan_fhnode *node);
/** @component lifespan_qos */
inline void ddsi_lifespan_register_sample_locked (struct ddsi_lifespan_adm *lifespan_adm, struct ddsi_lifespan_fhnode *node)
{
if (node->t_expire.v != DDS_NEVER)
ddsi_lifespan_register_sample_real (lifespan_adm, node);
}
/** @component lifespan_qos */
inline void ddsi_lifespan_unregister_sample_locked (struct ddsi_lifespan_adm *lifespan_adm, struct ddsi_lifespan_fhnode *node)
{
if (node->t_expire.v != DDS_NEVER)
ddsi_lifespan_unregister_sample_real (lifespan_adm, node);
}
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_LIFESPAN_H */
+39
View File
@@ -0,0 +1,39 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_LOCATOR_H
#define DDSI_LOCATOR_H
#include <stdint.h>
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_tran_factory;
struct ddsi_tran_conn;
/* address field in locator maintained in network byte order, the rest in host */
typedef struct ddsi_locator {
int32_t kind;
uint32_t port;
unsigned char address[16];
} ddsi_locator_t;
typedef struct ddsi_xlocator {
ddsi_locator_t c;
struct ddsi_tran_conn *conn;
} ddsi_xlocator_t;
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_LOCATOR_H */
+44
View File
@@ -0,0 +1,44 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_LOG_H
#define DDSI_LOG_H
#include <stdarg.h>
#include "dds/ddsrt/log.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define GVTRACE(...) DDS_CTRACE (&gv->logconfig, __VA_ARGS__)
#define GVLOG(cat, ...) DDS_CLOG ((cat), &gv->logconfig, __VA_ARGS__)
#define GVWARNING(...) DDS_CLOG (DDS_LC_WARNING, &gv->logconfig, __VA_ARGS__)
#define GVERROR(...) DDS_CLOG (DDS_LC_ERROR, &gv->logconfig, __VA_ARGS__)
#define RSTTRACE(...) DDS_CTRACE (&rst->gv->logconfig, __VA_ARGS__)
#define ETRACE(e_, ...) DDS_CTRACE (&(e_)->e.gv->logconfig, __VA_ARGS__)
#define EETRACE(e_, ...) DDS_CTRACE (&(e_)->gv->logconfig, __VA_ARGS__)
#define ELOG(cat, e_, ...) DDS_CLOG ((cat), &(e_)->e.gv->logconfig, __VA_ARGS__)
#define EELOG(cat, e_, ...) DDS_CLOG ((cat), &(e_)->gv->logconfig, __VA_ARGS__)
/* There are quite a few places where discovery-related things are logged, so abbreviate those
a bit */
#define GVLOGDISC(...) DDS_CLOG (DDS_LC_DISCOVERY, &gv->logconfig, __VA_ARGS__)
#define ELOGDISC(e_,...) DDS_CLOG (DDS_LC_DISCOVERY, &(e_)->e.gv->logconfig, __VA_ARGS__)
#define EELOGDISC(e_, ...) DDS_CLOG (DDS_LC_DISCOVERY, &(e_)->gv->logconfig, __VA_ARGS__)
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_LOG_H */
+45
View File
@@ -0,0 +1,45 @@
// Copyright(c) 2006 to 2023 ZettaScale Technology 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
#ifndef DDSI_NWINTERFACES_H
#define DDSI_NWINTERFACES_H
#include <stdbool.h>
#include "dds/ddsrt/ifaddrs.h"
#include "dds/ddsrt/sockets.h"
#include "dds/ddsi/ddsi_locator.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_network_interface {
ddsi_locator_t loc; // actual interface address
ddsi_locator_t extloc; // interface address to advertise in discovery
ddsi_locator_t netmask;
uint32_t if_index;
unsigned mc_capable: 1;
unsigned mc_flaky: 1;
unsigned point_to_point: 1;
unsigned loopback: 1;
unsigned link_local: 1;
unsigned prefer_multicast: 1;
unsigned is_psmx: 1;
uint32_t allow_multicast;
int32_t priority;
char *name;
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_NWINTERFACES_H */
+161
View File
@@ -0,0 +1,161 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_PARTICIPANT_H
#define DDSI_PARTICIPANT_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/log.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_inverse_uint32_set.h"
#include "dds/ddsi/ddsi_plist.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* Set this flag in new_participant to prevent the creation SPDP, SEDP
and PMD readers for that participant. It doesn't really need it,
they all share the information anyway. But you do need it once. */
#define RTPS_PF_NO_BUILTIN_READERS 1u
/* Set this flag to prevent the creation of SPDP, SEDP and PMD
writers. It will then rely on the "privileged participant", which
must exist at the time of creation. It creates a reference to that
"privileged participant" to ensure it won't disappear too early. */
#define RTPS_PF_NO_BUILTIN_WRITERS 2u
/* Set this flag to mark the participant as the "privileged
participant", there can only be one of these. The privileged
participant MUST have all builtin readers and writers. */
#define RTPS_PF_PRIVILEGED_PP 4u
/* Set this flag to mark the participant as is_ddsi2_pp. */
#define RTPS_PF_IS_DDSI2_PP 8u
/* Set this flag to mark the participant as an local entity only. */
#define RTPS_PF_ONLY_LOCAL 16u
/* Set this flag to mark that no privileged participant should be used
for the built-in readers and writers. Can be used with NO_BUILTIN_READER and
NO_BUILTIN_WRITER flag to avoid any communication for built-in topics. */
#define RTPS_PF_NO_PRIVILEGED_PP 32u
struct ddsi_avail_entityid_set {
struct ddsi_inverse_uint32_set x;
};
enum ddsi_participant_state {
DDSI_PARTICIPANT_STATE_INITIALIZING,
DDSI_PARTICIPANT_STATE_OPERATIONAL,
DDSI_PARTICIPANT_STATE_DELETE_STARTED,
DDSI_PARTICIPANT_STATE_DELETING_BUILTINS
};
struct ddsi_participant
{
struct ddsi_entity_common e;
uint32_t bes; /* built-in endpoint set */
unsigned is_ddsi2_pp: 1; /* true for the "federation leader", the ddsi2 participant itself in OSPL; FIXME: probably should use this for broker mode as well ... */
uint32_t flags; /* flags used when creating this participant */
struct ddsi_plist *plist; /* settings/QoS for this participant */
struct ddsi_serdata *spdp_serdata; /* SPDP message: we no longer have a writer for it */
ddsi_seqno_t spdp_seqno; /* sequence number of spdp_serdata; FIXME: move seqno into serdata and delete this */
struct ddsi_xevent *pmd_update_xevent; /* timed event for periodically publishing ParticipantMessageData */
ddsi_locator_t m_locator; /* this is always a unicast address, it is set if it is in the many unicast mode */
struct ddsi_tran_conn * m_conn; /* this is connection to m_locator, if it is set, this is used */
struct ddsi_avail_entityid_set avail_entityids; /* available entity ids [e.lock] */
ddsrt_mutex_t refc_lock;
int32_t user_refc; /* number of non-built-in endpoints in this participant [refc_lock] */
int32_t builtin_refc; /* number of built-in endpoints in this participant [refc_lock] */
enum ddsi_participant_state state; /* current state of this participant [refc_lock] */
ddsrt_fibheap_t ldur_auto_wr; /* Heap that contains lease duration for writers with automatic liveliness in this participant */
ddsrt_atomic_voidp_t minl_man; /* clone of min(leaseheap_man) */
ddsrt_fibheap_t leaseheap_man; /* keeps leases for this participant's writers (with liveliness manual-by-participant) */
#ifdef DDS_HAS_SECURITY
struct ddsi_participant_sec_attributes *sec_attr;
ddsi_security_info_t security_info;
#endif
};
/**
* @brief Generates a new participant GUID
*
* @param[out] ppguid The generated participant GUID
* @param[in] gv Domain globals
*/
void ddsi_generate_participant_guid (ddsi_guid_t *ppguid, struct ddsi_domaingv *gv);
/**
* @brief Create a new participant with a specified GUID
* @component ddsi_participant
*
* @param[in] ppguid The GUID for the new participant
* @param[in] gv Domain globals
* @param[in] flags
* Zero or more of:
* - RTPS_PF_NO_BUILTIN_READERS do not create discovery readers in new ppant
* - RTPS_PF_NO_BUILTIN_WRITERS do not create discvoery writers in new ppant
* - RTPS_PF_PRIVILEGED_PP FIXME: figure out how to describe this ...
* - RTPS_PF_IS_DDSI2_PP FIXME: OSPL holdover - there is no DDSI2E here
* - RTPS_PF_ONLY_LOCAL FIXME: not used, it seems
* @param[in] plist Parameters/QoS for this participant
*
* @returns A dds_return_t indicating success or failure.
*
* @retval DDS_RETCODE_OK
* Success
* @retval DDS_RETCODE_OUT_OF_RESOURCES
* The configured maximum number of participants has been reached.
*/
dds_return_t ddsi_new_participant (ddsi_guid_t *ppguid, struct ddsi_domaingv *gv, unsigned flags, const struct ddsi_plist *plist);
/**
* @component ddsi_participant
*
* Initiate the deletion of the participant:
* - dispose/unregister built-in topic
* - list it as one of the recently deleted participants
* - remote it from the GUID hash tables
* - schedule the scare stuff to really delete it via the GC
*
* It is ok to call delete_participant without deleting all DDSI-level
* readers/writers: those will simply be deleted. (New ones can't be
* created anymore because the participant can no longer be located via
* the hash tables).
*
* @param[in] ppguid
* GUID of the participant to be deleted.
*
* @returns A dds_return_t indicating success or failure.
*
* @retval DDS_RETCODE_OK
* Success, it is no longer visible and GC events have
* been scheduled for eventual deleting of all remaining
* readers and writers and freeing of memory
* @retval DDS_RETCODE_BAD_PARAMETER
* ppguid lookup failed.
*/
dds_return_t ddsi_delete_participant (struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid);
/**
* @brief Updates the parameters list for this participant and trigger sending an updated SPDP message.
* @component ddsi_participant
*
* @param[in] pp The participant
* @param[in] plist The new parameters
*/
void ddsi_update_participant_plist (struct ddsi_participant *pp, const struct ddsi_plist *plist);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PARTICIPANT_H */
+183
View File
@@ -0,0 +1,183 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_PLIST_H
#define DDSI_PLIST_H
#include "dds/ddsrt/bswap.h"
#include "dds/ddsi/ddsi_feature_check.h"
#include "dds/ddsi/ddsi_xqos.h"
#include "dds/ddsi/ddsi_keyhash.h"
#include "dds/ddsi/ddsi_tran.h" /* FIXME: eliminate */
#include "dds/ddsi/ddsi_protocol.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* For locators one could patch the received message data to create
singly-linked lists (parameter header -> offset of next entry in
list relative to current), allowing aliasing of the data. But that
requires modifying the data. For string sequences the length does
the same thing. */
struct ddsi_locators_one {
struct ddsi_locators_one *next;
ddsi_locator_t loc;
};
typedef struct ddsi_locators {
uint32_t n;
struct ddsi_locators_one *first;
struct ddsi_locators_one *last;
} ddsi_locators_t;
#ifdef DDS_HAS_SECURITY
typedef struct ddsi_tag {
char *name;
char *value;
} ddsi_tag_t;
typedef struct ddsi_tagseq {
uint32_t n;
ddsi_tag_t *tags;
} ddsi_tagseq_t;
typedef struct ddsi_datatags {
ddsi_tagseq_t tags;
} ddsi_datatags_t;
typedef struct ddsi_dataholder {
char *class_id;
dds_propertyseq_t properties;
dds_binarypropertyseq_t binary_properties;
} ddsi_dataholder_t;
typedef struct ddsi_dataholderseq {
uint32_t n;
ddsi_dataholder_t *tags;
} ddsi_dataholderseq_t;
typedef ddsi_dataholder_t ddsi_token_t;
/* Used for both ddsi_participant_security_info and ddsi_endpoint_security_info. */
typedef struct ddsi_security_info
{
uint32_t security_attributes;
uint32_t plugin_security_attributes;
} ddsi_security_info_t;
#else /* DDS_HAS_SECURITY */
struct ddsi_security_info;
typedef struct ddsi_security_info ddsi_security_info_t;
#endif /* DDS_HAS_SECURITY */
#ifdef DDSRT_HAVE_SSM
typedef struct ddsi_reader_favours_ssm {
uint32_t state; /* default is false */
} ddsi_reader_favours_ssm_t;
#endif /* DDSRT_HAVE_SSM */
typedef struct ddsi_adlink_participant_version_info
{
uint32_t version;
uint32_t flags;
uint32_t unused[3];
char *internals;
} ddsi_adlink_participant_version_info_t;
typedef struct ddsi_plist {
uint64_t present;
uint64_t aliased;
dds_qos_t qos;
ddsi_protocol_version_t protocol_version;
ddsi_vendorid_t vendorid;
ddsi_locators_t unicast_locators;
ddsi_locators_t multicast_locators;
ddsi_locators_t default_unicast_locators;
ddsi_locators_t default_multicast_locators;
ddsi_locators_t metatraffic_unicast_locators;
ddsi_locators_t metatraffic_multicast_locators;
unsigned char expects_inline_qos;
ddsi_count_t participant_manual_liveliness_count;
uint32_t participant_builtin_endpoints;
/* ddsi_content_filter_property_t content_filter_property; */
ddsi_guid_t participant_guid;
ddsi_guid_t endpoint_guid;
ddsi_guid_t group_guid;
ddsi_guid_t topic_guid;
#if 0 /* reserved, rather than NIY */
ddsi_entityid_t participant_entityid;
ddsi_entityid_t group_entityid;
#endif
uint32_t builtin_endpoint_set;
/* int type_max_size_serialized; */
ddsi_keyhash_t keyhash;
uint32_t statusinfo;
ddsi_adlink_participant_version_info_t adlink_participant_version_info;
#ifdef DDS_HAS_SECURITY
ddsi_token_t identity_token;
ddsi_token_t permissions_token;
ddsi_security_info_t endpoint_security_info;
ddsi_security_info_t participant_security_info;
ddsi_token_t identity_status_token;
ddsi_datatags_t data_tags;
#endif
#ifdef DDSRT_HAVE_SSM
ddsi_reader_favours_ssm_t reader_favours_ssm;
#endif
uint32_t domain_id;
char *domain_tag;
uint32_t cyclone_receive_buffer_size;
unsigned char cyclone_requests_keyhash;
unsigned char cyclone_redundant_networking;
} ddsi_plist_t;
/**
* @brief Initialize a ddsi_plist_t as an empty object
* @component parameter_list
*
* In principle, this only clears the "present" and "aliased" bitmasks. A debug build
* additionally initializes all other bytes to 0x55.
*
* @param[out] dest plist_t to be initialized.
*/
DDS_EXPORT void ddsi_plist_init_empty (ddsi_plist_t *dest);
/**
* @brief Free memory owned by "ps"
* @component parameter_list
*
* A ddsi_plist_t may own other allocated blocks of memory, depending on which fields are
* set, their types and whether they are marked as "aliased". This function releases any
* such memory owned by "ps", but not "ps" itself. Afterward, the contents of "ps" is
* undefined and must not be used again without initialising it (either via
* `ddsi_plist_init_empty`, `ddsi_plist_init_frommsg` or `ddsi_plist_copy`.
*
* @param[in] ps ddsi_plist_t for which to free memory
*/
DDS_EXPORT void ddsi_plist_fini (ddsi_plist_t *ps);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PLIST_H */
+30
View File
@@ -0,0 +1,30 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_PMD_H
#define DDSI_PMD_H
#include <stdint.h>
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_domaingv;
struct ddsi_guid;
/** @component pmd */
void ddsi_write_pmd_message_guid (struct ddsi_domaingv * const gv, struct ddsi_guid *pp_guid, unsigned pmd_kind);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PMD_H */
+46
View File
@@ -0,0 +1,46 @@
// Copyright(c) 2019 to 2020 ZettaScale Technology 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
#ifndef DDSI_PORTMAPPING_H
#define DDSI_PORTMAPPING_H
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined (__cplusplus)
extern "C" {
#endif
enum ddsi_port {
DDSI_PORT_MULTI_DISC,
DDSI_PORT_MULTI_DATA,
DDSI_PORT_UNI_DISC,
DDSI_PORT_UNI_DATA
};
struct ddsi_portmapping {
uint32_t base;
uint32_t dg;
uint32_t pg;
uint32_t d0;
uint32_t d1;
uint32_t d2;
uint32_t d3;
};
/** @component port_mapping */
DDS_EXPORT bool ddsi_get_port_int (uint32_t *port, const struct ddsi_portmapping *map, enum ddsi_port which, uint32_t domain_id, int32_t participant_index, char *str_if_overflow, size_t strsize);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PORTMAPPING_H */
+245
View File
@@ -0,0 +1,245 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_PROTOCOL_H
#define DDSI_PROTOCOL_H
#include "dds/ddsrt/endian.h"
#include "dds/ddsrt/misc.h"
#include "dds/ddsi/ddsi_feature_check.h"
#include "dds/ddsi/ddsi_locator.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define DDSI_STATUSINFO_DISPOSE 0x1u
#define DDSI_STATUSINFO_UNREGISTER 0x2u
#define DDSI_STATUSINFO_STANDARDIZED (DDSI_STATUSINFO_DISPOSE | DDSI_STATUSINFO_UNREGISTER)
#define DDSI_STATUSINFO_OSPL_AUTO 0x10000000u /* OSPL extension, not on the wire */
#define DDSI_STATUSINFOX_OSPL_AUTO 0x1 /* statusinfo word 2, OSPL L_AUTO flag on the wire */
#define DDSI_LOCATOR_KIND_INVALID -1
#define DDSI_LOCATOR_KIND_RESERVED 0
#define DDSI_LOCATOR_KIND_UDPv4 1
#define DDSI_LOCATOR_KIND_UDPv6 2
#define DDSI_LOCATOR_KIND_TCPv4 4
#define DDSI_LOCATOR_KIND_TCPv6 8
#define DDSI_LOCATOR_KIND_PSMX 16
#define DDSI_LOCATOR_KIND_RAWETH 0x02000000
#define DDSI_LOCATOR_KIND_UDPv4MCGEN 0x4fff0000
#define DDSI_LOCATOR_PORT_INVALID 0
// The maximum size of the index in a MCGEN locator, so that it can be stored in a cover_info_t
#define DDSI_LOCATOR_UDPv4MCGEN_INDEX_MASK_BITS 12
typedef uint32_t ddsi_count_t;
typedef struct ddsi_protocol_version {
uint8_t major, minor;
} ddsi_protocol_version_t;
typedef uint64_t ddsi_seqno_t;
#define DDSI_MAX_SEQ_NUMBER INT64_MAX
#define PGUIDPREFIX(gp) (gp).u[0], (gp).u[1], (gp).u[2]
#define PGUID(g) PGUIDPREFIX ((g).prefix), (g).entityid.u
#define PGUIDPREFIXFMT "%" PRIx32 ":%" PRIx32 ":%" PRIx32
#define PGUIDFMT PGUIDPREFIXFMT ":%" PRIx32
typedef struct {
uint8_t id[2];
} ddsi_vendorid_t;
typedef struct ddsi_protocolid {
uint8_t id[4];
} ddsi_protocolid_t;
typedef struct ddsi_rtps_header {
ddsi_protocolid_t protocol;
ddsi_protocol_version_t version;
ddsi_vendorid_t vendorid;
ddsi_guid_prefix_t guid_prefix;
} ddsi_rtps_header_t;
#define DDSI_RTPS_MESSAGE_HEADER_SIZE (sizeof (ddsi_rtps_header_t))
typedef struct ddsi_rtps_submessage_header {
uint8_t submessageId;
uint8_t flags;
uint16_t octetsToNextHeader;
} ddsi_rtps_submessage_header_t;
#define DDSI_RTPS_SUBMESSAGE_HEADER_SIZE (sizeof (ddsi_rtps_submessage_header_t))
#define DDSI_RTPS_SUBMESSAGE_FLAG_ENDIANNESS 0x01u
typedef enum ddsi_rtps_submessage_kind {
DDSI_RTPS_SMID_PAD = 0x01,
DDSI_RTPS_SMID_ACKNACK = 0x06,
DDSI_RTPS_SMID_HEARTBEAT = 0x07,
DDSI_RTPS_SMID_GAP = 0x08,
DDSI_RTPS_SMID_INFO_TS = 0x09,
DDSI_RTPS_SMID_INFO_SRC = 0x0c,
DDSI_RTPS_SMID_INFO_REPLY_IP4 = 0x0d,
DDSI_RTPS_SMID_INFO_DST = 0x0e,
DDSI_RTPS_SMID_INFO_REPLY = 0x0f,
DDSI_RTPS_SMID_NACK_FRAG = 0x12,
DDSI_RTPS_SMID_HEARTBEAT_FRAG = 0x13,
DDSI_RTPS_SMID_DATA = 0x15,
DDSI_RTPS_SMID_DATA_FRAG = 0x16,
/* security-specific sub messages */
DDSI_RTPS_SMID_SEC_BODY = 0x30,
DDSI_RTPS_SMID_SEC_PREFIX = 0x31,
DDSI_RTPS_SMID_SEC_POSTFIX = 0x32,
DDSI_RTPS_SMID_SRTPS_PREFIX = 0x33,
DDSI_RTPS_SMID_SRTPS_POSTFIX = 0x34,
/* vendor-specific sub messages (0x80 .. 0xff) */
DDSI_RTPS_SMID_ADLINK_MSG_LEN = 0x81,
DDSI_RTPS_SMID_ADLINK_ENTITY_ID = 0x82
} ddsi_rtps_submessage_kind_t;
typedef struct ddsi_rtps_info_src {
ddsi_rtps_submessage_header_t smhdr;
unsigned unused;
ddsi_protocol_version_t version;
ddsi_vendorid_t vendorid;
ddsi_guid_prefix_t guid_prefix;
} ddsi_rtps_info_src_t;
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
#define DDSI_RTPS_CDR_BE 0x0000u
#define DDSI_RTPS_CDR_LE 0x0100u
#define DDSI_RTPS_PL_CDR_BE 0x0200u
#define DDSI_RTPS_PL_CDR_LE 0x0300u
#define DDSI_RTPS_CDR2_BE 0x0600u
#define DDSI_RTPS_CDR2_LE 0x0700u
#define DDSI_RTPS_D_CDR2_BE 0x0800u
#define DDSI_RTPS_D_CDR2_LE 0x0900u
#define DDSI_RTPS_PL_CDR2_BE 0x0a00u
#define DDSI_RTPS_PL_CDR2_LE 0x0b00u
#define DDSI_RTPS_SAMPLE_NATIVE 0x00c0u
#define DDSI_RTPS_CDR_ENC_LE(x) (assert((x) != DDSI_RTPS_SAMPLE_NATIVE), ((x) & 0x0100) == 0x0100)
#define DDSI_RTPS_CDR_ENC_IS_NATIVE(x) (DDSI_RTPS_CDR_ENC_LE ((x)))
#define DDSI_RTPS_CDR_ENC_IS_VALID(x) (!((x) > DDSI_RTPS_PL_CDR2_LE || (x) == DDSI_RTPS_SAMPLE_NATIVE || (x) == 0x0400 || (x) == 0x0500))
#define DDSI_RTPS_CDR_ENC_TO_NATIVE(x) (assert((x) != DDSI_RTPS_SAMPLE_NATIVE), ((x) | 0x0100))
#else
#define DDSI_RTPS_CDR_BE 0x0000u
#define DDSI_RTPS_CDR_LE 0x0001u
#define DDSI_RTPS_PL_CDR_BE 0x0002u
#define DDSI_RTPS_PL_CDR_LE 0x0003u
#define DDSI_RTPS_CDR2_BE 0x0006u
#define DDSI_RTPS_CDR2_LE 0x0007u
#define DDSI_RTPS_D_CDR2_BE 0x0008u
#define DDSI_RTPS_D_CDR2_LE 0x0009u
#define DDSI_RTPS_PL_CDR2_BE 0x000au
#define DDSI_RTPS_PL_CDR2_LE 0x000bu
#define DDSI_RTPS_SAMPLE_NATIVE 0xc000u
#define DDSI_RTPS_CDR_ENC_LE(x) (assert((x) != DDSI_RTPS_SAMPLE_NATIVE), ((x) & 0x0001) == 0x0001)
#define DDSI_RTPS_CDR_ENC_IS_NATIVE(x) (!DDSI_RTPS_CDR_ENC_LE ((x)))
#define DDSI_RTPS_CDR_ENC_IS_VALID(x) (!((x) > DDSI_RTPS_PL_CDR2_LE || (x) == DDSI_RTPS_SAMPLE_NATIVE || (x) == 0x0004 || (x) == 0x0005))
#define DDSI_RTPS_CDR_ENC_TO_NATIVE(x) (assert((x) != DDSI_RTPS_SAMPLE_NATIVE), ((x) & ~0x0001))
#endif
typedef struct ddsi_rtps_msg_len {
ddsi_rtps_submessage_header_t smhdr;
uint32_t length;
} ddsi_rtps_msg_len_t;
#define DDSI_PARTICIPANT_MESSAGE_DATA_KIND_UNKNOWN 0x0u
#define DDSI_PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE 0x1u
#define DDSI_PARTICIPANT_MESSAGE_DATA_KIND_MANUAL_LIVELINESS_UPDATE 0x2u
#define DDSI_PARTICIPANT_MESSAGE_DATA_VENDOR_SPECIFIC_KIND_FLAG 0x8000000u
/* predefined entity ids; here viewed as an unsigned int, on the
network as four bytes corresponding to the integer in network byte
order */
#define DDSI_ENTITYID_UNKNOWN 0x0
#define DDSI_ENTITYID_PARTICIPANT 0x1c1
#define DDSI_ENTITYID_SEDP_BUILTIN_TOPIC_WRITER 0x2c2
#define DDSI_ENTITYID_SEDP_BUILTIN_TOPIC_READER 0x2c7
#define DDSI_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER 0x3c2
#define DDSI_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER 0x3c7
#define DDSI_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER 0x4c2
#define DDSI_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER 0x4c7
#define DDSI_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER 0x100c2
#define DDSI_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER 0x100c7
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER 0x200c2
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER 0x200c7
#define DDSI_ENTITYID_TL_SVC_BUILTIN_REQUEST_WRITER 0x300c3
#define DDSI_ENTITYID_TL_SVC_BUILTIN_REQUEST_READER 0x300c4
#define DDSI_ENTITYID_TL_SVC_BUILTIN_REPLY_WRITER 0x301c3
#define DDSI_ENTITYID_TL_SVC_BUILTIN_REPLY_READER 0x301c4
#define DDSI_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER 0xff0003c2
#define DDSI_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_READER 0xff0003c7
#define DDSI_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER 0xff0004c2
#define DDSI_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER 0xff0004c7
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_MESSAGE_WRITER 0x201c3
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_MESSAGE_READER 0x201c4
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER 0xff0200c2
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER 0xff0200c7
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_WRITER 0xff0202c3
#define DDSI_ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_READER 0xff0202c4
#define DDSI_ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_WRITER 0xff0101c2
#define DDSI_ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_READER 0xff0101c7
#define DDSI_ENTITYID_SOURCE_MASK 0xc0
#define DDSI_ENTITYID_SOURCE_USER 0x00
#define DDSI_ENTITYID_SOURCE_BUILTIN 0xc0
#define DDSI_ENTITYID_SOURCE_VENDOR 0x40
#define DDSI_ENTITYID_KIND_MASK 0x3f
#define DDSI_ENTITYID_KIND_WRITER_WITH_KEY 0x02
#define DDSI_ENTITYID_KIND_WRITER_NO_KEY 0x03
#define DDSI_ENTITYID_KIND_READER_NO_KEY 0x04
#define DDSI_ENTITYID_KIND_READER_WITH_KEY 0x07
/* Entity kind topic is not defined in the RTPS spec, so the following two
should to be used as vendor specific entities using DDSI_ENTITYID_SOURCE_VENDOR.
Two entity kinds for built-in and user topics are required, because the
vendor and built-in flags cannot be combined. */
#define DDSI_ENTITYID_KIND_CYCLONE_TOPIC_BUILTIN 0x0c
#define DDSI_ENTITYID_KIND_CYCLONE_TOPIC_USER 0x0d
#define DDSI_ENTITYID_ALLOCSTEP 0x100
/* Names of the built-in topics */
#define DDS_BUILTIN_TOPIC_PARTICIPANT_NAME "DCPSParticipant"
#define DDS_BUILTIN_TOPIC_PUBLICATION_NAME "DCPSPublication"
#define DDS_BUILTIN_TOPIC_SUBSCRIPTION_NAME "DCPSSubscription"
#define DDS_BUILTIN_TOPIC_TOPIC_NAME "DCPSTopic"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_MESSAGE_NAME "DCPSParticipantMessage"
#define DDS_BUILTIN_TOPIC_TYPELOOKUP_REQUEST_NAME "DCPSTypeLookupRequest"
#define DDS_BUILTIN_TOPIC_TYPELOOKUP_REPLY_NAME "DCPSTypeLookupReply"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_SECURE_NAME "DCPSParticipantsSecure"
#define DDS_BUILTIN_TOPIC_PUBLICATION_SECURE_NAME "DCPSPublicationsSecure"
#define DDS_BUILTIN_TOPIC_SUBSCRIPTION_SECURE_NAME "DCPSSubscriptionsSecure"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_MESSAGE_SECURE_NAME "DCPSParticipantMessageSecure"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_STATELESS_MESSAGE_NAME "DCPSParticipantStatelessMessage"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_VOLATILE_MESSAGE_SECURE_NAME "DCPSParticipantVolatileMessageSecure"
/* Participant built-in topic qos properties */
#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_PROCESS_NAME "__ProcessName"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_PID "__Pid"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_HOSTNAME "__Hostname"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_NETWORKADDRESSES "__NetworkAddresses"
#define DDS_BUILTIN_TOPIC_PARTICIPANT_DEBUG_MONITOR "__DebugMonitor"
#define DDS_BUILTIN_TOPIC_NULL_NAME NULL
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PROTOCOL_H */
+151
View File
@@ -0,0 +1,151 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_PROXY_ENDPOINT_H
#define DDSI_PROXY_ENDPOINT_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsi/ddsi_guid.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_lease.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_proxy_participant;
struct ddsi_proxy_reader;
struct ddsi_writer;
struct dds_qos;
struct ddsi_addrset;
struct ddsi_serdata;
struct ddsi_proxy_endpoint_common
{
struct ddsi_proxy_participant *proxypp; /* counted backref to proxy participant */
struct ddsi_proxy_endpoint_common *next_ep; /* next \ endpoint belonging to this proxy participant */
struct ddsi_proxy_endpoint_common *prev_ep; /* prev / -- this is in arbitrary ordering */
struct dds_qos *xqos; /* proxy endpoint QoS lives here; FIXME: local ones should have it moved to common as well */
struct ddsi_addrset *as; /* address set to use for communicating with this endpoint */
ddsi_xlocator_t loc_uc; /* preferred address for sending unicast */
ddsi_guid_t group_guid; /* 0:0:0:0 if not available */
ddsi_vendorid_t vendor; /* cached from proxypp->vendor */
ddsi_seqno_t seq; /* sequence number of most recent SEDP message */
#ifdef DDS_HAS_TYPELIB
struct ddsi_type_pair *type_pair;
#endif
#ifdef DDS_HAS_SECURITY
ddsi_security_info_t security_info;
#endif
};
struct ddsi_generic_proxy_endpoint {
struct ddsi_entity_common e;
struct ddsi_proxy_endpoint_common c;
};
struct ddsi_proxy_writer {
struct ddsi_entity_common e;
struct ddsi_proxy_endpoint_common c;
ddsrt_avl_tree_t readers; /* matching LOCAL readers, see pwr_rd_match */
int32_t n_reliable_readers; /* number of those that are reliable */
int32_t n_readers_out_of_sync; /* number of those that require special handling (accepting historical data, waiting for historical data set to become complete) */
ddsi_seqno_t last_seq; /* highest known seq published by the writer, not last delivered */
uint32_t last_fragnum; /* last known frag for last_seq, or UINT32_MAX if last_seq not partial */
ddsi_count_t nackfragcount; /* last nackfrag seq number */
ddsrt_atomic_uint32_t next_deliv_seq_lowword; /* lower 32-bits for next sequence number that will be delivered; for generating acks; 32-bit so atomic reads on all supported platforms */
unsigned deliver_synchronously: 1; /* iff 1, delivery happens straight from receive thread for non-historical data; else through delivery queue "dqueue" */
unsigned have_seen_heartbeat: 1; /* iff 1, we have received at least on heartbeat from this proxy writer */
unsigned local_matching_inprogress: 1; /* iff 1, we are still busy matching local readers; this is so we don't deliver incoming data to some but not all readers initially */
unsigned alive: 1; /* iff 1, the proxy writer is alive (lease for this proxy writer is not expired); field may be modified only when holding both pwr->e.lock and pwr->c.proxypp->e.lock */
unsigned filtered: 1; /* iff 1, builtin proxy writer uses content filter, which affects heartbeats and gaps. */
unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */
#ifdef DDSRT_HAVE_SSM
unsigned supports_ssm: 1; /* iff 1, this proxy writer supports SSM */
#endif
unsigned local_psmx: 1; /* whether this is a proxy writer for a local PSMX */
uint32_t alive_vclock; /* virtual clock counting transitions between alive/not-alive */
struct ddsi_defrag *defrag; /* defragmenter for this proxy writer; FIXME: perhaps shouldn't be for historical data */
struct ddsi_reorder *reorder; /* message reordering for this proxy writer, out-of-sync readers can have their own, see pwr_rd_match */
struct ddsi_dqueue *dqueue; /* delivery queue for asynchronous delivery (historical data is always delivered asynchronously) */
struct ddsi_xeventq *evq; /* timed event queue to be used for ACK generation */
struct ddsi_local_reader_ary rdary; /* LOCAL readers for fast-pathing; if not fast-pathed, fall back to scanning local_readers */
struct ddsi_lease *lease;
};
typedef int (*ddsi_filter_fn_t)(struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, struct ddsi_serdata *serdata);
struct ddsi_proxy_reader {
struct ddsi_entity_common e;
struct ddsi_proxy_endpoint_common c;
unsigned deleting: 1; /* set when being deleted */
unsigned is_fict_trans_reader: 1; /* only true when it is certain that is a fictitious transient data reader (affects built-in topic generation) */
unsigned requests_keyhash: 1; /* 1 iff this reader would like to receive keyhashes */
unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */
#ifdef DDSRT_HAVE_SSM
unsigned favours_ssm: 1; /* iff 1, this proxy reader favours SSM when available */
#endif
unsigned local_psmx: 1; /*whether this is a proxy reader for a local PSMX*/
ddsrt_avl_tree_t writers; /* matching LOCAL writers */
uint32_t receive_buffer_size; /* assumed receive buffer size inherited from proxypp */
ddsi_filter_fn_t filter;
};
/**
* @brief To create a new proxy writer
* @component ddsi_proxy_endpoint
*
* @param proxy_writer out parameter for the created proxy writer
* @param gv domain globals
* @param ppguid the proxy participant is determined from the GUID and must exist
* @param guid guid for the proxy writer
* @param as address set
* @param plist parameter list
* @param dqueue receive queue
* @param evq event queue
* @param timestamp timestamp to be used as creation time for the proxy writer
* @param seq sequence number
* @returns 0 on success
*/
DDS_EXPORT int ddsi_new_proxy_writer (struct ddsi_proxy_writer **proxy_writer, struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid, const struct ddsi_guid *guid, struct ddsi_addrset *as, const struct ddsi_plist *plist, struct ddsi_dqueue *dqueue, struct ddsi_xeventq *evq, ddsrt_wctime_t timestamp, ddsi_seqno_t seq);
/**
* @brief To create a new proxy reader
* @component ddsi_proxy_endpoint
*
* @param proxy_reader out parameter for the created proxy reader
* @param gv domain globals
* @param ppguid the proxy participant is determined from the GUID and must exist
* @param guid guid for the proxy reader
* @param as address set
* @param plist parameter list
* @param timestamp timestamp to be used as creation time for the proxy reader
* @param seq sequence number
* @param favours_ssm indicates if the proxy reader favors ssm
* @return int
*/
DDS_EXPORT int ddsi_new_proxy_reader (struct ddsi_proxy_reader **proxy_reader, struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid, const struct ddsi_guid *guid, struct ddsi_addrset *as, const struct ddsi_plist *plist, ddsrt_wctime_t timestamp, ddsi_seqno_t seq
#ifdef DDSRT_HAVE_SSM
, int favours_ssm
#endif
);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PROXY_ENDPOINT_H */
@@ -0,0 +1,78 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_PROXY_PARTICIPANT_H
#define DDSI_PROXY_PARTICIPANT_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/fibheap.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_topic.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_lease;
struct ddsi_plist;
struct ddsi_addrset;
struct ddsi_proxy_endpoint_common;
struct ddsi_proxy_participant
{
struct ddsi_entity_common e;
uint32_t refc; /* number of proxy endpoints (both user & built-in; not groups, they don't have a life of their own) */
ddsi_vendorid_t vendor; /* vendor code from discovery */
unsigned bes; /* built-in endpoint set */
ddsi_guid_t privileged_pp_guid; /* if this PP depends on another PP for its SEDP writing */
struct ddsi_plist *plist; /* settings/QoS for this participant */
ddsrt_atomic_voidp_t minl_auto; /* clone of min(leaseheap_auto) */
ddsrt_fibheap_t leaseheap_auto; /* keeps leases for this proxypp and leases for pwrs (with liveliness automatic) */
ddsrt_atomic_voidp_t minl_man; /* clone of min(leaseheap_man) */
ddsrt_fibheap_t leaseheap_man; /* keeps leases for this proxypp and leases for pwrs (with liveliness manual-by-participant) */
struct ddsi_lease *lease; /* lease for this proxypp */
struct ddsi_addrset *as_default; /* default address set to use for user data traffic */
struct ddsi_addrset *as_meta; /* default address set to use for discovery traffic */
struct ddsi_proxy_endpoint_common *endpoints; /* all proxy endpoints can be reached from here */
#ifdef DDS_HAS_TOPIC_DISCOVERY
ddsrt_avl_tree_t topics;
#endif
ddsi_seqno_t seq; /* sequence number of most recent SPDP message */
uint32_t receive_buffer_size; /* assumed size of receive buffer, used to limit bursts involving this proxypp */
unsigned implicitly_created : 1; /* participants are implicitly created for Cloud/Fog discovered endpoints */
unsigned is_ddsi2_pp: 1; /* if this is the federation-leader on the remote node */
unsigned minimal_bes_mode: 1;
unsigned lease_expired: 1;
unsigned deleting: 1;
unsigned proxypp_have_spdp: 1;
unsigned owns_lease: 1;
unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */
#ifdef DDS_HAS_SECURITY
ddsi_security_info_t security_info;
struct ddsi_proxy_participant_sec_attributes *sec_attr;
#endif
};
#ifdef DDS_HAS_TOPIC_DISCOVERY
extern const ddsrt_avl_treedef_t ddsi_proxypp_proxytp_treedef;
#endif
/** @component ddsi_proxy_participant */
DDS_EXPORT bool ddsi_new_proxy_participant (struct ddsi_proxy_participant **proxy_participant, struct ddsi_domaingv *gv, const struct ddsi_guid *guid, uint32_t bes, const struct ddsi_guid *privileged_pp_guid, struct ddsi_addrset *as_default, struct ddsi_addrset *as_meta, const struct ddsi_plist *plist, dds_duration_t tlease_dur, ddsi_vendorid_t vendor, unsigned custom_flags, ddsrt_wctime_t timestamp, ddsi_seqno_t seq);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_PROXY_PARTICIPANT_H */
+32
View File
@@ -0,0 +1,32 @@
// Copyright(c) 2023 ZettaScale Technology 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
#ifndef DDSI_PSMX_H
#define DDSI_PSMX_H
#include "dds/ddsi/ddsi_locator.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_psmx_instance_locators {
uint32_t length;
struct {
char *psmx_instance_name;
ddsi_locator_t locator;
} *instances;
};
#if defined (__cplusplus)
}
#endif
#endif // DDSI_PSMX_H
+75
View File
@@ -0,0 +1,75 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_QOSMATCH_H
#define DDSI_QOSMATCH_H
#include "dds/features.h"
#include "dds/ddsi/ddsi_typelib.h"
#include "dds/ddsi/ddsi_xqos.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_domaingv;
/**
* @brief perform reader/writer QoS (and topic name, type name, partition) matching
* @component qos_matching
*
* @param gv domain globals
* @param rd_qos reader qos
* @param wr_qos writer qos
* @param mask can be used to exclude some of these (including topic name and type name, so be careful!)
* @param 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)
* @param rd_type_pair minimal and complete ddsi type for the reader
* @param wr_type_pair minimal and complete ddsi type for the writer
* @param rd_typeid_req_lookup is set to true in case the matching cannot be completed because of missing type information. A type-lookup request is required to get the details of the type to do the qos matching (e.g. check assignability)
* @param wr_typeid_req_lookup see rd_typeid_req_lookup
*
* @returns true in case of a match, false otherwise
*/
bool ddsi_qos_match_mask_p (
struct ddsi_domaingv *gv,
const dds_qos_t *rd_qos,
const dds_qos_t *wr_qos,
uint64_t mask,
dds_qos_policy_id_t *reason
#ifdef DDS_HAS_TYPELIB
, const struct ddsi_type_pair *rd_type_pair
, const struct ddsi_type_pair *wr_type_pair
#endif
#ifdef DDS_HAS_TYPE_DISCOVERY
, bool *rd_typeid_req_lookup
, bool *wr_typeid_req_lookup
#endif
);
/** @component qos_matching */
bool ddsi_qos_match_p (
struct ddsi_domaingv *gv,
const dds_qos_t *rd_qos,
const dds_qos_t *wr_qos,
dds_qos_policy_id_t *reason
#ifdef DDS_HAS_TYPELIB
, const struct ddsi_type_pair *rd_type_pair
, const struct ddsi_type_pair *wr_type_pair
#endif
#ifdef DDS_HAS_TYPE_DISCOVERY
, bool *rd_typeid_req_lookup
, bool *wr_typeid_req_lookup
#endif
);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_QOSMATCH_H */
+135
View File
@@ -0,0 +1,135 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_RADMIN_H
#define DDSI_RADMIN_H
#include <stddef.h>
#include "dds/ddsrt/time.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/threads.h"
#include "dds/ddsrt/align.h"
#include "dds/ddsrt/static_assert.h"
#include "dds/ddsi/ddsi_locator.h"
#include "dds/ddsi/ddsi_protocol.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_rbuf;
struct ddsi_rmsg;
struct ddsi_rdata;
struct ddsi_rsample_info;
struct ddsi_tran_conn;
struct ddsi_rmsg_chunk {
struct ddsi_rbuf *rbuf;
struct ddsi_rmsg_chunk *next;
/* Size is 0 after initial allocation, must be set with
ddsi_rmsg_setsize after receiving a packet from the kernel and
before processing it. */
union {
uint32_t size;
/* to ensure reasonable alignment of payload */
int64_t l;
double d;
void *p;
} u;
/* unsigned char payload[] -- disallowed by C99 because of nesting */
};
struct ddsi_rmsg {
/* Reference count: all references to rdatas of this message are
counted. The rdatas themselves do not have a reference count.
The refcount is biased by RMSG_REFCOUNT_UNCOMMITED_BIAS while
still being inserted to allow verifying it is still uncommitted
when allocating memory, increasing refcounts, &c.
Each rdata adds RMS_REFCOUNT_RDATA_BIAS when it leaves
defragmentation until it has been rejected by reordering or has
been scheduled for delivery. This allows delaying the
decrementing of refcounts until after a sample has been added to
all radmins even though be delivery of it may take place in
concurrently. */
ddsrt_atomic_uint32_t refcount;
/* Worst-case memory requirement is gigantic (64kB UDP packet, only
1-byte final fragments, each of one a new interval, or maybe 1
byte messages, destined for many readers and in each case
introducing a new interval, with receiver state changes in
between, &c.), so we can either:
- allocate a _lot_ and cover the worst case
- allocate enough for all "reasonable" cases, discarding data when that limit is hit
- dynamically add chunks of memory, and even entire receive buffers.
The latter seems the best approach, especially because it also
covers the second one. We treat the other chunks specially,
which is not strictly required but also not entirely
unreasonable, considering that the first chunk has the refcount &
the real packet. */
struct ddsi_rmsg_chunk *lastchunk;
/* whether to log */
bool trace;
struct ddsi_rmsg_chunk chunk;
};
DDSRT_STATIC_ASSERT (sizeof (struct ddsi_rmsg) == offsetof (struct ddsi_rmsg, chunk) + sizeof (struct ddsi_rmsg_chunk));
#define DDSI_RMSG_PAYLOAD(m) ((unsigned char *) (m + 1))
#define DDSI_RMSG_PAYLOADOFF(m, o) (DDSI_RMSG_PAYLOAD (m) + (o))
struct ddsi_rdata {
struct ddsi_rmsg *rmsg; /* received (and refcounted) in rmsg */
struct ddsi_rdata *nextfrag; /* fragment chain */
uint32_t min, maxp1; /* fragment as byte offsets */
uint16_t submsg_zoff; /* offset to submessage from packet start, or 0 */
uint16_t payload_zoff; /* offset to payload from packet start */
uint16_t keyhash_zoff; /* offset to keyhash from packet start, or 0 */
#ifndef NDEBUG
ddsrt_atomic_uint32_t refcount_bias_added;
#endif
};
/* All relative offsets in packets that we care about (submessage
header, payload, writer info) are at multiples of 4 bytes and
within 64kB, so technically we can make do with 14 bits instead of
16, in case we run out of space.
If we _really_ need to squeeze out every last bit, only the submsg
offset really requires 14 bits, the for the others we could use an
offset relative to the submessage header so that it is limited by
the maximum size of the inline QoS ... Defining the macros now, so
we have the option to do wild things. */
#ifndef NDEBUG
#define DDSI_ZOFF_TO_OFF(zoff) ((unsigned) (zoff))
#define DDSI_OFF_TO_ZOFF(off) (assert ((off) < 65536), ((unsigned short) (off)))
#else
#define DDSI_ZOFF_TO_OFF(zoff) ((unsigned) (zoff))
#define DDSI_OFF_TO_ZOFF(off) ((unsigned short) (off))
#endif
#define DDSI_RDATA_PAYLOAD_OFF(rdata) DDSI_ZOFF_TO_OFF ((rdata)->payload_zoff)
#define DDSI_RDATA_SUBMSG_OFF(rdata) DDSI_ZOFF_TO_OFF ((rdata)->submsg_zoff)
#define DDSI_RDATA_KEYHASH_OFF(rdata) DDSI_ZOFF_TO_OFF ((rdata)->keyhash_zoff)
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_RADMIN_H */
+71
View File
@@ -0,0 +1,71 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_RHC_H
#define DDSI_RHC_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/time.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct dds_qos;
struct ddsi_rhc;
struct ddsi_tkmap_instance;
struct ddsi_serdata;
struct ddsi_writer_info
{
ddsi_guid_t guid;
bool auto_dispose;
int32_t ownership_strength;
uint64_t iid;
#ifdef DDS_HAS_LIFESPAN
ddsrt_mtime_t lifespan_exp;
#endif
};
typedef void (*ddsi_rhc_free_t) (struct ddsi_rhc *rhc);
typedef bool (*ddsi_rhc_store_t) (struct ddsi_rhc *rhc, const struct ddsi_writer_info *wrinfo, struct ddsi_serdata *sample, struct ddsi_tkmap_instance *tk);
typedef void (*ddsi_rhc_unregister_wr_t) (struct ddsi_rhc *rhc, const struct ddsi_writer_info *wrinfo);
typedef void (*ddsi_rhc_relinquish_ownership_t) (struct ddsi_rhc *rhc, const uint64_t wr_iid);
typedef void (*ddsi_rhc_set_qos_t) (struct ddsi_rhc *rhc, const struct dds_qos *qos);
struct ddsi_rhc_ops {
ddsi_rhc_store_t store;
ddsi_rhc_unregister_wr_t unregister_wr;
ddsi_rhc_relinquish_ownership_t relinquish_ownership;
ddsi_rhc_set_qos_t set_qos;
ddsi_rhc_free_t free;
};
struct ddsi_rhc {
const struct ddsi_rhc_ops *ops;
};
/** @component rhc_if */
inline bool ddsi_rhc_store (struct ddsi_rhc *rhc, const struct ddsi_writer_info *wrinfo, struct ddsi_serdata *sample, struct ddsi_tkmap_instance *tk) {
return rhc->ops->store (rhc, wrinfo, sample, tk);
}
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_RHC_H */
+44
View File
@@ -0,0 +1,44 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_SECURITY_MSG_H
#define DDSI_SECURITY_MSG_H
#include "dds/features.h"
#ifdef DDS_HAS_SECURITY
#include "dds/ddsrt/misc.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define DDS_SECURITY_AUTH_REQUEST "dds.sec.auth_request"
#define DDS_SECURITY_AUTH_HANDSHAKE "dds.sec.auth"
#define DDS_SECURITY_AUTH_VERSION_MAJOR 1
#define DDS_SECURITY_AUTH_VERSION_MINOR 0
#define DDS_SECURITY_AUTH_TOKEN_CLASS_ID_BASE "DDS:Auth:PKI-DH:"
#define DDS_SECURITY_AUTH_TOKEN_CLASS_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID_BASE DDSRT_STRINGIFY(DDS_SECURITY_AUTH_VERSION_MAJOR) "." DDSRT_STRINGIFY(DDS_SECURITY_AUTH_VERSION_MINOR)
#define DDS_SECURITY_AUTH_REQUEST_TOKEN_CLASS_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+AuthReq"
#define DDS_SECURITY_AUTH_HANDSHAKE_REQUEST_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Req"
#define DDS_SECURITY_AUTH_HANDSHAKE_REPLY_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Reply"
#define DDS_SECURITY_AUTH_HANDSHAKE_FINAL_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Final"
#if defined (__cplusplus)
}
#endif
#endif /* DDS_HAS_SECURITY */
#endif /* DDSI_SECURITY_MSG_H */
+127
View File
@@ -0,0 +1,127 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_OMG_SECURITY_H
#define DDSI_OMG_SECURITY_H
#include "dds/features.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_participant.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_xqos.h"
#if defined (__cplusplus)
extern "C" {
#endif
#ifdef DDS_HAS_SECURITY
/**
* @brief Check if security is enabled for the participant.
* @component security_entity
*
* @param[in] pp Participant to check if it is secure.
*
* @returns bool True if participant is secure
*/
bool ddsi_omg_participant_is_secure(const struct ddsi_participant *pp);
/**
* @brief Check if security allows to create the topic.
* @component security_entity
*
* This function checks with access control if is allowed to create
* this topic for the specified domain.
*
* @param[in] gv The domain global information.
* @param[in] pp_guid The participant guid.
* @param[in] topic_name The name of the topic.
* @param[in] qos The topic QoS used.
*
* @returns bool
* @retval true Creation of the topic is allowed
* @retval false Otherwise.
*/
bool ddsi_omg_security_check_create_topic (const struct ddsi_domaingv *gv, const ddsi_guid_t *pp_guid, const char *topic_name, const struct dds_qos *qos);
/**
* @brief Check if security allows to create the reader.
* @component security_entity
*
* This function checks with access control if is allowed to create
* this reader for the specified domain.
*
* @param[in] pp Participant on which the topic is being created.
* @param[in] domain_id The corresponding domain_id.
* @param[in] topic_name The name of the topic.
* @param[in] reader_qos The reader QoS used.
*
* @returns bool
* @retval true Creation of the writer is allowed
* @retval false Otherwise.
*/
bool ddsi_omg_security_check_create_reader (struct ddsi_participant *pp, uint32_t domain_id, const char *topic_name, const struct dds_qos *reader_qos);
/**
* @brief Check if security allows to create the writer.
* @component security_entity
*
* This function checks with access control if is allowed to create
* this writer for the specified domain.
*
* @param[in] pp Participant on which the topic is being created.
* @param[in] domain_id The corresponding domain_id.
* @param[in] topic_name The name of the topic.
* @param[in] writer_qos The writer QoS used.
*
* @returns bool
* @retval true Creation of the writer is allowed
* @retval false Otherwise.
*/
bool ddsi_omg_security_check_create_writer (struct ddsi_participant *pp, uint32_t domain_id, const char *topic_name, const struct dds_qos *writer_qos);
#else /* DDS_HAS_SECURITY */
#include "dds/ddsi/ddsi_unused.h"
/** @component security_entity */
inline bool ddsi_omg_participant_is_secure(UNUSED_ARG(const struct ddsi_participant *pp))
{
return false;
}
/** @component security_entity */
inline bool ddsi_omg_security_check_create_topic (UNUSED_ARG(const struct ddsi_domaingv *gv), UNUSED_ARG(const ddsi_guid_t *pp_guid), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *qos))
{
return true;
}
/** @component security_entity */
inline bool ddsi_omg_security_check_create_reader (UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *reader_qos))
{
return true;
}
/** @component security_entity */
inline bool ddsi_omg_security_check_create_writer (UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *writer_qos))
{
return true;
}
#endif /* DDS_HAS_SECURITY */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_OMG_SECURITY_H */
+413
View File
@@ -0,0 +1,413 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_SERDATA_H
#define DDSI_SERDATA_H
#include "dds/features.h"
#include "dds/ddsrt/misc.h"
#include "dds/ddsrt/time.h"
#include "dds/ddsrt/iovec.h"
#include "dds/ddsi/ddsi_sertype.h"
#include "dds/ddsi/ddsi_keyhash.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_rdata;
struct dds_loaned_sample;
struct ddsi_serdata {
const struct ddsi_serdata_ops *ops; /* cached from type->serdata_ops */
uint32_t hash;
ddsrt_atomic_uint32_t refc;
enum ddsi_serdata_kind kind;
const struct ddsi_sertype *type;
/* these get set by generic code after creating the serdata */
ddsrt_wctime_t timestamp;
uint32_t statusinfo;
/* FIXME: can I get rid of this one? */
ddsrt_mtime_t twrite; /* write time, not source timestamp, set post-throttling */
struct dds_loaned_sample *loan;
};
/* Serialised size of sample inclusive of DDSI encoding header
- uint32_t because the protocol can't handle samples larger than 4GB anyway
- FIXME: get the encoding header out of the serialised data */
typedef uint32_t (*ddsi_serdata_size_t) (const struct ddsi_serdata *d)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Free a serdata (called by unref when refcount goes to 0) */
typedef void (*ddsi_serdata_free_t) (struct ddsi_serdata *d)
ddsrt_nonnull_all;
/* Construct a serdata from a fragchain received over the network
- "kind" is KEY or DATA depending on the type of payload
- "size" is the serialised size of the sample, inclusive of DDSI encoding header
- the first fragchain always contains the encoding header in its entirety
- fragchains may overlap, though I have never seen any DDS implementation
actually send such nasty fragments
- FIXME: get the encoding header out of the serialised data */
typedef struct ddsi_serdata * (*ddsi_serdata_from_ser_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const struct ddsi_rdata *fragchain, size_t size)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Exactly like ddsi_serdata_from_ser_t, but with the data in an iovec and guaranteed absence of overlap */
typedef struct ddsi_serdata * (*ddsi_serdata_from_ser_iov_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Construct a serdata from a keyhash (an SDK_KEY by definition) */
typedef struct ddsi_serdata * (*ddsi_serdata_from_keyhash_t) (const struct ddsi_sertype *type, const struct ddsi_keyhash *keyhash)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Construct a serdata from an application sample
- "kind" is KEY or DATA depending on the operation invoked by the application;
e.g., write results in kind = DATA, dispose in kind = KEY. The important bit
is to not assume anything of the contents of non-key fields if kind = KEY
unless additional application knowledge is available */
typedef struct ddsi_serdata * (*ddsi_serdata_from_sample_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const void *sample)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Construct a untyped serdata with just a keyvalue given a normal serdata (either key or data)
- used for mapping key values to instance ids in tkmap
- two reasons: size (keys are typically smaller than samples), and data in tkmap
is shared across topics
- whether a serdata is untyped or not is known from the context, and the topic
field may have any value for a untyped serdata (so in some cases, one can
simply do "return ddsi_serdata_ref(d);"
*/
typedef struct ddsi_serdata * (*ddsi_serdata_to_untyped_t) (const struct ddsi_serdata *d)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Fill buffer with 'size' bytes of serialised data, starting from 'off'
- 0 <= off < off+sz <= alignup4(size(d))
- bytes at offsets 0 .. 3 are DDSI encoding header, size(d) includes that header
- what to copy for bytes in [size(d), alignup4(size(d))) depends on the serdata
implementation, the protocol treats them as undefined
- FIXME: get the encoding header out of the serialised data */
typedef void (*ddsi_serdata_to_ser_t) (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf)
ddsrt_nonnull_all;
/* Provide a pointer to 'size' bytes of serialised data, starting from 'off'
- see ddsi_serdata_to_ser_t above
- instead of copying, this gives a reference that must remain valid until the
corresponding call to to_ser_unref
- multiple calls to to_ser_ref() may be issued in parallel
- lazily creating the serialised representation is allowed (though I'm not sure
how that would work with knowing the serialised size beforehand ...) */
typedef struct ddsi_serdata * (*ddsi_serdata_to_ser_ref_t) (const struct ddsi_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/* Release a lock on serialised data
- ref was previousy filled by ddsi_serdata_to_ser_ref_t */
typedef void (*ddsi_serdata_to_ser_unref_t) (struct ddsi_serdata *d, const ddsrt_iovec_t *ref)
ddsrt_nonnull_all;
/* Turn serdata into an application sample (or just the key values if only key values are
available); return false on error (typically out-of-memory, but if from_ser doesn't do any
validation it might be a deserialisation error, too).
If (bufptr != 0), then *bufptr .. buflim is space to be used from *bufptr up (with minimal
padding) for any data in the sample that needs to be allocated (e.g., strings, sequences);
otherwise malloc() is to be used for those. (This allows read/take to be given a block of memory
by the caller.) */
typedef bool (*ddsi_serdata_to_sample_t) (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim)
ddsrt_nonnull ((1, 2)) ddsrt_attribute_warn_unused_result;
/* Create a sample from a untyped serdata, as returned by serdata_to_untyped. This sample
obviously has just the key fields filled in and is used for generating invalid samples. */
typedef bool (*ddsi_serdata_untyped_to_sample_t) (const struct ddsi_sertype *type, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim)
ddsrt_nonnull ((1, 2, 3)) ddsrt_attribute_warn_unused_result;
/* Test key values of two serdatas for equality. The two will have the same ddsi_serdata_ops,
but are not necessarily of the same topic (one can decide to never consider them equal if they
are of different topics, of course; but the nice thing about _not_ doing that is that all
instances with a certain key value with have the same instance id, and that in turn makes
computing equijoins across topics much simpler). */
typedef bool (*ddsi_serdata_eqkey_t) (const struct ddsi_serdata *a, const struct ddsi_serdata *b)
ddsrt_nonnull_all;
/* Print a serdata into the provided buffer (truncating as necessary)
- topic is present for supporting printing of "untyped" samples
- buf != NULL, bufsize > 0 on input
- buf must always be terminated with a nul character on return
- returns the number of characters (excluding the terminating 0) needed to print it
in full (or, as an optimization, it may pretend that it has printed it in full,
returning bufsize-1) if it had to truncate) */
typedef size_t (*ddsi_serdata_print_t) (const struct ddsi_sertype *type, const struct ddsi_serdata *d, char *buf, size_t size)
ddsrt_nonnull_all;
/* Add keyhash (from serdata) to buffer (forcing md5 when necessary).
- key needs to be set within serdata (can already be md5)
- buf needs to be at least 16 bytes large */
typedef void (*ddsi_serdata_get_keyhash_t) (const struct ddsi_serdata *d, struct ddsi_keyhash *buf, bool force_md5)
ddsrt_nonnull_all;
// Used for taking a loaned sample and constructing a serdata around this
// takes over ownership of loan on success (leaves it unchanged on failure)
typedef struct ddsi_serdata* (*ddsi_serdata_from_loan_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const char *sample, struct dds_loaned_sample *loaned_sample, bool will_require_cdr)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
// Used for constructing a serdata from data received on a PSMX
typedef struct ddsi_serdata* (*ddsi_serdata_from_psmx_t) (const struct ddsi_sertype *type, struct dds_loaned_sample *loaned_sample)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
struct ddsi_serdata_ops {
ddsi_serdata_eqkey_t eqkey;
ddsi_serdata_size_t get_size;
ddsi_serdata_from_ser_t from_ser;
ddsi_serdata_from_ser_iov_t from_ser_iov;
ddsi_serdata_from_keyhash_t from_keyhash;
ddsi_serdata_from_sample_t from_sample;
ddsi_serdata_to_ser_t to_ser;
ddsi_serdata_to_ser_ref_t to_ser_ref;
ddsi_serdata_to_ser_unref_t to_ser_unref;
ddsi_serdata_to_sample_t to_sample;
ddsi_serdata_to_untyped_t to_untyped;
ddsi_serdata_untyped_to_sample_t untyped_to_sample;
ddsi_serdata_free_t free;
ddsi_serdata_print_t print;
ddsi_serdata_get_keyhash_t get_keyhash;
ddsi_serdata_from_loan_t from_loaned_sample;
ddsi_serdata_from_psmx_t from_psmx;
};
#define DDSI_SERDATA_HAS_PRINT 1
#define DDSI_SERDATA_HAS_FROM_SER_IOV 1
#define DDSI_SERDATA_HAS_GET_KEYHASH 1
/** @component typesupport_if */
DDS_EXPORT void ddsi_serdata_init (struct ddsi_serdata *d, const struct ddsi_sertype *tp, enum ddsi_serdata_kind kind)
ddsrt_nonnull_all;
/**
* @brief Return a pointer to the keyhash in the message fragchain if it was present, or else NULL.
* @component typesupport_if
*
* @param[in] fragchain the fragchain argument passed to @ref ddsi_serdata_from_ser (the first one, not any subsequent ones)
* @returns A pointer to the keyhash in the message if it was present, NULL if not. The lifetime is at least that of the fragchain itself.
*/
const ddsi_keyhash_t *ddsi_serdata_keyhash_from_fragchain (const struct ddsi_rdata *fragchain)
ddsrt_nonnull_all;
/**
* @brief Return a copy of a serdata with possible type conversion
* @component typesupport_if
*
* This constructs a new one from the serialised representation of `serdata`.
* This can fail, in which case it returns NULL.
*
* @param[in] type sertype the returned serdata must have
* @param[in] serdata source sample
* @returns A reference to a serdata that is equivalent to the input with the correct
* type, or a null pointer on failure. The reference must be released with @ref
* ddsi_serdata_unref.
*/
struct ddsi_serdata *ddsi_serdata_copy_as_type (const struct ddsi_sertype *type, const struct ddsi_serdata *serdata)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/**
* @brief Return a reference to a serdata with possible type conversion
* @component typesupport_if
*
* If `serdata` is of type `type`, this increments the reference count and returns
* `serdata`. Otherwise, it constructs a new one as if by @ref ddsi_serdata_copy_as_type.
* This can fail, in which case it returns NULL.
*
* @param[in] type sertype the returned serdata must have
* @param[in] serdata source sample (untouched except for the reference count and/or
* extracting the serialised representation)
* @returns A reference to a serdata that is equivalent to the input with the correct
* topic, or a null pointer on failure. The reference must be released with @ref
* ddsi_serdata_unref.
*/
struct ddsi_serdata *ddsi_serdata_ref_as_type (const struct ddsi_sertype *type, struct ddsi_serdata *serdata)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_ref (const struct ddsi_serdata *serdata_const)
ddsrt_nonnull_all;
inline struct ddsi_serdata *ddsi_serdata_ref (const struct ddsi_serdata *serdata_const) {
#if defined (__cplusplus)
DDSRT_WARNING_GNUC_OFF(old-style-cast)
DDSRT_WARNING_CLANG_OFF(old-style-cast)
#endif
struct ddsi_serdata *serdata = (struct ddsi_serdata *)serdata_const;
#if defined (__cplusplus)
DDSRT_WARNING_CLANG_ON(old-style-cast)
DDSRT_WARNING_GNUC_ON(old-style-cast)
#endif
ddsrt_atomic_inc32 (&serdata->refc);
return serdata;
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_serdata_unref (struct ddsi_serdata *serdata)
ddsrt_nonnull_all;
inline void ddsi_serdata_unref (struct ddsi_serdata *serdata) {
if (ddsrt_atomic_dec32_ov (&serdata->refc) == 1)
serdata->ops->free (serdata);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline uint32_t ddsi_serdata_size (const struct ddsi_serdata *d)
ddsrt_nonnull_all;
inline uint32_t ddsi_serdata_size (const struct ddsi_serdata *d) {
return d->ops->get_size (d);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_ser (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const struct ddsi_rdata *fragchain, size_t size)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_from_ser (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const struct ddsi_rdata *fragchain, size_t size) {
return type->serdata_ops->from_ser (type, kind, fragchain, size);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_ser_iov (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_from_ser_iov (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size) {
return type->serdata_ops->from_ser_iov (type, kind, niov, iov, size);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_keyhash (const struct ddsi_sertype *type, const struct ddsi_keyhash *keyhash)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_from_keyhash (const struct ddsi_sertype *type, const struct ddsi_keyhash *keyhash) {
return type->serdata_ops->from_keyhash (type, keyhash);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_sample (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const void *sample)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_from_sample (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const void *sample) {
return type->serdata_ops->from_sample (type, kind, sample);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_to_untyped (const struct ddsi_serdata *d)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_to_untyped (const struct ddsi_serdata *d) {
struct ddsi_serdata * const d1 = d->ops->to_untyped (d);
assert (d1->loan == NULL);
return d1;
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_serdata_to_ser (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf)
ddsrt_nonnull_all;
inline void ddsi_serdata_to_ser (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf) {
d->ops->to_ser (d, off, sz, buf);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_to_ser_ref (const struct ddsi_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref)
ddsrt_nonnull_all ddsrt_attribute_warn_unused_result;
inline struct ddsi_serdata *ddsi_serdata_to_ser_ref (const struct ddsi_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref) {
return d->ops->to_ser_ref (d, off, sz, ref);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_serdata_to_ser_unref (struct ddsi_serdata *d, const ddsrt_iovec_t *ref)
ddsrt_nonnull_all;
inline void ddsi_serdata_to_ser_unref (struct ddsi_serdata *d, const ddsrt_iovec_t *ref) {
d->ops->to_ser_unref (d, ref);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline bool ddsi_serdata_to_sample (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim)
ddsrt_nonnull ((1, 2)) ddsrt_attribute_warn_unused_result;
inline bool ddsi_serdata_to_sample (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim) {
return d->ops->to_sample (d, sample, bufptr, buflim);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline bool ddsi_serdata_untyped_to_sample (const struct ddsi_sertype *type, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim)
ddsrt_nonnull ((1, 2, 3)) ddsrt_attribute_warn_unused_result;
inline bool ddsi_serdata_untyped_to_sample (const struct ddsi_sertype *type, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim) {
return d->ops->untyped_to_sample (type, d, sample, bufptr, buflim);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline bool ddsi_serdata_eqkey (const struct ddsi_serdata *a, const struct ddsi_serdata *b)
ddsrt_nonnull_all;
inline bool ddsi_serdata_eqkey (const struct ddsi_serdata *a, const struct ddsi_serdata *b) {
return a->ops->eqkey (a, b);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline size_t ddsi_serdata_print (const struct ddsi_serdata *d, char *buf, size_t size)
ddsrt_nonnull_all;
inline size_t ddsi_serdata_print (const struct ddsi_serdata *d, char *buf, size_t size) {
return d->ops->print (d->type, d, buf, size);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline size_t ddsi_serdata_print_untyped (const struct ddsi_sertype *type, const struct ddsi_serdata *d, char *buf, size_t size)
ddsrt_nonnull_all;
inline size_t ddsi_serdata_print_untyped (const struct ddsi_sertype *type, const struct ddsi_serdata *d, char *buf, size_t size) {
if (d->ops->print)
return d->ops->print (type, d, buf, size);
else
{
buf[0] = 0;
return 0;
}
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_serdata_get_keyhash (const struct ddsi_serdata *d, struct ddsi_keyhash *buf, bool force_md5)
ddsrt_nonnull_all;
inline void ddsi_serdata_get_keyhash (const struct ddsi_serdata *d, struct ddsi_keyhash *buf, bool force_md5) {
d->ops->get_keyhash (d, buf, force_md5);
}
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_loaned_sample(const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const char *sample, struct dds_loaned_sample *loan, bool will_require_cdr) ddsrt_nonnull_all;
/** @component typesupport_if */
inline struct ddsi_serdata *ddsi_serdata_from_loaned_sample(const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const char *sample, struct dds_loaned_sample *loan, bool will_require_cdr)
{
return type->serdata_ops->from_loaned_sample(type, kind, sample, loan, will_require_cdr);
}
DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_psmx(const struct ddsi_sertype *type, struct dds_loaned_sample *data) ddsrt_nonnull_all;
inline struct ddsi_serdata *ddsi_serdata_from_psmx(const struct ddsi_sertype *type, struct dds_loaned_sample *data)
{
return type->serdata_ops->from_psmx(type, data);
}
#if defined (__cplusplus)
}
#endif
#endif //DDSI_SERDATA_H
+300
View File
@@ -0,0 +1,300 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_SERTYPE_H
#define DDSI_SERTYPE_H
#include "dds/features.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_xqos.h"
#include "dds/ddsi/ddsi_typewrap.h"
#include "dds/ddsc/dds_public_alloc.h"
#include "dds/ddsc/dds_data_type_properties.h"
#include "dds/cdr/dds_cdrstream.h"
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_serdata;
struct ddsi_serdata_ops;
struct ddsi_sertype_ops;
struct ddsi_domaingv;
struct ddsi_typeid;
struct ddsi_type_pair;
enum ddsi_serdata_kind {
SDK_EMPTY,
SDK_KEY,
SDK_DATA
};
#define DDSI_SERTYPE_REGISTERING 0x40000000u // set prior to setting gv
#define DDSI_SERTYPE_REGISTERED 0x80000000u // set after setting gv
#define DDSI_SERTYPE_REFC_MASK 0x0fffffffu
struct ddsi_sertype {
const struct ddsi_sertype_ops *ops;
const struct ddsi_serdata_ops *serdata_ops;
uint32_t serdata_basehash;
uint32_t has_key : 1;
uint32_t request_keyhash : 1;
uint32_t is_memcpy_safe : 1;
uint32_t allowed_data_representation; /* Allowed data representations set in IDL for this type, or DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT in case of
no restrictions in the IDL. Unsupported representations for the type are left out when creating the sertype. */
char *type_name;
ddsrt_atomic_voidp_t gv; /* set during registration */
ddsrt_atomic_uint32_t flags_refc; /* counts refs from entities (topic, reader, writer), not from data */
const struct ddsi_sertype *base_sertype; /* counted ref to sertype used to derive this sertype, used to overwrite the serdata_ops for a specific data representation */
uint32_t sizeof_type;
dds_data_type_properties_t data_type_props; /* representation of properties of the data type */
};
/* The old and the new happen to have the same memory layout on a 64-bit machine
and so any user that memset's the ddsi_sertype to 0 before filling out the
required fields gets unchanged behaviour. 32-bit machines have a different
layout and no such luck.
There are presumably very few users of this type outside Cyclone DDS itself,
but the ROS2 RMW implementation does use it -- indeed, it prompted the change.
This define makes it possible to have a single version of the source that is
compatible with the old and the new definition, even if it is only partially
binary compatible. */
#define DDSI_SERTOPIC_HAS_TOPICKIND_NO_KEY 1
/* Type changed: name_type_name and ii removed and gv added; and the set of
operations got extended by the a predicate for testing to sertypes (with the
same "ops") for equality ("equal") as well as a function for hashing the
non-generic part of the sertype definition (via "hash"). These two operations
make it possible to intern sertypes without duplicates, which has become
relevant now that multiple ddsi_sertypes can be associated with a single topic
name.
Testing for DDSI_SERTOPIC_HAS_EQUAL_AND_HASH allows one to have a single source
that can handle both variants, but there's no binary compatbility. */
#define DDSI_SERTOPIC_HAS_EQUAL_AND_HASH 1
/* It was a bad decision to have a boolean argument in "init" specifying whether
the entity kind should say "with key" or "without key". A general "flags"
argument is much more flexible ... */
#define DDSI_SERTYPE_HAS_SERTYPE_INIT_FLAGS 1
/* Called to compare two sertypes for equality, if it is already known that
type name, kind_no_Key, and operations are all the same. (serdata_basehash
is computed from the set of operations.) */
typedef bool (*ddsi_sertype_equal_t) (const struct ddsi_sertype *a, const struct ddsi_sertype *b);
/* Hash the custom components of a sertype (this XOR'd with a hash computed from
the fields that are defined in struct ddsi_sertype) */
typedef uint32_t (*ddsi_sertype_hash_t) (const struct ddsi_sertype *tp);
/* Called when the refcount dropped to zero */
typedef void (*ddsi_sertype_free_t) (struct ddsi_sertype *tp);
/* Zero out a sample, used for generating samples from just a key value and in cleaning up
after dds_return_loan */
typedef void (*ddsi_sertype_zero_samples_t) (const struct ddsi_sertype *d, void *samples, size_t count);
/* (Re)allocate an array of samples, used in growing loaned sample arrays in dds_read */
typedef void (*ddsi_sertype_realloc_samples_t) (void **ptrs, const struct ddsi_sertype *d, void *old, size_t oldcount, size_t count);
/* Release any memory allocated by ddsi_sertype_to_sample (also undo sertype_alloc_sample if "op" so requests) */
typedef void (*ddsi_sertype_free_samples_t) (const struct ddsi_sertype *d, void **ptrs, size_t count, dds_free_op_t op);
/* Gets the type identifier of the requested kind (minimal or complete) for this sertype */
typedef ddsi_typeid_t * (*ddsi_sertype_typeid_t) (const struct ddsi_sertype *tp, ddsi_typeid_kind_t kind);
/* Compute the (unpadded) size of the CDR based on the sertype information and the sample (plus used encoding) */
typedef dds_return_t (*ddsi_sertype_get_serialized_size_t) (const struct ddsi_sertype *tp, enum ddsi_serdata_kind sdkind, const void *sample, size_t *size, uint16_t *enc_identifier);
/* Serialize into a destination buffer */
// Note that we assume the destination buffer is large enough (we do not necessarily check)
// The required size can be obtained with ddsi_sertype_get_serialized_size_t
// Returns true if the serialization succeeds, false otherwise.
typedef bool (*ddsi_sertype_serialize_into_t)(const struct ddsi_sertype *d, enum ddsi_serdata_kind sdkind, const void *sample, void *dst_buffer, size_t dst_size);
/* Gets the type map for this sertype */
typedef ddsi_typemap_t * (*ddsi_sertype_typemap_t) (const struct ddsi_sertype *tp);
/* Gets the CDR blob for the type information of this sertype */
typedef ddsi_typeinfo_t * (*ddsi_sertype_typeinfo_t) (const struct ddsi_sertype *tp);
/* Create a new derived sertype (a shallow copy of the provided sertype) with the
serdata_ops for the provided data representation */
typedef struct ddsi_sertype * (*ddsi_sertype_derive_t) (const struct ddsi_sertype *sertype, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t tce_qos);
struct ddsi_sertype_v0;
typedef void (*ddsi_sertype_v0_t) (struct ddsi_sertype_v0 *dummy);
// Because Windows ... just can't get its act together ...
#ifndef _WIN32
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_v0 (struct ddsi_sertype_v0 *dummy);
#else
#define ddsi_sertype_v0 ((ddsi_sertype_v0_t) 1)
#endif
struct ddsi_sertype_ops {
ddsi_sertype_v0_t version;
void *arg;
ddsi_sertype_free_t free;
ddsi_sertype_zero_samples_t zero_samples;
ddsi_sertype_realloc_samples_t realloc_samples;
ddsi_sertype_free_samples_t free_samples;
ddsi_sertype_equal_t equal;
ddsi_sertype_hash_t hash;
ddsi_sertype_typeid_t type_id;
ddsi_sertype_typemap_t type_map;
ddsi_sertype_typeinfo_t type_info;
ddsi_sertype_derive_t derive_sertype;
ddsi_sertype_get_serialized_size_t get_serialized_size;
ddsi_sertype_serialize_into_t serialize_into;
};
/** @component typesupport_if */
struct ddsi_sertype *ddsi_sertype_lookup_locked (struct ddsi_domaingv *gv, const struct ddsi_sertype *sertype_template);
/** @component typesupport_if */
void ddsi_sertype_register_locked (struct ddsi_domaingv *gv, struct ddsi_sertype *sertype);
#define DDSI_SERTYPE_FLAG_TOPICKIND_NO_KEY (1u)
#define DDSI_SERTYPE_FLAG_REQUEST_KEYHASH (2u)
#define DDSI_SERTYPE_FLAG_FIXED_SIZE (4u)
#define DDSI_SERTYPE_FLAG_MASK (0x7u)
#define DDSI_SERTYPE_PROPS_FLAG_MASK (DDSI_SERTYPE_FLAG_REQUEST_KEYHASH)
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_init_props (struct ddsi_sertype *tp, const char *type_name, const struct ddsi_sertype_ops *sertype_ops, const struct ddsi_serdata_ops *serdata_ops, size_t sizeof_type, dds_data_type_properties_t data_type_props, uint32_t allowed_data_representation, uint32_t flags);
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_init_flags (struct ddsi_sertype *tp, const char *type_name, const struct ddsi_sertype_ops *sertype_ops, const struct ddsi_serdata_ops *serdata_ops, uint32_t flags);
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_init (struct ddsi_sertype *tp, const char *type_name, const struct ddsi_sertype_ops *sertype_ops, const struct ddsi_serdata_ops *serdata_ops, bool topickind_no_key);
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_fini (struct ddsi_sertype *tp);
/** @component typesupport_if */
DDS_EXPORT struct ddsi_sertype *ddsi_sertype_ref (const struct ddsi_sertype *tp);
/** @component typesupport_if */
DDS_EXPORT void ddsi_sertype_unref (struct ddsi_sertype *tp); /* tp->gv->sertypes_lock may not be held */
/** @component typesupport_if */
DDS_EXPORT uint32_t ddsi_sertype_compute_serdata_basehash (const struct ddsi_serdata_ops *ops);
/** @component typesupport_if */
DDS_EXPORT bool ddsi_sertype_equal (const struct ddsi_sertype *a, const struct ddsi_sertype *b);
/** @component typesupport_if */
DDS_EXPORT uint32_t ddsi_sertype_hash (const struct ddsi_sertype *tp);
/** @component typesupport_if */
DDS_EXPORT uint16_t ddsi_sertype_extensibility_enc_format (enum dds_cdr_type_extensibility type_extensibility);
/** @component typesupport_if */
DDS_EXPORT uint16_t ddsi_sertype_get_native_enc_identifier (uint32_t enc_version, uint32_t encoding_format);
/** @component typesupport_if */
DDS_EXPORT uint32_t ddsi_sertype_enc_id_xcdr_version (uint16_t cdr_identifier);
/** @component typesupport_if */
DDS_EXPORT uint32_t ddsi_sertype_enc_id_enc_format (uint16_t cdr_identifier);
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_free (struct ddsi_sertype *tp) {
tp->ops->free (tp);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_zero_samples (const struct ddsi_sertype *tp, void *samples, size_t count) {
tp->ops->zero_samples (tp, samples, count);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_realloc_samples (void **ptrs, const struct ddsi_sertype *tp, void *old, size_t oldcount, size_t count)
{
tp->ops->realloc_samples (ptrs, tp, old, oldcount, count);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_free_samples (const struct ddsi_sertype *tp, void **ptrs, size_t count, dds_free_op_t op) {
tp->ops->free_samples (tp, ptrs, count, op);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_zero_sample (const struct ddsi_sertype *tp, void *sample) {
ddsi_sertype_zero_samples (tp, sample, 1);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void *ddsi_sertype_alloc_sample (const struct ddsi_sertype *tp) {
void *ptr;
ddsi_sertype_realloc_samples (&ptr, tp, NULL, 0, 1);
return ptr;
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline void ddsi_sertype_free_sample (const struct ddsi_sertype *tp, void *sample, dds_free_op_t op) {
ddsi_sertype_free_samples (tp, &sample, 1, op);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline ddsi_typeid_t * ddsi_sertype_typeid (const struct ddsi_sertype *tp, ddsi_typeid_kind_t kind)
{
if (!tp->ops->type_id)
return NULL;
return tp->ops->type_id (tp, kind);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline ddsi_typemap_t * ddsi_sertype_typemap (const struct ddsi_sertype *tp)
{
if (!tp->ops->type_map)
return NULL;
return tp->ops->type_map (tp);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline ddsi_typeinfo_t *ddsi_sertype_typeinfo (const struct ddsi_sertype *tp)
{
if (!tp->ops->type_info)
return NULL;
return tp->ops->type_info (tp);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline struct ddsi_sertype * ddsi_sertype_derive_sertype (const struct ddsi_sertype *base_sertype, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t tce_qos) {
if (!base_sertype->ops->derive_sertype)
return NULL;
return base_sertype->ops->derive_sertype (base_sertype, data_representation, tce_qos);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline dds_return_t ddsi_sertype_get_serialized_size(const struct ddsi_sertype *tp, enum ddsi_serdata_kind sdkind, const void *sample, size_t *size, uint16_t *enc_identifier) {
return tp->ops->get_serialized_size(tp, sdkind, sample, size, enc_identifier);
}
/** @component typesupport_if */
DDS_INLINE_EXPORT inline bool ddsi_sertype_serialize_into(const struct ddsi_sertype *tp, enum ddsi_serdata_kind sdkind, const void *sample, void *dst_buffer, size_t dst_size) {
return tp->ops->serialize_into(tp, sdkind, sample, dst_buffer, dst_size);
}
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_SERTYPE_H */
+24
View File
@@ -0,0 +1,24 @@
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
#ifndef DDSI_SOCKWAITSET_H
#define DDSI_SOCKWAITSET_H
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_sock_waitset;
struct ddsi_sock_waitset_ctx;
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_SOCKWAITSET_H */
+32
View File
@@ -0,0 +1,32 @@
// Copyright(c) 2020 ZettaScale Technology 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
#ifndef _DDSI_STATISTICS_H_
#define _DDSI_STATISTICS_H_
#include <stdint.h>
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_reader;
struct ddsi_writer;
/** @component ddsi_statistics */
void ddsi_get_writer_stats (struct ddsi_writer *wr, uint64_t *rexmit_bytes, uint32_t *throttle_count, uint64_t *time_throttled, uint64_t *time_retransmit);
/** @component ddsi_statistics */
void ddsi_get_reader_stats (struct ddsi_reader *rd, uint64_t *discarded_bytes);
#if defined (__cplusplus)
}
#endif
#endif
+235
View File
@@ -0,0 +1,235 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_THREAD_H
#define DDSI_THREAD_H
#include <assert.h>
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/threads.h"
#include "dds/ddsrt/static_assert.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_domaingv;
struct ddsi_thread_state;
/* Things don't go wrong if DDSI_CACHE_LINE_SIZE is defined incorrectly,
they just run slower because of false cache-line sharing. It can be
discovered at run-time, but in practice it's 64 for most CPUs and
128 for some. */
#define DDSI_CACHE_LINE_SIZE 64
typedef uint32_t ddsi_vtime_t;
#define DDSI_VTIME_NEST_MASK 0xfu
#define DDSI_VTIME_TIME_MASK 0xfffffff0u
#define DDSI_VTIME_TIME_SHIFT 4
enum ddsi_thread_state_kind {
DDSI_THREAD_STATE_ZERO, /* known to be dead */
DDSI_THREAD_STATE_STOPPED, /* internal thread, stopped-but-not-reaped */
DDSI_THREAD_STATE_INIT, /* internal thread, initializing */
DDSI_THREAD_STATE_LAZILY_CREATED, /* lazily created in response because an application used it. Reclaimed if the thread terminates, but not considered an error if all of Cyclone is shutdown while this thread hasn't terminated yet */
DDSI_THREAD_STATE_ALIVE /* known to be alive - for Cyclone internal threads */
};
/*
* vtime indicates progress for the garbage collector and the liveliness monitoring.
*
* vtime is updated without using atomic operations: only the owning thread updates
* them, and the garbage collection mechanism and the liveliness monitoring only
* observe the value
*
* gv is constant for internal threads, i.e., for threads with state = ALIVE
* gv is non-NULL for internal threads except thread liveliness monitoring
*
* DDSI_THREAD_DEBUG enables some really costly debugging stuff that may not be fully
* portable (I used it once, might as well keep it)
*/
#define DDSI_THREAD_DEBUG 0
#if DDSI_THREAD_DEBUG
#define DDSI_THREAD_NSTACKS 20
#define DDSI_THREAD_STACKDEPTH 10
#define THREAD_BASE_DEBUG \
void *stks[DDSI_THREAD_NSTACKS][DDSI_THREAD_STACKDEPTH]; \
int stks_depth[DDSI_THREAD_NSTACKS]; \
int stks_idx;
/** @component thread_support */
void ddsi_thread_vtime_trace (struct ddsi_thread_state *thrst);
#else /* DDSI_THREAD_DEBUG */
#define THREAD_BASE_DEBUG
#define ddsi_thread_vtime_trace(thrst) do { } while (0)
#endif /* DDSI_THREAD_DEBUG */
/**
* When DDS_ALLOW_NESTED_DOMAIN is set, the thread state can store an additional
* gv pointer, so that in case of domain nesting in a single thread, the gv
* pointer of the nested domain won't overwrite the top-level domain's gv pointer.
* Nesting domains has several limitations, and is used for PSMX testing using the
* Cyclone DDS PSMX implementation.
*/
#ifdef DDS_ALLOW_NESTED_DOMAIN
#define THREAD_BASE_NESTEDGV ddsrt_atomic_voidp_t nested_gv;
#else
#define THREAD_BASE_NESTEDGV
#endif
#define THREAD_BASE \
ddsrt_atomic_uint32_t vtime; \
enum ddsi_thread_state_kind state; \
ddsrt_atomic_voidp_t gv; \
THREAD_BASE_NESTEDGV \
ddsrt_thread_t tid; \
uint32_t (*f) (void *arg); \
void *f_arg; \
THREAD_BASE_DEBUG /* note: no semicolon! */ \
char name[24] /* note: no semicolon! */
struct ddsi_thread_state_base {
THREAD_BASE;
};
/* GCC has a nifty feature allowing the specification of the required
alignment: __attribute__ ((aligned (DDSI_CACHE_LINE_SIZE))) in this
case. Many other compilers implement it as well, but it is by no
means a standard feature. So we do it the old-fashioned way. */
struct ddsi_thread_state {
THREAD_BASE;
char pad[DDSI_CACHE_LINE_SIZE
* ((sizeof (struct ddsi_thread_state_base) + DDSI_CACHE_LINE_SIZE - 1)
/ DDSI_CACHE_LINE_SIZE)
- sizeof (struct ddsi_thread_state_base)];
};
#undef THREAD_BASE
struct ddsi_thread_states {
ddsrt_mutex_t lock;
ddsrt_atomic_voidp_t thread_states_head;
};
extern struct ddsi_thread_states thread_states;
// thread_local cannot (and doesn't need to?) be exported on Windows
#if defined _WIN32 && !defined __MINGW32__
extern ddsrt_thread_local struct ddsi_thread_state *tsd_thread_state;
#else
DDS_EXPORT extern ddsrt_thread_local struct ddsi_thread_state *tsd_thread_state;
#endif
#ifdef DDS_ALLOW_NESTED_DOMAIN
DDS_EXPORT extern ddsrt_atomic_uint32_t ddsi_thread_nested_gv_allowed;
#endif
/** @component thread_support */
void ddsi_thread_states_init (void);
/** @component thread_support */
bool ddsi_thread_states_fini (void);
/** @component thread_support */
dds_return_t ddsi_create_thread (struct ddsi_thread_state **thrst, const struct ddsi_domaingv *gv, const char *name, uint32_t (*f) (void *arg), void *arg);
/** @component thread_support */
dds_return_t ddsi_join_thread (struct ddsi_thread_state *thrst);
/** @component thread_support */
DDS_EXPORT struct ddsi_thread_state *ddsi_lookup_thread_state_real (void);
/** @component thread_support */
DDS_INLINE_EXPORT inline struct ddsi_thread_state *ddsi_lookup_thread_state (void) {
struct ddsi_thread_state *thrst = tsd_thread_state;
if (thrst)
return thrst;
else
return ddsi_lookup_thread_state_real ();
}
/** @component thread_support */
inline bool ddsi_vtime_awake_p (ddsi_vtime_t vtime)
{
return (vtime & DDSI_VTIME_NEST_MASK) != 0;
}
/** @component thread_support */
inline bool ddsi_vtime_asleep_p (ddsi_vtime_t vtime)
{
return (vtime & DDSI_VTIME_NEST_MASK) == 0;
}
/** @component thread_support */
inline bool ddsi_thread_is_awake (void)
{
struct ddsi_thread_state *thrst = ddsi_lookup_thread_state ();
ddsi_vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime);
return ddsi_vtime_awake_p (vt);
}
/** @component thread_support */
inline bool ddsi_thread_is_asleep (void)
{
struct ddsi_thread_state *thrst = ddsi_lookup_thread_state ();
ddsi_vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime);
return ddsi_vtime_asleep_p (vt);
}
/** @component thread_support */
DDS_INLINE_EXPORT inline void ddsi_thread_state_asleep (struct ddsi_thread_state *thrst)
{
ddsi_vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime);
assert (ddsi_vtime_awake_p (vt));
/* nested calls a rare and an extra fence doesn't break things */
ddsrt_atomic_fence_rel ();
ddsi_thread_vtime_trace (thrst);
if ((vt & DDSI_VTIME_NEST_MASK) == 1)
vt += (1u << DDSI_VTIME_TIME_SHIFT) - 1u;
else
vt -= 1u;
ddsrt_atomic_st32 (&thrst->vtime, vt);
}
/** @component thread_support */
DDS_INLINE_EXPORT inline void ddsi_thread_state_awake (struct ddsi_thread_state *thrst, const struct ddsi_domaingv *gv)
{
ddsi_vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime);
assert ((vt & DDSI_VTIME_NEST_MASK) < DDSI_VTIME_NEST_MASK);
assert (gv != NULL);
assert (thrst->state != DDSI_THREAD_STATE_ALIVE || gv == ddsrt_atomic_ldvoidp (&thrst->gv));
ddsi_thread_vtime_trace (thrst);
#ifdef DDS_ALLOW_NESTED_DOMAIN
assert ((vt & DDSI_VTIME_NEST_MASK) == 0 || gv == ddsrt_atomic_ldvoidp (&thrst->gv) || gv == ddsrt_atomic_ldvoidp (&thrst->nested_gv) || 0 == ddsrt_atomic_ldvoidp (&thrst->nested_gv));
if ((vt & DDSI_VTIME_NEST_MASK) == 0)
ddsrt_atomic_stvoidp (&thrst->gv, (struct ddsi_domaingv *) gv);
else if (gv != ddsrt_atomic_ldvoidp (&thrst->gv))
{
assert (ddsrt_atomic_ld32 (&ddsi_thread_nested_gv_allowed));
ddsrt_atomic_stvoidp (&thrst->nested_gv, (struct ddsi_domaingv *) gv);
}
#else
assert ((vt & DDSI_VTIME_NEST_MASK) == 0 || gv == ddsrt_atomic_ldvoidp (&thrst->gv));
ddsrt_atomic_stvoidp (&thrst->gv, (struct ddsi_domaingv *) gv);
#endif
ddsrt_atomic_fence_stst ();
ddsrt_atomic_st32 (&thrst->vtime, vt + 1u);
/* nested calls a rare and an extra fence doesn't break things */
ddsrt_atomic_fence_acq ();
}
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_THREAD_H */
+43
View File
@@ -0,0 +1,43 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_THREADMON_H
#define DDSI_THREADMON_H
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_threadmon;
struct ddsi_domaingv;
/** @component thread_monitor */
struct ddsi_threadmon *ddsi_threadmon_new (int64_t liveliness_monitoring_interval, bool noprogress_log_stacktraces);
/** @component thread_monitor */
dds_return_t ddsi_threadmon_start (struct ddsi_threadmon *sl, const char *name);
/** @component thread_monitor */
void ddsi_threadmon_register_domain (struct ddsi_threadmon *sl, const struct ddsi_domaingv *gv);
/** @component thread_monitor */
void ddsi_threadmon_unregister_domain (struct ddsi_threadmon *sl, const struct ddsi_domaingv *gv);
/** @component thread_monitor */
void ddsi_threadmon_stop (struct ddsi_threadmon *sl);
/** @component thread_monitor */
void ddsi_threadmon_free (struct ddsi_threadmon *sl);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_THREADMON_H */
+59
View File
@@ -0,0 +1,59 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef _DDS_TKMAP_H_
#define _DDS_TKMAP_H_
#include "dds/ddsrt/atomics.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_tkmap;
struct ddsi_serdata;
struct dds_topic;
struct ddsi_domaingv;
struct ddsi_tkmap_instance
{
struct ddsi_serdata *m_sample;
uint64_t m_iid;
ddsrt_atomic_uint32_t m_refc;
};
/** @component key_instance_map */
struct ddsi_tkmap *ddsi_tkmap_new (struct ddsi_domaingv *gv);
/** @component key_instance_map */
void ddsi_tkmap_free (struct ddsi_tkmap *tkmap);
/** @component key_instance_map */
void ddsi_tkmap_instance_ref (struct ddsi_tkmap_instance *tk);
/** @component key_instance_map */
uint64_t ddsi_tkmap_lookup (struct ddsi_tkmap *tkmap, const struct ddsi_serdata *serdata);
/** @component key_instance_map */
struct ddsi_tkmap_instance * ddsi_tkmap_find(struct ddsi_tkmap *map, struct ddsi_serdata *sd, const bool create);
/** @component key_instance_map */
struct ddsi_tkmap_instance * ddsi_tkmap_find_by_id (struct ddsi_tkmap *map, uint64_t iid);
/** @component key_instance_map */
DDS_EXPORT struct ddsi_tkmap_instance * ddsi_tkmap_lookup_instance_ref (struct ddsi_tkmap *map, struct ddsi_serdata * sd);
/** @component key_instance_map */
DDS_EXPORT void ddsi_tkmap_instance_unref (struct ddsi_tkmap *map, struct ddsi_tkmap_instance *tk);
#if defined (__cplusplus)
}
#endif
#endif
+79
View File
@@ -0,0 +1,79 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_TOPIC_H
#define DDSI_TOPIC_H
#include "dds/export.h"
#include "dds/features.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_entity.h"
#ifdef DDS_HAS_TOPIC_DISCOVERY
#include "dds/ddsi/ddsi_typelib.h"
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/** @component ddsi_topic */
int ddsi_is_builtin_topic (ddsi_entityid_t id, ddsi_vendorid_t vendorid);
#ifdef DDS_HAS_TOPIC_DISCOVERY
struct ddsi_proxy_participant;
struct ddsi_type_pair;
struct dds_qos;
struct ddsi_topic_definition {
unsigned char key[16]; /* key for this topic definition (MD5 hash of the type_id and qos) */
struct ddsi_type_pair *type_pair; /* has a ddsi_type object for the minimal and complete type, which contains the XTypes type identifiers */
struct dds_qos *xqos; /* contains also the topic name and type name */
uint32_t refc;
struct ddsi_domaingv *gv;
};
struct ddsi_topic {
struct ddsi_entity_common e;
struct ddsi_topic_definition *definition; /* ref to (shared) topic definition, protected by e.qos_lock */
struct ddsi_participant *pp; /* backref to the participant */
};
struct ddsi_proxy_topic
{
ddsi_entityid_t entityid;
struct ddsi_topic_definition *definition; /* ref to (shared) topic definition */
ddsrt_wctime_t tupdate; /* timestamp of last update */
ddsi_seqno_t seq; /* sequence number of most recent SEDP message */
ddsrt_avl_node_t avlnode; /* entry in proxypp->topics */
unsigned deleted: 1;
};
/** @component ddsi_topic */
dds_return_t ddsi_new_topic (struct ddsi_topic **tp_out, struct ddsi_guid *tpguid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, bool is_builtin, bool *new_topic_def);
/** @component ddsi_topic */
void ddsi_update_topic_qos (struct ddsi_topic *tp, const dds_qos_t *xqos);
/** @component ddsi_topic */
dds_return_t ddsi_delete_topic (struct ddsi_domaingv *gv, const struct ddsi_guid *guid);
/** @component ddsi_topic */
dds_return_t ddsi_lookup_topic_definition (struct ddsi_domaingv *gv, const char * topic_name, const ddsi_typeid_t *type_id, struct ddsi_topic_definition **tpd);
#endif /* DDS_HAS_TOPIC_DISCOVERY */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_TOPIC_H */
+59
View File
@@ -0,0 +1,59 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef _DDSI_TRAN_H_
#define _DDSI_TRAN_H_
/* DDSI Transport module */
#include "dds/ddsrt/ifaddrs.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsi/ddsi_locator.h"
#include "dds/ddsi/ddsi_config.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_tran_base;
struct ddsi_tran_conn;
struct ddsi_tran_listener;
struct ddsi_tran_factory;
struct ddsi_tran_qos;
/* 8 for transport/
1 for [
48 for IPv6 hex digits (3*16) + separators
2 for ]:
10 for port (DDSI loc has signed 32-bit)
11 for @ifindex
1 for terminator
--
81
*/
#define DDSI_LOCSTRLEN 81
/** @component locators */
char *ddsi_xlocator_to_string (char *dst, size_t sizeof_dst, const ddsi_xlocator_t *loc);
/** @component locators */
DDS_EXPORT char *ddsi_locator_to_string (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc);
/** @component locators */
char *ddsi_xlocator_to_string_no_port (char *dst, size_t sizeof_dst, const ddsi_xlocator_t *loc);
/** @component locators */
char *ddsi_locator_to_string_no_port (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc);
#if defined (__cplusplus)
}
#endif
#endif
+56
View File
@@ -0,0 +1,56 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
#ifndef DDSI_TRANSMIT_H
#define DDSI_TRANSMIT_H
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_xpack;
struct ddsi_writer;
struct ddsi_serdata;
struct ddsi_tkmap_instance;
struct ddsi_thread_state;
/**
* @component outgoing_rtps
*
* Writing new data; serdata_twrite (serdata) is assumed to be really recentish; serdata is unref'd.
* If xp == NULL, data is queued, else packed. GC may occur, which means the writer history and watermarks
* can be anything. This must be used for all application data.
*
* @param thrst Thread state
* @param xp xpack
* @param wr writer
* @param serdata serialized sample data
* @param tk key-instance map instance
* @return int
*/
DDS_EXPORT int ddsi_write_sample_gc (struct ddsi_thread_state * const thrst, struct ddsi_xpack *xp, struct ddsi_writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
/**
* @component outgoing_rtps
*
* @remark wr->lock must be held
*
* @param gv domain globals
* @param wr_guid writer guid
* @param xp xpack
* @return dds_return_t
*/
dds_return_t ddsi_write_hb_liveliness (struct ddsi_domaingv * const gv, struct ddsi_guid *wr_guid, struct ddsi_xpack *xp);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_TRANSMIT_H */
+39
View File
@@ -0,0 +1,39 @@
// Copyright(c) 2022 ZettaScale Technology
//
// 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
#ifndef DDSI_TYPEBUILDER_H
#define DDSI_TYPEBUILDER_H
#include "dds/features.h"
#include <stdbool.h>
#include <stdint.h>
#include "dds/dds.h"
#include "dds/ddsi/ddsi_typelib.h"
#if defined (__cplusplus)
extern "C" {
#endif
#ifdef DDS_HAS_TYPELIB
/** @component dynamic_types */
DDS_EXPORT dds_return_t ddsi_topic_descriptor_from_type (struct ddsi_domaingv *gv, dds_topic_descriptor_t *desc, const struct ddsi_type *type);
/** @component dynamic_types */
DDS_EXPORT void ddsi_topic_descriptor_fini (dds_topic_descriptor_t *desc);
#endif /* DDS_HAS_TYPELIB */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_TYPEBUILDER_H */
+158
View File
@@ -0,0 +1,158 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_TYPELIB_H
#define DDSI_TYPELIB_H
#include "dds/features.h"
#include <stdbool.h>
#include <stdint.h>
#include "dds/ddsrt/static_assert.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/ddsi_guid.h"
#include "dds/ddsi/ddsi_typewrap.h"
#include "dds/ddsi/ddsi_sertype.h"
#if defined (__cplusplus)
extern "C" {
#endif
#ifdef DDS_HAS_TYPELIB
struct ddsi_domaingv;
struct ddsi_sertype;
struct ddsi_type;
enum ddsi_type_include_deps;
typedef enum ddsi_type_request {
DDSI_TYPE_NO_REQUEST,
DDSI_TYPE_SEND_REQUEST
} ddsi_type_request_t;
/* Used for converting type-id to strings */
struct ddsi_typeid_str {
char str[50];
};
/** @component type_system */
DDS_EXPORT bool ddsi_typeinfo_equal (const ddsi_typeinfo_t *a, const ddsi_typeinfo_t *b, enum ddsi_type_include_deps deps);
/** @component type_system */
DDS_EXPORT ddsi_typeid_t *ddsi_typeinfo_typeid (const ddsi_typeinfo_t *type_info, ddsi_typeid_kind_t kind);
/** @component type_system */
DDS_EXPORT ddsi_typeinfo_t *ddsi_typeinfo_deser (const unsigned char *data, uint32_t sz);
/** @component type_system */
DDS_EXPORT void ddsi_typeinfo_fini (ddsi_typeinfo_t *typeinfo);
/** @component type_system */
DDS_EXPORT void ddsi_typeinfo_free (ddsi_typeinfo_t *typeinfo);
/** @component type_system */
DDS_EXPORT ddsi_typeinfo_t * ddsi_typeinfo_dup (const ddsi_typeinfo_t *src);
/** @component type_system */
DDS_EXPORT const ddsi_typeid_t *ddsi_typeinfo_minimal_typeid (const ddsi_typeinfo_t *typeinfo);
/** @component type_system */
DDS_EXPORT const ddsi_typeid_t *ddsi_typeinfo_complete_typeid (const ddsi_typeinfo_t *typeinfo);
/** @component type_system */
DDS_EXPORT char *ddsi_make_typeid_str (struct ddsi_typeid_str *buf, const ddsi_typeid_t *type_id);
/** @component type_system */
char *ddsi_make_typeid_str_impl (struct ddsi_typeid_str *buf, const DDS_XTypes_TypeIdentifier *type_id);
/** @component type_system */
bool ddsi_typeinfo_present (const ddsi_typeinfo_t *typeinfo);
/** @component type_system */
bool ddsi_typeinfo_valid (const ddsi_typeinfo_t *typeinfo);
/** @component type_system */
DDS_EXPORT ddsi_typemap_t *ddsi_typemap_deser (const unsigned char *data, uint32_t sz);
/** @component type_system */
DDS_EXPORT void ddsi_typemap_fini (ddsi_typemap_t *typemap);
/** @component type_system */
DDS_EXPORT bool ddsi_typemap_equal (const ddsi_typemap_t *a, const ddsi_typemap_t *b);
/** @component type_system */
DDS_EXPORT const char * ddsi_typemap_get_type_name (const ddsi_typemap_t *typemap, const ddsi_typeid_t *type_id);
/** @component type_system */
dds_return_t ddsi_type_ref_local (struct ddsi_domaingv *gv, struct ddsi_type **type, const struct ddsi_sertype *sertype, ddsi_typeid_kind_t kind);
/** @component type_system */
DDS_EXPORT dds_return_t ddsi_type_add (struct ddsi_domaingv *gv, struct ddsi_type **type_minimal, struct ddsi_type **type_complete, const ddsi_typeinfo_t *type_info, const ddsi_typemap_t *type_map);
/** @component type_system */
DDS_EXPORT void ddsi_type_ref (struct ddsi_domaingv *gv, struct ddsi_type **type, const struct ddsi_type *src);
/** @component type_system */
DDS_EXPORT void ddsi_type_unref (struct ddsi_domaingv *gv, struct ddsi_type *type);
/** @component type_system */
void ddsi_type_unref_sertype (struct ddsi_domaingv *gv, const struct ddsi_sertype *sertype);
/** @component type_system */
struct ddsi_typeobj *ddsi_type_get_typeobj (struct ddsi_domaingv *gv, const struct ddsi_type *type);
/** @component type_system */
bool ddsi_type_resolved (struct ddsi_domaingv *gv, const struct ddsi_type *type, enum ddsi_type_include_deps resolved_kind);
/** @component type_system */
struct ddsi_domaingv *ddsi_type_get_gv (const struct ddsi_type *type);
/** @component type_system */
DDS_XTypes_TypeKind ddsi_type_get_kind (const struct ddsi_type *type);
#ifdef DDS_HAS_TYPELIB
/**
* @brief Waits for the provided type to be resolved
* @component type_system
*
* In case the type is succesfully resolved (or was already resolved), this
* function increases the refcount for this type. Caller should do the unref.
*/
dds_return_t ddsi_wait_for_type_resolved (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id, dds_duration_t timeout, struct ddsi_type **type, enum ddsi_type_include_deps resolved_kind, ddsi_type_request_t request);
#endif
/**
* @brief Returns the type lookup meta object for the provided type identifier.
* @component type_system
*
* @remark The returned object from this function is not refcounted,
* its lifetime is at lease the lifetime of the (proxy) endpoints
* that are referring to it.
*/
DDS_EXPORT struct ddsi_type * ddsi_type_lookup (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id);
/**
* @brief Compares the provided type lookup meta objects.
* @component type_system
*
*/
DDS_EXPORT int ddsi_type_compare (const struct ddsi_type *a, const struct ddsi_type *b);
#endif /* DDS_HAS_TYPELIB */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_TYPELIB_H */
+104
View File
@@ -0,0 +1,104 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_TYPEWRAP_H
#define DDSI_TYPEWRAP_H
#include "dds/features.h"
#include <stdbool.h>
#include <stdint.h>
#include "dds/ddsrt/static_assert.h"
#include "dds/ddsi/ddsi_xqos.h"
#include "dds/ddsi/ddsi_xt_typeinfo.h"
#if defined (__cplusplus)
extern "C" {
#endif
#ifdef DDS_HAS_TYPELIB
#define DDS_XTypes_TRY_CONSTRUCT_INVALID 0
#define DDS_XTypes_TRY_CONSTRUCT_DISCARD DDS_XTypes_TRY_CONSTRUCT1
#define DDS_XTypes_TRY_CONSTRUCT_USE_DEFAULT DDS_XTypes_TRY_CONSTRUCT2
#define DDS_XTypes_TRY_CONSTRUCT_TRIM (DDS_XTypes_TRY_CONSTRUCT1 | DDS_XTypes_TRY_CONSTRUCT2)
typedef struct ddsi_typeid ddsi_typeid_t;
typedef struct ddsi_typeinfo ddsi_typeinfo_t;
typedef struct ddsi_typeobj ddsi_typeobj_t;
typedef struct ddsi_typemap ddsi_typemap_t;
typedef enum ddsi_typeid_kind {
DDSI_TYPEID_KIND_MINIMAL,
DDSI_TYPEID_KIND_COMPLETE,
DDSI_TYPEID_KIND_PLAIN_COLLECTION_MINIMAL,
DDSI_TYPEID_KIND_PLAIN_COLLECTION_COMPLETE,
DDSI_TYPEID_KIND_FULLY_DESCRIPTIVE,
DDSI_TYPEID_KIND_INVALID
} ddsi_typeid_kind_t;
enum ddsi_type_include_deps {
DDSI_TYPE_IGNORE_DEPS,
DDSI_TYPE_INCLUDE_DEPS
};
/** @component xtypes_wrapper */
DDS_EXPORT int ddsi_typeid_compare (const ddsi_typeid_t *a, const ddsi_typeid_t *b);
/** @component xtypes_wrapper */
DDS_EXPORT void ddsi_typeid_copy (ddsi_typeid_t *dst, const ddsi_typeid_t *src);
/** @component xtypes_wrapper */
DDS_EXPORT ddsi_typeid_t * ddsi_typeid_dup (const ddsi_typeid_t *src);
/** @component xtypes_wrapper */
DDS_EXPORT void ddsi_typeid_ser (const ddsi_typeid_t *type_id, unsigned char **buf, uint32_t *sz);
/** @component xtypes_wrapper */
DDS_EXPORT bool ddsi_typeid_is_none (const ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
DDS_EXPORT bool ddsi_typeid_is_hash (const ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
DDS_EXPORT bool ddsi_typeid_is_minimal (const ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
DDS_EXPORT bool ddsi_typeid_is_complete (const ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
DDS_EXPORT bool ddsi_typeid_is_fully_descriptive (const ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
DDS_EXPORT void ddsi_typeid_get_equivalence_hash (const ddsi_typeid_t *type_id, DDS_XTypes_EquivalenceHash *hash);
/** @component xtypes_wrapper */
DDS_EXPORT ddsi_typeid_kind_t ddsi_typeid_kind (const ddsi_typeid_t *type);
/** @component xtypes_wrapper */
DDS_EXPORT void ddsi_typeid_fini (ddsi_typeid_t *type_id);
/** @component xtypes_wrapper */
void ddsi_typeobj_fini (ddsi_typeobj_t *typeobj);
#else /* DDS_HAS_TYPELIB */
typedef void ddsi_typeid_t;
typedef int ddsi_typeid_kind_t;
typedef void ddsi_typemap_t;
typedef void ddsi_typeinfo_t;
#endif /* DDS_HAS_TYPELIB */
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_TYPEWRAP_H */
+26
View File
@@ -0,0 +1,26 @@
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
#ifndef DDSI_UNUSED_H
#define DDSI_UNUSED_H
#ifdef __GNUC__
#define UNUSED_ARG(x) x __attribute__ ((unused))
#else
#define UNUSED_ARG(x) x
#endif
#ifndef NDEBUG
#define UNUSED_ARG_NDEBUG(x) x
#else
#define UNUSED_ARG_NDEBUG(x) UNUSED_ARG (x)
#endif
#endif /* DDSI_UNUSED_H */
+106
View File
@@ -0,0 +1,106 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_WHC_H
#define DDSI_WHC_H
#include <stddef.h>
#include "dds/ddsrt/time.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_serdata;
struct ddsi_plist;
struct ddsi_tkmap_instance;
struct ddsi_whc;
/**
* @brief Base type for whc node
*/
struct ddsi_whc_node {
ddsi_seqno_t seq;
};
struct ddsi_whc_borrowed_sample {
ddsi_seqno_t seq;
struct ddsi_serdata *serdata;
bool unacked;
ddsrt_mtime_t last_rexmit_ts;
unsigned rexmit_count;
};
struct ddsi_whc_state {
ddsi_seqno_t min_seq; /* 0 if WHC empty, else > 0 */
ddsi_seqno_t max_seq; /* 0 if WHC empty, else >= min_seq */
size_t unacked_bytes;
};
#define DDSI_WHCST_ISEMPTY(whcst) ((whcst)->max_seq == 0)
/* Adjust SIZE and alignment stuff as needed: they are here simply so we can allocate
an iter on the stack without specifying an implementation. If future changes or
implementations require more, these can be adjusted. An implementation should check
things fit at compile time. */
#define DDSI_WHC_SAMPLE_ITER_SIZE (8 * sizeof(void *))
struct ddsi_whc_sample_iter_base {
struct ddsi_whc *whc;
};
struct ddsi_whc_sample_iter {
struct ddsi_whc_sample_iter_base c;
union {
char opaque[DDSI_WHC_SAMPLE_ITER_SIZE];
/* cover alignment requirements: */
uint64_t x;
double y;
void *p;
} opaque;
};
typedef ddsi_seqno_t (*ddsi_whc_next_seq_t)(const struct ddsi_whc *whc, ddsi_seqno_t seq);
typedef void (*ddsi_whc_get_state_t)(const struct ddsi_whc *whc, struct ddsi_whc_state *st);
typedef bool (*ddsi_whc_borrow_sample_t)(const struct ddsi_whc *whc, ddsi_seqno_t seq, struct ddsi_whc_borrowed_sample *sample);
typedef bool (*ddsi_whc_borrow_sample_key_t)(const struct ddsi_whc *whc, const struct ddsi_serdata *serdata_key, struct ddsi_whc_borrowed_sample *sample);
typedef void (*ddsi_whc_return_sample_t)(struct ddsi_whc *whc, struct ddsi_whc_borrowed_sample *sample, bool update_retransmit_info);
typedef void (*ddsi_whc_sample_iter_init_t)(const struct ddsi_whc *whc, struct ddsi_whc_sample_iter *it);
typedef bool (*ddsi_whc_sample_iter_borrow_next_t)(struct ddsi_whc_sample_iter *it, struct ddsi_whc_borrowed_sample *sample);
typedef void (*whc_free_t)(struct ddsi_whc *whc);
/* min_seq is lowest sequence number that must be retained because of
reliable readers that have not acknowledged all data */
/* max_drop_seq must go soon, it's way too ugly. */
/* plist may be NULL or ddsrt_malloc'd, WHC takes ownership of plist */
typedef int (*ddsi_whc_insert_t)(struct ddsi_whc *whc, ddsi_seqno_t max_drop_seq, ddsi_seqno_t seq, ddsrt_mtime_t exp, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
typedef uint32_t (*ddsi_whc_remove_acked_messages_t)(struct ddsi_whc *whc, ddsi_seqno_t max_drop_seq, struct ddsi_whc_state *whcst, struct ddsi_whc_node **deferred_free_list);
typedef void (*ddsi_whc_free_deferred_free_list_t)(struct ddsi_whc *whc, struct ddsi_whc_node *deferred_free_list);
struct ddsi_whc_ops {
ddsi_whc_insert_t insert;
ddsi_whc_remove_acked_messages_t remove_acked_messages;
ddsi_whc_free_deferred_free_list_t free_deferred_free_list;
ddsi_whc_get_state_t get_state;
ddsi_whc_next_seq_t next_seq;
ddsi_whc_borrow_sample_t borrow_sample;
ddsi_whc_borrow_sample_key_t borrow_sample_key;
ddsi_whc_return_sample_t return_sample;
ddsi_whc_sample_iter_init_t sample_iter_init;
ddsi_whc_sample_iter_borrow_next_t sample_iter_borrow_next;
whc_free_t free;
};
struct ddsi_whc {
const struct ddsi_whc_ops *ops;
};
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_WHC_H */
+101
View File
@@ -0,0 +1,101 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_XEVENT_H
#define DDSI_XEVENT_H
#include "dds/ddsrt/retcode.h"
#include "dds/ddsi/ddsi_guid.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_xevent;
struct ddsi_xeventq;
struct ddsi_domaingv;
struct ddsi_xpack;
typedef void (*ddsi_xevent_cb_t) (struct ddsi_domaingv *gv, struct ddsi_xevent *ev, struct ddsi_xpack *xp, void *arg, ddsrt_mtime_t tnow);
/** @brief removes an event from the event queue and frees it
* @component timed_events
*
* @remark: may be called from inside the event handler
* @remark: if the event was created with the `sync_on_delete` flag set, it blocks until
* the system guarantees that it is not and will not be executing anymore
*
* @param[in] ev the event to be deleted
*/
void ddsi_delete_xevent (struct ddsi_xevent *ev)
ddsrt_nonnull_all;
/** @brief reschedules the event iff `tsched` precedes the time for which it is currently scheduled
* @component timed_events
*
* @remark: may be called from inside the event handler
*
* @param[in] ev the event to be rescheduled
* @param[in] tsched new scheduled time
*
* @return whether the event was actually rescheduled, i.e., whether `tsched` preceded the
* time for which it was scheduled before
*
* @retval 0 not rescheduled
* @retval 1 rescheduled
*/
int ddsi_resched_xevent_if_earlier (struct ddsi_xevent *ev, ddsrt_mtime_t tsched)
ddsrt_nonnull_all;
/** @brief returns whether or not the event is scheduled or pending deletion
* @component timed_events
*
* @remark: may be called from inside the event handler
*
* @param[in] ev the event for which to check whether it is scheduled
*
* @retval 0 not scheduled
* @retval 1 scheduled or pending deletion
*/
int ddsi_xevent_is_scheduled (struct ddsi_xevent *ev)
ddsrt_nonnull_all;
/** @brief creates a new event object on the given event queue for invoking `cb` in the
* future on the thread handling this queue
* @component timed_events
*
* @remark: delete does not block until an ongoing callback finishes, unless
* `sync_on_delete` is set
* @remark: just before invoking the callback, the schedule time is set to NEVER
* @remark: cb will be called with now = NEVER if the event is still enqueued when
* `ddsi_xeventq_free` starts cleaning up (a consequence of the combination of
* this and being allowed to delete the event from within the callback is that
* one need not always store the returned event pointer)
*
* @param[in] evq event queue
* @param[in] tsched timestamp scheduled, may be NEVER
* @param[in] cb callback function pointer
* @param[in] arg argument (copied into ddsi_xevent, may be a null pointer
* when arg_size = 0)
* @param[in] arg_size size of argument in bytes
* @param[in] sync_on_delete whether `ddsi_delete_xevent` must block until the
* system guarantees that `cb` is not and will not be executing
* anymore
*
* @return the new event object
*/
struct ddsi_xevent *ddsi_qxev_callback (struct ddsi_xeventq *evq, ddsrt_mtime_t tsched, ddsi_xevent_cb_t cb, const void *arg, size_t arg_size, bool sync_on_delete)
ddsrt_nonnull((1,3));
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_XEVENT_H */
+43
View File
@@ -0,0 +1,43 @@
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
#ifndef DDSI_XMSG_H
#define DDSI_XMSG_H
#include <stddef.h>
#include "dds/features.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_domaingv;
struct ddsi_xpack;
/** @component rtps_msg */
DDS_EXPORT struct ddsi_xpack * ddsi_xpack_new (struct ddsi_domaingv *gv, bool async_mode);
/** @component rtps_msg */
DDS_EXPORT void ddsi_xpack_free (struct ddsi_xpack *xp);
/** @component rtps_msg */
DDS_EXPORT void ddsi_xpack_send (struct ddsi_xpack *xp, bool immediately /* unused */);
/** @component rtps_msg */
void ddsi_xpack_sendq_init (struct ddsi_domaingv *gv);
/** @component rtps_msg */
void ddsi_xpack_sendq_start (struct ddsi_domaingv *gv);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_XMSG_H */
+416
View File
@@ -0,0 +1,416 @@
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
#ifndef DDSI_XQOS_H
#define DDSI_XQOS_H
#include "dds/features.h"
#include "dds/ddsrt/retcode.h"
#include "dds/ddsrt/time.h"
#include "dds/ddsc/dds_public_qosdefs.h"
#include "dds/ddsi/ddsi_protocol.h"
#include "dds/ddsi/ddsi_log.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_typeinfo;
typedef struct ddsi_octetseq {
uint32_t length;
unsigned char *value;
} ddsi_octetseq_t;
typedef ddsi_octetseq_t dds_userdata_qospolicy_t;
typedef ddsi_octetseq_t dds_topicdata_qospolicy_t;
typedef ddsi_octetseq_t dds_groupdata_qospolicy_t;
typedef struct dds_property {
/* The propagate boolean will not be send over the wire.
* When the value is 'false', the complete struct shouldn't be send.
* It has to be the first variable within the structure because it
* is mapped to XbPROP in the serialiser. */
unsigned char propagate;
char *name;
char *value;
} dds_property_t;
typedef struct dds_propertyseq {
uint32_t n;
dds_property_t *props;
} dds_propertyseq_t;
typedef struct dds_binaryproperty {
/* The propagate boolean will not be send over the wire.
* When the value is 'false', the complete struct shouldn't be send.
* It has to be the first variable within the structure because it
* is mapped to XbPROP in the serialiser. */
unsigned char propagate;
char *name;
ddsi_octetseq_t value;
} dds_binaryproperty_t;
typedef struct dds_binarypropertyseq {
uint32_t n;
dds_binaryproperty_t *props;
} dds_binarypropertyseq_t;
typedef struct dds_property_qospolicy {
dds_propertyseq_t value;
dds_binarypropertyseq_t binary_value;
} dds_property_qospolicy_t;
typedef struct dds_durability_qospolicy {
dds_durability_kind_t kind;
} dds_durability_qospolicy_t;
typedef struct dds_history_qospolicy {
dds_history_kind_t kind;
int32_t depth;
} dds_history_qospolicy_t;
typedef struct dds_resource_limits_qospolicy {
int32_t max_samples;
int32_t max_instances;
int32_t max_samples_per_instance;
} dds_resource_limits_qospolicy_t;
typedef struct dds_durability_service_qospolicy {
dds_duration_t service_cleanup_delay;
dds_history_qospolicy_t history;
dds_resource_limits_qospolicy_t resource_limits;
} dds_durability_service_qospolicy_t;
typedef struct dds_presentation_qospolicy {
dds_presentation_access_scope_kind_t access_scope;
unsigned char coherent_access;
unsigned char ordered_access;
} dds_presentation_qospolicy_t;
typedef struct dds_deadline_qospolicy {
dds_duration_t deadline;
} dds_deadline_qospolicy_t;
typedef struct dds_latency_budget_qospolicy {
dds_duration_t duration;
} dds_latency_budget_qospolicy_t;
typedef struct dds_ownership_qospolicy {
dds_ownership_kind_t kind;
} dds_ownership_qospolicy_t;
typedef struct dds_ownership_strength_qospolicy {
int32_t value;
} dds_ownership_strength_qospolicy_t;
typedef struct dds_liveliness_qospolicy {
dds_liveliness_kind_t kind;
dds_duration_t lease_duration;
} dds_liveliness_qospolicy_t;
typedef struct dds_time_based_filter_qospolicy {
dds_duration_t minimum_separation;
} dds_time_based_filter_qospolicy_t;
typedef struct ddsi_stringseq {
uint32_t n;
char **strs;
} ddsi_stringseq_t;
typedef ddsi_stringseq_t dds_partition_qospolicy_t;
typedef struct dds_reliability_qospolicy {
dds_reliability_kind_t kind;
dds_duration_t max_blocking_time;
} dds_reliability_qospolicy_t;
typedef enum dds_external_reliability_kind {
DDS_EXTERNAL_RELIABILITY_BEST_EFFORT = 1,
DDS_EXTERNAL_RELIABILITY_RELIABLE = 2
} dds_external_reliability_kind_t;
typedef struct dds_transport_priority_qospolicy {
int32_t value;
} dds_transport_priority_qospolicy_t;
typedef struct dds_lifespan_qospolicy {
dds_duration_t duration;
} dds_lifespan_qospolicy_t;
typedef struct dds_destination_order_qospolicy {
dds_destination_order_kind_t kind;
} dds_destination_order_qospolicy_t;
typedef struct dds_entity_factory_qospolicy {
unsigned char autoenable_created_entities;
} dds_entity_factory_qospolicy_t;
typedef struct dds_writer_data_lifecycle_qospolicy {
unsigned char autodispose_unregistered_instances;
} dds_writer_data_lifecycle_qospolicy_t;
typedef struct dds_reader_data_lifecycle_qospolicy {
dds_duration_t autopurge_nowriter_samples_delay;
dds_duration_t autopurge_disposed_samples_delay;
} dds_reader_data_lifecycle_qospolicy_t;
typedef struct dds_reader_lifespan_qospolicy {
unsigned char use_lifespan;
dds_duration_t duration;
} dds_reader_lifespan_qospolicy_t;
typedef struct dds_writer_batching_qospolicy {
unsigned char batch_updates;
} dds_writer_batching_qospolicy_t;
typedef struct dds_ignorelocal_qospolicy {
dds_ignorelocal_kind_t value;
} dds_ignorelocal_qospolicy_t;
typedef struct dds_type_consistency_enforcement_qospolicy {
dds_type_consistency_kind_t kind;
bool ignore_sequence_bounds;
bool ignore_string_bounds;
bool ignore_member_names;
bool prevent_type_widening;
bool force_type_validation;
} dds_type_consistency_enforcement_qospolicy_t;
typedef uint32_t dds_locator_mask_t;
typedef struct dds_data_representation_id_seq {
uint32_t n;
dds_data_representation_id_t *ids;
} dds_data_representation_id_seq_t;
typedef struct dds_data_representation_qospolicy {
dds_data_representation_id_seq_t value;
} dds_data_representation_qospolicy_t;
typedef ddsi_stringseq_t dds_pubsub_message_exchange_qospolicy_t;
/***/
/* Qos Present bit indices */
#define DDSI_QP_TOPIC_NAME ((uint64_t)1 << 0)
#define DDSI_QP_TYPE_NAME ((uint64_t)1 << 1)
#define DDSI_QP_PRESENTATION ((uint64_t)1 << 2)
#define DDSI_QP_PARTITION ((uint64_t)1 << 3)
#define DDSI_QP_GROUP_DATA ((uint64_t)1 << 4)
#define DDSI_QP_TOPIC_DATA ((uint64_t)1 << 5)
#define DDSI_QP_DURABILITY ((uint64_t)1 << 6)
#define DDSI_QP_DURABILITY_SERVICE ((uint64_t)1 << 7)
#define DDSI_QP_DEADLINE ((uint64_t)1 << 8)
#define DDSI_QP_LATENCY_BUDGET ((uint64_t)1 << 9)
#define DDSI_QP_LIVELINESS ((uint64_t)1 << 10)
#define DDSI_QP_RELIABILITY ((uint64_t)1 << 11)
#define DDSI_QP_DESTINATION_ORDER ((uint64_t)1 << 12)
#define DDSI_QP_HISTORY ((uint64_t)1 << 13)
#define DDSI_QP_RESOURCE_LIMITS ((uint64_t)1 << 14)
#define DDSI_QP_TRANSPORT_PRIORITY ((uint64_t)1 << 15)
#define DDSI_QP_LIFESPAN ((uint64_t)1 << 16)
#define DDSI_QP_USER_DATA ((uint64_t)1 << 17)
#define DDSI_QP_OWNERSHIP ((uint64_t)1 << 18)
#define DDSI_QP_OWNERSHIP_STRENGTH ((uint64_t)1 << 19)
#define DDSI_QP_TIME_BASED_FILTER ((uint64_t)1 << 20)
#define DDSI_QP_ADLINK_WRITER_DATA_LIFECYCLE ((uint64_t)1 << 21)
#define DDSI_QP_ADLINK_READER_DATA_LIFECYCLE ((uint64_t)1 << 22)
#define DDSI_QP_ADLINK_READER_LIFESPAN ((uint64_t)1 << 24)
#define DDSI_QP_CYCLONE_WRITER_BATCHING ((uint64_t)1 << 25)
#define DDSI_QP_ADLINK_ENTITY_FACTORY ((uint64_t)1 << 27)
#define DDSI_QP_CYCLONE_IGNORELOCAL ((uint64_t)1 << 30)
#define DDSI_QP_PROPERTY_LIST ((uint64_t)1 << 31)
#define DDSI_QP_TYPE_CONSISTENCY_ENFORCEMENT ((uint64_t)1 << 32)
#define DDSI_QP_TYPE_INFORMATION ((uint64_t)1 << 33)
#define DDSI_QP_PSMX ((uint64_t)1 << 34)
#define DDSI_QP_DATA_REPRESENTATION ((uint64_t)1 << 35)
#define DDSI_QP_ENTITY_NAME ((uint64_t)1 << 36)
/* Partition QoS is not RxO according to the specification (DDS 1.2,
section 7.1.3), but communication will not take place unless it
matches. Same for topic and type. Relaxed qos matching is a bit of
a weird one, but it affects matching, so ... */
#define DDSI_QP_RXO_MASK (DDSI_QP_DURABILITY | DDSI_QP_PRESENTATION | DDSI_QP_DEADLINE | DDSI_QP_LATENCY_BUDGET | DDSI_QP_OWNERSHIP | DDSI_QP_LIVELINESS | DDSI_QP_RELIABILITY | DDSI_QP_DESTINATION_ORDER | DDSI_QP_DATA_REPRESENTATION)
#define DDSI_QP_CHANGEABLE_MASK (DDSI_QP_USER_DATA | DDSI_QP_TOPIC_DATA | DDSI_QP_GROUP_DATA | DDSI_QP_DEADLINE | DDSI_QP_LATENCY_BUDGET | DDSI_QP_OWNERSHIP_STRENGTH | DDSI_QP_TIME_BASED_FILTER | DDSI_QP_PARTITION | DDSI_QP_TRANSPORT_PRIORITY | DDSI_QP_LIFESPAN | DDSI_QP_ADLINK_ENTITY_FACTORY | DDSI_QP_ADLINK_WRITER_DATA_LIFECYCLE | DDSI_QP_ADLINK_READER_DATA_LIFECYCLE)
#define DDSI_QP_UNRECOGNIZED_INCOMPATIBLE_MASK ((uint64_t) 0)
/* readers & writers have an extended qos, hence why it is a separate
type */
struct dds_qos {
/* Entries present, for sparse QoS */
uint64_t present;
uint64_t aliased;
/*v---- in ...Qos
v--- in ...BuiltinTopicData
v-- mapped in DDSI
v- reader/writer/publisher/subscriber/participant specific */
/* Extras: */
/* xx */char *topic_name;
/* xx */char *type_name;
/* xx */char *entity_name;
#ifdef DDS_HAS_TYPELIB
/* xx */struct ddsi_typeinfo *type_information;
#endif
/* PublisherQos, SubscriberQos: */
/*xxx */dds_presentation_qospolicy_t presentation;
/*xxx */dds_partition_qospolicy_t partition;
/*xxx */dds_groupdata_qospolicy_t group_data;
/*x xX*/dds_entity_factory_qospolicy_t entity_factory;
/* TopicQos: */
/*xxx */dds_topicdata_qospolicy_t topic_data;
/* DataWriterQos, DataReaderQos: */
/*xxx */dds_durability_qospolicy_t durability;
/*xxx */dds_durability_service_qospolicy_t durability_service;
/*xxx */dds_deadline_qospolicy_t deadline;
/*xxx */dds_latency_budget_qospolicy_t latency_budget;
/*xxx */dds_liveliness_qospolicy_t liveliness;
/*xxx */dds_reliability_qospolicy_t reliability;
/*xxx */dds_destination_order_qospolicy_t destination_order;
/*x x */dds_history_qospolicy_t history;
/*x x */dds_resource_limits_qospolicy_t resource_limits;
/*x x */dds_transport_priority_qospolicy_t transport_priority;
/*xxx */dds_lifespan_qospolicy_t lifespan;
/*xxx */dds_userdata_qospolicy_t user_data;
/*xxx */dds_ownership_qospolicy_t ownership;
/*xxxW*/dds_ownership_strength_qospolicy_t ownership_strength;
/*xxxR*/dds_time_based_filter_qospolicy_t time_based_filter;
/*x W*/dds_writer_data_lifecycle_qospolicy_t writer_data_lifecycle;
/*x xR*/dds_reader_data_lifecycle_qospolicy_t reader_data_lifecycle;
/*x xR*/dds_reader_lifespan_qospolicy_t reader_lifespan;
/*x W*/dds_writer_batching_qospolicy_t writer_batching;
/* x */dds_ignorelocal_qospolicy_t ignorelocal;
/*xxx */dds_property_qospolicy_t property;
/*xxxR*/dds_type_consistency_enforcement_qospolicy_t type_consistency;
/*xxxX*/dds_pubsub_message_exchange_qospolicy_t psmx;
/*xxx */dds_data_representation_qospolicy_t data_representation;
};
DDS_EXPORT extern const dds_qos_t ddsi_default_qos_reader;
DDS_EXPORT extern const dds_qos_t ddsi_default_qos_writer;
DDS_EXPORT extern const dds_qos_t ddsi_default_qos_topic;
DDS_EXPORT extern const dds_qos_t ddsi_default_qos_publisher_subscriber;
DDS_EXPORT extern const dds_qos_t ddsi_default_qos_participant;
/**
* @brief Initialize a new empty dds_qos_t as an empty object
* @component qos_handling
*
* In principle, this only clears the "present" and "aliased" bitmasks. A debug build
* additionally initializes all other bytes to 0x55.
*
* @param[out] xqos qos object to be initialized.
*/
void ddsi_xqos_init_empty (dds_qos_t *xqos);
/**
* @brief Copy "src" to "dst"
* @component qos_handling
*
* @param[out] dst destination, any contents are overwritten
* @param[in] src source dds_qos_t
*/
void ddsi_xqos_copy (dds_qos_t *dst, const dds_qos_t *src);
/**
* @brief Free memory owned by "xqos"
* @component qos_handling
*
* A dds_qos_t may own other allocated blocks of memory, depending on which fields are
* set, their types and whether they are marked as "aliased". This function releases any
* such memory owned by "xqos", but not "xqos" itself. Afterward, the content of "xqos"
* is undefined and must not be used again without initialising it.
*
* @param[in] xqos dds_qos_t for which to free memory
*/
void ddsi_xqos_fini (dds_qos_t *xqos);
/**
* @brief Check whether xqos is valid according to the validation rules in the spec
* @component qos_handling
*
* The checks concern the values for the individual fields as well as a few combinations
* of fields. Only those that are set are checked (the defaults are all valid anyway),
* and where a combination of fields must be checked and some but not all fields are
* specified, it uses the defaults for the missing ones.
*
* Invalid values get logged as category "plist" according to the specified logging
* configuration.
*
* @param[in] logcfg logging configuration
* @param[in] xqos qos object to check
*
* @returns DDS_RETCODE_OK or DDS_RETCODE_BAD_PARAMETER
*/
dds_return_t ddsi_xqos_valid (const struct ddsrt_log_cfg *logcfg, const dds_qos_t *xqos);
/**
* @brief Extend "a" with selected entries present in "b"
* @component qos_handling
*
* This copies into "a" any entries present in "b" that are included in "mask" and missing
* in "a". It doesn't touch any entries already present in "a". Calling this on an empty
* "a" with all bits set in "mask" is equivalent to copying "b" into "a"; calling this
* with "mask" 0 copies nothing.
*
* @param[in,out] a dds_qos_t to be extended
* @param[in] b dds_qos_t from which to copy entries
* @param[in] mask which to include (if DDSI_QP_X is set, include X)
*/
void ddsi_xqos_mergein_missing (dds_qos_t *a, const dds_qos_t *b, uint64_t mask);
/**
* @brief Determine the set of entries in which "x" differs from "y"
* @component qos_handling
*
* This computes the entries set in "x" but not set in "y", not set in "x" but set in "y",
* or set in both "x" and "y" but to a different value. It returns this set reduced to
* only those included in "mask", that is, if bit X is clear in "mask", bit X will be
* clear in the result.
*
* @param[in] a one of the two plists to compare
* @param[in] b other plist to compare
* @param[in] mask subset of entries to be compared
*
* @returns Bitmask of differences
*/
DDS_EXPORT uint64_t ddsi_xqos_delta (const dds_qos_t *a, const dds_qos_t *b, uint64_t mask);
/**
* @brief Add a property 'name' to the properties of "xqos" if it does not exists
* @component qos_handling
*
* @param[in] xqos qos object to add property to.
* @param[in] propagate whether to propagate (emit to wire) the property
* @param[in] name property name
* @param[in] value property value
*
* @returns true iff xqos was modified (property did not exist yet)
*/
bool ddsi_xqos_add_property_if_unset (dds_qos_t *xqos, bool propagate, const char *name, const char *value);
/**
* @brief Duplicate "src"
* @component qos_handling
*
* @param[in] src dds_qos_t to be duplicated
*
* @returns a new (allocated using ddsrt_malloc) dds_qos_t containing a copy of "src".
*/
dds_qos_t *ddsi_xqos_dup (const dds_qos_t *src);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_XQOS_H */
File diff suppressed because it is too large. Load diff
+314
View File
@@ -0,0 +1,314 @@
/****************************************************************
Generated by Eclipse Cyclone DDS IDL to C Translator
File name: ddsi_xt_typelookup.h
Source: ddsi_xt_typelookup.idl
Cyclone DDS: V0.11.0
*****************************************************************/
#ifndef DDSI_XT_TYPELOOKUP_H
#define DDSI_XT_TYPELOOKUP_H
#include "dds/ddsi/ddsi_xt_typeinfo.h"
#include "dds/ddsc/dds_public_impl.h"
#include "dds/cdr/dds_cdrstream.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t DDS_GuidPrefix_t[12];
#define DDS_GuidPrefix_t__alloc() \
((DDS_GuidPrefix_t*) dds_alloc (sizeof (DDS_GuidPrefix_t)));
typedef struct DDS_EntityId_t
{
uint8_t entityKey[3];
uint8_t entityKind;
} DDS_EntityId_t;
typedef struct DDS_GUID_t
{
DDS_GuidPrefix_t guidPrefix;
struct DDS_EntityId_t entityId;
} DDS_GUID_t;
typedef struct DDS_SequenceNumber
{
int32_t high;
uint32_t low;
} DDS_SequenceNumber;
typedef struct DDS_SampleIdentity
{
struct DDS_GUID_t writer_guid;
struct DDS_SequenceNumber sequence_number;
} DDS_SampleIdentity;
#define DDS_DDS_RETCODE_OK 0
typedef uint8_t DDS_RPC_UnknownOperation;
#define DDS_RPC_UnknownOperation__alloc() \
((DDS_RPC_UnknownOperation*) dds_alloc (sizeof (DDS_RPC_UnknownOperation)));
typedef uint8_t DDS_RPC_UnknownException;
#define DDS_RPC_UnknownException__alloc() \
((DDS_RPC_UnknownException*) dds_alloc (sizeof (DDS_RPC_UnknownException)));
typedef uint8_t DDS_RPC_UnusedMember;
#define DDS_RPC_UnusedMember__alloc() \
((DDS_RPC_UnusedMember*) dds_alloc (sizeof (DDS_RPC_UnusedMember)));
typedef enum DDS_RPC_RemoteExceptionCode
{
DDS_RPC_REMOTE_EX_OK,
DDS_RPC_REMOTE_EX_UNSUPPORTED,
DDS_RPC_REMOTE_EX_INVALID_ARGUMENT,
DDS_RPC_REMOTE_EX_OUT_OF_RESOURCES,
DDS_RPC_REMOTE_EX_UNKNOWN_OPERATION,
DDS_RPC_REMOTE_EX_UNKNOWN_EXCEPTION
} DDS_RPC_RemoteExceptionCode;
#define DDS_RPC_RemoteExceptionCode__alloc() \
((DDS_RPC_RemoteExceptionCode*) dds_alloc (sizeof (DDS_RPC_RemoteExceptionCode)));
typedef char DDS_RPC_InstanceName[256];
#define DDS_RPC_InstanceName__alloc() \
((DDS_RPC_InstanceName*) dds_alloc (sizeof (DDS_RPC_InstanceName)));
typedef struct DDS_RPC_RequestHeader
{
struct DDS_SampleIdentity requestId;
DDS_RPC_InstanceName instanceName;
} DDS_RPC_RequestHeader;
typedef struct DDS_RPC_ReplyHeader
{
struct DDS_SampleIdentity relatedRequestId;
DDS_RPC_RemoteExceptionCode remoteEx;
} DDS_RPC_ReplyHeader;
#define DDS_Builtin_TypeLookup_getTypes_HashId 25318099
#define DDS_Builtin_TypeLookup_getDependencies_HashId 95091505
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifier
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifier *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifier;
#define dds_sequence_DDS_XTypes_TypeIdentifier__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifier*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifier)));
#define dds_sequence_DDS_XTypes_TypeIdentifier_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifier *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifier)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED */
typedef struct DDS_Builtin_TypeLookup_getTypes_In
{
dds_sequence_DDS_XTypes_TypeIdentifier type_ids;
} DDS_Builtin_TypeLookup_getTypes_In;
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair;
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair)));
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierPair
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierPair *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierPair;
#define dds_sequence_DDS_XTypes_TypeIdentifierPair__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierPair)));
#define dds_sequence_DDS_XTypes_TypeIdentifierPair_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierPair)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED */
typedef struct DDS_Builtin_TypeLookup_getTypes_Out
{
dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair types;
dds_sequence_DDS_XTypes_TypeIdentifierPair complete_to_minimal;
} DDS_Builtin_TypeLookup_getTypes_Out;
typedef struct DDS_Builtin_TypeLookup_getTypes_Result
{
int32_t _d;
union
{
struct DDS_Builtin_TypeLookup_getTypes_Out result;
} _u;
} DDS_Builtin_TypeLookup_getTypes_Result;
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifier
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifier *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifier;
#define dds_sequence_DDS_XTypes_TypeIdentifier__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifier*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifier)));
#define dds_sequence_DDS_XTypes_TypeIdentifier_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifier *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifier)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED */
#ifndef DDS_SEQUENCE_OCTET_DEFINED
#define DDS_SEQUENCE_OCTET_DEFINED
typedef struct dds_sequence_octet
{
uint32_t _maximum;
uint32_t _length;
uint8_t *_buffer;
bool _release;
} dds_sequence_octet;
#define dds_sequence_octet__alloc() \
((dds_sequence_octet*) dds_alloc (sizeof (dds_sequence_octet)));
#define dds_sequence_octet_allocbuf(l) \
((uint8_t *) dds_alloc ((l) * sizeof (uint8_t)))
#endif /* DDS_SEQUENCE_OCTET_DEFINED */
typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_In
{
dds_sequence_DDS_XTypes_TypeIdentifier type_ids;
dds_sequence_octet continuation_point;
} DDS_Builtin_TypeLookup_getTypeDependencies_In;
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierWithSize
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierWithSize *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierWithSize;
#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierWithSize*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierWithSize)));
#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierWithSize *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierWithSize)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED */
#ifndef DDS_SEQUENCE_OCTET_DEFINED
#define DDS_SEQUENCE_OCTET_DEFINED
typedef struct dds_sequence_octet
{
uint32_t _maximum;
uint32_t _length;
uint8_t *_buffer;
bool _release;
} dds_sequence_octet;
#define dds_sequence_octet__alloc() \
((dds_sequence_octet*) dds_alloc (sizeof (dds_sequence_octet)));
#define dds_sequence_octet_allocbuf(l) \
((uint8_t *) dds_alloc ((l) * sizeof (uint8_t)))
#endif /* DDS_SEQUENCE_OCTET_DEFINED */
typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_Out
{
dds_sequence_DDS_XTypes_TypeIdentifierWithSize dependent_typeids;
dds_sequence_octet continuation_point;
} DDS_Builtin_TypeLookup_getTypeDependencies_Out;
typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_Result
{
int32_t _d;
union
{
struct DDS_Builtin_TypeLookup_getTypeDependencies_Out result;
} _u;
} DDS_Builtin_TypeLookup_getTypeDependencies_Result;
typedef struct DDS_Builtin_TypeLookup_Call
{
int32_t _d;
union
{
struct DDS_Builtin_TypeLookup_getTypes_In getTypes;
struct DDS_Builtin_TypeLookup_getTypeDependencies_In getTypeDependencies;
} _u;
} DDS_Builtin_TypeLookup_Call;
typedef struct DDS_Builtin_TypeLookup_Request
{
struct DDS_RPC_RequestHeader header;
struct DDS_Builtin_TypeLookup_Call data;
} DDS_Builtin_TypeLookup_Request;
DDS_EXPORT extern const dds_topic_descriptor_t DDS_Builtin_TypeLookup_Request_desc;
#define DDS_Builtin_TypeLookup_Request__alloc() \
((DDS_Builtin_TypeLookup_Request*) dds_alloc (sizeof (DDS_Builtin_TypeLookup_Request)));
#define DDS_Builtin_TypeLookup_Request_free(d,o) \
dds_sample_free ((d), &DDS_Builtin_TypeLookup_Request_desc, (o))
DDS_EXPORT extern const struct dds_cdrstream_desc DDS_Builtin_TypeLookup_Request_cdrstream_desc;
typedef struct DDS_Builtin_TypeLookup_Return
{
int32_t _d;
union
{
struct DDS_Builtin_TypeLookup_getTypes_Result getType;
struct DDS_Builtin_TypeLookup_getTypeDependencies_Result getTypeDependencies;
} _u;
} DDS_Builtin_TypeLookup_Return;
typedef struct DDS_Builtin_TypeLookup_Reply
{
struct DDS_RPC_ReplyHeader header;
struct DDS_Builtin_TypeLookup_Return return_data;
} DDS_Builtin_TypeLookup_Reply;
DDS_EXPORT extern const dds_topic_descriptor_t DDS_Builtin_TypeLookup_Reply_desc;
#define DDS_Builtin_TypeLookup_Reply__alloc() \
((DDS_Builtin_TypeLookup_Reply*) dds_alloc (sizeof (DDS_Builtin_TypeLookup_Reply)));
#define DDS_Builtin_TypeLookup_Reply_free(d,o) \
dds_sample_free ((d), &DDS_Builtin_TypeLookup_Reply_desc, (o))
DDS_EXPORT extern const struct dds_cdrstream_desc DDS_Builtin_TypeLookup_Reply_cdrstream_desc;
#ifdef __cplusplus
}
#endif
#endif /* DDSI_XT_TYPELOOKUP_H */
+93
View File
@@ -0,0 +1,93 @@
/****************************************************************
Generated by Eclipse Cyclone DDS IDL to C Translator
File name: ddsi_xt_typemap.h
Source: ddsi_xt_typemap.idl
Cyclone DDS: V0.11.0
*****************************************************************/
#ifndef DDSI_XT_TYPEMAP_H
#define DDSI_XT_TYPEMAP_H
#include "dds/ddsi/ddsi_xt_typeinfo.h"
#include "dds/ddsc/dds_public_impl.h"
#include "dds/cdr/dds_cdrstream.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair;
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair)));
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair;
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair)));
#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */
#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED
#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED
typedef struct dds_sequence_DDS_XTypes_TypeIdentifierPair
{
uint32_t _maximum;
uint32_t _length;
struct DDS_XTypes_TypeIdentifierPair *_buffer;
bool _release;
} dds_sequence_DDS_XTypes_TypeIdentifierPair;
#define dds_sequence_DDS_XTypes_TypeIdentifierPair__alloc() \
((dds_sequence_DDS_XTypes_TypeIdentifierPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierPair)));
#define dds_sequence_DDS_XTypes_TypeIdentifierPair_allocbuf(l) \
((struct DDS_XTypes_TypeIdentifierPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierPair)))
#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED */
typedef struct DDS_XTypes_TypeMapping
{
dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair identifier_object_pair_minimal;
dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair identifier_object_pair_complete;
dds_sequence_DDS_XTypes_TypeIdentifierPair identifier_complete_minimal;
} DDS_XTypes_TypeMapping;
DDS_EXPORT extern const dds_topic_descriptor_t DDS_XTypes_TypeMapping_desc;
#define DDS_XTypes_TypeMapping__alloc() \
((DDS_XTypes_TypeMapping*) dds_alloc (sizeof (DDS_XTypes_TypeMapping)));
#define DDS_XTypes_TypeMapping_free(d,o) \
dds_sample_free ((d), &DDS_XTypes_TypeMapping_desc, (o))
DDS_EXPORT extern const struct dds_cdrstream_desc DDS_XTypes_TypeMapping_cdrstream_desc;
#ifdef __cplusplus
}
#endif
#endif /* DDSI_XT_TYPEMAP_H */