kernels/linux-2.4.0/net/irda/irnet/irnet_irda.c
/*------------------------------------------------------------------*/
/*
 * Function irnet_daddr_to_dname (self)
 *
 *    Convert an IrDA address to a IrDA nickname
 *
 * It basically look into the discovery log until there is a match.
 */
Function irnet_daddr_to_dname (self)
Convert an IrDA address to a IrDA nickname

It basically look into the discovery log until there is a match.
Function irnet_daddr_to_dname ( self ) Convert an IrDA address to a IrDA nickname It basically look into the discovery log until there is a match .
static inline int
irnet_daddr_to_dname(irnet_socket *	self)
{
  struct irda_device_info *discoveries;	
  int	number;			
  int	i;
  DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self);
  discoveries = irlmp_get_discoveries(&number, 0xffff);
  if (discoveries == NULL)
    DRETURN(-ENETUNREACH, IRDA_SERV_INFO, "Cachelog empty...\n");
  for(i = 0; i < number; i++)
    {
      if(discoveries[i].daddr == self->daddr)
	{
	  strncpy(self->rname, discoveries[i].info, NICKNAME_MAX_LEN);
	  self->rname[NICKNAME_MAX_LEN + 1] = '\0';
	  DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
		self->daddr, self->rname);
	  kfree(discoveries);
	  DEXIT(IRDA_SERV_TRACE, "\n");
	  return 0;
	}
    }
  DEXIT(IRDA_SERV_INFO, ": cannot discover device 0x%08x !!!\n", self->daddr);
  kfree(discoveries);
  return(-EADDRNOTAVAIL);
}
static inline int irnet_daddr_to_dname ( irnet_socket * self ) { struct irda_device_info * discoveries ; int number ; int i ; DENTER ( IRDA_SERV_TRACE , " \n " , ( unsigned int ) self ) ; discoveries = irlmp_get_discoveries ( & number , 0xffff ) ; if ( discoveries == NULL ) DRETURN ( - ENETUNREACH , IRDA_SERV_INFO , " \n " ) ; for ( i = 0 ; i < number ; i ++ ) { if ( discoveries [ i ] . daddr == self -> daddr ) { strncpy ( self -> rname , discoveries [ i ] . info , NICKNAME_MAX_LEN ) ; self -> rname [ NICKNAME_MAX_LEN + 1 ] = ' \0 ' ; DEBUG ( IRDA_SERV_INFO , " \n " , self -> daddr , self -> rname ) ; kfree ( discoveries ) ; DEXIT ( IRDA_SERV_TRACE , " \n " ) ; return 0 ; } } DEXIT ( IRDA_SERV_INFO , " \n " , self -> daddr ) ; kfree ( discoveries ) ; return ( - EADDRNOTAVAIL ) ; }
Function irnet_daddr_to_dname (self)
    Convert an IrDA address to a IrDA nickname
Function irnet_daddr_to_dname ( self ) Convert an IrDA address to a IrDA nickname
/* Copy of the discovery log */ /* Number of nodes in the log */ /* Ask lmp for the current discovery log */ /* Check if the we got some results */ /* Now, check all discovered devices (if any) */ /* Does the name match ? */ /* Yes !!! Get it.. */ /* No luck ! */