예제 #1
0
파일: str.c 프로젝트: Refandler/gentee
uint   STDCALL str_fwildcard( pstr name, pstr mask )
{
   uint   ret;
   uint   dotstr;
   uint   dotmask;
   pubyte pname = str_ptr( name );
   pubyte pmask = str_ptr( mask );
   uint   isstr = FALSE;
   uint   ismask = FALSE;
   uint   empty = 0;

   dotstr = str_find( name, 0, '.', TRUE );
   dotmask = str_find( mask, 0, '.', TRUE );

   if ( pname[ dotstr ] )
   {
      pname[ dotstr ] = 0;
      isstr = TRUE;
   }
   if ( pmask[ dotmask ] )
   {
      pmask[ dotmask ] = 0;
      ismask = TRUE;
   }
   ret = ptr_wildcardignore( pname, pmask );
   if ( ismask || ( isstr && pmask[ dotmask - 1 ] != '*' ))
      ret &= ptr_wildcardignore( isstr ? pname + dotstr + 1 : ( pubyte )&empty,
                              ismask ? pmask + dotmask + 1 : ( pubyte )&empty );
   if ( isstr )
      pname[ dotstr ] = '.';
   if ( ismask )
      pmask[ dotmask ] = '.';
   return ret;
}
예제 #2
0
int sedp_reader_remove (Domain_t *dp, Reader_t *rp)
{
	Endpoint_t	*ep;
	Topic_t		*tp;
	FilteredTopic_t	*ftp;

	tp = rp->r_topic;
	if ((tp->entity.flags & EF_FILTERED) != 0) {
		ftp = (FilteredTopic_t *) tp;
		tp = ftp->related;
	}
	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Reader (%s/%s) removed.\r\n",
				str_ptr (tp->name),
				str_ptr (tp->type->type_name));

	/* Remove the subscription. */
	sedp_subscription_remove (dp, rp);

	/* Can we match/unmatch discovered writers with the reader? */
	for (ep = tp->writers; ep; ep = ep->next)
		if (remote_active (ep->entity.flags) &&
		    rtps_reader_matches (rp, (DiscoveredWriter_t *) ep))
			disc_end_matched_writer (rp, (DiscoveredWriter_t *) ep);

	return (DDS_RETCODE_OK);
}
예제 #3
0
파일: defines.c 프로젝트: Refandler/gentee
uint  STDCALL os_fileopen( pstr name, uint flag )
{
#ifdef LINUX
   int fd;
   fd = open( str_ptr( name ), ( flag & FOP_READONLY ? O_RDONLY : O_RDWR ) |
                    ( flag & FOP_CREATE ? O_CREAT : 0 ) |
                    ( flag & FOP_IFCREATE ? O_TRUNC : 0 ), S_IRWXU );
   if ( fd != -1 && flag & FOP_EXCLUSIVE )
   {
      if ( flock( fd, LOCK_EX ) == -1 )
      {
        	close( fd );
			fd = -1;
      }
   }
   return fd;
#else
   uint ret;

   ret = ( uint )CreateFile( str_ptr( name ), ( flag & FOP_READONLY ? GENERIC_READ :
            GENERIC_READ | GENERIC_WRITE ), ( flag & FOP_EXCLUSIVE ? 0 :
            FILE_SHARE_READ | FILE_SHARE_WRITE ), NULL,
           ( flag & FOP_CREATE ? CREATE_ALWAYS :
              ( flag & FOP_IFCREATE ? OPEN_ALWAYS : OPEN_EXISTING )),
           /*FILE_FLAG_WRITE_THROUGH*/ 0, NULL );
   //printf("Name=%s %i\n", str_ptr( name ), ret );
   return ret == ( uint )INVALID_HANDLE_VALUE ? 0 : ret ;
#endif

}
예제 #4
0
NetStream::NetStream(
   int                 fd, 
   struct sockaddr_in *client,
   bool                should_block
   ): name_(""), port_(-1), msgSize_(-1), processing_(0)
{
   _fd = fd;
   if (!should_block) set_blocking(false);

   if (client == 0) 
   {
      name_ = str_ptr(fd);
      port_ = 0;
      print_name_ = str_ptr("file descriptor ") + name_;
      // XXX - assumes fd is not a socket and doesn't need no_tcp_delay()
   } 
   else 
   {
      NetHost host(client);
      name_       = host.name();
      port_       = -1;  // host.port();
      print_name_ = str_ptr(get_host_print_name(port_, **name_));

      no_linger(_fd);
      if (_fd != -1) 
      {
         // don't wait for large packets before sending a message
         no_tcp_delay();
      }
   }

   block(STD_FALSE);
}
예제 #5
0
NetHost::NetHost(
   const char *hostname
   )
{
   struct hostent *entry;

   assert(hostname != NULL);

   if (isdigit(hostname[0])) {
      unsigned long netAddr = inet_addr(hostname);
      entry = gethostbyaddr((const char*) &netAddr, sizeof(netAddr), AF_INET);
      if (entry) {
         name_ = str_ptr(entry->h_name);
      } else name_ = hostname;
      addr_ = netAddr;
      port_ = -1;
   } else {
      entry = gethostbyname(hostname);

      if (entry == NULL) {
         cerr << "NetHost: Could not resolve hostname!" << endl;
         exit(1);
      }

      name_ = str_ptr(entry->h_name);
      addr_ = *(unsigned long*)(entry->h_addr_list[0]);
      port_ = -1;
   }

}
예제 #6
0
파일: defines.c 프로젝트: Refandler/gentee
pvoid  STDCALL os_filefullname( pubyte filename, pvoid buf )
{
   pubyte  ptr;

#ifdef LINUX

   char  cur[512];
   if ( filename[0] != '/' )
   {
      getcwd( cur, 512 );
      chdir( filename );
      basename( filename );
      getcwd( str_ptr( ( pstr )buf ), 512 );
      str_setlen( ( pstr )buf, strlen( str_ptr( ( pstr )buf ) ) );
      str_appendb( buf, '/' );
       str_appendp( buf, filename );
      chdir( cur );
   }
   else
   { //Ìîæåò ðàáîòàòü íåêîððåêòíî åñëè â àáñîëþòíîì ïóòè âñòðå÷àþòñÿ '.' '..'
       str_appendp( buf, filename );
   }
#else
   DWORD  temp;
   temp = GetFullPathName( filename, 512, str_ptr( ( pstr )buf ), &ptr );
   // äëÿ Windows
   CharLowerBuff( str_ptr( ( pstr )buf ), temp );
   str_setlen( ( pstr )buf, temp );
#endif
   return buf;
}
예제 #7
0
파일: defines.c 프로젝트: Refandler/gentee
uint     STDCALL os_dirdeletefull( pstr name )
{
 #ifdef WINDOWS
   str  stemp;
   WIN32_FIND_DATA  data;
   pvoid            find;

   str_init( &stemp );
   str_printf( &stemp, "%s%c*.*", str_ptr( name ), SLASH );
   find = FindFirstFile( str_ptr( &stemp ), &data );
   if ( find != INVALID_HANDLE_VALUE )
   {
      do {
         if ( data.cFileName[0] == '.' && ( !data.cFileName[1] ||
            ( data.cFileName[1] == '.' && !data.cFileName[2] )))
            continue;

         str_printf( &stemp, "%s%c%s", str_ptr( name ), SLASH, data.cFileName );

         if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
            os_dirdeletefull( &stemp );
         else
            os_filedelete( &stemp );

      } while ( FindNextFile( find, &data ));

      FindClose( find );
   }
   str_delete( &stemp );
 #endif
   return os_dirdelete( name );
}
예제 #8
0
파일: test.c 프로젝트: Refandler/gentee
int __cdecl main( int argc, char *argv[] )
{
   lex ilex;
   plexitem pil;
   buf in;
   str fn;
   arr out;
   uint i;
   uint fout;

   gentee_init();
   printf("Start\n");
   str_init( &fn );

   str_copyzero( &fn, "gttbl.dat");
   fout = os_fileopen( &fn, FOP_CREATE );
   printf("Fout=%i %s\n", fout, str_ptr( &fn ));
   os_filewrite( fout, ( pubyte )&tbl_gt, 97 * sizeof( uint ));
   os_fileclose( ( pvoid )fout );

   str_copyzero( &fn, "gtdotbl.dat");
   fout = os_fileopen( &fn, FOP_CREATE );
   printf("Fout=%i %s\n", fout, str_ptr( &fn ));
   str_delete( &fn );
   os_filewrite( fout, ( pubyte )&tbl_gtdo, 81 * sizeof( uint ));
   os_fileclose( ( pvoid )fout );

   arr_init( &out, sizeof( lexitem ));
   buf_init( &in );
   buf_copyzero( &in, 
      "</r/&xfa;&#10;&#3;&#1&xfa; #ap/dfield( 'qwer ()ty' , \"my , name\" , qqq)#asdf.fgwsw/# se# &xaa;"
      "<2 qqq> </2><1 a2345=&xf0;> 223&</1><-qwe-rty->"
      "<mygt /asd = \"qwerty sese'\" qq21 = 'dedxd' 'esese;' aqaq=325623/>"
      "<a asdff /a>   <mygtdd><a /><-ooops-><ad />< qq</>"
      "xxx  </r/nm <_aa aqaqa /_aaaa /_a/_aa><a22222/ >"
      "<*abc ></abc><|*aaa = qqqq></aaa>ooops aaa</eee>\"\r\n</>");
//   buf_copyzero( &in, "<mygt > <aaa asdff>qqqq</>      </mygtdd>qq </> xxx  </r/nm <_aa aqaqa /_aaaa /_aa> <a22222/ /> </ >  ");
   printf("lex_init\n");
   lex_init( &ilex, (puint)&tbl_gtdo );
   printf("gentee_lex\n");
   gentee_lex( &in, &ilex, &out );
   if (arr_count(&ilex.state))
      printf("================= State=%x/%i \n", arr_getuint( &ilex.state,
          arr_count(&ilex.state) - 1 ), arr_count(&ilex.state));
   for ( i = 0; i < arr_count( &out ); i++ )
   {
      pil = ( plexitem )arr_ptr( &out, i );
      printf("ID=%x pos=%i len=%i \n", pil->type, pil->pos, pil->len,
             buf_ptr( &in ) + pil->pos );
   }
//   gentee_compile();
   lex_delete( &ilex );
   buf_delete( &in );
   arr_delete( &out );
   gentee_deinit();
   printf("OK\n");
   getch();
   return 0;
}
예제 #9
0
static int sedp_subscription_update (Domain_t *dp, Reader_t *rp)
{
	GUID_t		guid;
	Writer_t	*sw;
	Topic_t		*tp;
	FilteredTopic_t	*ftp;
	HCI		hci;
	InstanceHandle	handle;
	DDS_HANDLE	endpoint;
	FTime_t		time;
	int		error;

	/* Derive key and publication endpoint. */
	guid.prefix = dp->participant.p_guid_prefix;
	guid.entity_id = rp->r_entity_id;

#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
	if (SECURE_DISCOVERY (dp, rp->r_disc_prot))
		sw = (Writer_t *) dp->participant.p_builtin_ep [EPB_SUBSCRIPTION_SEC_W];
	else
#endif
		sw = (Writer_t *) dp->participant.p_builtin_ep [EPB_SUBSCRIPTION_W];
	if (!sw)
		return (DDS_RETCODE_ALREADY_DELETED);

	/* Lookup instance. */
	lock_take (sw->w_lock);
	hci = hc_lookup_key (sw->w_cache, (unsigned char *) &guid,
							sizeof (guid), &handle);
	if (!hci) {
		warn_printf ("sedp_subscription_update: failed to lookup instance handle!");
		lock_release (sw->w_lock);
		return (DDS_RETCODE_ALREADY_DELETED);
	}

	/* Write subscription data. */
	tp = rp->r_topic;
	if ((tp->entity.flags & EF_FILTERED) != 0) {
		ftp = (FilteredTopic_t *) tp;
		tp = ftp->related;
	}
	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Resend %ssubscription (%s/%s)\r\n",
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
				(SECURE_DISCOVERY (dp, rp->r_disc_prot)) ? "secure " : 
#endif
									   "",
				str_ptr (tp->name), 
				str_ptr (tp->type->type_name));
	endpoint = rp->r_handle;
	sys_getftime (&time);
	error = rtps_writer_write (sw, &endpoint, sizeof (endpoint), handle,
							hci, &time, NULL, 0);
	lock_release (sw->w_lock);
	if (error)
		warn_printf ("sedp_subscription_update: write failure!");

	return (DDS_RETCODE_OK);
}
예제 #10
0
파일: defines.c 프로젝트: Refandler/gentee
uint     STDCALL os_dircreate( pstr name )
{
 #ifdef LINUX
   return mkdir(str_ptr( name ),700);
 #else
   return CreateDirectory( str_ptr( name ), NULL );
 #endif
}
예제 #11
0
파일: defines.c 프로젝트: Refandler/gentee
uint     STDCALL os_dirdelete( pstr name )
{
  #ifdef LINUX
   return rmdir(str_ptr( name ));
  #else
   return RemoveDirectory( str_ptr( name ));
  #endif
}
예제 #12
0
파일: defines.c 프로젝트: Refandler/gentee
uint  STDCALL os_dirsetcur( pstr name )
{
   #ifdef LINUX
    return chdir( str_ptr( name));
   #else
    return SetCurrentDirectory( str_ptr( name ));
   #endif
}
예제 #13
0
파일: defines.c 프로젝트: Refandler/gentee
pstr   STDCALL os_dirgetcur( pstr name )
{
   #ifdef LINUX
    return str_setlen( name,getcwd( str_ptr( name), 512 ));
   #else
    return str_setlen( name, GetCurrentDirectory( 512,str_ptr( str_reserve( name, 512 ))));
   #endif
}
예제 #14
0
파일: defines.c 프로젝트: Refandler/gentee
uint     STDCALL os_filedelete( pstr name )
{
    #ifdef LINUX
     return remove(str_ptr(name));
    #else
     return DeleteFile( str_ptr( name ));
    #endif
}
예제 #15
0
int sedp_writer_update (Domain_t             *domain,
			Writer_t             *wp,
			int                  changed,
			DDS_InstanceHandle_t peer)
{
	Endpoint_t	*ep;
	int		ret;
	DDS_QOS_POLICY_ID qid;
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
	Domain_t	*dp;

	dp = wp->w_publisher->domain;
#endif
	if (sedp_log && changed)
		log_printf (SEDP_ID, 0, "SEDP: Writer (%s/%s) updated.\r\n",
				str_ptr (wp->w_topic->name),
				str_ptr (wp->w_topic->type->type_name));

	/* Update publication. */
	if (changed && 
	    (ret = sedp_publication_update (domain, wp)) != DDS_RETCODE_OK)
		return (ret);

	/* Can we match discovered readers with the writer? */
	for (ep = wp->w_topic->readers; ep; ep = ep->next) {
		int old_match;
		int new_match;

		if (peer && ep->u.participant->p_handle != peer)
			continue;

		if (!remote_active (ep->entity.flags))
			continue;

		old_match = rtps_writer_matches (wp, (DiscoveredReader_t *) ep);
		new_match = 0;
		if (!qos_same_partition (wp->w_publisher->qos.partition,
					 ep->qos->qos.partition))
			dcps_offered_incompatible_qos (wp, DDS_PARTITION_QOS_POLICY_ID);
		else if (!qos_match (qos_ptr (wp->w_qos), &wp->w_publisher->qos,
				     qos_ptr (ep->qos), NULL, &qid))
			dcps_offered_incompatible_qos (wp, qid);
		else 
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
		     if (!ACCESS_CONTROL (dp) ||
			 !sec_check_local_writer_match (dp->participant.p_permissions,
			    			        ep->u.participant->p_permissions,
						        wp,
						        ep))
#endif
			new_match = 1;
		if (old_match && !new_match) 
			disc_end_matched_reader (wp, (DiscoveredReader_t *) ep);
		else if (!old_match && new_match)
			disc_new_matched_reader (wp, (DiscoveredReader_t *) ep);
	}
	return (DDS_RETCODE_OK);
}
예제 #16
0
파일: defines.c 프로젝트: Refandler/gentee
uint  STDCALL os_getattrib( pstr name )
{
    #ifdef LINUX
     struct stat statbuf;
     stat(str_ptr(name),&statbuf);
     return statbuf.st_mode;
    #else
         return GetFileAttributes( str_ptr( name ));
    #endif

}
예제 #17
0
static int sedp_publication_update (Domain_t *dp, Writer_t *wp)
{
	GUID_t		guid;
	Writer_t	*pw;
	HCI		hci;
	InstanceHandle	handle;
	DDS_HANDLE	endpoint;
	FTime_t		time;
	int		error;

	/* Derive key and publication endpoint. */
	guid.prefix = dp->participant.p_guid_prefix;
	guid.entity_id = wp->w_entity_id;
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
	if (SECURE_DISCOVERY (dp, wp->w_disc_prot))
		pw = (Writer_t *) dp->participant.p_builtin_ep [EPB_PUBLICATION_SEC_W];
	else
#endif
		pw = (Writer_t *) dp->participant.p_builtin_ep [EPB_PUBLICATION_W];
	if (!pw)
		return (DDS_RETCODE_ALREADY_DELETED);

	/* Lookup instance. */
	lock_take (pw->w_lock);
	hci = hc_lookup_key (pw->w_cache, (unsigned char *) &guid,
							sizeof (guid), &handle);
	if (!hci) {
		warn_printf ("sedp_publication_update: failed to lookup instance handle!");
		lock_release (pw->w_lock);
		return (DDS_RETCODE_ALREADY_DELETED);
	}

	/* Write publication data. */
	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Resend %spublication (%s/%s)\r\n",
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
				(SECURE_DISCOVERY (dp, wp->w_disc_prot)) ? "secure " : 
#endif
									   "",
				str_ptr (wp->w_topic->name), 
				str_ptr (wp->w_topic->type->type_name));
	endpoint = wp->w_handle;
	sys_getftime (&time);
	error = rtps_writer_write (pw, &endpoint, sizeof (endpoint), handle,
							hci, &time, NULL, 0);
	lock_release (pw->w_lock);
	if (error)
		warn_printf ("sedp_publication_update: write failure!");

	return (error);
}
예제 #18
0
void
APPEAR::get_texture(TAGformat &d)
{
   _has_texture = 1;

   str_ptr texture_name;
   *d >> _tex_xform >> texture_name;
   _texture = 0;
   if (texture_name && texture_name != str_ptr("NO_TEXTURE")) {
      // XXX - taken from CLI::get_file_relative
      if ((**texture_name)[0] != '/' && (*texture_name)[0] != '.')
         texture_name = Config::JOT_ROOT() + str_ptr("/") + texture_name;
      _texture = new TEXTUREgl(texture_name);
   }
}
예제 #19
0
파일: file.c 프로젝트: Refandler/gentee
pstr  STDCALL gettempdir( pstr name )
{
   if ( !str_len( &_gentee.tempdir ))
   {
      uint   id = 0;
      str    path;
      pstr   ps;

      ps = &_gentee.tempdir;

      os_tempdir( str_init( &path ));

      while ( 1 )
      {
         str_clear( ps );
         str_printf( ps, (pubyte)("%s%cgentee%02X.tmp"), str_ptr( &path ), SLASH, id );
         _gentee.tempfile = os_fileopen( ps, FOP_CREATE | FOP_EXCLUSIVE );

         if ( !_gentee.tempfile )
         {
            if ( id++ > 0xFFFF )
               msg( MFileopen | MSG_STR | MSG_EXIT, ps );
         }
         else
            break;
      }
      os_dircreate( str_setlen( ps, str_len( ps ) - 4 ));
      str_delete( &path );
   }
   return str_copy( name, &_gentee.tempdir );

   //return str_copy( name, os_gettemp());
}
예제 #20
0
static unsigned partition_set (DDS_StringSeq *ssp,
			       Strings_t     *pp,
			       unsigned char *dst)
{
	String_t	*sp;
	unsigned char	*start = dst;
	unsigned	i, len;

	ssp->_esize = sizeof (char *);
	if (pp) {
		ssp->_maximum = ssp->_length = pp->_length;
		ssp->_buffer = (char **) dst;
		dst += pp->_length * sizeof (char *);
		for (i = 0; i < DDS_SEQ_LENGTH (*pp); i++) {
			sp = DDS_SEQ_ITEM (*pp, i);
			if (sp) {
				len = str_len (sp);
				memcpy (dst, str_ptr (sp), len);
			}
			else {
				len = 1;
				*dst = '\0';
			}
			DDS_SEQ_ITEM_SET (*ssp, i, (char *) dst);
			dst += len;
		}
	}
	else
		ssp->_maximum = ssp->_length = 0;
	return (dst - start);
}
예제 #21
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);
}
예제 #22
0
/**********************************************************************
 * Pen:
 **********************************************************************/
