|
Data Structures |
struct | search_ctrl |
| Structure for search results. More...
|
Defines |
#define | MUID_MAX 4 /**< Max amount of MUID we keep per search */ |
| Max amount of MUID we keep per search.
|
#define | SEARCH_MIN_RETRY 1800 /**< Minimum search retry timeout */ |
| Minimum search retry timeout.
|
#define | search_find_by_handle(n) (search_ctrl_t *) idtable_get_value(search_handle_map, n) |
#define | search_request_handle(n) idtable_new_id(search_handle_map, n) |
#define | search_drop_handle(n) idtable_free_id(search_handle_map, n); |
#define | count_sha1(x) do { } while (0) |
#define | count_host(x) do { } while (0) |
#define | CLOSED_SEARCH 0xffff |
Typedefs |
typedef search_ctrl | search_ctrl_t |
| Structure for search results.
|
Functions |
| RCSID ("$Id:search.c, v 1.98 2006/02/01 23:13:21 cbiere Exp $") |
void | search_check_results_set (gnet_results_set_t *rs) |
| Check a results_set for matching entries in the download queue, and generate new entries if we find a match.
|
void | search_add_got_results_listener (search_got_results_listener_t l) |
void | search_remove_got_results_listener (search_got_results_listener_t l) |
void | search_fire_got_results (GSList *sch_matched, const gnet_results_set_t *rs) |
guint | sent_node_hash_func (gconstpointer key) |
gint | sent_node_compare (gconstpointer a, gconstpointer b) |
gboolean | search_free_sent_node (gpointer key, gpointer unused_value, gpointer unused_udata) |
void | search_free_sent_nodes (search_ctrl_t *sch) |
void | search_reset_sent_nodes (search_ctrl_t *sch) |
void | mark_search_sent_to_node (search_ctrl_t *sch, gnutella_node_t *n) |
void | mark_search_sent_to_connected_nodes (search_ctrl_t *sch) |
void | search_free_sent_node_ids (search_ctrl_t *sch) |
void | search_reset_sent_node_ids (search_ctrl_t *sch) |
void | mark_search_sent_to_node_id (search_ctrl_t *sch, guint32 node_id) |
gboolean | search_already_sent_to_node (const search_ctrl_t *sch, const gnutella_node_t *n) |
void | search_free_alt_locs (gnet_record_t *rc) |
| Free the alternate locations held within a file record.
|
void | search_free_proxies (gnet_results_set_t *rs) |
| Free the push proxies held within a result set.
|
void | search_free_record (gnet_record_t *rc) |
| Free one file record.
|
void | search_free_r_set (gnet_results_set_t *rs) |
| Free one results_set.
|
gnet_results_set_t * | get_results_set (gnutella_node_t *n, gboolean validate_only, gboolean browse) |
| Parse Query Hit and extract the embedded records, plus the optional trailing Query Hit Descritor (QHD).
|
void | update_neighbour_info (gnutella_node_t *n, gnet_results_set_t *rs) |
| Called when we get a query hit from an immediate neighbour.
|
gnutella_msg_search * | build_search_msg (search_ctrl_t *sch, guint32 *len, guint32 *sizep) |
| Create a search request message for specified search.
|
void | search_qhv_fill (search_ctrl_t *sch, query_hashvec_t *qhv) |
| Fill supplied query hash vector `qhv' with relevant word/SHA1 entries for the given search.
|
void | search_send_packet (search_ctrl_t *sch, gnutella_node_t *n) |
| Create and send a search request packet.
|
void | node_added_callback (gpointer data) |
| Called when we connect to a new node and thus can send it our searches.
|
void | search_add_new_muid (search_ctrl_t *sch, gchar *muid) |
| Create a new muid and add it to the search's list of muids.
|
void | search_send_packet_all (search_ctrl_t *sch) |
| Send search to all connected nodes.
|
gboolean | search_reissue_timeout_callback (gpointer data) |
| Called when the reissue timer for any search is triggered.
|
void | update_one_reissue_timeout (search_ctrl_t *sch) |
| Make sure a timer is created/removed after a search was started/stopped.
|
gboolean | search_alive (search_ctrl_t *sch, guint32 id) |
| Check whether search bearing the specified ID is still alive.
|
void | search_send_query_status (search_ctrl_t *sch, guint32 node_id, guint16 kept) |
| Send an unsolicited "Query Status Response" to the specified node ID, bearing the amount of kept results.
|
void | search_send_status (gpointer key, gpointer unused_value, gpointer udata) |
| Send an unsolicited "Query Status Response" to the specified node ID about the results we kept so far for the relevant search.
|
void | search_update_results (search_ctrl_t *sch) |
| Update our querying ultrapeers about the results we kept so far for the given search.
|
void | search_send_closed (gpointer key, gpointer unused_value, gpointer udata) |
| Send an unsolicited "Query Status Response" to the specified node ID informing it that the search was closed.
|
void | search_notify_closed (gnet_search_t sh) |
| Tell our querying ultrapeers that the search is closed.
|
void | search_dequeue_all_nodes (gnet_search_t sh) |
| Signal to all search queues that search was closed.
|
void | search_init (void) |
void | search_shutdown (void) |
void | search_browse_results (gnutella_node_t *n, gnet_search_t sh) |
| This routine is called for each Query Hit packet we receive out of a browse-host request, since we know the target search result, and we don't need to bother with forwarding that message.
|
gboolean | search_results (gnutella_node_t *n, gint *results) |
| This routine is called for each Query Hit packet we receive.
|
gboolean | search_query_allowed (gnet_search_t sh) |
| Check whether we can send another query for this search.
|
guint32 | search_get_id (gnet_search_t sh, gpointer *search) |
void | search_notify_sent (gpointer search, guint32 id, guint32 node_id) |
| Notification from sq that a query for this search was sent to the specified node ID.
|
void | search_check_alt_locs (gnet_results_set_t *rs, gnet_record_t *rc, fileinfo_t *fi) |
| Check for alternate locations in the result set, and enqueue the downloads if there are any.
|
void | search_close (gnet_search_t sh) |
| Remove the search from the list of searches and free all associated ressources.
|
gchar * | search_new_muid (gboolean initial) |
| Allocate a new MUID for a search.
|
gboolean | search_expired (const search_ctrl_t *sch) |
void | search_reissue (gnet_search_t sh) |
| Force a reissue of the given search.
|
void | search_set_reissue_timeout (gnet_search_t sh, guint32 timeout) |
| Set the reissue timeout of a search.
|
guint32 | search_get_reissue_timeout (gnet_search_t sh) |
| Get the reissue timeout of a search.
|
guint | search_get_lifetime (gnet_search_t sh) |
| Get the initial lifetime (in hours) of a search.
|
time_t | search_get_create_time (gnet_search_t sh) |
| Get the create time of a search.
|
void | search_set_create_time (gnet_search_t sh, time_t t) |
| Set the create time of a search.
|
gnet_search_t | search_new (const gchar *query, time_t create_time, guint lifetime, guint32 reissue_timeout, flag_t flags) |
| Create a new suspended search and return a handle which identifies it.
|
void | search_update_items (gnet_search_t sh, guint32 items) |
| The GUI updates us on the amount of items displayed in the search.
|
void | search_add_kept (gnet_search_t sh, guint32 kept) |
| The filtering side lets us know the amount of items we "kept", which are either things we display to the user or entries we used for auto-download.
|
void | search_start (gnet_search_t sh) |
| Start a newly created start or resume stopped search.
|
void | search_stop (gnet_search_t sh) |
| Stop search.
|
gboolean | search_get_kept_results (gchar *muid, guint32 *kept) |
| Get amount of results we displayed for the search identified by its MUID.
|
guint32 | search_get_kept_results_by_handle (gnet_search_t sh) |
void | search_oob_pending_results (gnutella_node_t *n, gchar *muid, gint hits, gboolean udp_firewalled) |
| Received out-of-band indication of results for search identified by its MUID, on remote node `n'.
|
gboolean | search_is_frozen (gnet_search_t sh) |
gboolean | search_is_passive (gnet_search_t sh) |
gboolean | search_is_active (gnet_search_t sh) |
gboolean | search_is_expired (gnet_search_t sh) |
gboolean | search_browse (gnet_search_t sh, const gchar *hostname, host_addr_t addr, guint16 port, const gchar *guid, gboolean push, const gnet_host_vec_t *proxies) |
| Associate download to fill in the opened browse search.
|
void | search_dissociate_browse (gnet_search_t sh, gpointer download) |
| Notification from the download layer that a browse-host download is being removed.
|
Variables |
guint32 | search_id = 0 |
| Unique search counter.
|
GHashTable * | searches = NULL |
| All alive searches.
|
GSList * | sl_search_ctrl = NULL |
| All searches.
|
GSList * | sl_passive_ctrl = NULL |
| Only passive searches.
|
GHashTable * | search_by_muid = NULL |
zone_t * | rs_zone = NULL |
| Allocation of results_set.
|
zone_t * | rc_zone = NULL |
| Allocation of record.
|
idtable_t * | search_handle_map = NULL |
query_hashvec_t * | query_hashvec = NULL |
GHashTable * | ht_sha1 = NULL |
GHashTable * | ht_host = NULL |
listeners_t | search_got_results_listeners = NULL |