/** * Suited for use as a GFunc in a g_list_for_each. */ static void browse_uploading_host(gpointer data, gpointer unused_udata) { upload_row_data_t *d = data; (void) unused_udata; if (host_addr_initialized(d->gnet_addr)) uploads_gui_browse_host(d->gnet_addr, d->gnet_port); }
/** * @param ha An initialized host address. * @return The proper AF_* value or -1 if not available. */ int host_addr_family(const host_addr_t ha) { if (!host_addr_initialized(ha)) { g_error("host_addr_family(): ha.net=%u", (uint8) ha.net); } switch (ha.net) { case NET_TYPE_IPV4: return AF_INET; case NET_TYPE_IPV6: #ifdef HAS_IPV6 return AF_INET6; #else return -1; #endif case NET_TYPE_LOCAL: return AF_LOCAL; case NET_TYPE_NONE: break; } return -1; }