make internal header files more C++ friendly

Generally one doesn't need to include any internal header files in an
application, but the (unstable) interface for application-defined sample
representation and serialization does require including some.  It turns
out a keyword clash had to be resolved (typename => type_name) and that
a whole bunch of them were missing the #ifdef __cplusplus / extern "C"
bit.

It further turned out that one had to pull in nearly all of the type
definitions, including some typedefs that are illegal in C++, e.g.,

  typedef struct os_sockWaitset *os_sockWaitset;

C++ is right to forbid this, but Cyclone's header files were wrong to
force inclusion of so much irrelevant stuff.  This commit leaves these
typedefs in place, but eliminates a few header file inclusions to avoid
the problem.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-04-29 09:24:18 +02:00 committed by eboasson
parent d2ebbbc880
commit b686ba858c
56 changed files with 345 additions and 60 deletions

View file

@ -14,10 +14,18 @@
#include "dds__entity.h" #include "dds__entity.h"
#if defined (__cplusplus)
extern "C" {
#endif
dds_guardcond* dds_guardcond*
dds_create_guardcond( dds_create_guardcond(
dds_participant *pp); dds_participant *pp);
DEFINE_ENTITY_LOCK_UNLOCK(inline, dds_guardcond, DDS_KIND_COND_GUARD) DEFINE_ENTITY_LOCK_UNLOCK(inline, dds_guardcond, DDS_KIND_COND_GUARD)
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#include "dds__entity.h" #include "dds__entity.h"
#if defined (__cplusplus)
extern "C" {
#endif
dds_readcond * dds_readcond *
dds_create_readcond( dds_create_readcond(
dds_reader *rd, dds_reader *rd,
@ -21,4 +25,8 @@ dds_create_readcond(
uint32_t mask, uint32_t mask,
dds_querycondition_filter_fn filter); dds_querycondition_filter_fn filter);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "dds/ddsi/ddsi_serdata.h" #include "dds/ddsi/ddsi_serdata.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_serdata_builtintopic { struct ddsi_serdata_builtintopic {
struct ddsi_serdata c; struct ddsi_serdata c;
nn_guid_t key; nn_guid_t key;
@ -39,4 +43,8 @@ extern const struct ddsi_serdata_ops ddsi_serdata_ops_builtintopic;
struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic_type type, const char *name, const char *typename); struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic_type type, const char *name, const char *typename);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -30,6 +30,7 @@
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_gc.h" #include "dds/ddsi/q_gc.h"
#include "dds/ddsi/q_globals.h"
#include "dds/version.h" #include "dds/version.h"
#define DOMAIN_ID_MIN 0 #define DOMAIN_ID_MIN 0

View file

@ -22,7 +22,7 @@
#include "dds/ddsi/ddsi_serdata.h" #include "dds/ddsi/ddsi_serdata.h"
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_thread.h" #include "dds/ddsi/q_thread.h"
#include "dds/ddsi/q_globals.h"
dds_return_t dds_return_t
dds_writedispose( dds_writedispose(

View file

@ -19,6 +19,7 @@
#include "dds/ddsi/q_thread.h" #include "dds/ddsi/q_thread.h"
#include "dds/ddsi/q_ephash.h" #include "dds/ddsi/q_ephash.h"
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"
static dds_retcode_t dds_read_lock (dds_entity_t hdl, dds_reader **reader, dds_readcond **condition, bool only_reader) static dds_retcode_t dds_read_lock (dds_entity_t hdl, dds_reader **reader, dds_readcond **condition, bool only_reader)

View file

@ -23,6 +23,7 @@
#include "dds__topic.h" #include "dds__topic.h"
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_thread.h" #include "dds/ddsi/q_thread.h"
#include "dds/ddsi/q_globals.h"
#include "dds__builtin.h" #include "dds__builtin.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"

View file

@ -91,7 +91,7 @@ static void set_topic_type_from_sertopic (struct ddsi_serdata_builtintopic *d, c
} }
if (!(d->xqos.present & QP_TYPE_NAME)) if (!(d->xqos.present & QP_TYPE_NAME))
{ {
d->xqos.type_name = dds_string_dup (tp->typename); d->xqos.type_name = dds_string_dup (tp->type_name);
d->xqos.present |= QP_TYPE_NAME; d->xqos.present |= QP_TYPE_NAME;
} }
} }

View file

@ -21,6 +21,7 @@
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_freelist.h" #include "dds/ddsi/q_freelist.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"
#include "dds/ddsi/ddsi_iid.h"
#include "dds__serdata_builtintopic.h" #include "dds__serdata_builtintopic.h"
/* FIXME: sertopic /= ddstopic so a lot of stuff needs to be moved here from dds_topic.c and the free function needs to be implemented properly */ /* FIXME: sertopic /= ddstopic so a lot of stuff needs to be moved here from dds_topic.c and the free function needs to be implemented properly */
@ -30,10 +31,10 @@ struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic
struct ddsi_sertopic_builtintopic *tp = ddsrt_malloc (sizeof (*tp)); struct ddsi_sertopic_builtintopic *tp = ddsrt_malloc (sizeof (*tp));
tp->c.iid = ddsi_iid_gen(); tp->c.iid = ddsi_iid_gen();
tp->c.name = dds_string_dup (name); tp->c.name = dds_string_dup (name);
tp->c.typename = dds_string_dup (typename); tp->c.type_name = dds_string_dup (typename);
const size_t name_typename_size = strlen (tp->c.name) + 1 + strlen (tp->c.typename) + 1; const size_t name_typename_size = strlen (tp->c.name) + 1 + strlen (tp->c.type_name) + 1;
tp->c.name_typename = dds_alloc (name_typename_size); tp->c.name_type_name = dds_alloc (name_typename_size);
snprintf (tp->c.name_typename, name_typename_size, "%s/%s", tp->c.name, tp->c.typename); snprintf (tp->c.name_type_name, name_typename_size, "%s/%s", tp->c.name, tp->c.type_name);
tp->c.ops = &ddsi_sertopic_ops_builtintopic; tp->c.ops = &ddsi_sertopic_ops_builtintopic;
tp->c.serdata_ops = &ddsi_serdata_ops_builtintopic; tp->c.serdata_ops = &ddsi_serdata_ops_builtintopic;
tp->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (tp->c.serdata_ops); tp->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (tp->c.serdata_ops);

View file

