DDS_ReturnCode_t DDS_DomainParticipant_set_qos (DDS_DomainParticipant dp, DDS_DomainParticipantQos *qos) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_S_QOS, &dp, sizeof (dp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!domain_ptr (dp, 1, &ret)) return (ret); if (qos == DDS_PARTICIPANT_QOS_DEFAULT) qos = &dcps_def_participant_qos; else if (!qos_valid_participant_qos (qos)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } if (dp->participant.p_user_data) str_unref (dp->participant.p_user_data); dp->participant.p_user_data = qos_octets2str (&qos->user_data.value); dp->autoenable = qos->entity_factory.autoenable_created_entities; if ((dp->participant.p_flags & EF_ENABLED) != 0) ret = disc_participant_update (dp); done: lock_release (dp->lock); return (ret); }
DDS_ReturnCode_t DDS_Subscriber_set_default_datareader_qos (DDS_Subscriber sp, DDS_DataReaderQos *qos) { Domain_t *dp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_S_S_DR_QOS, &sp, sizeof (sp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!subscriber_ptr (sp, &ret)) return (ret); dp = domain_ptr (sp->domain, 1, &ret); if (!dp) return (ret); if (qos == DDS_DATAREADER_QOS_DEFAULT) qos = (DDS_DataReaderQos *) &qos_def_reader_qos; else if (!qos_valid_reader_qos (qos)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } sp->def_reader_qos = *qos; done: lock_release (dp->lock); return (ret); }
DDS_ReturnCode_t DDS_DomainParticipant_ignore_publication (DDS_DomainParticipant dp, DDS_InstanceHandle_t handle) { Entity_t *ep; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_IGN_PUB, &dp, sizeof (dp)); ctrc_contd (&handle, sizeof (handle)); ctrc_endd (); if (!domain_ptr (dp, 1, &ret)) return (ret); if ((dp->participant.p_flags & EF_ENABLED) == 0) { lock_release (dp->lock); return (DDS_RETCODE_NOT_ENABLED); } ep = entity_ptr (handle); if (!ep || ep->type != ET_WRITER || !entity_discovered (ep->flags)) { ret = DDS_RETCODE_ALREADY_DELETED; goto done; } ret = disc_ignore_writer ((DiscoveredWriter_t *) ep); done: lock_release (dp->lock); return (ret); }
DDS_ReturnCode_t DDS_DataWriter_set_qos (DDS_DataWriter wp, DDS_DataWriterQos *qos) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DW_S_QOS, &wp, sizeof (wp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!writer_ptr (wp, 1, &ret)) return (ret); if (qos == DDS_DATAWRITER_QOS_DEFAULT) qos = &wp->w_publisher->def_writer_qos; else if (!qos_valid_writer_qos (qos)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } ret = qos_writer_update (&wp->w_qos, qos); done: lock_release (wp->w_lock); if (ret) return (ret); lock_take (wp->w_topic->domain->lock); dcps_update_writer_qos (NULL, &wp, wp->w_publisher); lock_release (wp->w_topic->domain->lock); return (ret); }
DDS_ReturnCode_t DDS_DomainParticipant_delete_typesupport (DDS_DomainParticipant dp, DDS_TypeSupport ts) { struct type_sup_rem_state_st state; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_D_TS, &p, sizeof (p)); ctrc_contd (&ts, sizeof (ts)); ctrc_endd (); /* Validate some required arguments. */ if (!ts) return (DDS_RETCODE_BAD_PARAMETER); if (!domain_ptr (dp, 1, &ret)) return (ret); /* Search type name in participant type list. */ state.part = dp; state.ts = ts; state.ret = DDS_RETCODE_ALREADY_DELETED; sl_walk (&dp->types, delete_type_support, &state); lock_release (dp->lock); return (state.ret); }
DDS_MultiTopic DDS_DomainParticipant_create_multitopic ( DDS_DomainParticipant dp, const char *name, const char *type_name, const char *subs_expr, DDS_StringSeq *expr_pars) { ctrc_begind (DCPS_ID, DCPS_DP_C_MTOP, &dp, sizeof (dp)); ctrc_contd (name, strlen (name) + 1); ctrc_contd (type_name, strlen (type_name) + 1); ctrc_contd (subs_expr, strlen (subs_expr) + 1); ctrc_contd (&expr_pars, sizeof (expr_pars)); ctrc_endd (); ARG_NOT_USED (expr_pars) /* Check some required parameters. */ if (!domain_ptr (dp, 0, NULL)) return (NULL); if (!subs_expr || !name || !type_name) return (NULL); return (NULL); }
DDS_ReturnCode_t DDS_DataWriter_get_matched_subscription_data ( DDS_DataWriter wp, DDS_SubscriptionBuiltinTopicData *data, DDS_InstanceHandle_t handle) { Entity_t *ep; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DW_G_SUBS_D, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_endd (); if (!data || !handle) return (DDS_RETCODE_BAD_PARAMETER); if (!writer_ptr (wp, 1, &ret)) return (ret); ep = entity_ptr (handle); if (!ep || ep->type != ET_READER || entity_ignored (ep->flags)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } if (entity_discovered (ep->flags)) ret = dcps_get_builtin_subscription_data (data, (DiscoveredReader_t *) ep); else ret = dcps_get_local_subscription_data (data, (Reader_t *) ep); done: lock_release (wp->w_lock); return (ret); }
DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_topics (DDS_DomainParticipant dp, DDS_InstanceHandleSeq *handles) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_G_DISC_T_S, &dp, sizeof (dp)); ctrc_contd (&handles, sizeof (handles)); ctrc_endd (); if (!handles) return (DDS_RETCODE_BAD_PARAMETER); if (!domain_ptr (dp, 1, &ret)) return (ret); DDS_SEQ_INIT (*handles); if ((dp->participant.p_flags & EF_ENABLED) == 0) { lock_release (dp->lock); return (DDS_RETCODE_NOT_ENABLED); } sl_walk (&dp->participant.p_topics, topic_add_handle, handles); lock_release (dp->lock); return (ret); }
DDS_ReturnCode_t DDS_Subscriber_get_default_datareader_qos (DDS_Subscriber sp, DDS_DataReaderQos *qos) { Domain_t *dp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_S_G_DR_QOS, &sp, sizeof (sp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!qos) { log_printf (DCPS_ID, 0, "get_default_datareader_qos: invalid parameters!\r\n"); return (DDS_RETCODE_BAD_PARAMETER); } if (!subscriber_ptr (sp, &ret)) return (ret); dp = domain_ptr (sp->domain, 1, &ret); if (!dp) return (ret); *qos = sp->def_reader_qos; lock_release (dp->lock); return (DDS_RETCODE_OK); }
DDS_ReturnCode_t DDS_ContentFilteredTopic_set_expression_parameters ( DDS_ContentFilteredTopic ftp, DDS_StringSeq *expr_pars) { DDS_ReturnCode_t rc; ctrc_begind (DCPS_ID, DCPS_FT_S_PARS, &ftp, sizeof (ftp)); ctrc_contd (&expr_pars, sizeof (expr_pars)); ctrc_endd (); if (!topic_ptr (ftp, 1, NULL)) return (DDS_RETCODE_ALREADY_DELETED); if ((ftp->topic.entity.flags & EF_FILTERED) == 0) { rc = DDS_RETCODE_ALREADY_DELETED; goto done; } if (!expr_pars || DDS_SEQ_LENGTH (*expr_pars) < ftp->data.program.npars) { rc = DDS_RETCODE_BAD_PARAMETER; goto done; } rc = dcps_update_str_pars (&ftp->data.filter.expression_pars, expr_pars); done: lock_release (ftp->topic.lock); return (rc); }
DDS_ReturnCode_t DDS_ContentFilteredTopic_get_expression_parameters ( DDS_ContentFilteredTopic ftp, DDS_StringSeq *expr_pars) { DDS_ReturnCode_t rc; ctrc_begind (DCPS_ID, DCPS_FT_G_PARS, &ftp, sizeof (ftp)); ctrc_contd (&expr_pars, sizeof (expr_pars)); ctrc_endd (); if (!topic_ptr (ftp, 1, NULL)) return (DDS_RETCODE_ALREADY_DELETED); if ((ftp->topic.entity.flags & EF_FILTERED) == 0) { lock_release (ftp->topic.lock); return (DDS_RETCODE_ALREADY_DELETED); } if (!expr_pars) { lock_release (ftp->topic.lock); return (DDS_RETCODE_BAD_PARAMETER); } DDS_SEQ_INIT (*expr_pars); rc = dcps_get_str_pars (expr_pars, ftp->data.filter.expression_pars); lock_release (ftp->topic.lock); return (rc); }
DDS_ReturnCode_t DDS_DataWriter_get_matched_subscriptions( DDS_DataWriter wp, DDS_InstanceHandleSeq *handles) { Topic_t *tp; Endpoint_t *ep; FilteredTopic_t *ftp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DW_G_MATCH_S, &wp, sizeof (wp)); ctrc_contd (&handles, sizeof (handles)); ctrc_endd (); if (!handles) return (DDS_RETCODE_BAD_PARAMETER); DDS_SEQ_INIT (*handles); if (!writer_ptr (wp, 0, &ret)) return (ret); tp = wp->w_topic; if (lock_take (tp->lock)) return (DDS_RETCODE_ALREADY_DELETED); #ifndef RW_TOPIC_LOCK if (lock_take (wp->w_lock)) { lock_release (tp->lock); return (DDS_RETCODE_ALREADY_DELETED); } #endif for (ep = tp->writers; ep && ep != &wp->w_ep; ep = ep->next) ; if (!ep) { ret = DDS_RETCODE_ALREADY_DELETED; goto done; } for (ep = tp->readers; ep; ep = ep->next) if (check_matched_subscription (wp, ep, handles, NULL)) { ret = DDS_RETCODE_OUT_OF_RESOURCES; goto done; } for (ftp = tp->filters; ftp; ftp = ftp->next) for (ep = ftp->topic.readers; ep; ep = ep->next) if (check_matched_subscription (wp, ep, handles, NULL)) { ret = DDS_RETCODE_OUT_OF_RESOURCES; goto done; } done: #ifndef RW_TOPIC_LOCK lock_release (wp->w_lock); #endif lock_release (tp->lock); return (ret); }
DDS_ReturnCode_t DDS_Topic_set_qos (DDS_Topic tp, DDS_TopicQos *qos) { Endpoint_t *ep; Reader_t *rp; Writer_t *wp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_T_S_QOS, &tp, sizeof (tp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!topic_ptr (tp, 1, &ret)) return (ret); if (qos == DDS_TOPIC_QOS_DEFAULT) qos = &tp->domain->def_topic_qos; else if (!qos_valid_topic_qos (qos)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } ret = qos_topic_update (&tp->qos, qos); if (ret != DDS_RETCODE_OK) goto done; /* Update all local Readers associated with topic. */ for (ep = tp->readers; ep; ep = ep->next) if ((ep->entity.flags & EF_LOCAL) != 0) { rp = (Reader_t *) ep; #ifdef RW_LOCKS lock_take (rp->r_lock); #endif disc_reader_update (tp->domain, rp, 1, 0); #ifdef RW_LOCKS lock_release (rp->r_lock); #endif } /* Update all local Writers associated with topic. */ for (ep = tp->writers; ep; ep = ep->next) if ((ep->entity.flags & EF_LOCAL) != 0) { wp = (Writer_t *) ep; #ifdef RW_LOCKS lock_take (wp->w_lock); #endif disc_writer_update (tp->domain, wp, 1, 0); #ifdef RW_LOCKS lock_release (wp->w_lock); #endif } done: lock_release (tp->lock); return (ret); }
static void tcp_wait_connect_complete (SOCKET fd, short revents, void *arg) { TCP_CON_REQ_ST *p = (TCP_CON_REQ_ST *) arg; IP_CX *cxp = p->cxp; socklen_t s; int err, r; socklen_t sz; ctrc_begind (TCPS_ID, TCPS_WCON_EV, &fd, sizeof (fd)); ctrc_contd (&revents, sizeof (revents)); ctrc_endd (); trace_poll_events (fd, revents, arg); trc_con2 ("tcp_wait_connect_complete(cp=%p, cxp=%p);\r\n", (void *) p, (void *) cxp); p = tcp_clear_pending_connect (p); do { if ((revents & (POLLERR | POLLNVAL)) != 0) { sz = sizeof (err); r = getsockopt (cxp->fd, SOL_SOCKET, SO_ERROR, &err, &sz); if (r == -1 || err) { log_printf (RTPS_ID, 0, "POLLERR | POLLNVAL [%d]: %d %s\r\n", cxp->fd, err, strerror (err)); tcp_cleanup_ctx (cxp); break; } } if ((revents & POLLHUP) != 0) { tcp_cleanup_ctx (cxp); break; } if ((revents & POLLOUT) != 0) { s = sizeof (err); r = getsockopt (cxp->fd, SOL_SOCKET, SO_ERROR, &err, &s); if (r || err) { if (r) perror ("cc_control: getsockopt(SOL_SOCKET/SO_ERROR)"); tcp_cleanup_ctx (cxp); break; } } log_printf (RTPS_ID, 0, "TCP: server connection established [%d]\r\n", cxp->fd); cxp->cx_state = CXS_OPEN; sock_fd_remove_socket (cxp->fd); sock_fd_add_socket (cxp->fd, POLLIN | POLLPRI | POLLHUP | POLLNVAL, tcp_socket_activity, cxp, "DDS.TCP-H"); ctrc_printd (TCPS_ID, TCPS_CON_COMPL, &fd, sizeof (fd)); cxp->stream_cb->on_connected (cxp); } while (0); if (p) tcp_do_connect (p); }
DDS_InstanceHandle_t DDS_DataWriter_register_instance (DDS_DataWriter wp, const void *data) { FTime_t time; ctrc_begind (DCPS_ID, DCPS_DW_R_INST, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_endd (); sys_getftime (&time); return (dcps_register_instance (wp, data, 0, &time)); }
DDS_ReturnCode_t DDS_DomainParticipant_delete_subscriber (DDS_DomainParticipant dp, DDS_Subscriber sp) { Condition_t *cp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_D_SUB, &dp, sizeof (dp)); ctrc_contd (&sp, sizeof (sp)); ctrc_endd (); prof_start (dcps_delete_sub); if (!domain_ptr (dp, 1, &ret)) return (ret); if (!subscriber_ptr (sp, &ret)) goto done; if (sp->domain != dp) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } if (sp->nreaders) { log_printf (DCPS_ID, 0, "delete_subscriber(): still readers connected!\r\n"); ret = DDS_RETCODE_PRECONDITION_NOT_MET; goto done; } if (!dds_purge_notifications ((Entity_t *) sp, DDS_ALL_STATUS, 1)) { ret = DDS_RETCODE_PRECONDITION_NOT_MET; goto done; } sp->entity.flags &= ~EF_ENABLED; qos_subscriber_free (&sp->qos); /* Delete StatusCondition if it exists. */ if (sp->condition) { cp = (Condition_t *) sp->condition; if (cp->deferred) dds_defer_waitset_undo (sp, sp->condition); dcps_delete_status_condition (sp->condition); sp->condition = NULL; } subscriber_delete (sp); done: lock_release (dp->lock); prof_stop (dcps_delete_sub, 1); return (ret); }
int DDS_DomainParticipant_contains_entity (DDS_DomainParticipant dp, DDS_InstanceHandle_t handle) { Entity_t *ep; int contained = 0; ctrc_begind (DCPS_ID, DCPS_DP_CONT, &dp, sizeof (dp)); ctrc_contd (&handle, sizeof (handle)); ctrc_endd (); if (!domain_ptr (dp, 1, NULL)) return (0); ep = entity_ptr (handle); if (!ep) goto done; if ((ep->flags & EF_LOCAL) == 0) goto done; switch (ep->type) { case ET_TOPIC: contained = (((Topic_t *) ep)->domain == dp); break; case ET_PUBLISHER: contained = (((Publisher_t *) ep)->domain == dp); break; case ET_SUBSCRIBER: contained = (((Subscriber_t *) ep)->domain == dp); break; case ET_WRITER: contained = (((Writer_t *) ep)->w_publisher->domain == dp); break; case ET_READER: contained = (((Reader_t *) ep)->r_subscriber->domain == dp); break; case ET_PARTICIPANT: default: break; } done: lock_release (dp->lock); return (contained); }
DDS_ReturnCode_t DDS_DataWriter_dispose (DDS_DataWriter wp, const void *data, const DDS_InstanceHandle_t handle) { FTime_t time; ctrc_begind (DCPS_ID, DCPS_DW_DISP, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_endd (); sys_getftime (&time); return (dcps_dispose (wp, data, 0, handle, &time, NULL)); }
DDS_InstanceHandle_t DDS_DataWriter_register_instance_w_timestamp ( DDS_DataWriter wp, const void *data, const DDS_Time_t *time) { FTime_t ftime; ctrc_begind (DCPS_ID, DCPS_DW_R_INST_TS, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (time, sizeof (*time)); ctrc_endd (); FTIME_SET (ftime, time->sec, time->nanosec); return (dcps_register_instance (wp, data, 0, &ftime)); }
int trc_lock_destroy (pthread_mutex_t *l, const char *file, int line) { LockState_t *lp, *prev_lp; unsigned h; int res; ARG_NOT_USED (file) ARG_NOT_USED (line) lock_takef (trc_lock); h = lock_hash (l); for (prev_lp = NULL, lp = locks [h]; lp && lp->lock != l; prev_lp = lp, lp = lp->next) ; if (lp) { ltrc_print1 ("{Destroy(%s)", lp->name); if (prev_lp) prev_lp->next = lp->next; else locks [h] = lp->next; } #ifdef LOG_LOCKS else ltrc_print1 ("{Destroy(%p)", (void *) l); #endif ltrc_print1 ("%c}", '!'); #ifdef CTRC_LOCKS if (ctrace_used) { ctrc_begind (THREAD_ID, LOCK_DESTROY, &l, sizeof (l)); if (lp && lp->name) ctrc_contd (lp->name, strlen (lp->name) + 1); ctrc_contd (file, strlen (file) + 1); ctrc_contd (&line, sizeof (line)); ctrc_endd (); } #endif res = pthread_mutex_destroy (l); if (res) warn_printf ("trc_lock_destroy: pthread_mutex_destroy(%s) returned error: %s", (lp) ? lp->name : NULL, strerror (res)); if (lp) Free (lp); lock_releasef (trc_lock); return (res); }
static void tcp_socket_activity (SOCKET fd, short revents, void *arg) { IP_CX *cxp = (IP_CX *) arg; int err, r; socklen_t sz; int handle; ctrc_begind (TCPS_ID, TCPS_SK_ACT, &fd, sizeof (fd)); ctrc_contd (&revents, sizeof (revents)); ctrc_endd (); trace_poll_events (fd, revents, arg); # if 0 if (!cxp->fd_owner) log_printf (RTPS_ID, 0, "Socket is not the fd_owner [%d] cxp:%p(%d) paired:%p(%d) \r\n", fd, (void *) cxp, cxp->fd_owner, (void *) cxp->paired, cxp->paired ? cxp->paired->fd_owner : 99999); # endif if ((revents & (POLLERR | POLLNVAL)) != 0) { sz = sizeof (err); r = getsockopt (cxp->fd, SOL_SOCKET, SO_ERROR, &err, &sz); if ((r == -1) || err) { log_printf (RTPS_ID, 0, "POLLERR | POLLNVAL [%d]: %d %s\r\n", cxp->fd, err, strerror (err)); tcp_cleanup_ctx (cxp); return; } } if ((revents & POLLHUP) != 0) { tcp_cleanup_ctx (cxp); return; } if ((revents & POLLOUT) != 0) { handle = cxp->handle; tcp_write_message_fragment (cxp); /* It is possible that the above call ended up in cxp being cleaned up. We can verify this by varifying on the handle of that context. If the handle is still valid, we're in good shape and it is safe to continue. */ if (!rtps_ip_from_handle (handle)) { log_printf (RTPS_ID, 0, "POLLOUT [%d]: cxp %p h:%d was cleaned up\r\n", fd, (void *) cxp, handle); return; } } if ((revents & POLLIN) != 0) { tcp_receive_message (cxp); return; } }
DDS_ReturnCode_t DDS_DataWriter_write_w_timestamp ( DDS_DataWriter wp, const void *data, const DDS_InstanceHandle_t handle, const DDS_Time_t *time) { FTime_t ftime; ctrc_begind (DCPS_ID, DCPS_DW_WRITE_TS, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_contd (time, sizeof (*time)); ctrc_endd (); time2ftime ((const Time_t *) time, &ftime); return (dcps_write (wp, data, 0, handle, &ftime, NULL)); }
DDS_ReturnCode_t DDS_DataWriter_dispose_w_timestamp ( DDS_DataWriter wp, const void *data, const DDS_InstanceHandle_t handle, const DDS_Time_t *time) { FTime_t ftime; ctrc_begind (DCPS_ID, DCPS_DW_DISP_TS, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_contd (time, sizeof (*time)); ctrc_endd (); FTIME_SET (ftime, time->sec, time->nanosec); return (dcps_dispose (wp, data, 0, handle, &ftime, NULL)); }
DDS_ReturnCode_t DDS_DataWriter_write_directed ( DDS_DataWriter wp, const void *data, const DDS_InstanceHandle_t handle, DDS_InstanceHandleSeq *dests) { FTime_t time; ctrc_begind (DCPS_ID, DCPS_DW_WRITE_D, &wp, sizeof (wp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_contd (&dests, sizeof (dests)); ctrc_endd (); sys_getftime (&time); return (dcps_write (wp, data, 0, handle, &time, dests)); }
DDS_ReturnCode_t DDS_DataWriter_unregister_instance_w_timestamp ( DDS_DataWriter wp, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *time) { FTime_t ftime; ctrc_begind (DCPS_ID, DCPS_DW_U_INST_TS, &wp, sizeof (wp)); ctrc_contd (&instance_data, sizeof (instance_data)); ctrc_contd (&handle, sizeof (handle)); ctrc_contd (time, sizeof (*time)); ctrc_endd (); FTIME_SET (ftime, time->sec, time->nanosec); return (dcps_unregister_instance (wp, instance_data, 0, handle, &ftime, NULL)); }
DDS_Publisher DDS_DomainParticipant_create_publisher (DDS_DomainParticipant dp, const DDS_PublisherQos *qos, const DDS_PublisherListener *listener, DDS_StatusMask mask) { Publisher_t *up; int enable; ctrc_begind (DCPS_ID, DCPS_DP_C_PUB, &dp, sizeof (dp)); ctrc_contd (&qos, sizeof (qos)); ctrc_contd (&listener, sizeof (listener)); ctrc_contd (&mask, sizeof (mask)); ctrc_endd (); prof_start (dcps_create_pub); if (!domain_ptr (dp, 1, NULL)) return (NULL); if (qos == DDS_PUBLISHER_QOS_DEFAULT) qos = &dp->def_publisher_qos; else if (!qos_valid_publisher_qos (qos)) { up = NULL; goto done; } up = publisher_create (dp, 0); if (!up) goto done; qos_publisher_new (&up->qos, qos); if (listener) up->listener = *listener; up->mask = mask; up->def_writer_qos = qos_def_writer_qos; enable = dp->autoenable; lock_release (dp->lock); if (enable) DDS_Publisher_enable (up); return (up); done: lock_release (dp->lock); prof_stop (dcps_create_pub, 1); return (NULL); }
DDS_Subscriber DDS_DomainParticipant_create_subscriber (DDS_DomainParticipant dp, const DDS_SubscriberQos *qos, const DDS_SubscriberListener *listener, DDS_StatusMask mask) { Subscriber_t *sp; int enable; ctrc_begind (DCPS_ID, DCPS_DP_C_SUB, &dp, sizeof (dp)); ctrc_contd (&qos, sizeof (qos)); ctrc_contd (&listener, sizeof (listener)); ctrc_contd (&mask, sizeof (mask)); ctrc_endd (); prof_start (dcps_create_sub); if (!domain_ptr (dp, 1, NULL)) return (NULL); if (qos == DDS_SUBSCRIBER_QOS_DEFAULT) qos = &dp->def_subscriber_qos; else if (!qos_valid_subscriber_qos (qos)) { sp = NULL; goto done; } sp = subscriber_create (dp, 0); if (!sp) goto done; qos_subscriber_new (&sp->qos, qos); if (listener) sp->listener = *listener; sp->mask = mask; enable = dp->autoenable; lock_release (dp->lock); if (enable) DDS_Subscriber_enable (sp); prof_stop (dcps_create_sub, 1); return (sp); done: lock_release (dp->lock); return (NULL); }
DDS_ReturnCode_t DDS_Topic_get_qos (DDS_Topic tp, DDS_TopicQos *qos) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_T_G_QOS, &tp, sizeof (tp)); ctrc_contd (&qos, sizeof (qos)); ctrc_endd (); if (!qos) return (DDS_RETCODE_BAD_PARAMETER); if (!topic_ptr (tp, 1, &ret)) return (ret); qos_topic_get (tp->qos, qos); lock_release (tp->lock); return (DDS_RETCODE_OK); }
DDS_ReturnCode_t DDS_DataWriter_wait_for_acknowledgments ( DDS_DataWriter wp, const DDS_Duration_t *max_wait) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DW_WACKS, &wp, sizeof (wp)); ctrc_contd (max_wait, sizeof (max_wait)); ctrc_endd (); if (!writer_ptr (wp, 1, &ret)) return (ret); ret = hc_wait_acks (wp->w_cache, (const Duration_t *) max_wait); lock_release (wp->w_lock); return (ret); }
DDS_ReturnCode_t DDS_DomainParticipant_delete_multitopic ( DDS_DomainParticipant dp, DDS_MultiTopic t) { DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_D_MTOP, &dp, sizeof (dp)); ctrc_contd (&t, sizeof (t)); ctrc_endd (); ARG_NOT_USED (t) /* Check some required parameters. */ if (!domain_ptr (dp, 0, &ret)) return (ret); return (DDS_RETCODE_UNSUPPORTED); }