Ejemplo n.º 1
0
void tty_input (HANDLE fd, short events, void *udata)
{
	char		ch;
	unsigned	n;

	ARG_NOT_USED (fd)
	ARG_NOT_USED (events)
	ARG_NOT_USED (udata)

	DDS_continue ();

	n = tty_read (&ch, 1);
	if (!n)
		return;

	if (full) {
		printf ("\a");
		return;
	}
	tty_queue [wp++] = ch;
	if (wp >= MAX_QUEUE)
		wp = 0;
	empty = 0;
	if (wp == rp)
		full = 1;
}
Ejemplo n.º 2
0
AuthState_t validate_peer_identity (Identity_t    id,
				    void          *token,
				    unsigned char *identity,
				    size_t        identity_length,
				    unsigned char *challenge,
				    size_t        *challenge_length)
{
	Identity_t		h;
	AuthState_t		r;
	DDS_IdentityToken	rem_idt, *list;
	DDS_OctetSeq		seq;
	DDS_ReturnCode_t	err;

	ARG_NOT_USED (token)
	ARG_NOT_USED (challenge)

	DDS_DataHolder__init (&rem_idt, DDS_DTLS_ID_TOKEN_CLASS);
	rem_idt.binary_value1 = &seq;
	DDS_SEQ_INIT (seq);
	seq._buffer = identity;
	seq._maximum = seq._length = identity_length;
	rem_idt.nusers = ~0;
	list = &rem_idt;
	r = sec_validate_remote_id (id,
				    &list,
				    NULL,
				    NULL,
				    &h, &err);
	*challenge_length = 0;
	if (err)
		return (AS_FAILED);

	return (r);
}
Ejemplo n.º 3
0
static int trace_set_fct (Skiplist_t *list, void *node, void *arg)
{
	Endpoint_t	*ep, **epp = (Endpoint_t **) node;
	unsigned	*mode = (unsigned *) arg;

	ARG_NOT_USED (list)
	ARG_NOT_USED (arg)

	ep = *epp;
	if (!ep->rtps)
		return (1);

	rtps_trace_set (ep, *mode);
	return (1);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
static int sfw_be_new_change (RemReader_t      *rrp,
			      Change_t         *cp,
			      HCI              hci,
			      SequenceNumber_t *snr)
{
	CCREF	*rp;

	ARG_NOT_USED (snr)

	ctrc_printd (RTPS_ID, RTPS_SFW_BE_NEW, &rrp, sizeof (rrp));
	prof_start (rtps_bw_new);

	RR_SIGNAL (rrp, "BE-NewChange");

#ifdef RTPS_MARKERS
	if (rrp->rr_writer->endpoint.mark_newch)
		rtps_marker_notify (rrp->rr_writer->endpoint.endpoint, EM_NEW_CHANGE, "sfw_be_new_change");
#endif
	rp = change_enqueue (rrp, cp, hci, CS_UNSENT);
	if (!rp)
		return (0);

	rp->ack_req = 1;
	rrp->rr_unacked++;
	if (!rrp->rr_unsent_changes) {
		rrp->rr_unsent_changes = rp;
		proxy_activate (&rrp->proxy);
	}
	NEW_RR_TSTATE (rrp, RRTS_PUSHING, 0);
	CACHE_CHECK (&rrp->rr_writer->endpoint, "sfw_be_new_change");
	prof_stop (rtps_bw_new, 1);
	return (1);
}
Ejemplo n.º 6
0
char *sys_username (char *buf, size_t length)
{
#ifdef _WIN32
	char	ts [UNLEN + 1];
	DWORD	len = sizeof (ts);

	if (!GetUserNameA (ts, &len))
		fatal_printf ("sys_username(): GetUserNameA() returned error!");

	if (len >= length)
		fatal_printf ("sys_username(): buffer too short!");

	memcpy (buf, ts, len);
	buf [len] = '\0';
#elif defined (NUTTX_RTOS)
	ARG_NOT_USED (length)
	strcpy (buf, "NuttX_username");
#else
	char	*cp = getlogin ();

	if (strlen (cp) >= length) {
		memcpy (buf, cp, length - 1);
		buf [length - 1] = '\0';
		warn_printf ("sys_username(): login name too long ('%s')!", cp);
	}
	else
		strcpy (buf, cp);
#endif
	return (buf);
}
Ejemplo n.º 7
0
void read_msg (DDS_DataReaderListener *l, DDS_DataReader dr)
{
	ChatMsg_t		msg;
	DDS_InstanceStateKind	kind;
	int			valid;
	DDS_ReturnCode_t	ret;

	ARG_NOT_USED (l)

	memset (&msg, 0, sizeof (msg));
	ret = ChatMsg_read_or_take (dr, &msg, DDS_NOT_READ_SAMPLE_STATE, 
					      DDS_ANY_VIEW_STATE,
					      DDS_ANY_INSTANCE_STATE, 1,
					      &valid, &kind);
	if (ret == DDS_RETCODE_OK)
		do {
#ifndef DISPLAY_SELF
			if (!strcmp (msg.from, user_name) &&
			    !strcmp (msg.chatroom, chatroom))
				break;
#endif
			if (valid)
				printf ("%s: %s\r\n", msg.from, msg.message);
			else if (kind == DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE)
				printf ("%s is busy!\r\n", msg.from);
			else if (kind == DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE)
				printf ("%s has left!\r\n", msg.from);
		}
		while (0);

	ChatMsg_cleanup (&msg);
}
Ejemplo n.º 8
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   I n i t i a l i z e P i x e l I t e r a t o r O p t i o n s               %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  InitializePixelIteratorOptions() assigns default options to a user-provided
%  PixelIteratorOptions structure.  This function should always be used
%  to initialize the PixelIteratorOptions structure prior to making any
%  changes to it.
%
%  The format of the InitializePixelIteratorOptions method is:
%
%      void InitializePixelIteratorOptions(PixelIteratorOptions *options,
%                                          ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o options: pointer to PixelIteratorOptions structure to initialize.
%
%    o exception: Return any errors or warnings in this structure.
%
*/
MagickExport void
InitializePixelIteratorOptions(PixelIteratorOptions *options,
                               ExceptionInfo *exception)
{
  ARG_NOT_USED(exception);
  assert(options != (PixelIteratorOptions *) NULL);
  options->max_threads=0;
  options->signature=MagickSignature;
}
Ejemplo n.º 9
0
Archivo: cdl.c Proyecto: airhuman/cwf
static MagickPassFail
CdlImagePixels(void *mutable_data,         /* User provided mutable data */
	       const void *immutable_data, /* User provided immutable data */
	       Image *image,               /* Modify image */
	       PixelPacket *pixels,        /* Pixel row */
	       IndexPacket *indexes,       /* Pixel row indexes */
	       const long npixels,         /* Number of pixels in row */
	       ExceptionInfo *exception)   /* Exception report */
{
  const CdlImageParameters_t
    param = *(const CdlImageParameters_t *) immutable_data;
	
  register long
    i;
	
  ARG_NOT_USED(mutable_data);
  ARG_NOT_USED(image);
  ARG_NOT_USED(indexes);
  ARG_NOT_USED(exception);	

  if (param.lut != (PixelPacket *) NULL)
    {
      for(i = 0; i < npixels; i++)
	{
	  pixels[i].red=param.lut[pixels[i].red].red;
	  pixels[i].green=param.lut[pixels[i].green].green;
	  pixels[i].blue=param.lut[pixels[i].blue].blue;
	}
    }
  else
    {
      for(i = 0; i < npixels; i++)
	{
	  pixels[i].red=CdlQuantum(pixels[i].red,param.redslope,param.redoffset,
				   param.redpower,param.saturation);
	  pixels[i].green=CdlQuantum(pixels[i].green,param.greenslope,param.greenoffset,
				     param.greenpower,param.saturation);
	  pixels[i].blue=CdlQuantum(pixels[i].blue,param.blueslope,param.blueoffset,
				    param.bluepower,param.saturation);
	}
    }
	
  return MagickPass;
}
Ejemplo n.º 10
0
char *sys_hostname (char *buf, size_t length)
{
#if defined (NUTTX_RTOS)
	ARG_NOT_USED (length)
	strcpy (buf, "NuttX_hostname");
#else
	gethostname (buf, length);
#endif
	return (buf);
}
Ejemplo n.º 11
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   I n i t i a l i z e D i f f e r e n c e S t a t i s t i c s               %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  InitializeDifferenceStatistics() assigns default options to a user-provided
%  DifferenceStatistics structure.
%
%  The format of the InitializeDifferenceStatistics method is:
%
%      void InitializeDifferenceStatistics(DifferenceStatistics *options,
%                                          ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o options: pointer to DifferenceStatistics structure to initialize.
%
%    o exception: Return any errors or warnings in this structure.
%
*/
MagickExport void
InitializeDifferenceStatistics(DifferenceStatistics *statistics,
                               ExceptionInfo *exception)
{
  ARG_NOT_USED(exception);
  assert(statistics != (DifferenceStatistics *) NULL);
  statistics->red=0.0;
  statistics->green=0.0;
  statistics->blue=0.0;
  statistics->opacity=0.0;
  statistics->combined=0.0;
}
Ejemplo n.º 12
0
static int topic_type_check_fct (Skiplist_t *list, void *node, void *arg)
{
	Topic_t			*tp, **tpp = (Topic_t **) node;
	struct type_lookup_st	*lookup = (struct type_lookup_st *) arg;

	ARG_NOT_USED (list)

	tp = *tpp;
	if (tp->nlrefs && tp->type == lookup->type) {
		lookup->nusers++;
	}
	return (1);
}
Ejemplo n.º 13
0
static Permissions_t sp_check_rem_perms (const SEC_PERM            *pp,
					 Identity_t                local,
					 Identity_t                remote,
					 DDS_PermissionsToken      *token,
					 DDS_PermissionsCredential *cred)
{
	DDS_SecurityReqData	data;
	DDS_ReturnCode_t	ret;

	ARG_NOT_USED (pp)
	ARG_NOT_USED (token)

	data.handle = remote;
	data.secure = local;
	data.data = DDS_SEQ_DATA (*cred->binary_value1);
	data.length = DDS_SEQ_LENGTH (*cred->binary_value1);
	data.name = cred->class_id;
	ret = sec_access_control_request (DDS_VALIDATE_REMOTE_PERM, &data);
	if (ret)
		return (0);

	return (data.handle);
}
Ejemplo n.º 14
0
/*
  Compute the squared difference.

  In this case we sum the square of the difference between channel
  pixel quantums.
*/
static MagickPassFail
ComputeSquaredError(void *mutable_data,
                    const void *immutable_data,
                    const Image *first_image,
                    const PixelPacket *first_pixels,
                    const IndexPacket *first_indexes,
                    const Image *second_image,
                    const PixelPacket *second_pixels,
                    const IndexPacket *second_indexes,
                    const long npixels,
                    ExceptionInfo *exception)
{
  DifferenceStatistics
    lstats,
    *stats = (DifferenceStatistics *) mutable_data;

  double
    difference;

  register long
    i;

  ARG_NOT_USED(immutable_data);
  ARG_NOT_USED(first_image);
  ARG_NOT_USED(first_indexes);
  ARG_NOT_USED(second_image);
  ARG_NOT_USED(second_indexes);
  ARG_NOT_USED(exception);

  InitializeDifferenceStatistics(&lstats,exception);
  for (i=0; i < npixels; i++)
    {
      difference=(first_pixels[i].red-(double) second_pixels[i].red)/MaxRGBDouble;
      lstats.red += difference*difference;

      difference=(first_pixels[i].green-(double) second_pixels[i].green)/MaxRGBDouble;
      lstats.green += difference*difference;

      difference=(first_pixels[i].blue-(double) second_pixels[i].blue)/MaxRGBDouble;
      lstats.blue += difference*difference;

      difference=(first_pixels[i].opacity-(double) second_pixels[i].opacity)/MaxRGBDouble;
      lstats.opacity += difference*difference;
    }

#if defined(HAVE_OPENMP)
#  pragma omp critical (GM_ComputeSquaredError)
#endif
  {
    stats->red += lstats.red;
    stats->green += lstats.green;
    stats->blue += lstats.blue;
    stats->opacity += lstats.opacity;
  }

  return (MagickPass);
}
Ejemplo n.º 15
0
static int participant_add_handle (Skiplist_t *list, void *node, void *arg)
{
	const Participant_t	*pp, **ppp = (const Participant_t **) node;
	DDS_InstanceHandleSeq	*handles = (DDS_InstanceHandleSeq *) arg;
	DDS_InstanceHandle_t	h;

	ARG_NOT_USED (list)

	pp = *ppp;
	if (entity_ignored (pp->p_entity.flags))
		return (1);

	h = pp->p_handle;
	return (dds_seq_append (handles, &h) == 0);
}
Ejemplo n.º 16
0
static int topic_type_promote_tc_fct (Skiplist_t *list, void *node, void *arg)
{
	Topic_t		*tp, **tpp = (Topic_t **) node;
	TPTC_t		*tptc = (TPTC_t *) arg;

	ARG_NOT_USED (list)

	tp = *tpp;
	if (tp->nlrefs && tp->type == tptc->type) {
		topic_type_promote_tc_eps (tp->writers, tptc, 1);
		topic_type_promote_tc_eps (tp->readers, tptc, 0);
		tptc->ntopics--;
	}
	return (tptc->ntopics != 0);
}
Ejemplo n.º 17
0
static int topic_add_handle (Skiplist_t *list, void *node, void *arg)
{
	const Topic_t		*tp, **tpp = (const Topic_t **) node;
	DDS_InstanceHandleSeq	*handles = (DDS_InstanceHandleSeq *) arg;
	DDS_InstanceHandle_t	h;

	ARG_NOT_USED (list)

	tp = *tpp;
	if (!entity_discovered (tp->entity.flags) ||
	    entity_ignored (tp->entity.flags))
		return (1);

	h = tp->entity.handle;
	return (dds_seq_append (handles, &h) == 0);
}
Ejemplo n.º 18
0
static int delete_type (Skiplist_t *list, void *node, void *arg)
{
	TopicType_t		*ttp, **ttpp = (TopicType_t **) node;
	DDS_DomainParticipant	p = (DDS_DomainParticipant) arg;

	ARG_NOT_USED (list)

	ttp = *ttpp;
	if ((ttp->flags & (EF_BUILTIN | EF_LOCAL)) == EF_LOCAL) {
		dtrc_printf ("participant_delete_contained_entitities: unregister Type (%s)\r\n", 
							str_ptr (ttp->type_name));
		DDS_DomainParticipant_unregister_type (p, ttp->type_support, 
							str_ptr (ttp->type_name));
	}
	return (1);
}
Ejemplo n.º 19
0
int dcps_delete_topic (Skiplist_t *list, void *node, void *arg)
{
	Topic_t			*tp, **tpp = (Topic_t **) node;
	DDS_DomainParticipant	p = (DDS_DomainParticipant) arg;
	unsigned		n;

	ARG_NOT_USED (list)

	tp = *tpp;
	if ((tp->entity.flags & EF_BUILTIN) == 0) {
		dtrc_printf ("participant_delete_contained_entitities: delete Topic (%s)\r\n", 
						str_ptr (tp->name));
		for (n = tp->nlrefs; n; n--)	/* Make sure we *really* delete it! */
			DDS_DomainParticipant_delete_topic (p, tp);
	}
	return (1);
}
Ejemplo n.º 20
0
static int delete_type_support (Skiplist_t *list, void *node, void *arg)
{
	TopicType_t			*typep, **typepp = (TopicType_t **) node;
	struct type_sup_rem_state_st	*state = (struct type_sup_rem_state_st *) arg;

	ARG_NOT_USED (list)

	typep = *typepp;
	if ((typep->flags & EF_LOCAL) != 0 &&
	    typep->type_support == state->ts) {
		state->ret = DDS_DomainParticipant_unregister_type (state->part,
					    state->ts,
					    (void *) str_ptr (typep->type_name));
		return (0);
	}
	return (1);
}
Ejemplo n.º 21
0
char *sys_osname (char *buf, size_t length)
{
	ARG_NOT_USED (length)

#ifdef _WIN32
	strcpy (buf, "Windows");
#elif defined (__APPLE__)
	strcpy (buf, "OSX");
#elif defined (NetBSD)
	strcpy (buf, "NetBSD");
#elif defined (__FreeBSD__)
	strcpy (buf, "FreeBSD");
#elif defined (__OpenBSD__)
	strcpy (buf, "OpenBSD");
#else
	strcpy (buf, "Linux");
#endif
	return (buf);
}
Ejemplo n.º 22
0
void read_msg (DDS_DataReaderListener *l, DDS_DataReader dr)
{
	Vector3_dos_t		msg;
	DDS_InstanceStateKind	kind;
	int			valid;
	DDS_ReturnCode_t	ret;

	ARG_NOT_USED (l)

	memset (&msg, 0, sizeof (msg));
	ret = Vector3_dos_read_or_take (dr, &msg, DDS_NOT_READ_SAMPLE_STATE, 
					      DDS_ANY_VIEW_STATE,
					      DDS_ANY_INSTANCE_STATE, 1,
					      &valid, &kind);
	if (ret == DDS_RETCODE_OK)
		do {
#if 0
/*  
	Use a from field within the message to avoid to read the messages that this
	node sent.
*/
#ifndef DISPLAY_SELF
			if (!strcmp (msg.from, user_name) &&
			    !strcmp (msg.chatroom, chatroom))
				break;
#endif
#endif
			if (valid){
				printf ("Vector3_dos message:\r\n");
				printf (" uno.x_=%f, uno.y_=%f and uno.z_=%f\r\n", msg.uno.x_, msg.uno.y_, msg.uno.z_);
				printf (" dos.x_=%f, dos.y_=%f and dos.z_=%f\r\n", msg.dos.x_, msg.dos.y_, msg.dos.z_);
			}
			else if (kind == DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE)
				printf ("DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE!\r\n");
			else if (kind == DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE)
				printf ("DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE!\r\n");
		}
		while (0);

	Vector3_dos_cleanup (&msg);
}
Ejemplo n.º 23
0
static int subscriber_notify_reader (Skiplist_t *list, void *node, void *args)
{
	Endpoint_t		*ep, **epp = (Endpoint_t **) node;
	Subscriber_t		*sp = (Subscriber_t *) args;
	Reader_t		*rp;

	ARG_NOT_USED (list)

	ep = *epp;
	if (!entity_reader (entity_type (&ep->entity)) || ep->u.subscriber != sp)
		return (1);

	rp = (Reader_t *) ep;
	if (dcps_data_available_listener (rp) &&
	    (rp->r_status & DDS_DATA_AVAILABLE_STATUS) != 0)
		dds_notify (NSC_DCPS, (Entity_t *) rp, NT_DATA_AVAILABLE);

	else if (rp->r_conditions)
		dcps_waitset_wakeup (rp, rp->r_conditions, &sp->domain->lock);

	return (1);
}
Ejemplo n.º 24
0
static int subscriber_get_reader (Skiplist_t *list, void *node, void *args)
{
	Endpoint_t		*ep, **epp = (Endpoint_t **) node;
	SubGReaders_t		*sp = (SubGReaders_t *) args;
	Reader_t		*rp;

	ARG_NOT_USED (list)

	ep = *epp;
	if (!entity_reader (entity_type (&ep->entity)) || ep->u.subscriber != sp->sp)
		return (1);

	rp = (Reader_t *) ep;
	if (!hc_avail (rp->r_cache, sp->skip))
		return (1);

	if (dds_seq_append (sp->rseq, (DDS_DataReader *) &rp)) {
		sp->ret = DDS_RETCODE_OUT_OF_RESOURCES;
		return (0);
	}
	return (1);
}
Ejemplo n.º 25
0
static int update_reader_qos (Skiplist_t *list, void *node, void *arg)
{
	Reader_t        *rp, **rpp = (Reader_t **) node;
	Subscriber_t    *sp = (Subscriber_t *) arg;

	ARG_NOT_USED (list)     

	rp = *rpp;

	if (rp->r_subscriber == sp && (rp->r_flags & EF_ENABLED) != 0) {
		lock_take (rp->r_topic->lock);
#ifdef RW_LOCKS
		lock_take (rp->r_lock);
#endif
		hc_qos_update (rp->r_cache);
		disc_reader_update (sp->domain, rp, 1, 0);
#ifdef RW_LOCKS
		lock_release (rp->r_lock);
#endif
		lock_release (rp->r_topic->lock);
	}
	return (1);
}
Ejemplo n.º 26
0
static void msg_data_info (Participant_t          *pp,
			   ParticipantMessageData *dp,
			   char                   dir,
			   InfoType_t             type)
{
	uint32_t	*lp = (uint32_t *) &dp->participantGuidPrefix;

	ARG_NOT_USED (pp)

	log_printf (SPDP_ID, 0, "MSG-%c: %08x:%08x:%08x - ", dir, ntohl (lp [0]), ntohl (lp [1]), ntohl (lp [2]));
	if ((dp->kind [0] & 0x80) != 0)
		log_printf (SPDP_ID, 0, "Vendor: %02x.%02x.%02x.%02x, ",
			dp->kind [0], dp->kind [1], dp->kind [2], dp->kind [3]);
	else if (dp->kind [0] == 0 &&
		 dp->kind [1] == 0 &&
		 dp->kind [2] == 0 &&
		 (dp->kind [3] == 1 || dp->kind [3] == 2))
		if (dp->kind [3] == 1)
			log_printf (SPDP_ID, 0, "Auto Liveliness Update, ");
		else
			log_printf (SPDP_ID, 0, "Manual Liveliness Update, ");
	else
		log_printf (SPDP_ID, 0, "Reserved: %02x.%02x.%02x.%02x, ",
			dp->kind [0], dp->kind [1], dp->kind [2], dp->kind [3]);
	switch (type) {
		case EI_NEW:
			log_printf (SPDP_ID, 0, "{New} ");
			msg_dump_data (&dp->data);
			break;
		case EI_UPDATE:
			msg_dump_data (&dp->data);
			break;
		case EI_DELETE:
			log_printf (SPDP_ID, 0, "{deleted}!\r\n");
			break;
	}
}
Ejemplo n.º 27
0
static int ep_dump_fct (Skiplist_t *list, void *node, void *arg)
{
	LocalEndpoint_t	*ep, **epp = (LocalEndpoint_t **) node;
	DomainId_t	*dip = (DomainId_t *) arg;
	int		n;

	ARG_NOT_USED (list)

	ep = *epp;
	dbg_printf ("    %u/%02x%02x%02x-%02x %c{%u}\t",
			*dip,
			ep->ep.entity_id.id [0], 
			ep->ep.entity_id.id [1],
			ep->ep.entity_id.id [2],
			ep->ep.entity_id.id [3],
			entity_writer (entity_type (&ep->ep.entity)) ? 'W' : 'R',
			ep->ep.entity.handle);
	dbg_printf ("%u", hc_total_changes (ep->cache));
	if ((n = hc_total_instances (ep->cache)) >= 0)
		dbg_printf ("/%d", n);
	dbg_printf ("\t%s/%s\r\n", str_ptr (ep->ep.topic->name),
				   str_ptr (ep->ep.topic->type->type_name));
	return (1);
}
Ejemplo n.º 28
0
	r = DDS_DomainParticipant_delete_subscriber (p, sub);
	fail_unless (r == DDS_RETCODE_OK);
	r = DDS_DomainParticipant_delete_topic (p, t);
	fail_unless (r == DDS_RETCODE_OK);

	unregister_HelloWorldData_type (p);
	r = DDS_DomainParticipantFactory_delete_participant (p);
	fail_unless (r == DDS_RETCODE_OK);
}

static void subscription_matched (
	DDS_DataReaderListener *self,
	DDS_DataReader reader, /* in (variable length) */
	DDS_SubscriptionMatchedStatus *status)
{
	ARG_NOT_USED (self)
	ARG_NOT_USED (reader)
	ARG_NOT_USED (status)
}

static void sample_rejected (
	DDS_DataReaderListener *self,
	DDS_DataReader reader, /* in (variable length) */
	DDS_SampleRejectedStatus *status)
{
	ARG_NOT_USED (self)
	ARG_NOT_USED (reader)
	ARG_NOT_USED (status)
}

static void data_available (
Ejemplo n.º 29
0
static Token_t *sp_get_perm_token (const SEC_PERM *pp, Permissions_t id)
{
	Token_t			*tp;
	unsigned char		*p;
	DDS_SecurityReqData	data;
	DDS_PermissionsToken	*token;
	size_t			cred_len;
	DDS_ReturnCode_t	error;

	ARG_NOT_USED (pp)

	tp = xmalloc (sizeof (Token_t));
	if (!tp)
		return (NULL);

	token = DDS_DataHolder__alloc (GMCLASSID_SECURITY_PERMISSIONS_TOKEN);
	if (!token) {
		xfree (tp);
		return (NULL);
	}
	token->binary_value1 = DDS_OctetSeq__alloc ();
	if (!token->binary_value1)
		goto free_dh;

	error = dds_seq_require (token->binary_value1, 32);
	if (error)
		goto free_dh;

	data.handle = id;
	data.data = NULL;
	data.kdata = NULL;
	data.length = 0;
	data.rlength = 0;
	error = sec_access_control_request (DDS_GET_PERM_CRED, &data);
	if (error)
		goto free_dh;

	cred_len = data.rlength;
	p = xmalloc (cred_len);
	if (!p)
		goto free_dh;

	data.data = p;
	data.kdata = NULL;
	data.length = cred_len;
	error = sec_access_control_request (DDS_GET_PERM_CRED, &data);
	if (error)
		goto free_p;

	error = sec_hash_sha256 ((unsigned char *) p,
				 cred_len,
				 DDS_SEQ_DATA (*token->binary_value1));
	xfree (p);
	if (error)
		goto free_dh;

	tp->data = token;
	tp->nusers = 1;
	tp->encoding = 0;
	tp->integral = 0;
	tp->next = NULL;
	return (tp);

    free_p:
    	xfree (p);
    free_dh:
	DDS_DataHolder__free (token);
	xfree (tp);
	return (NULL);
}
Ejemplo n.º 30
0
	tp->next = NULL;
	return (tp);

    free_p:
    	xfree (p);
    free_dh:
	DDS_DataHolder__free (token);
	xfree (tp);
	return (NULL);
}

/* sp_free_perm_token -- Release a previously received PermissionsToken. */

static void sp_free_perm_token (const SEC_PERM *pp, Permissions_t h)
{
	ARG_NOT_USED (pp)
	ARG_NOT_USED (h)

	/* ... TBC ... */
}

/* sp_get_perm_creds -- Get a PermissionsCredential token from a permissions
			handle. */

static DDS_PermissionsCredential *sp_get_perm_creds (const SEC_PERM *pp,
					             Permissions_t  id)
{
	ARG_NOT_USED (pp)
	ARG_NOT_USED (id)

	/* ... TBC ... */