Changeset ba88ae7 for message.c


Ignore:
Timestamp:
Oct 19, 2009, 10:40:02 PM (15 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
68f358c
Parents:
26255f0
git-author:
Alejandro R. Sedeño <asedeno@mit.edu> (10/13/09 21:37:51)
git-committer:
Alejandro R. Sedeño <asedeno@mit.edu> (10/19/09 22:40:02)
Message:
Prepare for libzephyr4's sockaddr support.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    rc79a047 rba88ae7  
    736736void owl_message_create_from_znotice(owl_message *m, const ZNotice_t *n)
    737737{
     738#ifdef ZNOTICE_SOCKADDR
     739  char hbuf[NI_MAXHOST];
     740#else /* !ZNOTICE_SOCKADDR */
    738741  struct hostent *hent;
     742#endif /* ZNOTICE_SOCKADDR */
    739743  const char *ptr;
    740744  char *tmp, *tmp2;
     
    810814
    811815  /* save the hostname */
     816#ifdef ZNOTICE_SOCKADDR
     817  owl_function_debugmsg("About to do getnameinfo");
     818  if (getnameinfo(&n->z_sender_sockaddr.sa, sizeof(n->z_sender_sockaddr), hbuf, sizeof(hbuf), NULL, 0, 0) == 0)
     819    owl_message_set_hostname(m, hbuf);
     820#else /* !ZNOTICE_SOCKADDR */
    812821  owl_function_debugmsg("About to do gethostbyaddr");
    813   hent=gethostbyaddr(&(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET);
    814   if (hent && hent->h_name) {
     822  hent = gethostbyaddr(&n->z_uid.zuid_addr, sizeof(n->z_uid.zuid_addr), AF_INET);
     823  if (hent && hent->h_name)
    815824    owl_message_set_hostname(m, hent->h_name);
    816   } else {
     825  else
    817826    owl_message_set_hostname(m, inet_ntoa(n->z_sender_addr));
    818   }
     827#endif /* ZNOTICE_SOCKADDR */
    819828
    820829  /* set the body */
Note: See TracChangeset for help on using the changeset viewer.