|
Data Structures |
| struct | shared_file |
| struct | special_file |
| | Describes special files which are served by GTKG. More...
|
| struct | query_context |
| | A query context. More...
|
Defines |
| #define | MIN_WORD_LENGTH 1 |
| | For compaction.
|
| #define | APPEND_WORD() |
Enumerations |
| enum | shared_file_magic { SHARED_FILE_MAGIC = 0x3702b437U
} |
Functions |
| gint | compare_share_sha1 (gconstpointer s1, gconstpointer s2) |
| | Compare binary SHA1 hashes.
|
| void | reinit_sha1_table (void) |
| | Reset sha1_to_share.
|
| void | share_add_search_request_listener (search_request_listener_t l) |
| void | share_remove_search_request_listener (search_request_listener_t l) |
| void | share_emit_search_request (query_type_t type, const gchar *query, const host_addr_t addr, guint16 port) |
| query_context * | share_query_context_make (void) |
| | Create new query context.
|
| void | share_query_context_free (struct query_context *ctx) |
| | Get rid of the query context.
|
| gboolean | shared_file_already_found (struct query_context *ctx, const shared_file_t *sf) |
| | Check if a given shared_file has been added to the QueryHit.
|
| void | shared_file_mark_found (struct query_context *ctx, const shared_file_t *sf) |
| | Add the shared_file to the set of files already added to the QueryHit.
|
| void | got_match (gpointer context, gpointer data) |
| | Invoked for each new match we get.
|
| void | shared_file_check (const struct shared_file *sf) |
| shared_file_t * | shared_file_alloc (void) |
| | Allocate a shared_file_t structure.
|
| void | shared_file_deindex (shared_file_t *sf) |
| void | shared_file_free (shared_file_t **sf_ptr) |
| | Dispose of a shared_file_t structure and nullify the pointer.
|
| gboolean | shared_file_set_names (shared_file_t *sf, const gchar *filename) |
| shared_file_t * | share_special_load (const struct special_file *sp) |
| | Initialize special file entry, returning shared_file_t structure if the file exists, NULL otherwise.
|
| void | share_special_init (void) |
| | Initialize the special files we're sharing.
|
| shared_file_t * | shared_special (const gchar *path) |
| | Look up a possibly shared special file, updating the entry with current file size and modification time.
|
| void | query_muid_map_init (void) |
| gboolean | query_muid_map_remove_oldest (void) |
| void | query_muid_map_close (void) |
| void | query_muid_map_garbage_collect (void) |
| void | record_query_string (const gchar muid[GUID_RAW_SIZE], const gchar *query) |
| const gchar * | map_muid_to_query_string (const gchar muid[GUID_RAW_SIZE]) |
| void | share_init (void) |
| | Initialization of the sharing library.
|
| shared_file_t * | shared_file (guint idx) |
| | Given a valid index, returns the `struct shared_file' entry describing the shared file bearing that index if found, NULL if not found (invalid index) and SHARE_REBUILDING when we're rebuilding the library.
|
| guint | shared_file_get_index (const gchar *filename) |
| | Get index of shared file identified by its name.
|
| shared_file_t * | shared_file_by_name (const gchar *filename) |
| | Given a file basename, returns the `struct shared_file' entry describing the shared file bearing that basename, provided it is unique, NULL if we either don't have a unique filename or SHARE_REBUILDING if the library is being rebuilt.
|
| const gchar * | share_mime_type (enum share_mime_type type) |
| | Returns the MIME content type string.
|
| void | free_extensions_helper (gpointer key, gpointer unused_value, gpointer unused_data) |
| void | free_extensions (void) |
| | Free existing extensions.
|
| void | parse_extensions (const gchar *str) |
| | Get the file extensions to scan.
|
| void | shared_dirs_free (void) |
| | Release shared dirs.
|
| void | shared_dirs_update_prop (void) |
| | Update the property holding the shared directories.
|
| gboolean | shared_dirs_parse (const gchar *str) |
| | Parses the given string and updated the internal list of shared dirs.
|
| void | shared_dir_add (const gchar *path) |
| | Add directory to the list of shared directories.
|
| shared_file_t * | shared_file_ref (shared_file_t *sf) |
| | Add one more reference to a shared_file_t.
|
| void | shared_file_unref (shared_file_t **sf_ptr) |
| | Remove one reference to a shared_file_t, freeing entry if there are no reference left.
|
| gboolean | too_big_for_gnutella (off_t size) |
| | Is file too big to be shared on Gnutella?
|
| gboolean | contains_control_chars (const gchar *pathname) |
| | Checks whether it's OK to share the pathname with respect to special characters in the string.
|
| const gchar * | get_relative_path (const gchar *base_dir, const gchar *pathname) |
| | Extracts the relative path from a pathname relative to base_dir.
|
| gboolean | shared_file_valid_extension (const gchar *filename) |
| | Verify that a file extension is valid for sharing.
|
| shared_file_t * | share_scan_add_file (const gchar *relative_path, const gchar *pathname, const struct stat *sb) |
| mode_t | dir_entry_mode (const struct dirent *dir_entry) |
| | Tries to extrace the file mode from a struct dirent.
|
| void | recurse_scan_intern (const gchar *const base_dir, const gchar *const dir) |
| | The directories that are given as shared will be completly transversed including all files and directories.
|
| void | recurse_scan (const gchar *base_dir) |
| void | share_free (void) |
| | Free up memory used by the shared library.
|
| gint | shared_file_sort_by_mtime (gconstpointer f1, gconstpointer f2) |
| | Sort function - shared files by descending mtime.
|
| void | share_scan (void) |
| | Perform scanning of the shared directories to build up the list of shared files.
|
| void | special_free_kv (gpointer unused_key, gpointer val, gpointer unused_udata) |
| | Hash table iterator callback to free the value.
|
| void | share_special_close (void) |
| | Get rid of the special file descriptions, if any.
|
| void | share_close (void) |
| | Shutdown cleanup.
|
| size_t | compact_query_utf8 (gchar *search) |
| | Remove unnecessary ballast from a query before processing it.
|
| gboolean | query_utf8_decode (const gchar *text, guint *retoff) |
| | Determine whether the given string is UTF-8 encoded.
|
| size_t | compact_query (gchar *search) |
| | Remove unnecessary ballast from a query string, in-place.
|
| void | query_strip_oob_flag (const gnutella_node_t *n, gchar *data) |
| | Remove the OOB delivery flag by patching the query message inplace.
|
| void | query_set_oob_flag (const gnutella_node_t *n, gchar *data) |
| | Set the OOB delivery flag by patching the query message inplace.
|
| gboolean | search_request (struct gnutella_node *n, query_hashvec_t *qhv) |
| | Searches requests (from others nodes) Basic matching.
|
| void | shared_file_set_sha1 (struct shared_file *sf, const struct sha1 *sha1) |
| | Set the SHA1 hash of a given shared_file.
|
| void | shared_file_set_tth (struct shared_file *sf, const struct tth *tth) |
| void | shared_file_set_modification_time (struct shared_file *sf, time_t mtime) |
| gboolean | sha1_hash_available (const struct shared_file *sf) |
| | Predicate returning TRUE if the SHA1 hash is available for a given shared_file, FALSE otherwise.
|
| gboolean | sha1_hash_is_uptodate (struct shared_file *sf) |
| | Predicate returning TRUE if the SHA1 hash is available AND is up to date for the shared file.
|
| gboolean | shared_file_is_partial (const struct shared_file *sf) |
| filesize_t | shared_file_size (const shared_file_t *sf) |
| guint32 | shared_file_index (const shared_file_t *sf) |
| const struct sha1 * | shared_file_sha1 (const shared_file_t *sf) |
| const struct tth * | shared_file_tth (const shared_file_t *sf) |
| const gchar * | shared_file_name_nfc (const shared_file_t *sf) |
| const gchar * | shared_file_name_canonic (const shared_file_t *sf) |
| size_t | shared_file_name_nfc_len (const shared_file_t *sf) |
| size_t | shared_file_name_canonic_len (const shared_file_t *sf) |
| const gchar * | shared_file_relative_path (const shared_file_t *sf) |
| | Returns the relative path of the shared files unless there was none or exposing relative paths is disabled.
|
| const gchar * | shared_file_path (const shared_file_t *sf) |
| | Get the pathname of a shared file.
|
| time_t | shared_file_modification_time (const shared_file_t *sf) |
| guint32 | shared_file_flags (const shared_file_t *sf) |
| fileinfo_t * | shared_file_fileinfo (const shared_file_t *sf) |
| const gchar * | shared_file_content_type (const shared_file_t *sf) |
| void | shared_file_remove (struct shared_file *sf) |
| void | shared_file_set_path (struct shared_file *sf, const gchar *pathname) |
| void | shared_file_from_fileinfo (fileinfo_t *fi) |
| shared_file * | shared_file_complete_by_sha1 (const struct sha1 *sha1) |
| shared_file_t * | shared_file_by_sha1 (const struct sha1 *sha1) |
| | Take a given binary SHA1 digest, and return the corresponding shared_file if we have it.
|
| guint64 | shared_kbytes_scanned (void) |
| | Get accessor for ``kbytes_scanned''.
|
| guint64 | shared_files_scanned (void) |
| | Get accessor for ``files_scanned''.
|
Variables |
| const struct special_file | specials [] |
| GHashTable * | special_names = NULL |
| | Maps special names (e.g.
|
| guint64 | files_scanned = 0 |
| guint64 | bytes_scanned = 0 |
| GHashTable * | extensions = NULL |
| GSList * | shared_dirs = NULL |
| GSList * | shared_files = NULL |
| shared_file ** | file_table = NULL |
| search_table_t * | search_table |
| GHashTable * | file_basenames = NULL |
| GHashTable * | muid_to_query_map |
| hash_list_t * | query_muids |
| GTree * | sha1_to_share |
| | This tree maps a SHA1 hash (base-32 encoded) onto the corresponding shared_file if we have one.
|
| listeners_t | search_request_listeners = NULL |
| const guint | FILENAME_CLASH = -1 |
| | Indicates basename clashes.
|