/* This file is part of Lcrzo.
*/

/*-------------------------------------------------------------*/
int lcrzo_priv_ipa_init_etha_etcethers(const lcrzo_etha etha, lcrzo_ipa ipa)
#if LCRZODEF_HAVEFONC_ETHER_NTOHOST==1
{ struct ether_addr ea;
  int retour;
  lcrzo_ips ips;
  lcrzo_ipl ipl;

#ifdef LCRZODEF_SYSTEM_FreeBSD
  memcpy(ea.octet, etha, LCRZO_ETHA_MAXBYTES);
#elif defined LCRZODEF_SYSTEM_Linux || defined LCRZODEF_SYSTEM_OpenBSD || defined LCRZODEF_SYSTEM_Solaris
  memcpy(ea.ether_addr_octet, etha, LCRZO_ETHA_MAXBYTES);
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif
  retour=ether_ntohost(ips, &ea);
  if ( ! retour )
  { lcrzo_er(lcrzo_ipl_init_ips(ips, &ipl));
    lcrzo_er(lcrzo_priv_conf_arp_add_system("", etha, ipl, LCRZO_FALSE));
    return(lcrzo_ipa_init_ips(ips, ipa));
  }
  /*sinon l'adresse n'a pas ete resolue*/
  lcrzo_err_purge();
  return(LCRZO_ERR_OKUNRESOLVED);
}
#else
{ return(LCRZO_ERR_OKUNRESOLVED);
  { int i; 
    /* just for the compiler warning */
    if (ipa==NULL && etha==NULL) i=0;
  }
}
#endif

