--- a/libpurple/protocols/zephyr/ZCkIfNot.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/ZCkIfNot.c Fri Dec 11 04:12:45 2020 -0600
@@ -11,7 +11,7 @@
-ZCheckIfNotice(ZNotice_t *notice, struct sockaddr_in *from,
+ZCheckIfNotice(ZNotice_t *notice, GSocketAddress **from, register int (*predicate)(ZNotice_t *, void *), void *args)
@@ -32,8 +32,9 @@
if (!(buffer = (char *) malloc((unsigned) qptr->packet_len)))
(void) memcpy(buffer, qptr->packet, qptr->packet_len);
+ *from = g_object_ref(qptr->from); if ((retval = ZParseNotice(buffer, qptr->packet_len,
--- a/libpurple/protocols/zephyr/ZIfNotice.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/ZIfNotice.c Fri Dec 11 04:12:45 2020 -0600
@@ -11,7 +11,7 @@
-ZIfNotice(ZNotice_t *notice, struct sockaddr_in *from,
+ZIfNotice(ZNotice_t *notice, GSocketAddress **from, int (*predicate)(ZNotice_t *, void *), void *args)
@@ -33,8 +33,9 @@
if (!(buffer = (char *) malloc((unsigned) qptr->packet_len)))
(void) memcpy(buffer, qptr->packet, qptr->packet_len);
+ *from = g_object_ref(qptr->from); if ((retval = ZParseNotice(buffer, qptr->packet_len,
--- a/libpurple/protocols/zephyr/ZInit.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/ZInit.c Fri Dec 11 04:12:45 2020 -0600
@@ -32,35 +32,26 @@
- struct servent *hmserv;
- struct hostent *hostent;
- char addr[4], hostname[MAXHOSTNAMELEN];
- struct in_addr servaddr;
- struct sockaddr_in sin;
- socklen_t sinsize = sizeof(sin);
+ struct servent *hmserv; + GResolver *resolver = NULL; #ifdef ZEPHYR_USES_KERBEROS
- char d1[ANAME_SZ], d2[INST_SZ];
+ gchar d1[ANAME_SZ], d2[INST_SZ]; - (void) memset((char *)&__HM_addr, 0, sizeof(__HM_addr));
- __HM_addr.sin_family = AF_INET;
+ g_clear_object(&__HM_addr); - /* Set up local loopback address for HostManager */
+ hmserv = (struct servent *)getservbyname(HM_SVCNAME, "udp"); + port = hmserv ? hmserv->s_port : HM_SVC_FALLBACK; - hmserv = (struct servent *)getservbyname(HM_SVCNAME, "udp");
- __HM_addr.sin_port = (hmserv) ? hmserv->s_port : HM_SVC_FALLBACK;
- (void) memcpy((char *)&__HM_addr.sin_addr, addr, 4);
+ /* Set up local loopback address for HostManager */ + __HM_addr = g_inet_socket_address_new_from_string("127.0.0.1", port); /* Initialize the input queue */
g_queue_init(&Z_input_queue);
@@ -69,12 +60,12 @@
* not be "right", but this is is ok, since none of the servers call
- servaddr.s_addr = INADDR_NONE;
+ servaddr = INADDR_NONE; if ((code = ZOpenPort(NULL)) != ZERR_NONE) {
- if ((code = ZhmStat(NULL, ¬ice)) != ZERR_NONE) {
+ if ((code = ZhmStat(¬ice)) != ZERR_NONE) { @@ -87,63 +78,103 @@
#ifdef ZEPHYR_USES_KERBEROS
krealm = krb_realmofhost(notice.z_message);
- hostent = gethostbyname(notice.z_message);
- if (hostent && hostent->h_addrtype == AF_INET) {
- memcpy(&servaddr, hostent->h_addr, sizeof(servaddr));
+ resolver = g_resolver_get_default(); + hosts = g_resolver_lookup_by_name(resolver, notice.z_message, NULL, NULL); + GInetAddress *host_addr = hosts->data; + if (g_inet_address_get_family(host_addr) == G_SOCKET_FAMILY_IPV4) { + memcpy(&servaddr, g_inet_address_to_bytes(host_addr), + g_list_free_full(hosts, g_object_unref); + g_object_unref(host_addr); + hosts = g_list_delete_link(hosts, hosts); #ifdef ZEPHYR_USES_KERBEROS
- g_strlcpy(__Zephyr_realm, krealm, REALM_SZ);
- } else if ((krb_get_tf_fullname(TKT_FILE, d1, d2, __Zephyr_realm)
- ((krbval = krb_get_lrealm(__Zephyr_realm, 1)) != KSUCCESS)) {
+ g_strlcpy(__Zephyr_realm, krealm, REALM_SZ); + } else if ((krb_get_tf_fullname(TKT_FILE, d1, d2, __Zephyr_realm) != + ((krbval = krb_get_lrealm(__Zephyr_realm, 1)) != KSUCCESS)) { + g_object_unref(resolver); - g_strlcpy(__Zephyr_realm, "local-realm", REALM_SZ);
+ g_strlcpy(__Zephyr_realm, "local-realm", REALM_SZ); - __My_addr.s_addr = INADDR_NONE;
- if (servaddr.s_addr != INADDR_NONE) {
- /* Try to get the local interface address by connecting a UDP
- * socket to the server address and getting the local address.
- * Some broken operating systems (e.g. Solaris 2.0-2.5) yield
- * INADDR_ANY (zero), so we have to check for that. */
- s = socket(AF_INET, SOCK_DGRAM, 0);
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- memcpy(&sin.sin_addr, &servaddr, sizeof(servaddr));
- sin.sin_port = HM_SRV_SVC_FALLBACK;
- if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == 0
- && getsockname(s, (struct sockaddr *) &sin, &sinsize) == 0
- && sin.sin_addr.s_addr != 0)
- memcpy(&__My_addr, &sin.sin_addr, sizeof(__My_addr));
+ __My_addr = INADDR_NONE; + if (servaddr != INADDR_NONE) { + /* Try to get the local interface address by connecting a UDP + * socket to the server address and getting the local address. + * Some broken operating systems (e.g. Solaris 2.0-2.5) yield + * INADDR_ANY (zero), so we have to check for that. */ + GSocket *s = g_socket_new(G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM, + G_SOCKET_PROTOCOL_DEFAULT, NULL); + GSocketAddress *remote_addr = NULL; + GInetAddress *inet_addr = NULL; + inet_addr = g_inet_address_new_from_bytes((const guint8 *)&servaddr, + g_inet_socket_address_new(inet_addr, HM_SRV_SVC_FALLBACK); + g_object_unref(inet_addr); + if (g_socket_connect(s, remote_addr, NULL, NULL)) { + GSocketAddress *local_addr = + g_socket_get_local_address(s, NULL); + inet_addr = g_inet_socket_address_get_address( + G_INET_SOCKET_ADDRESS(local_addr)); + memcpy(&__My_addr, g_inet_address_to_bytes(inet_addr), + g_object_unref(inet_addr); + g_object_unref(local_addr); + g_object_unref(remote_addr);
- if (__My_addr.s_addr == INADDR_NONE) {
- /* We couldn't figure out the local interface address by the
- * above method. Try by resolving the local hostname. (This
- * is a pretty broken thing to do, and unfortunately what we
- * always do on server machines.) */
- if (gethostname(hostname, sizeof(hostname)) == 0) {
- hostent = gethostbyname(hostname);
- if (hostent && hostent->h_addrtype == AF_INET)
- memcpy(&__My_addr, hostent->h_addr, sizeof(__My_addr));
+ if (__My_addr == INADDR_NONE) { + /* We couldn't figure out the local interface address by the + * above method. Try by resolving the local hostname. (This + * is a pretty broken thing to do, and unfortunately what we + * always do on server machines.) */ + const gchar *hostname = g_get_host_name(); + hosts = g_resolver_lookup_by_name(resolver, hostname, NULL, NULL); + GInetAddress *host_addr = hosts->data; + if (g_inet_address_get_family(host_addr) == G_SOCKET_FAMILY_IPV4) { + memcpy(&servaddr, g_inet_address_to_bytes(host_addr), + g_list_free_full(hosts, g_object_unref); + g_object_unref(host_addr); + hosts = g_list_delete_link(hosts, hosts);
- /* If the above methods failed, zero out __My_addr so things will
- * sort of kind of work. */
- if (__My_addr.s_addr == INADDR_NONE)
+ /* If the above methods failed, zero out __My_addr so things will sort + if (__My_addr == INADDR_NONE) { - /* Get the sender so we can cache it */
+ g_object_unref(resolver);
+ /* Get the sender so we can cache it */ --- a/libpurple/protocols/zephyr/ZWait4Not.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/ZWait4Not.c Fri Dec 11 04:12:45 2020 -0600
@@ -19,40 +19,44 @@
Z_WaitForNotice(ZNotice_t *notice, int (*pred)(ZNotice_t *, void *), void *arg,
+ gint64 t0, tdiff, timeout_us; - retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred,
- if (retval == ZERR_NONE)
- if (retval != ZERR_NONOTICE)
+ retval = ZCheckIfNotice(notice, NULL, pred, (char *)arg); + if (retval == ZERR_NONE) { + if (retval != ZERR_NONOTICE) {
- t0 = g_get_monotonic_time() + timeout * G_USEC_PER_SEC;
- i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv);
- if (i < 0 && errno != EINTR)
- retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred,
- if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */
+ timeout_us = timeout * G_USEC_PER_SEC; + t0 = g_get_monotonic_time() + timeout_us; + if (!g_socket_condition_timed_wait(ZGetSocket(), G_IO_IN, timeout_us, + gint ret = ZERR_INTERNAL; + if (error->code == G_IO_ERROR_TIMED_OUT) { + retval = ZCheckIfNotice(notice, NULL, pred, (char *)arg); + if (retval != ZERR_NONOTICE) { + /* includes ZERR_NONE */ tdiff = t0 - g_get_monotonic_time();
- tv.tv_sec = tdiff / G_USEC_PER_SEC;
- tv.tv_usec = tdiff - tv.tv_sec * G_USEC_PER_SEC;
+ /* g_socket_condition_timed_wait requires timeout to be an integral + * number of milliseconds. */ + timeout_us = (tdiff / 1000 + 1) * 1000; --- a/libpurple/protocols/zephyr/Zinternal.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/Zinternal.c Fri Dec 11 04:12:45 2020 -0600
@@ -9,6 +9,8 @@
@@ -17,14 +19,13 @@
-struct in_addr __My_addr;
+GSocket *__Zephyr_socket = NULL; +gint __Zephyr_port = -1; GQueue Z_input_queue = G_QUEUE_INIT;
-struct sockaddr_in __HM_addr;
-struct sockaddr_in __HM_addr_real;
+GSocketAddress *__HM_addr; ZLocations_t *__locate_list;
@@ -112,21 +113,6 @@
-/* Return 1 if there is a packet waiting, 0 otherwise */
-static int Z_PacketWaiting(void)
- tv.tv_sec = tv.tv_usec = 0;
- FD_SET(ZGetFD(), &read);
- return (select(ZGetFD() + 1, &read, NULL, NULL, &tv));
/* Wait for a complete notice to become available */
Code_t Z_WaitForComplete(void)
@@ -149,16 +135,18 @@
+ if (ZGetSocket() == NULL) { - while (Z_PacketWaiting())
- if ((retval = Z_ReadWait()) != ZERR_NONE)
+ while (g_socket_condition_check(ZGetSocket(), G_IO_IN)) { + Code_t retval = Z_ReadWait(); + if (retval != ZERR_NONE) {
@@ -208,49 +196,52 @@
- struct sockaddr_in olddest, from;
+ GSocketAddress *from = NULL; int packet_len, zvlen, part, partof;
+ if (ZGetSocket() == NULL) {
- FD_SET(ZGetFD(), &fds);
- if (select(ZGetFD() + 1, &fds, NULL, NULL, &tv) < 0)
- if (!FD_ISSET(ZGetFD(), &fds))
- from_len = sizeof(struct sockaddr_in);
+ if (!g_socket_condition_timed_wait(ZGetSocket(), G_IO_IN, + 60 * G_USEC_PER_SEC, NULL, &error)) { + gint ret = ZERR_INTERNAL; + if (error->code == G_IO_ERROR_TIMED_OUT) { - packet_len = recvfrom(ZGetFD(), packet, sizeof(packet) - 1, 0,
- (struct sockaddr *)&from, &from_len);
+ packet_len = g_socket_receive_from(ZGetSocket(), &from, packet, + sizeof(packet) - 1, NULL, &error); + purple_debug_error("zephyr", "Unable to receive from socket: %s", - packet[packet_len] = '\0';
+ packet[packet_len] = '\0'; - /* Ignore obviously non-Zephyr packets. */
- zvlen = sizeof(ZVERSIONHDR) - 1;
- if (packet_len < zvlen || memcmp(packet, ZVERSIONHDR, zvlen) != 0) {
+ /* Ignore obviously non-Zephyr packets. */ + zvlen = sizeof(ZVERSIONHDR) - 1; + if (packet_len < zvlen || memcmp(packet, ZVERSIONHDR, zvlen) != 0) { if ((retval = ZParseNotice(packet, packet_len, ¬ice)) != ZERR_NONE) {
@@ -258,6 +249,7 @@
* whoever sent it to say we got it. */
if (notice.z_kind != HMACK && notice.z_kind != SERVACK &&
notice.z_kind != SERVNAK && notice.z_kind != CLIENTACK) {
+ GSocketAddress *olddest = NULL; @@ -268,19 +260,24 @@
if ((retval = ZFormatSmallRawNotice(&tmpnotice, pkt, &len)) != ZERR_NONE) {
if ((retval = ZSendPacket(pkt, len, 0)) != ZERR_NONE) {
if (find_or_insert_uid(¬ice.z_uid, notice.z_kind)) {
/* Check authentication on the notice. */
- notice.z_checked_auth = ZCheckAuthentication(¬ice, &from);
+ notice.z_checked_auth = ZCheckAuthentication(¬ice); * Parse apart the z_multinotice field - if the field is blank for
@@ -300,9 +297,11 @@
partof = notice.z_message_len;
- /* Too big a packet...just ignore it! */
- if (partof > Z_MAXNOTICESIZE)
+ /* Too big a packet...just ignore it! */ + if (partof > Z_MAXNOTICESIZE) { /* If we can find a notice in the queue with the same multiuid field,
* insert the current fragment as appropriate. */
@@ -319,8 +318,9 @@
regarding failure/success)
if (!ZCompareUID(¬ice.z_multiuid, ¬ice.z_uid)) {
- /* they're not the same... throw away this packet. */
+ /* they're not the same... throw away this packet. */ /* fall thru & process it */
@@ -334,6 +334,7 @@
qptr->header_len = packet_len - notice.z_message_len;
qptr->header = g_memdup(packet, qptr->header_len);
return Z_AddNoticeToEntry(qptr, ¬ice, part);
@@ -341,6 +342,7 @@
/* We'll have to create a new entry...make sure the queue isn't going
if (__Q_Size + partof > Z_MAXQUEUESIZE) {
@@ -351,11 +353,11 @@
/* Insert the entry at the end of the queue */
g_queue_push_tail(&Z_input_queue, qptr);
- /* Copy the from field, multiuid, kind, and checked authentication. */
- qptr->uid = notice.z_multiuid;
- qptr->kind = notice.z_kind;
- qptr->auth = notice.z_checked_auth;
+ /* Copy the from field, multiuid, kind, and checked authentication. */ + qptr->uid = notice.z_multiuid; + qptr->kind = notice.z_kind; + qptr->auth = notice.z_checked_auth; /* If this is the first part of the notice, we take the header from it.
* We only take it if this is the first fragment so that the Unique
@@ -501,28 +503,38 @@
Z_FormatHeader(ZNotice_t *notice, char *buffer, int buffer_len, int *len,
- static char version[BUFSIZ]; /* default init should be all \0 */
+ static char version[BUFSIZ]; /* default init should be all \0 */ - struct sockaddr_in name;
- socklen_t namelen = sizeof(name);
- notice->z_sender = ZGetSender();
+ if (!notice->z_sender) { + notice->z_sender = ZGetSender(); + if (notice->z_port == 0) { + GSocketAddress *addr = NULL; - if (notice->z_port == 0) {
- retval = ZOpenPort((unsigned short *)0);
- if (retval != ZERR_NONE)
+ if (ZGetSocket() == NULL) { + Code_t retval = ZOpenPort(NULL); + if (retval != ZERR_NONE) { + addr = g_socket_get_local_address(ZGetSocket(), &error); + purple_debug_error("zephyr", + "Unable to determine socket local address: %s", + g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(addr)); - retval = getsockname(ZGetFD(), (struct sockaddr *) &name, &namelen);
- notice->z_port = name.sin_port;
- notice->z_multinotice = "";
+ notice->z_multinotice = ""; realtime = g_get_real_time();
notice->z_uid.tv.tv_sec = realtime / G_USEC_PER_SEC;
@@ -533,14 +545,14 @@
memcpy(¬ice->z_uid.zuid_addr, &__My_addr, sizeof(__My_addr));
- notice->z_multiuid = notice->z_uid;
+ notice->z_multiuid = notice->z_uid;
- (void) sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR,
- notice->z_version = version;
+ sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR, ZVERSIONMINOR); + notice->z_version = version; - return Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine);
+ return Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine); @@ -728,6 +740,8 @@
+ g_clear_object(&qptr->from); g_slist_free_full(qptr->holelist, g_free);
g_queue_remove(&Z_input_queue, qptr);
@@ -765,8 +779,7 @@
htonl((unsigned long)partnotice.z_uid.tv.tv_sec);
partnotice.z_uid.tv.tv_usec =
htonl((unsigned long)partnotice.z_uid.tv.tv_usec);
- (void) memcpy((char *)&partnotice.z_uid.zuid_addr, &__My_addr,
+ memcpy(&partnotice.z_uid.zuid_addr, &__My_addr, sizeof(__My_addr)); message_len = MIN(notice->z_message_len - offset, fragsize);
partnotice.z_message = (char*)notice->z_message+offset;
--- a/libpurple/protocols/zephyr/zephyr.c Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/zephyr.c Fri Dec 11 04:12:45 2020 -0600
@@ -790,7 +790,8 @@
/* Called when the server notifies us a message couldn't get sent */
-static void message_failed(PurpleConnection *gc, ZNotice_t *notice, struct sockaddr_in from)
+message_failed(PurpleConnection *gc, ZNotice_t *notice) if (g_ascii_strcasecmp(notice->z_class, "message")) {
gchar* chat_failed = g_strdup_printf(
@@ -948,17 +949,18 @@
gcc = purple_conversations_find_chat_with_account(
zt2->name, purple_connection_get_account(gc));
-#define INET_ADDRSTRLEN 16
if (!purple_chat_conversation_has_user(gcc, stripped_sender)) {
- gchar ipaddr[INET_ADDRSTRLEN];
- inet_ntop(AF_INET, ¬ice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr));
- memcpy(ipaddr,inet_ntoa(notice.z_sender_addr),sizeof(ipaddr));
- purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, PURPLE_CHAT_USER_NONE, TRUE);
+ GInetAddress *inet_addr = NULL; + inet_addr = g_inet_address_new_from_bytes( + (const guint8 *)¬ice.z_sender_addr, + ipaddr = g_inet_address_to_string(inet_addr); + purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, + PURPLE_CHAT_USER_NONE, TRUE); + g_object_unref(inet_addr); purple_serv_got_chat_in(gc, zt2->id, send_inst_utf8,
PURPLE_MESSAGE_RECV, buf3, time(NULL));
@@ -1279,10 +1281,9 @@
PurpleConnection *gc = (PurpleConnection*) data;
- struct sockaddr_in from;
/* XXX add real error reporting */
- z_call_r(ZReceiveNotice(¬ice, &from));
+ z_call_r(ZReceiveNotice(¬ice, NULL)); @@ -1292,7 +1293,7 @@
if (!(g_ascii_strcasecmp(notice.z_message, ZSRVACK_NOTSENT))) {
- message_failed(gc, ¬ice, from);
+ message_failed(gc, ¬ice); --- a/libpurple/protocols/zephyr/zephyr_internal.h Fri Dec 11 01:48:49 2020 -0600
+++ b/libpurple/protocols/zephyr/zephyr_internal.h Fri Dec 11 04:12:45 2020 -0600
@@ -16,6 +16,7 @@
@@ -61,9 +62,9 @@
-#define SERVER_SVC_FALLBACK htons((unsigned short) 2103)
-#define HM_SVC_FALLBACK htons((unsigned short) 2104)
-#define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105)
+#define SERVER_SVC_FALLBACK (2103) +#define HM_SVC_FALLBACK (2104) +#define HM_SRV_SVC_FALLBACK (2105) #define ZAUTH_UNSET (-3) /* Internal to client library. */
#define Z_MAXFRAGS 500 /* Max number of packet fragments */
@@ -82,7 +83,7 @@
- struct in_addr zuid_addr;
@@ -151,7 +152,7 @@
- struct sockaddr_in from;
GSList *holelist; /* element-type: Z_Hole* */
@@ -173,7 +174,7 @@
Code_t ZSetVariable(char *var, char *value);
Code_t ZUnsetVariable(char *var);
-Code_t ZSetDestAddr(struct sockaddr_in *);
+Code_t ZSetDestAddr(GSocketAddress *); Code_t ZFormatNoticeList(ZNotice_t *, char **, int, char **, int *, Z_AuthProc);
Code_t ZParseNotice(char *, int, ZNotice_t *);
Code_t ZReadAscii(char *, int, unsigned char *, int);
@@ -191,15 +192,15 @@
Code_t ZLocateUser(char *, int *, Z_AuthProc);
Code_t ZRequestLocations(const char *, ZAsyncLocateData_t *, ZNotice_Kind_t,
-Code_t ZhmStat(struct in_addr *, ZNotice_t *);
+Code_t ZhmStat(ZNotice_t *); Code_t ZInitialize(void);
Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *);
int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *);
Code_t ZMakeAscii(char *, int, unsigned char *, int);
Code_t ZMakeAscii32(char *, int, unsigned long);
Code_t ZMakeAscii16(char *, int, unsigned int);
-Code_t ZReceivePacket(ZPacket_t, int *, struct sockaddr_in *);
-Code_t ZCheckAuthentication(ZNotice_t *, struct sockaddr_in *);
+Code_t ZReceivePacket(ZPacket_t, int *, GSocketAddress **); +Code_t ZCheckAuthentication(ZNotice_t *); Code_t ZSetLocation(char *exposure);
Code_t ZUnsetLocation(void);
Code_t ZFlushMyLocations(void);
@@ -215,12 +216,12 @@
int ZCompareALDPred(ZNotice_t *notice, void *zald);
void ZFreeALD(register ZAsyncLocateData_t *zald);
-Code_t ZCheckIfNotice(ZNotice_t *notice, struct sockaddr_in *from,
+Code_t ZCheckIfNotice(ZNotice_t *notice, GSocketAddress **from, register int (*predicate)(ZNotice_t *, void *),
-Code_t ZPeekPacket(char **buffer, int *ret_len, struct sockaddr_in *from);
-Code_t ZPeekNotice(ZNotice_t *notice, struct sockaddr_in *from);
-Code_t ZIfNotice(ZNotice_t *notice, struct sockaddr_in *from,
+Code_t ZPeekPacket(char **buffer, int *ret_len, GSocketAddress **from); +Code_t ZPeekNotice(ZNotice_t *notice, GSocketAddress **from); +Code_t ZIfNotice(ZNotice_t *notice, GSocketAddress **from, int (*predicate)(ZNotice_t *, void *), void *args);
Code_t ZSubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port);
Code_t ZSubscribeToSansDefaults(ZSubscription_t *sublist, int nitems,
@@ -228,7 +229,7 @@
Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port);
Code_t ZCancelSubscriptions(unsigned int port);
-Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from);
+Code_t ZReceiveNotice(ZNotice_t *notice, GSocketAddress **from); typedef Code_t (*Z_SendProc)(ZNotice_t *, char *, int, int);
@@ -259,15 +260,15 @@
extern int __subscriptions_num;
extern int __subscriptions_next;
-extern int __Zephyr_port; /* Port number */
-extern struct in_addr __My_addr;
+extern gint __Zephyr_port; /* Port number */ +extern guint32 __My_addr; /* Macros to retrieve Zephyr library values. */
+extern GSocket *__Zephyr_socket; extern int __Q_CompleteLength;
-extern struct sockaddr_in __HM_addr;
+extern GSocketAddress *__HM_addr; extern char __Zephyr_realm[];
-#define ZGetFD() __Zephyr_fd
+#define ZGetSocket() __Zephyr_socket #define ZQLength() __Q_CompleteLength
#define ZGetDestAddr() __HM_addr
#define ZGetRealm() __Zephyr_realm