@ -35,7 +35,7 @@ DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_topic)
const ddsrt_avl_treedef_t dds_topictree_def = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY const ddsrt_avl_treedef_t dds_topictree_def = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY
( (
offsetof (struct ddsi_sertopic, avlnode), offsetof (struct ddsi_sertopic, avlnode),
offsetof (struct ddsi_sertopic, name_typename), offsetof (struct ddsi_sertopic, name_type_name),
(int (*) (const void *, const void *)) strcmp, (int (*) (const void *, const void *)) strcmp,
0 0
); );
@ -285,7 +285,7 @@ static bool dupdef_qos_ok(const dds_qos_t *qos, const struct ddsi_sertopic *st)
static bool sertopic_equivalent (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b) static bool sertopic_equivalent (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b)
{ {
if (strcmp (a->name_typename, b->name_typename) != 0) if (strcmp (a->name_type_name, b->name_type_name) != 0)
return false; return false;
if (a->serdata_basehash != b->serdata_basehash) if (a->serdata_basehash != b->serdata_basehash)
return false; return false;
@ -447,9 +447,9 @@ dds_create_topic(
st->c.iid = ddsi_iid_gen (); st->c.iid = ddsi_iid_gen ();
st->c.status_cb = dds_topic_status_cb; st->c.status_cb = dds_topic_status_cb;
st->c.status_cb_entity = NULL; /* set by dds_create_topic_arbitrary */ st->c.status_cb_entity = NULL; /* set by dds_create_topic_arbitrary */
st->c.name_typename = key; st->c.name_type_name = key;
st->c.name = dds_string_dup (name); st->c.name = dds_string_dup (name);
st->c.typename = dds_string_dup (typename); st->c.type_name = dds_string_dup (typename);
st->c.ops = &ddsi_sertopic_ops_default; st->c.ops = &ddsi_sertopic_ops_default;
st->c.serdata_ops = desc->m_nkeys ? &ddsi_serdata_ops_cdr : &ddsi_serdata_ops_cdr_nokey; st->c.serdata_ops = desc->m_nkeys ? &ddsi_serdata_ops_cdr : &ddsi_serdata_ops_cdr_nokey;
st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops); st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
@ -471,7 +471,7 @@ dds_create_topic(
/* Set Topic meta data (for SEDP publication) */ /* Set Topic meta data (for SEDP publication) */
plist.qos.topic_name = dds_string_dup (st->c.name); plist.qos.topic_name = dds_string_dup (st->c.name);
plist.qos.type_name = dds_string_dup (st->c.typename); plist.qos.type_name = dds_string_dup (st->c.type_name);
plist.qos.present |= (QP_TOPIC_NAME | QP_TYPE_NAME); plist.qos.present |= (QP_TOPIC_NAME | QP_TYPE_NAME);
if (desc->m_meta) { if (desc->m_meta) {
plist.type_description = dds_string_dup (desc->m_meta); plist.type_description = dds_string_dup (desc->m_meta);
@ -643,7 +643,7 @@ dds_get_type_name(
ret = DDS_ERRNO(rc); ret = DDS_ERRNO(rc);
goto fail; goto fail;
} }
(void)snprintf(name, size, "%s", t->m_stopic->typename); (void)snprintf(name, size, "%s", t->m_stopic->type_name);
dds_topic_unlock(t); dds_topic_unlock(t);
ret = DDS_RETCODE_OK; ret = DDS_RETCODE_OK;
fail: fail:

View file

@ -27,6 +27,7 @@
#include "dds/ddsi/q_time.h" #include "dds/ddsi/q_time.h"
#include "dds/ddsi/q_rtps.h" #include "dds/ddsi/q_rtps.h"
#include "dds/ddsi/q_freelist.h" #include "dds/ddsi/q_freelist.h"
#include "dds/ddsi/q_globals.h"
#define USE_EHH 0 #define USE_EHH 0

View file

@ -14,6 +14,7 @@
#include "dds/dds.h" #include "dds/dds.h"
#include "dds/version.h" #include "dds/version.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_thread.h" #include "dds/ddsi/q_thread.h"
#include "dds/ddsi/q_xmsg.h" #include "dds/ddsi/q_xmsg.h"

View file

@ -14,11 +14,19 @@
#include "dds/ddsi/ddsi_tran.h" #include "dds/ddsi/ddsi_tran.h"
enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface interf[]); #if defined (__cplusplus)
extern "C" {
#endif
enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface *interf);
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind); enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind);
int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2); int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2);
char *ddsi_ipaddr_to_string (ddsi_tran_factory_t tran, char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port); char *ddsi_ipaddr_to_string (ddsi_tran_factory_t tran, char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port);
void ddsi_ipaddr_to_loc (nn_locator_t *dst, const struct sockaddr *src, int32_t kind); void ddsi_ipaddr_to_loc (nn_locator_t *dst, const struct sockaddr *src, int32_t kind);
void ddsi_ipaddr_from_loc (struct sockaddr_storage *dst, const nn_locator_t *src); void ddsi_ipaddr_from_loc (struct sockaddr_storage *dst, const nn_locator_t *src);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#include "dds/ddsi/ddsi_tran.h" #include "dds/ddsi/ddsi_tran.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct nn_group_membership; struct nn_group_membership;
struct nn_group_membership *new_group_membership (void); struct nn_group_membership *new_group_membership (void);
@ -23,4 +27,8 @@ int ddsi_leave_mc (ddsi_tran_conn_t conn, const nn_locator_t *srcip, const nn_lo
void ddsi_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_t newconn); void ddsi_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_t newconn);
int ddsi_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn); int ddsi_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -12,6 +12,14 @@
#ifndef DDSI_RAWETH_H #ifndef DDSI_RAWETH_H
#define DDSI_RAWETH_H #define DDSI_RAWETH_H
#if defined (__cplusplus)
extern "C" {
#endif
int ddsi_raweth_init (void); int ddsi_raweth_init (void);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -12,6 +12,10 @@
#ifndef DDSI_RHC_PLUGIN_H #ifndef DDSI_RHC_PLUGIN_H
#define DDSI_RHC_PLUGIN_H #define DDSI_RHC_PLUGIN_H
#if defined (__cplusplus)
extern "C" {
#endif
struct rhc; struct rhc;
struct nn_xqos; struct nn_xqos;
struct ddsi_tkmap_instance; struct ddsi_tkmap_instance;
@ -42,4 +46,8 @@ struct ddsi_rhc_plugin
DDS_EXPORT void make_proxy_writer_info(struct proxy_writer_info *pwr_info, const struct entity_common *e, const struct nn_xqos *xqos); DDS_EXPORT void make_proxy_writer_info(struct proxy_writer_info *pwr_info, const struct entity_common *e, const struct nn_xqos *xqos);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "dds/ddsi/q_time.h" #include "dds/ddsi/q_time.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct nn_rdata; struct nn_rdata;
struct nn_keyhash; struct nn_keyhash;
@ -40,37 +44,62 @@ struct ddsi_serdata {
nn_mtime_t twrite; /* write time, not source timestamp, set post-throttling */ nn_mtime_t twrite; /* write time, not source timestamp, set post-throttling */
}; };
/* Serialised size of sample: uint32_t because the protocol can't handle samples larger than 4GB anyway */ /* 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); typedef uint32_t (*ddsi_serdata_size_t) (const struct ddsi_serdata *d);
/* Free a serdata (called by unref when refcount goes to 0) */ /* Free a serdata (called by unref when refcount goes to 0) */
typedef void (*ddsi_serdata_free_t) (struct ddsi_serdata *d); typedef void (*ddsi_serdata_free_t) (struct ddsi_serdata *d);
/* Construct a serdata from a fragchain received over the network */ /* 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_sertopic *topic, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size); typedef struct ddsi_serdata * (*ddsi_serdata_from_ser_t) (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size);
/* Construct a serdata from a keyhash (an SDK_KEY by definition) */ /* Construct a serdata from a keyhash (an SDK_KEY by definition) */
typedef struct ddsi_serdata * (*ddsi_serdata_from_keyhash_t) (const struct ddsi_sertopic *topic, const struct nn_keyhash *keyhash); typedef struct ddsi_serdata * (*ddsi_serdata_from_keyhash_t) (const struct ddsi_sertopic *topic, const struct nn_keyhash *keyhash);
/* Construct a serdata from an application sample */ /* 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_sertopic *topic, enum ddsi_serdata_kind kind, const void *sample); typedef struct ddsi_serdata * (*ddsi_serdata_from_sample_t) (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const void *sample);
/* Construct a topic-less serdata with a keyvalue given a normal serdata (either key or data) - used for tkmap */ /* Construct a topic-less 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 topicless or not is known from the context, and the topic
field may have any value for a topicless serdata (so in some cases, one can
simply do "return ddsi_serdata_ref(d);"
*/
typedef struct ddsi_serdata * (*ddsi_serdata_to_topicless_t) (const struct ddsi_serdata *d); typedef struct ddsi_serdata * (*ddsi_serdata_to_topicless_t) (const struct ddsi_serdata *d);
/* Fill buffer with 'size' bytes of serialised data, starting from 'off'; 0 <= off < off+sz <= /* Fill buffer with 'size' bytes of serialised data, starting from 'off'
alignup4(size(d)) */ - 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); typedef void (*ddsi_serdata_to_ser_t) (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf);
/* Provide a pointer to 'size' bytes of serialised data, starting from 'off'; 0 <= off < off+sz <= /* Provide a pointer to 'size' bytes of serialised data, starting from 'off'
alignup4(size(d)); it must remain valid until the corresponding call to to_ser_unref. Multiple - see ddsi_serdata_to_ser_t above
calls to to_ser_ref() may be issued in parallel, the separate ref/unref bit is there to at least - instead of copying, this gives a reference that must remain valid until the
have the option of lazily creating the serialised representation and freeing it when no one needs corresponding call to to_ser_unref
it, while the sample itself remains valid */ - 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); 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);
/* Release a lock on serialised data, ref must be a pointer previously obtained by calling /* Release a lock on serialised data
to_ser_ref(d, off, sz) for some offset off. */ - 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); typedef void (*ddsi_serdata_to_ser_unref_t) (struct ddsi_serdata *d, const ddsrt_iovec_t *ref);
/* Turn serdata into an application sample (or just the key values if only key values are /* Turn serdata into an application sample (or just the key values if only key values are
@ -83,11 +112,11 @@ typedef void (*ddsi_serdata_to_ser_unref_t) (struct ddsi_serdata *d, const ddsrt
by the caller.) */ by the caller.) */
typedef bool (*ddsi_serdata_to_sample_t) (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim); typedef bool (*ddsi_serdata_to_sample_t) (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim);
/* Create a sample from a topicless serdata, as returned by serdata_to_topicless. This sample /* Create a sample from a topicless serdata, as returned by serdata_to_topicless. This sample
obviously has just the key fields filled in, and is used for generating invalid samples. */ obviously has just the key fields filled in and is used for generating invalid samples. */
typedef bool (*ddsi_serdata_topicless_to_sample_t) (const struct ddsi_sertopic *topic, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim); typedef bool (*ddsi_serdata_topicless_to_sample_t) (const struct ddsi_sertopic *topic, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim);
/* Test key values of two serdatas for equality. The two will have the same ddsi_serdata_ops, /* 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 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 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 instances with a certain key value with have the same instance id, and that in turn makes
@ -166,4 +195,8 @@ DDS_EXPORT inline bool ddsi_serdata_eqkey (const struct ddsi_serdata *a, const s
return a->ops->eqkey (a, b); return a->ops->eqkey (a, b);
} }
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -22,6 +22,10 @@
#include "dds/dds.h" #include "dds/dds.h"
#include "dds__topic.h" #include "dds__topic.h"
#if defined (__cplusplus)
extern "C" {
#endif
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN #if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
#define CDR_BE 0x0000 #define CDR_BE 0x0000
#define CDR_LE 0x0100 #define CDR_LE 0x0100
@ -125,4 +129,8 @@ extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_rawcdr;
struct serdatapool * ddsi_serdatapool_new (void); struct serdatapool * ddsi_serdatapool_new (void);
void ddsi_serdatapool_free (struct serdatapool * pool); void ddsi_serdatapool_free (struct serdatapool * pool);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "dds/ddsrt/avl.h" #include "dds/ddsrt/avl.h"
#include "dds/ddsc/dds_public_alloc.h" #include "dds/ddsc/dds_public_alloc.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_serdata; struct ddsi_serdata;
struct ddsi_serdata_ops; struct ddsi_serdata_ops;
@ -29,9 +33,9 @@ struct ddsi_sertopic {
const struct ddsi_sertopic_ops *ops; const struct ddsi_sertopic_ops *ops;
const struct ddsi_serdata_ops *serdata_ops; const struct ddsi_serdata_ops *serdata_ops;
uint32_t serdata_basehash; uint32_t serdata_basehash;
char *name_typename; char *name_type_name;
char *name; char *name;
char *typename; char *type_name;
uint64_t iid; uint64_t iid;
ddsrt_atomic_uint32_t refc; /* counts refs from entities, not from data */ ddsrt_atomic_uint32_t refc; /* counts refs from entities, not from data */
@ -39,12 +43,14 @@ struct ddsi_sertopic {
struct dds_topic * status_cb_entity; struct dds_topic * status_cb_entity;
}; };
/* Called when the refcount dropped to zero */
typedef void (*ddsi_sertopic_deinit_t) (struct ddsi_sertopic *tp); typedef void (*ddsi_sertopic_deinit_t) (struct ddsi_sertopic *tp);
/* Release any memory allocated by ddsi_sertopic_to_sample */ /* Zero out a sample, used for generating samples from just a key value and in cleaning up
after dds_return_loan */
typedef void (*ddsi_sertopic_zero_samples_t) (const struct ddsi_sertopic *d, void *samples, size_t count); typedef void (*ddsi_sertopic_zero_samples_t) (const struct ddsi_sertopic *d, void *samples, size_t count);
/* Release any memory allocated by ddsi_sertopic_to_sample */ /* (Re)allocate an array of samples, used in growing loaned sample arrays in dds_read */
typedef void (*ddsi_sertopic_realloc_samples_t) (void **ptrs, const struct ddsi_sertopic *d, void *old, size_t oldcount, size_t count); typedef void (*ddsi_sertopic_realloc_samples_t) (void **ptrs, const struct ddsi_sertopic *d, void *old, size_t oldcount, size_t count);
/* Release any memory allocated by ddsi_sertopic_to_sample (also undo sertopic_alloc_sample if "op" so requests) */ /* Release any memory allocated by ddsi_sertopic_to_sample (also undo sertopic_alloc_sample if "op" so requests) */
@ -86,4 +92,8 @@ DDS_EXPORT inline void ddsi_sertopic_free_sample (const struct ddsi_sertopic *tp
ddsi_sertopic_free_samples (tp, &sample, 1, op); ddsi_sertopic_free_samples (tp, &sample, 1, op);
} }
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -20,8 +20,16 @@
#endif #endif
#include <openssl/ssl.h> #include <openssl/ssl.h>
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_ssl_plugins; struct ddsi_ssl_plugins;
void ddsi_ssl_config_plugin (struct ddsi_ssl_plugins *plugin); void ddsi_ssl_config_plugin (struct ddsi_ssl_plugins *plugin);
#if defined (__cplusplus)
}
#endif
#endif #endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "dds/ddsi/ddsi_ssl.h" #include "dds/ddsi/ddsi_ssl.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_ssl_plugins struct ddsi_ssl_plugins
{ {
bool (*init) (void); bool (*init) (void);
@ -31,8 +35,20 @@ struct ddsi_ssl_plugins
SSL * (*accept) (BIO *bio, ddsrt_socket_t *sock); SSL * (*accept) (BIO *bio, ddsrt_socket_t *sock);
}; };
#if defined (__cplusplus)
}
#endif
#endif
#if defined (__cplusplus)
extern "C" {
#endif #endif
int ddsi_tcp_init (void); int ddsi_tcp_init (void);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -14,9 +14,16 @@
/* DDSI Transport module */ /* DDSI Transport module */
#include "dds/ddsi/q_globals.h" #include "dds/ddsrt/ifaddrs.h"
#include "dds/ddsrt/atomics.h"
#include "dds/ddsi/q_protocol.h" #include "dds/ddsi/q_protocol.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct nn_interface;
/* Types supporting handles */ /* Types supporting handles */
#define DDSI_TRAN_CONN 1 #define DDSI_TRAN_CONN 1
@ -69,7 +76,7 @@ enum ddsi_nearby_address_result {
DNAR_SAME DNAR_SAME
}; };
typedef enum ddsi_nearby_address_result (*ddsi_is_nearby_address_fn_t) (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface interf[]); typedef enum ddsi_nearby_address_result (*ddsi_is_nearby_address_fn_t) (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface *interf);
enum ddsi_locator_from_string_result { enum ddsi_locator_from_string_result {
AFSR_OK, /* conversion succeeded */ AFSR_OK, /* conversion succeeded */
@ -239,7 +246,7 @@ void ddsi_conn_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_
int ddsi_conn_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn); int ddsi_conn_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn);
int ddsi_is_mcaddr (const nn_locator_t *loc); int ddsi_is_mcaddr (const nn_locator_t *loc);
int ddsi_is_ssm_mcaddr (const nn_locator_t *loc); int ddsi_is_ssm_mcaddr (const nn_locator_t *loc);
enum ddsi_nearby_address_result ddsi_is_nearby_address (const nn_locator_t *loc, size_t ninterf, const struct nn_interface interf[]); enum ddsi_nearby_address_result ddsi_is_nearby_address (const nn_locator_t *loc, size_t ninterf, const struct nn_interface *interf);
enum ddsi_locator_from_string_result ddsi_locator_from_string (nn_locator_t *loc, const char *str); enum ddsi_locator_from_string_result ddsi_locator_from_string (nn_locator_t *loc, const char *str);
@ -271,4 +278,8 @@ inline ddsi_tran_conn_t ddsi_listener_accept (ddsi_tran_listener_t listener) {
void ddsi_listener_unblock (ddsi_tran_listener_t listener); void ddsi_listener_unblock (ddsi_tran_listener_t listener);
void ddsi_listener_free (ddsi_tran_listener_t listener); void ddsi_listener_free (ddsi_tran_listener_t listener);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -12,6 +12,14 @@
#ifndef _DDSI_UDP_H_ #ifndef _DDSI_UDP_H_
#define _DDSI_UDP_H_ #define _DDSI_UDP_H_
#if defined (__cplusplus)
extern "C" {
#endif
int ddsi_udp_init (void); int ddsi_udp_init (void);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "dds/ddsi/q_unused.h" #include "dds/ddsi/q_unused.h"
#if defined (__cplusplus)
extern "C" {
#endif
inline int nn_bitset_isset (uint32_t numbits, const uint32_t *bits, uint32_t idx) inline int nn_bitset_isset (uint32_t numbits, const uint32_t *bits, uint32_t idx)
{ {
return idx < numbits && (bits[idx/32] & (UINT32_C(1) << (31 - (idx%32)))); return idx < numbits && (bits[idx/32] & (UINT32_C(1) << (31 - (idx%32))));
@ -52,4 +56,8 @@ inline void nn_bitset_one (uint32_t numbits, uint32_t *bits)
} }
} }
#if defined (__cplusplus)
}
#endif
#endif /* NN_BITSET_H */ #endif /* NN_BITSET_H */