Pen::Pen(Cstr_ptr& pen_name,
         CGEST_INTptr &gest_int,
         CEvent &d, CEvent &m, CEvent &u,
         CEvent &shift_d, CEvent &shift_u,
         CEvent &ctrl_d,  CEvent &ctrl_u) :
   Simple_int(d, m, u),
   _gest_int(gest_int),
   _shift_fsa(0),
   _ctrl_fsa(0),
   _pen_name(pen_name),
   _view(VIEW::peek()),
   _fsa(&_draw_start)
{
   if (!(shift_d == Event())) {
      _shift_fsa = create_fsa(
         shift_d, m, shift_u,
         &Pen::erase_down, &Pen::erase_move, &Pen::erase_up);
   }
   if (!(ctrl_d == Event()))  {
      _ctrl_fsa = create_fsa(ctrl_d, m, ctrl_u,
                             &Pen::ctrl_down, &Pen::ctrl_move,
                             &Pen::ctrl_up);
   }

   _entry.set_name(str_ptr("Pen Entry - ") + pen_name);
}
예제 #23
0
void
APPEAR::put_texture(TAGformat &d) const
{
   if (!_has_texture)
      return;

   d.id() << _tex_xform;

   if (_texture) {
      str_ptr texture_name =_texture->file();
      // If texture name begins with JOT_ROOT, strip it off
      // XXX - does not work if filename is below JOT_ROOT but the path to
      // the file does not start with JOT_ROOT
      if (strstr(**texture_name, **Config::JOT_ROOT()) == **texture_name) {
         cerr << texture_name << endl;
         char *name =  **texture_name + Config::JOT_ROOT().len() + 1;
         // Strip extra slashes ("/")
         while (name && *name == '/' && *name != '\0') name++;
         texture_name = str_ptr(name);
      }
      *d << texture_name;
   } else *d << "NO_TEXTURE";

   d.end_id();
}
예제 #24
0
파일: libcall.c 프로젝트: dzruyk/crypti
int
libcall_print(id_item_t **args, int *rettypes, void **retvals)
{
	id_item_t *current;
	str_t *str;
	struct variable *var;

	assert(args != NULL && args[0] != NULL);

	current = args[0];

	switch (current->type) {
	case ID_VAR:
		var = current->var;
		str = var_cast_to_str(var);

		printf("%s\n", str_ptr(str));
		break;
	case ID_ARR:
		arr_print(current->arr);
		break;
	default:
		error(1, "something wrong\n");
	}

	rettypes[0] = ID_UNKNOWN;
	retvals[0] = NULL;

	return 0;
}
예제 #25
0
int sedp_reader_add (Domain_t *dp, Reader_t *rp)
{
	Endpoint_t	*ep;
	Topic_t		*tp;
	FilteredTopic_t	*ftp;
	int		ret;
	DDS_QOS_POLICY_ID qid;

	tp = rp->r_topic;
	if ((tp->entity.flags & EF_FILTERED) != 0) {
		ftp = (FilteredTopic_t *) tp;
		tp = ftp->related;
	}
	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Reader (%s/%s) added.\r\n",
				str_ptr (tp->name),
				str_ptr (tp->type->type_name));

	/* Add subscription. */
	if ((ret = sedp_subscription_add (dp, rp)) != DDS_RETCODE_OK)
		return (ret);

	/* Can we match/unmatch discovered writers with the reader? */
	for (ep = tp->writers; ep; ep = ep->next) {
		if (!remote_active (ep->entity.flags))
			continue;

		if (!qos_same_partition (rp->r_subscriber->qos.partition,
					 ep->qos->qos.partition))
			dcps_requested_incompatible_qos (rp, DDS_PARTITION_QOS_POLICY_ID);
		else if (!qos_match (qos_ptr (ep->qos), NULL,
				     qos_ptr (rp->r_qos), &rp->r_subscriber->qos,
				     &qid))
			dcps_requested_incompatible_qos (rp, qid);
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
		else if (ACCESS_CONTROL (dp) &&
			 sec_check_local_reader_match (dp->participant.p_permissions,
			    			       ep->u.participant->p_permissions,
						       rp,
						       ep))
			continue;
#endif
		else
			disc_new_matched_writer (rp, (DiscoveredWriter_t *) ep);
	}
	return (DDS_RETCODE_OK);
}
예제 #26
0
int sedp_writer_remove (Domain_t *dp, Writer_t *wp)
{
	Endpoint_t	*ep;

	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Writer (%s/%s) removed.\r\n",
				str_ptr (wp->w_topic->name),
				str_ptr (wp->w_topic->type->type_name));

	/* Remove publication. */
	sedp_publication_remove (dp, wp);

	/* Do we have to unmatch discovered readers from the writer? */
	for (ep = wp->w_topic->readers; ep; ep = ep->next)
		if (remote_active (ep->entity.flags) &&
		    rtps_writer_matches (wp, (DiscoveredReader_t *) ep))
			disc_end_matched_reader (wp, (DiscoveredReader_t *) ep);

	return (DDS_RETCODE_OK);
}
예제 #27
0
파일: file.c 프로젝트: Refandler/gentee
pstr  STDCALL getmodulename( pstr name )
{
 #ifdef WINDOWS
   uint  i;

   str_reserve( name, 512 );
   i = GetModuleFileName( 0, str_ptr( name ), 511 );
   str_setlen( name, i );
#endif
   return name;
}
예제 #28
0
int sedp_writer_add (Domain_t *dp, Writer_t *wp)
{
	Endpoint_t	*ep;
	int		ret;
	DDS_QOS_POLICY_ID qid;

	if (sedp_log)
		log_printf (SEDP_ID, 0, "SEDP: Writer (%s/%s) added.\r\n",
				str_ptr (wp->w_topic->name),
				str_ptr (wp->w_topic->type->type_name));

	/* Add publication. */
	if ((ret = sedp_publication_add (dp, wp)) != DDS_RETCODE_OK)
		return (ret);

	/* Can we match discovered readers with the writer? */
	for (ep = wp->w_topic->readers; ep; ep = ep->next) {
		if (!remote_active (ep->entity.flags))
			continue;

		if (!qos_same_partition (wp->w_publisher->qos.partition,
					 ep->qos->qos.partition))
			dcps_offered_incompatible_qos (wp, DDS_PARTITION_QOS_POLICY_ID);
		else if (!qos_match (qos_ptr (wp->w_qos), &wp->w_publisher->qos,
	    				      qos_ptr (ep->qos), NULL, &qid))
			dcps_offered_incompatible_qos (wp, qid);
#if defined (DDS_SECURITY) && defined (DDS_NATIVE_SECURITY)
		else if (ACCESS_CONTROL (dp) &&
			 sec_check_local_writer_match (dp->participant.p_permissions,
			    			       ep->u.participant->p_permissions,
						       wp,
						       ep))
			continue;
#endif
		else
			disc_new_matched_reader (wp, (DiscoveredReader_t *) ep);
	}
	return (DDS_RETCODE_OK);
}
예제 #29
0
파일: str.c 프로젝트: Refandler/gentee
uint STDCALL str_getdirfile( pstr src, pstr dir, pstr name )
{
   uint   separ = str_find( src, 0, SLASH, 1 );
   uint   off;

   off = separ >= str_len( src ) ? 0 : separ + 1;
   
   if ( name )
      str_copyzero( name, str_ptr( src ) + off );
   if ( dir )
      str_substr( dir, src, 0, separ < str_len( src ) ? separ : 0 );
   return 1;
}
예제 #30
0
/*****************************************************************
 * XformPen
 *****************************************************************/
XformPen::XformPen(
   CGEST_INTptr &gest_int,
   CEvent &d,
   CEvent &m,
   CEvent &u) :
   Pen(str_ptr("xform"), gest_int, d, m, u)
{
   // Set up GESTURE FSA (First matched will be executed)

   _draw_start += DrawArc(new GarbageGuard,  drawCB(&XformPen::garbage_cb));
   _draw_start += DrawArc(new DoubleTapGuard,drawCB(&XformPen::double_tap_cb));
   _draw_start += DrawArc(new       TapGuard,drawCB(&XformPen::       tap_cb));
   _draw_start += DrawArc(new StrokeGuard,   drawCB(&XformPen::stroke_cb));
}