-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
assert(name);
AVAHI_WARN_LINKAGE;
-
+
if (!(he = gethostbyname(name)))
return SW_E_UNKNOWN;
-
+
self->m_addr = *(uint32_t*) he->h_addr;
return SW_OKAY;
}
assert(self);
AVAHI_WARN_LINKAGE;
-
+
/* This is so fucked up ... */
memset(&sa, 0, sizeof(sa));
close(fd);
self->m_addr = sa.sin_addr.s_addr;
-
+
return SW_OKAY;
}
AVAHI_WARN_LINKAGE;
/* This is ridiculous ... */
-
+
return SW_OKAY;
}
if (len < INET_ADDRSTRLEN)
return NULL;
-
+
if (!(inet_ntop(AF_INET, &self.m_addr, name, len)))
return NULL;
-
+
return name;
}
uint32_t a;
AVAHI_WARN_LINKAGE;
-
+
a = ntohl(self.m_addr);
-
+
assert(a1);
assert(a2);
assert(a3);
*a2 = (uint8_t) (a >> 16);
*a3 = (uint8_t) (a >> 8);
*a4 = (uint8_t) (a);
-
+
return SW_OKAY;
}