View file

@ -19,6 +19,10 @@
#include "dds/ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */ #include "dds/ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */
#include "dds/ddsi/q_protocol.h" /* for nn_sequence_number_t */ #include "dds/ddsi/q_protocol.h" /* for nn_sequence_number_t */
#if defined (__cplusplus)
extern "C" {
#endif
inline uint16_t bswap2u (uint16_t x) inline uint16_t bswap2u (uint16_t x)
{ {
return (uint16_t) ((x >> 8) | (x << 8)); return (uint16_t) ((x >> 8) | (x << 8));
@ -84,10 +88,6 @@ inline void bswapSN (nn_sequence_number_t *sn)
#define fromBE8u(x) (x) #define fromBE8u(x) (x)
#endif #endif
#if defined (__cplusplus)
extern "C" {
#endif
nn_guid_prefix_t nn_hton_guid_prefix (nn_guid_prefix_t p); nn_guid_prefix_t nn_hton_guid_prefix (nn_guid_prefix_t p);
nn_guid_prefix_t nn_ntoh_guid_prefix (nn_guid_prefix_t p); nn_guid_prefix_t nn_ntoh_guid_prefix (nn_guid_prefix_t p);
nn_entityid_t nn_hton_entityid (nn_entityid_t e); nn_entityid_t nn_hton_entityid (nn_entityid_t e);

View file

@ -12,6 +12,10 @@
#ifndef Q_DEBMON_H #ifndef Q_DEBMON_H
#define Q_DEBMON_H #define Q_DEBMON_H
#if defined (__cplusplus)
extern "C" {
#endif
struct debug_monitor; struct debug_monitor;
typedef int (*debug_monitor_cpf_t) (ddsi_tran_conn_t conn, const char *fmt, ...); typedef int (*debug_monitor_cpf_t) (ddsi_tran_conn_t conn, const char *fmt, ...);
typedef int (*debug_monitor_plugin_t) (ddsi_tran_conn_t conn, debug_monitor_cpf_t cpf, void *arg); typedef int (*debug_monitor_plugin_t) (ddsi_tran_conn_t conn, debug_monitor_cpf_t cpf, void *arg);
@ -20,4 +24,8 @@ struct debug_monitor *new_debug_monitor (int port);
void add_debug_monitor_plugin (struct debug_monitor *dm, debug_monitor_plugin_t fn, void *arg); void add_debug_monitor_plugin (struct debug_monitor *dm, debug_monitor_plugin_t fn, void *arg);
void free_debug_monitor (struct debug_monitor *dm); void free_debug_monitor (struct debug_monitor *dm);
#endif /* defined(__ospli_osplo__q_debmon__) */ #if defined (__cplusplus)
}
#endif
#endif

View file

@ -14,6 +14,7 @@
#include "dds/ddsrt/atomics.h" #include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/avl.h" #include "dds/ddsrt/avl.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsi/q_rtps.h" #include "dds/ddsi/q_rtps.h"
#include "dds/ddsi/q_protocol.h" #include "dds/ddsi/q_protocol.h"
#include "dds/ddsi/q_lat_estim.h" #include "dds/ddsi/q_lat_estim.h"
@ -32,11 +33,14 @@ struct xevent;
struct nn_reorder; struct nn_reorder;
struct nn_defrag; struct nn_defrag;
struct nn_dqueue; struct nn_dqueue;
struct nn_rsample_info;
struct nn_rdata;
struct addrset; struct addrset;
struct ddsi_sertopic; struct ddsi_sertopic;
struct whc; struct whc;
struct nn_xqos; struct nn_xqos;
struct nn_plist; struct nn_plist;
struct lease;
struct proxy_group; struct proxy_group;
struct proxy_endpoint_common; struct proxy_endpoint_common;
@ -159,7 +163,7 @@ struct participant
unsigned bes; /* built-in endpoint set */ unsigned bes; /* built-in endpoint set */
unsigned prismtech_bes; /* prismtech-specific extension of built-in endpoints set */ unsigned prismtech_bes; /* prismtech-specific extension of built-in endpoints 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 ... */ 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 ... */
nn_plist_t *plist; /* settings/QoS for this participant */ struct nn_plist *plist; /* settings/QoS for this participant */
struct xevent *spdp_xevent; /* timed event for periodically publishing SPDP */ struct xevent *spdp_xevent; /* timed event for periodically publishing SPDP */
struct xevent *pmd_update_xevent; /* timed event for periodically publishing ParticipantMessageData */ struct xevent *pmd_update_xevent; /* timed event for periodically publishing ParticipantMessageData */
nn_locator_t m_locator; nn_locator_t m_locator;
@ -294,7 +298,7 @@ struct proxy_participant
unsigned bes; /* built-in endpoint set */ unsigned bes; /* built-in endpoint set */
unsigned prismtech_bes; /* prismtech-specific extension of built-in endpoints set */ unsigned prismtech_bes; /* prismtech-specific extension of built-in endpoints set */
nn_guid_t privileged_pp_guid; /* if this PP depends on another PP for its SEDP writing */ nn_guid_t privileged_pp_guid; /* if this PP depends on another PP for its SEDP writing */
nn_plist_t *plist; /* settings/QoS for this participant */ struct nn_plist *plist; /* settings/QoS for this participant */
ddsrt_atomic_voidp_t lease; /* lease object for this participant, for automatic leases */ ddsrt_atomic_voidp_t lease; /* lease object for this participant, for automatic leases */
struct addrset *as_default; /* default address set to use for user data traffic */ struct addrset *as_default; /* default address set to use for user data traffic */
struct addrset *as_meta; /* default address set to use for discovery traffic */ struct addrset *as_meta; /* default address set to use for discovery traffic */

View file

@ -15,6 +15,10 @@
#include "dds/ddsrt/atomics.h" #include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/sync.h" #include "dds/ddsrt/sync.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define FREELIST_SIMPLE 1 #define FREELIST_SIMPLE 1
#define FREELIST_ATOMIC_LIFO 2 #define FREELIST_ATOMIC_LIFO 2
#define FREELIST_DOUBLE 3 #define FREELIST_DOUBLE 3
@ -74,4 +78,8 @@ bool nn_freelist_push (struct nn_freelist *fl, void *elem);
void *nn_freelist_pushmany (struct nn_freelist *fl, void *first, void *last, uint32_t n); void *nn_freelist_pushmany (struct nn_freelist *fl, void *first, void *last, uint32_t n);
void *nn_freelist_pop (struct nn_freelist *fl); void *nn_freelist_pop (struct nn_freelist *fl);
#if defined (__cplusplus)
}
#endif
#endif /* NN_FREELIST_H */ #endif /* NN_FREELIST_H */

View file

@ -12,7 +12,15 @@
#ifndef Q_INIT_H #ifndef Q_INIT_H
#define Q_INIT_H #define Q_INIT_H
#if defined (__cplusplus)
extern "C" {
#endif
int create_multicast_sockets(void); int create_multicast_sockets(void);
int joinleave_spdp_defmcip (int dojoin); int joinleave_spdp_defmcip (int dojoin);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#include "dds/ddsrt/avl.h" #include "dds/ddsrt/avl.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct inverse_uint32_set_node { struct inverse_uint32_set_node {
ddsrt_avl_node_t avlnode; ddsrt_avl_node_t avlnode;
uint32_t min, max; uint32_t min, max;
@ -29,4 +33,8 @@ void inverse_uint32_set_fini(struct inverse_uint32_set *set);
int inverse_uint32_set_alloc(uint32_t * const id, struct inverse_uint32_set *set); int inverse_uint32_set_alloc(uint32_t * const id, struct inverse_uint32_set *set);
void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id); void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id);
#if defined (__cplusplus)
}
#endif
#endif #endif

View file

@ -14,7 +14,6 @@
#include "dds/ddsrt/atomics.h" #include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/threads.h" #include "dds/ddsrt/threads.h"
#include "dds/ddsi/q_rtps.h"
#include "dds/ddsi/ddsi_tran.h" #include "dds/ddsi/ddsi_tran.h"
#if defined (__cplusplus) #if defined (__cplusplus)

View file

@ -29,6 +29,7 @@ struct proxy_writer;
struct nn_prismtech_participant_version_info; struct nn_prismtech_participant_version_info;
struct nn_prismtech_writer_info; struct nn_prismtech_writer_info;
struct nn_prismtech_eotinfo;
struct nn_xmsgpool; struct nn_xmsgpool;
struct nn_xmsg_data; struct nn_xmsg_data;
struct nn_xmsg; struct nn_xmsg;

View file

@ -14,6 +14,14 @@
#include "dds/ddsi/ddsi_tran.h" #include "dds/ddsi/ddsi_tran.h"
#if defined (__cplusplus)
extern "C" {
#endif
int ddsi_eth_enumerate_interfaces(ddsi_tran_factory_t fact, ddsrt_ifaddrs_t **ifs); int ddsi_eth_enumerate_interfaces(ddsi_tran_factory_t fact, ddsrt_ifaddrs_t **ifs);
#if defined (__cplusplus)
}
#endif
#endif /* DDSI_ETH_H */ #endif /* DDSI_ETH_H */

View file

@ -18,6 +18,7 @@
#include "dds/ddsi/ddsi_ipaddr.h" #include "dds/ddsi/ddsi_ipaddr.h"
#include "dds/ddsi/q_nwif.h" #include "dds/ddsi/q_nwif.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_globals.h"
int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2) int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2)
{ {

View file

@ -20,6 +20,7 @@
#include "dds/ddsi/ddsi_mcgroup.h" #include "dds/ddsi/ddsi_mcgroup.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_log.h" #include "dds/ddsi/q_log.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsrt/avl.h" #include "dds/ddsrt/avl.h"
struct nn_group_membership_node { struct nn_group_membership_node {

View file

@ -18,6 +18,7 @@
#include "dds/ddsi/q_log.h" #include "dds/ddsi/q_log.h"
#include "dds/ddsi/q_error.h" #include "dds/ddsi/q_error.h"
#include "dds/ddsi/q_pcap.h" #include "dds/ddsi/q_pcap.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsrt/atomics.h" #include "dds/ddsrt/atomics.h"
#include "dds/ddsrt/heap.h" #include "dds/ddsrt/heap.h"
#include "dds/ddsrt/log.h" #include "dds/ddsrt/log.h"

View file

@ -24,6 +24,7 @@
#include "dds/ddsi/ddsi_tkmap.h" #include "dds/ddsi/ddsi_tkmap.h"
#include "dds__stream.h" #include "dds__stream.h"
#include "dds/ddsi/q_radmin.h" #include "dds/ddsi/q_radmin.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsi/ddsi_serdata_default.h" #include "dds/ddsi/ddsi_serdata_default.h"
#define MAX_POOL_SIZE 16384 #define MAX_POOL_SIZE 16384

View file

@ -37,9 +37,9 @@ void ddsi_sertopic_unref (struct ddsi_sertopic *sertopic)
if (ddsrt_atomic_dec32_ov (&sertopic->refc) == 1) if (ddsrt_atomic_dec32_ov (&sertopic->refc) == 1)
{ {
ddsi_sertopic_deinit (sertopic); ddsi_sertopic_deinit (sertopic);
ddsrt_free (sertopic->name_typename); ddsrt_free (sertopic->name_type_name);
ddsrt_free (sertopic->name); ddsrt_free (sertopic->name);
ddsrt_free (sertopic->typename); ddsrt_free (sertopic->type_name);
ddsrt_free (sertopic); ddsrt_free (sertopic);
} }
} }

View file

@ -25,6 +25,7 @@
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_log.h" #include "dds/ddsi/q_log.h"
#include "dds/ddsi/q_entity.h" #include "dds/ddsi/q_entity.h"
#include "dds/ddsi/q_globals.h"
#define INVALID_PORT (~0u) #define INVALID_PORT (~0u)

View file

@ -19,6 +19,7 @@
#include "dds/ddsi/ddsi_tran.h" #include "dds/ddsi/ddsi_tran.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_log.h" #include "dds/ddsi/q_log.h"
#include "dds/ddsi/q_globals.h"
static ddsi_tran_factory_t ddsi_tran_factories = NULL; static ddsi_tran_factory_t ddsi_tran_factories = NULL;

View file

@ -25,6 +25,7 @@
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_log.h" #include "dds/ddsi/q_log.h"
#include "dds/ddsi/q_pcap.h" #include "dds/ddsi/q_pcap.h"
#include "dds/ddsi/q_globals.h"
extern void ddsi_factory_conn_init (ddsi_tran_factory_t factory, ddsi_tran_conn_t conn); extern void ddsi_factory_conn_init (ddsi_tran_factory_t factory, ddsi_tran_conn_t conn);

View file

@ -121,7 +121,7 @@ static int print_any_endpoint_common (ddsi_tran_conn_t conn, const char *label,
if (xqos->partition.n > 1) cpf (conn, "}"); if (xqos->partition.n > 1) cpf (conn, "}");
x += cpf (conn, ".%s/%s", x += cpf (conn, ".%s/%s",
topic && topic->name ? topic->name : (xqos->present & QP_TOPIC_NAME) ? xqos->topic_name : "(null)", topic && topic->name ? topic->name : (xqos->present & QP_TOPIC_NAME) ? xqos->topic_name : "(null)",
topic && topic->typename ? topic->typename : (xqos->present & QP_TYPE_NAME) ? xqos->type_name : "(null)"); topic && topic->type_name ? topic->type_name : (xqos->present & QP_TYPE_NAME) ? xqos->type_name : "(null)");
} }
cpf (conn, "\n"); cpf (conn, "\n");
return x; return x;

View file

@ -2383,7 +2383,7 @@ static void new_reader_writer_common (const struct nn_guid *guid, const struct d
PGUID (*guid), PGUID (*guid),
partition, partition_suffix, partition, partition_suffix,
topic ? topic->name : "(null)", topic ? topic->name : "(null)",
topic ? topic->typename : "(null)"); topic ? topic->type_name : "(null)");
} }
static void endpoint_common_init (struct entity_common *e, struct endpoint_common *c, enum entity_kind kind, const struct nn_guid *guid, const struct nn_guid *group_guid, struct participant *pp) static void endpoint_common_init (struct entity_common *e, struct endpoint_common *c, enum entity_kind kind, const struct nn_guid *guid, const struct nn_guid *group_guid, struct participant *pp)
@ -2415,7 +2415,7 @@ static int set_topic_type_name (nn_xqos_t *xqos, const struct ddsi_sertopic * to
if (!(xqos->present & QP_TYPE_NAME) && topic) if (!(xqos->present & QP_TYPE_NAME) && topic)
{ {
xqos->present |= QP_TYPE_NAME; xqos->present |= QP_TYPE_NAME;
xqos->type_name = ddsrt_strdup (topic->typename); xqos->type_name = ddsrt_strdup (topic->type_name);
} }
if (!(xqos->present & QP_TOPIC_NAME) && topic) if (!(xqos->present & QP_TOPIC_NAME) && topic)
{ {
@ -2881,7 +2881,7 @@ struct local_orphan_writer *new_local_orphan_writer (nn_entityid_t entityid, str
struct writer *wr; struct writer *wr;
nn_mtime_t tnow = now_mt (); nn_mtime_t tnow = now_mt ();
DDS_LOG(DDS_LC_DISCOVERY, "new_local_orphan_writer(%s/%s)\n", topic->name, topic->typename); DDS_LOG(DDS_LC_DISCOVERY, "new_local_orphan_writer(%s/%s)\n", topic->name, topic->type_name);
lowr = ddsrt_malloc (sizeof (*lowr)); lowr = ddsrt_malloc (sizeof (*lowr));
wr = &lowr->wr; wr = &lowr->wr;

View file

@ -28,6 +28,7 @@
#include "dds/ddsi/q_xmsg.h" #include "dds/ddsi/q_xmsg.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_globals.h"
#include "dds/ddsi/q_protocol.h" /* for NN_STATUSINFO_... */ #include "dds/ddsi/q_protocol.h" /* for NN_STATUSINFO_... */
#include "dds/ddsi/q_radmin.h" /* for nn_plist_quickscan */ #include "dds/ddsi/q_radmin.h" /* for nn_plist_quickscan */
#include "dds/ddsi/q_static_assert.h" #include "dds/ddsi/q_static_assert.h"

View file

@ -1885,7 +1885,7 @@ static struct ddsi_serdata *extract_sample_from_data
"data(application, vendor %u.%u): %x:%x:%x:%x #%"PRId64": deserialization %s/%s failed (%s)\n", "data(application, vendor %u.%u): %x:%x:%x:%x #%"PRId64": deserialization %s/%s failed (%s)\n",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1], sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (guid), sampleinfo->seq, PGUID (guid), sampleinfo->seq,
topic->name, topic->typename, topic->name, topic->type_name,
failmsg ? failmsg : "for reasons unknown" failmsg ? failmsg : "for reasons unknown"
); );
} }
@ -2388,7 +2388,7 @@ static void drop_oversize (struct receiver_state *rst, struct nn_rmsg *rmsg, con
if (gap_was_valuable) if (gap_was_valuable)
{ {
const char *tname = pwr->c.topic ? pwr->c.topic->name : "(null)"; const char *tname = pwr->c.topic ? pwr->c.topic->name : "(null)";
const char *ttname = pwr->c.topic ? pwr->c.topic->typename : "(null)"; const char *ttname = pwr->c.topic ? pwr->c.topic->type_name : "(null)";
DDS_WARNING ("dropping oversize (%u > %u) sample %"PRId64" from remote writer %x:%x:%x:%x %s/%s\n", DDS_WARNING ("dropping oversize (%u > %u) sample %"PRId64" from remote writer %x:%x:%x:%x %s/%s\n",
sampleinfo->size, config.max_sample_size, sampleinfo->seq, sampleinfo->size, config.max_sample_size, sampleinfo->seq,
PGUIDPREFIX (rst->src_guid_prefix), msg->writerId.u, PGUIDPREFIX (rst->src_guid_prefix), msg->writerId.u,

View file

@ -868,7 +868,7 @@ static int insert_sample_in_whc (struct writer *wr, seqno_t seq, struct nn_plist
char ppbuf[1024]; char ppbuf[1024];
int tmp; int tmp;
const char *tname = wr->topic ? wr->topic->name : "(null)"; const char *tname = wr->topic ? wr->topic->name : "(null)";
const char *ttname = wr->topic ? wr->topic->typename : "(null)"; const char *ttname = wr->topic ? wr->topic->type_name : "(null)";
ppbuf[0] = '\0'; ppbuf[0] = '\0';
tmp = sizeof (ppbuf) - 1; tmp = sizeof (ppbuf) - 1;
DDS_TRACE("write_sample %x:%x:%x:%x #%"PRId64"", PGUID (wr->e.guid), seq); DDS_TRACE("write_sample %x:%x:%x:%x #%"PRId64"", PGUID (wr->e.guid), seq);
@ -1043,7 +1043,7 @@ static int write_sample_eot (struct thread_state1 * const ts1, struct nn_xpack *
char ppbuf[1024]; char ppbuf[1024];
int tmp; int tmp;
const char *tname = wr->topic ? wr->topic->name : "(null)"; const char *tname = wr->topic ? wr->topic->name : "(null)";
const char *ttname = wr->topic ? wr->topic->typename : "(null)"; const char *ttname = wr->topic ? wr->topic->type_name : "(null)";
ppbuf[0] = '\0'; ppbuf[0] = '\0';
tmp = sizeof (ppbuf) - 1; tmp = sizeof (ppbuf) - 1;
DDS_WARNING ("dropping oversize (%u > %u) sample from local writer %x:%x:%x:%x %s/%s:%s%s\n", DDS_WARNING ("dropping oversize (%u > %u) sample from local writer %x:%x:%x:%x %s/%s:%s%s\n",

View file

@ -12,6 +12,10 @@
#ifndef DDSRT_ATOMICS_ARM_H #ifndef DDSRT_ATOMICS_ARM_H
#define DDSRT_ATOMICS_ARM_H #define DDSRT_ATOMICS_ARM_H
#if defined (__cplusplus)
extern "C" {
#endif
#if !defined(__arm__) #if !defined(__arm__)
#define __arm__ #define __arm__
#endif #endif
@ -209,5 +213,8 @@ inline void ddsrt_atomic_fence_rel (void) {
ddsrt_atomic_fence (); ddsrt_atomic_fence ();
} }
#endif /* DDSRT_ATOMICS_ARM_H */ #if defined (__cplusplus)
}
#endif
#endif /* DDSRT_ATOMICS_ARM_H */

View file

@ -14,6 +14,10 @@
#include "dds/ddsrt/misc.h" #include "dds/ddsrt/misc.h"
#if defined (__cplusplus)
extern "C" {
#endif
#if ( DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) || \ #if ( DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) || \
(!DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) (!DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
# define DDSRT_HAVE_ATOMIC_LIFO 1 # define DDSRT_HAVE_ATOMIC_LIFO 1
@ -287,5 +291,8 @@ inline void ddsrt_atomic_fence_rel (void) {
ddsrt_atomic_fence (); ddsrt_atomic_fence ();
} }
#endif /* DDSRT_ATOMICS_GCC_H */ #if defined (__cplusplus)
}
#endif
#endif /* DDSRT_ATOMICS_GCC_H */

View file

@ -14,6 +14,10 @@
#include "dds/ddsrt/misc.h" #include "dds/ddsrt/misc.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* x86 has supported 64-bit CAS for a long time, so Windows ought to /* x86 has supported 64-bit CAS for a long time, so Windows ought to
provide all the interlocked operations for 64-bit operands on x86 provide all the interlocked operations for 64-bit operands on x86
platforms, but it doesn't. */ platforms, but it doesn't. */
@ -295,5 +299,8 @@ inline void ddsrt_atomic_fence_rel (void) {
#undef DDSRT_ATOMIC_PTROP #undef DDSRT_ATOMIC_PTROP
#endif /* DDSRT_ATOMICS_MSVC_H */ #if defined (__cplusplus)
}
#endif
#endif /* DDSRT_ATOMICS_MSVC_H */

View file

@ -11,6 +11,10 @@
*/ */
#include <atomic.h> #include <atomic.h>
#if defined (__cplusplus)
extern "C" {
#endif
#define DDSRT_ATOMIC64_SUPPORT 1 #define DDSRT_ATOMIC64_SUPPORT 1
/* LD, ST */ /* LD, ST */
@ -239,3 +243,6 @@ inline void ddsrt_atomic_fence_rel (void) {
membar_exit (); membar_exit ();
} }
#if defined (__cplusplus)
}
#endif

View file

@ -15,10 +15,18 @@
#include "dds/export.h" #include "dds/export.h"
#include "dds/ddsrt/sync.h" #include "dds/ddsrt/sync.h"
#if defined (__cplusplus)
extern "C" {
#endif
DDS_EXPORT void ddsrt_init(void); DDS_EXPORT void ddsrt_init(void);
DDS_EXPORT void ddsrt_fini(void); DDS_EXPORT void ddsrt_fini(void);
DDS_EXPORT ddsrt_mutex_t *ddsrt_get_singleton_mutex(void); DDS_EXPORT ddsrt_mutex_t *ddsrt_get_singleton_mutex(void);
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_CDTORS_H */ #endif /* DDSRT_CDTORS_H */

View file

@ -63,6 +63,7 @@
#define DDSRT_MD5_H #define DDSRT_MD5_H
#include <stddef.h> #include <stddef.h>
#include "dds/export.h"
/* /*
* This package supports both compile-time and run-time determination of CPU * This package supports both compile-time and run-time determination of CPU
@ -90,13 +91,13 @@ extern "C"
#endif #endif
/* Initialize the algorithm. */ /* Initialize the algorithm. */
void ddsrt_md5_init(ddsrt_md5_state_t *pms); DDS_EXPORT void ddsrt_md5_init(ddsrt_md5_state_t *pms);
/* Append a string to the message. */ /* Append a string to the message. */
void ddsrt_md5_append(ddsrt_md5_state_t *pms, const ddsrt_md5_byte_t *data, unsigned nbytes); DDS_EXPORT void ddsrt_md5_append(ddsrt_md5_state_t *pms, const ddsrt_md5_byte_t *data, unsigned nbytes);
/* Finish the message and return the digest. */ /* Finish the message and return the digest. */
void ddsrt_md5_finish(ddsrt_md5_state_t *pms, ddsrt_md5_byte_t digest[16]); DDS_EXPORT void ddsrt_md5_finish(ddsrt_md5_state_t *pms, ddsrt_md5_byte_t digest[16]);
#ifdef __cplusplus #ifdef __cplusplus
} /* end extern "C" */ } /* end extern "C" */

View file

@ -5,6 +5,10 @@
#include "dds/export.h" #include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef int32_t dds_retcode_t; typedef int32_t dds_retcode_t;
/* /*
@ -86,4 +90,8 @@ typedef int32_t dds_retcode_t;
*/ */
DDS_EXPORT const char *dds_strretcode(dds_retcode_t ret); DDS_EXPORT const char *dds_strretcode(dds_retcode_t ret);
#if defined (__cplusplus)
}
#endif
#endif /* DDS_RETCODE_H */ #endif /* DDS_RETCODE_H */

View file

@ -17,6 +17,10 @@
#include "dds/ddsrt/time.h" #include "dds/ddsrt/time.h"
#include "dds/ddsrt/retcode.h" #include "dds/ddsrt/retcode.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef struct { typedef struct {
dds_time_t utime; /* User CPU time used. */ dds_time_t utime; /* User CPU time used. */
dds_time_t stime; /* System CPU time used. */ dds_time_t stime; /* System CPU time used. */
@ -47,4 +51,8 @@ typedef struct {
*/ */
DDS_EXPORT dds_retcode_t ddsrt_getrusage(int who, ddsrt_rusage_t *usage); DDS_EXPORT dds_retcode_t ddsrt_getrusage(int who, ddsrt_rusage_t *usage);
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_RUSAGE_H */ #endif /* DDSRT_RUSAGE_H */

View file

@ -14,6 +14,10 @@
#include "dds/ddsrt/sockets/posix.h" #include "dds/ddsrt/sockets/posix.h"
#endif #endif
#if defined (__cplusplus)
extern "C" {
#endif
#define INET_ADDRSTRLEN_EXTENDED (INET_ADDRSTRLEN + 6) /* ":12345" */ #define INET_ADDRSTRLEN_EXTENDED (INET_ADDRSTRLEN + 6) /* ":12345" */
#if DDSRT_HAVE_IPV6 #if DDSRT_HAVE_IPV6
@ -261,4 +265,8 @@ ddsrt_gethostbyname(
ddsrt_hostent_t **hentp); ddsrt_hostent_t **hentp);
#endif #endif
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_SOCKETS_H */ #endif /* DDSRT_SOCKETS_H */

View file

@ -22,6 +22,10 @@
#include "dds/export.h" #include "dds/export.h"
#include "dds/ddsrt/retcode.h" #include "dds/ddsrt/retcode.h"
#if defined (__cplusplus)
extern "C" {
#endif
/** /**
* @brief Convert a string to a double precision floating point number. * @brief Convert a string to a double precision floating point number.
* *
@ -72,4 +76,8 @@ ddsrt_dtostr(double src, char *str, size_t size);
DDS_EXPORT int DDS_EXPORT int
ddsrt_ftostr(float src, char *str, size_t size); ddsrt_ftostr(float src, char *str, size_t size);
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_STRTOD_H */ #endif /* DDSRT_STRTOD_H */