source: trunk/libtransmission/quark.h @ 13683

Last change on this file since 13683 was 13683, checked in by jordan, 8 years ago

(trunk, libT) first drop of the tr_quark patch.

File size: 10.4 KB
Line 
1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2 (b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: utils.h 13667 2012-12-14 04:34:42Z jordan $
11 */
12
13#ifndef TR_QUARK_H
14#define TR_QUARK_H 1
15
16/* Quarks — a 2-way association between a string and a unique integer identifier */
17typedef size_t tr_quark;
18
19/*
20 * Predefined Quarks.
21 *
22 * TODO: it would be nice to clean up all the naming inconsistencies
23 * between RPC and settings. This will be a mess and we shouldn't be
24 * in a hurry to do it.
25 */
26enum
27{
28  TR_KEY_NONE, /* represented as an empty string */
29  TR_KEY_activeTorrentCount, /* rpc */
30  TR_KEY_activity_date, /* resume file */
31  TR_KEY_activityDate, /* rpc */
32  TR_KEY_added, /* pex */
33  TR_KEY_added_date, /* rpc */
34  TR_KEY_added_f, /* pex */
35  TR_KEY_added6, /* pex */
36  TR_KEY_added6_f, /* pex */
37  TR_KEY_addedDate, /* rpc */
38  TR_KEY_address, /* rpc */
39  TR_KEY_alt_speed_down, /* rpc, settings */
40  TR_KEY_alt_speed_enabled, /* rpc, settings */
41  TR_KEY_alt_speed_time_begin, /* rpc, settings */
42  TR_KEY_alt_speed_time_day, /* rpc, settings */
43  TR_KEY_alt_speed_time_enabled, /* rpc, settings */
44  TR_KEY_alt_speed_time_end, /* rpc, settings */
45  TR_KEY_alt_speed_up, /* rpc, settings */
46  TR_KEY_announce, /* metainfo */
47  TR_KEY_announce_list, /* metainfo */
48  TR_KEY_announceState, /* rpc */
49  TR_KEY_arguments, /* rpc */
50  TR_KEY_bandwidth_priority,
51  TR_KEY_bandwidthPriority,
52  TR_KEY_bind_address_ipv4,
53  TR_KEY_bind_address_ipv6,
54  TR_KEY_bitfield,
55  TR_KEY_blocklist_date,
56  TR_KEY_blocklist_enabled,
57  TR_KEY_blocklist_size,
58  TR_KEY_blocklist_updates_enabled,
59  TR_KEY_blocklist_url,
60  TR_KEY_blocks,
61  TR_KEY_bytesCompleted,
62  TR_KEY_cache_size_mb,
63  TR_KEY_clientIsChoked,
64  TR_KEY_clientIsInterested,
65  TR_KEY_clientName,
66  TR_KEY_comment,
67  TR_KEY_comment_utf_8,
68  TR_KEY_compact_view,
69  TR_KEY_complete,
70  TR_KEY_config_dir,
71  TR_KEY_cookies,
72  TR_KEY_corrupt,
73  TR_KEY_corruptEver,
74  TR_KEY_created_by,
75  TR_KEY_created_by_utf_8,
76  TR_KEY_creation_date,
77  TR_KEY_creator,
78  TR_KEY_cumulative_stats,
79  TR_KEY_current_stats,
80  TR_KEY_date,
81  TR_KEY_dateCreated,
82  TR_KEY_delete_local_data,
83  TR_KEY_desiredAvailable,
84  TR_KEY_destination,
85  TR_KEY_dht_enabled,
86  TR_KEY_display_name,
87  TR_KEY_dnd,
88  TR_KEY_done_date,
89  TR_KEY_doneDate,
90  TR_KEY_download_dir,
91  TR_KEY_download_dir_free_space,
92  TR_KEY_download_queue_enabled,
93  TR_KEY_download_queue_size,
94  TR_KEY_downloadCount,
95  TR_KEY_downloadDir,
96  TR_KEY_downloadLimit,
97  TR_KEY_downloadLimited,
98  TR_KEY_downloadSpeed,
99  TR_KEY_downloaded,
100  TR_KEY_downloaded_bytes,
101  TR_KEY_downloadedBytes,
102  TR_KEY_downloadedEver,
103  TR_KEY_downloaders,
104  TR_KEY_downloading_time_seconds,
105  TR_KEY_dropped,
106  TR_KEY_dropped6,
107  TR_KEY_e,
108  TR_KEY_encoding,
109  TR_KEY_encryption,
110  TR_KEY_error,
111  TR_KEY_errorString,
112  TR_KEY_eta,
113  TR_KEY_failure_reason,
114  TR_KEY_fields,
115  TR_KEY_fileStats,
116  TR_KEY_filename,
117  TR_KEY_files,
118  TR_KEY_files_added,
119  TR_KEY_files_unwanted,
120  TR_KEY_files_wanted,
121  TR_KEY_filesAdded,
122  TR_KEY_filter_mode,
123  TR_KEY_filter_text,
124  TR_KEY_filter_trackers,
125  TR_KEY_flagStr,
126  TR_KEY_flags,
127  TR_KEY_fromCache,
128  TR_KEY_fromDht,
129  TR_KEY_fromIncoming,
130  TR_KEY_fromLpd,
131  TR_KEY_fromLtep,
132  TR_KEY_fromPex,
133  TR_KEY_fromTracker,
134  TR_KEY_hasAnnounced,
135  TR_KEY_hasScraped,
136  TR_KEY_hashString,
137  TR_KEY_have,
138  TR_KEY_haveUnchecked,
139  TR_KEY_haveValid,
140  TR_KEY_honorsSessionLimits,
141  TR_KEY_host,
142  TR_KEY_id,
143  TR_KEY_idle_limit,
144  TR_KEY_idle_mode,
145  TR_KEY_idle_seeding_limit,
146  TR_KEY_idle_seeding_limit_enabled,
147  TR_KEY_ids,
148  TR_KEY_incomplete,
149  TR_KEY_incomplete_dir,
150  TR_KEY_incomplete_dir_enabled,
151  TR_KEY_info,
152  TR_KEY_info_hash,
153  TR_KEY_inhibit_desktop_hibernation,
154  TR_KEY_interval,
155  TR_KEY_ip,
156  TR_KEY_ipv4,
157  TR_KEY_ipv6,
158  TR_KEY_isBackup,
159  TR_KEY_isDownloadingFrom,
160  TR_KEY_isEncrypted,
161  TR_KEY_isFinished,
162  TR_KEY_isIncoming,
163  TR_KEY_isPrivate,
164  TR_KEY_isStalled,
165  TR_KEY_isUTP,
166  TR_KEY_isUploadingTo,
167  TR_KEY_lastAnnouncePeerCount,
168  TR_KEY_lastAnnounceResult,
169  TR_KEY_lastAnnounceStartTime,
170  TR_KEY_lastAnnounceSucceeded,
171  TR_KEY_lastAnnounceTime,
172  TR_KEY_lastAnnounceTimedOut,
173  TR_KEY_lastScrapeResult,
174  TR_KEY_lastScrapeStartTime,
175  TR_KEY_lastScrapeSucceeded,
176  TR_KEY_lastScrapeTime,
177  TR_KEY_lastScrapeTimedOut,
178  TR_KEY_ldp_enabled,
179  TR_KEY_leecherCount,
180  TR_KEY_leftUntilDone,
181  TR_KEY_length,
182  TR_KEY_location,
183  TR_KEY_lpd_enabled,
184  TR_KEY_m,
185  TR_KEY_magnet_info,
186  TR_KEY_magnetLink,
187  TR_KEY_main_window_height,
188  TR_KEY_main_window_is_maximized,
189  TR_KEY_main_window_layout_order,
190  TR_KEY_main_window_width,
191  TR_KEY_main_window_x,
192  TR_KEY_main_window_y,
193  TR_KEY_manualAnnounceTime,
194  TR_KEY_max_peers,
195  TR_KEY_maxConnectedPeers,
196  TR_KEY_memory_bytes,
197  TR_KEY_memory_units,
198  TR_KEY_message_level,
199  TR_KEY_metadataPercentComplete,
200  TR_KEY_metadata_size,
201  TR_KEY_metainfo,
202  TR_KEY_method,
203  TR_KEY_min_interval,
204  TR_KEY_min_request_interval,
205  TR_KEY_move,
206  TR_KEY_msg_type,
207  TR_KEY_mtimes,
208  TR_KEY_name,
209  TR_KEY_name_utf_8,
210  TR_KEY_nextAnnounceTime,
211  TR_KEY_nextScrapeTime,
212  TR_KEY_nodes,
213  TR_KEY_nodes6,
214  TR_KEY_open_dialog_dir,
215  TR_KEY_p,
216  TR_KEY_path,
217  TR_KEY_path_utf_8,
218  TR_KEY_paused,
219  TR_KEY_pausedTorrentCount,
220  TR_KEY_peer_congestion_algorithm,
221  TR_KEY_peer_limit,
222  TR_KEY_peer_limit_global,
223  TR_KEY_peer_limit_per_torrent,
224  TR_KEY_peer_port,
225  TR_KEY_peer_port_random_high,
226  TR_KEY_peer_port_random_low,
227  TR_KEY_peer_port_random_on_start,
228  TR_KEY_peer_socket_tos,
229  TR_KEY_peerIsChoked,
230  TR_KEY_peerIsInterested,
231  TR_KEY_peers,
232  TR_KEY_peers2,
233  TR_KEY_peers2_6,
234  TR_KEY_peers6,
235  TR_KEY_peersConnected,
236  TR_KEY_peersFrom,
237  TR_KEY_peersGettingFromUs,
238  TR_KEY_peersSendingToUs,
239  TR_KEY_percentDone,
240  TR_KEY_pex_enabled,
241  TR_KEY_piece,
242  TR_KEY_piece_length,
243  TR_KEY_pieceCount,
244  TR_KEY_pieceSize,
245  TR_KEY_pieces,
246  TR_KEY_play_download_complete_sound,
247  TR_KEY_port,
248  TR_KEY_port_forwarding_enabled,
249  TR_KEY_port_is_open,
250  TR_KEY_preallocation,
251  TR_KEY_prefetch_enabled,
252  TR_KEY_priorities,
253  TR_KEY_priority,
254  TR_KEY_priority_high,
255  TR_KEY_priority_low,
256  TR_KEY_priority_normal,
257  TR_KEY_private,
258  TR_KEY_progress,
259  TR_KEY_prompt_before_exit,
260  TR_KEY_queue_move_bottom,
261  TR_KEY_queue_move_down,
262  TR_KEY_queue_move_top,
263  TR_KEY_queue_move_up,
264  TR_KEY_queue_stalled_enabled,
265  TR_KEY_queue_stalled_minutes,
266  TR_KEY_queuePosition,
267  TR_KEY_rateDownload,
268  TR_KEY_rateToClient,
269  TR_KEY_rateToPeer,
270  TR_KEY_rateUpload,
271  TR_KEY_ratio_limit,
272  TR_KEY_ratio_limit_enabled,
273  TR_KEY_ratio_mode,
274  TR_KEY_recent_download_dir_1,
275  TR_KEY_recent_download_dir_2,
276  TR_KEY_recent_download_dir_3,
277  TR_KEY_recent_download_dir_4,
278  TR_KEY_recheckProgress,
279  TR_KEY_remote_session_enabled,
280  TR_KEY_remote_session_host,
281  TR_KEY_remote_session_password,
282  TR_KEY_remote_session_port,
283  TR_KEY_remote_session_requres_authentication,
284  TR_KEY_remote_session_username,
285  TR_KEY_removed,
286  TR_KEY_rename_partial_files,
287  TR_KEY_reqq,
288  TR_KEY_result,
289  TR_KEY_rpc_authentication_required,
290  TR_KEY_rpc_bind_address,
291  TR_KEY_rpc_enabled,
292  TR_KEY_rpc_password,
293  TR_KEY_rpc_port,
294  TR_KEY_rpc_url,
295  TR_KEY_rpc_username,
296  TR_KEY_rpc_version,
297  TR_KEY_rpc_version_minimum,
298  TR_KEY_rpc_whitelist,
299  TR_KEY_rpc_whitelist_enabled,
300  TR_KEY_scrape,
301  TR_KEY_scrape_paused_torrents_enabled,
302  TR_KEY_scrapeState,
303  TR_KEY_script_torrent_done_enabled,
304  TR_KEY_script_torrent_done_filename,
305  TR_KEY_seconds_active,
306  TR_KEY_secondsActive,
307  TR_KEY_secondsDownloading,
308  TR_KEY_secondsSeeding,
309  TR_KEY_seed_queue_enabled,
310  TR_KEY_seed_queue_size,
311  TR_KEY_seedIdleLimit,
312  TR_KEY_seedIdleMode,
313  TR_KEY_seedRatioLimit,
314  TR_KEY_seedRatioLimited,
315  TR_KEY_seedRatioMode,
316  TR_KEY_seederCount,
317  TR_KEY_seeding_time_seconds,
318  TR_KEY_session_count,
319  TR_KEY_sessionCount,
320  TR_KEY_show_backup_trackers,
321  TR_KEY_show_desktop_notification,
322  TR_KEY_show_extra_peer_details,
323  TR_KEY_show_filterbar,
324  TR_KEY_show_notification_area_icon,
325  TR_KEY_show_options_window,
326  TR_KEY_show_statusbar,
327  TR_KEY_show_toolbar,
328  TR_KEY_show_tracker_scrapes,
329  TR_KEY_size_bytes,
330  TR_KEY_size_units,
331  TR_KEY_sizeWhenDone,
332  TR_KEY_sort_mode,
333  TR_KEY_sort_reversed,
334  TR_KEY_speed,
335  TR_KEY_speed_Bps,
336  TR_KEY_speed_bytes,
337  TR_KEY_speed_limit_down,
338  TR_KEY_speed_limit_down_enabled,
339  TR_KEY_speed_limit_up,
340  TR_KEY_speed_limit_up_enabled,
341  TR_KEY_speed_units,
342  TR_KEY_start_added_torrents,
343  TR_KEY_startDate,
344  TR_KEY_status,
345  TR_KEY_statusbar_stats,
346  TR_KEY_tag,
347  TR_KEY_tier,
348  TR_KEY_time_checked,
349  TR_KEY_torrent_added,
350  TR_KEY_torrent_added_notification_command,
351  TR_KEY_torrent_added_notification_enabled,
352  TR_KEY_torrent_complete_notification_command,
353  TR_KEY_torrent_complete_notification_enabled,
354  TR_KEY_torrent_complete_sound_command,
355  TR_KEY_torrent_complete_sound_enabled,
356  TR_KEY_torrent_get,
357  TR_KEY_torrent_set,
358  TR_KEY_torrentCount,
359  TR_KEY_torrentFile,
360  TR_KEY_torrents,
361  TR_KEY_totalSize,
362  TR_KEY_total_size,
363  TR_KEY_tracker_id,
364  TR_KEY_trackerAdd,
365  TR_KEY_trackerRemove,
366  TR_KEY_trackerReplace,
367  TR_KEY_trackerStats,
368  TR_KEY_trackers,
369  TR_KEY_trash_can_enabled,
370  TR_KEY_trash_original_torrent_files,
371  TR_KEY_umask,
372  TR_KEY_units,
373  TR_KEY_upload_slots_per_torrent,
374  TR_KEY_uploadLimit,
375  TR_KEY_uploadLimited,
376  TR_KEY_uploadRatio,
377  TR_KEY_uploadSpeed,
378  TR_KEY_upload_only,
379  TR_KEY_uploaded,
380  TR_KEY_uploaded_bytes,
381  TR_KEY_uploadedBytes,
382  TR_KEY_uploadedEver,
383  TR_KEY_url_list,
384  TR_KEY_use_global_speed_limit,
385  TR_KEY_use_speed_limit,
386  TR_KEY_user_has_given_informed_consent,
387  TR_KEY_ut_comment,
388  TR_KEY_ut_holepunch,
389  TR_KEY_ut_metadata,
390  TR_KEY_ut_pex,
391  TR_KEY_ut_recommend,
392  TR_KEY_utp_enabled,
393  TR_KEY_v,
394  TR_KEY_version,
395  TR_KEY_wanted,
396  TR_KEY_warning_message,
397  TR_KEY_watch_dir,
398  TR_KEY_watch_dir_enabled,
399  TR_KEY_webseeds,
400  TR_KEY_webseedsSendingToUs,
401  TR_N_KEYS
402};
403
404/**
405 * Find the quark that matches the specified string
406 *
407 * @return true if the specified string exists as a quark
408 */
409bool tr_quark_lookup (const void * str, size_t len, tr_quark * setme);
410
411/**
412 * Get the string that corresponds to the specified quark
413 */
414const char * tr_quark_get_string (const tr_quark quark, size_t * len);
415
416/**
417 * Create a new quark for the specified string. If a quark already
418 * exists for that string, it is returned so that no duplicates are
419 * created.
420 */
421tr_quark tr_quark_new (const void * str, size_t len);
422
423
424#endif
Note: See TracBrowser for help on using the repository browser.