source: trunk/libtransmission/quark.h

Last change on this file was 14724, checked in by jordan, 5 years ago

use '#pragma once' instead of #ifndef..#define..#endif guards

  • Property svn:keywords set to Date Rev Author Id
File size: 10.3 KB
Line 
1/*
2 * This file Copyright (C) 2013-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: quark.h 14724 2016-03-29 16:37:21Z mikedld $
8 */
9
10#pragma once
11
12#ifdef __cplusplus
13extern "C" {
14#endif
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_etaIdle,
114  TR_KEY_failure_reason,
115  TR_KEY_fields,
116  TR_KEY_fileStats,
117  TR_KEY_filename,
118  TR_KEY_files,
119  TR_KEY_files_added,
120  TR_KEY_files_unwanted,
121  TR_KEY_files_wanted,
122  TR_KEY_filesAdded,
123  TR_KEY_filter_mode,
124  TR_KEY_filter_text,
125  TR_KEY_filter_trackers,
126  TR_KEY_flagStr,
127  TR_KEY_flags,
128  TR_KEY_fromCache,
129  TR_KEY_fromDht,
130  TR_KEY_fromIncoming,
131  TR_KEY_fromLpd,
132  TR_KEY_fromLtep,
133  TR_KEY_fromPex,
134  TR_KEY_fromTracker,
135  TR_KEY_hasAnnounced,
136  TR_KEY_hasScraped,
137  TR_KEY_hashString,
138  TR_KEY_have,
139  TR_KEY_haveUnchecked,
140  TR_KEY_haveValid,
141  TR_KEY_honorsSessionLimits,
142  TR_KEY_host,
143  TR_KEY_id,
144  TR_KEY_idle_limit,
145  TR_KEY_idle_mode,
146  TR_KEY_idle_seeding_limit,
147  TR_KEY_idle_seeding_limit_enabled,
148  TR_KEY_ids,
149  TR_KEY_incomplete,
150  TR_KEY_incomplete_dir,
151  TR_KEY_incomplete_dir_enabled,
152  TR_KEY_info,
153  TR_KEY_info_hash,
154  TR_KEY_inhibit_desktop_hibernation,
155  TR_KEY_interval,
156  TR_KEY_ip,
157  TR_KEY_ipv4,
158  TR_KEY_ipv6,
159  TR_KEY_isBackup,
160  TR_KEY_isDownloadingFrom,
161  TR_KEY_isEncrypted,
162  TR_KEY_isFinished,
163  TR_KEY_isIncoming,
164  TR_KEY_isPrivate,
165  TR_KEY_isStalled,
166  TR_KEY_isUTP,
167  TR_KEY_isUploadingTo,
168  TR_KEY_lastAnnouncePeerCount,
169  TR_KEY_lastAnnounceResult,
170  TR_KEY_lastAnnounceStartTime,
171  TR_KEY_lastAnnounceSucceeded,
172  TR_KEY_lastAnnounceTime,
173  TR_KEY_lastAnnounceTimedOut,
174  TR_KEY_lastScrapeResult,
175  TR_KEY_lastScrapeStartTime,
176  TR_KEY_lastScrapeSucceeded,
177  TR_KEY_lastScrapeTime,
178  TR_KEY_lastScrapeTimedOut,
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_id_ttl_hours,
222  TR_KEY_peer_limit,
223  TR_KEY_peer_limit_global,
224  TR_KEY_peer_limit_per_torrent,
225  TR_KEY_peer_port,
226  TR_KEY_peer_port_random_high,
227  TR_KEY_peer_port_random_low,
228  TR_KEY_peer_port_random_on_start,
229  TR_KEY_peer_socket_tos,
230  TR_KEY_peerIsChoked,
231  TR_KEY_peerIsInterested,
232  TR_KEY_peers,
233  TR_KEY_peers2,
234  TR_KEY_peers2_6,
235  TR_KEY_peers6,
236  TR_KEY_peersConnected,
237  TR_KEY_peersFrom,
238  TR_KEY_peersGettingFromUs,
239  TR_KEY_peersSendingToUs,
240  TR_KEY_percentDone,
241  TR_KEY_pex_enabled,
242  TR_KEY_piece,
243  TR_KEY_piece_length,
244  TR_KEY_pieceCount,
245  TR_KEY_pieceSize,
246  TR_KEY_pieces,
247  TR_KEY_play_download_complete_sound,
248  TR_KEY_port,
249  TR_KEY_port_forwarding_enabled,
250  TR_KEY_port_is_open,
251  TR_KEY_preallocation,
252  TR_KEY_prefetch_enabled,
253  TR_KEY_priorities,
254  TR_KEY_priority,
255  TR_KEY_priority_high,
256  TR_KEY_priority_low,
257  TR_KEY_priority_normal,
258  TR_KEY_private,
259  TR_KEY_progress,
260  TR_KEY_prompt_before_exit,
261  TR_KEY_queue_move_bottom,
262  TR_KEY_queue_move_down,
263  TR_KEY_queue_move_top,
264  TR_KEY_queue_move_up,
265  TR_KEY_queue_stalled_enabled,
266  TR_KEY_queue_stalled_minutes,
267  TR_KEY_queuePosition,
268  TR_KEY_rateDownload,
269  TR_KEY_rateToClient,
270  TR_KEY_rateToPeer,
271  TR_KEY_rateUpload,
272  TR_KEY_ratio_limit,
273  TR_KEY_ratio_limit_enabled,
274  TR_KEY_ratio_mode,
275  TR_KEY_recent_download_dir_1,
276  TR_KEY_recent_download_dir_2,
277  TR_KEY_recent_download_dir_3,
278  TR_KEY_recent_download_dir_4,
279  TR_KEY_recheckProgress,
280  TR_KEY_remote_session_enabled,
281  TR_KEY_remote_session_host,
282  TR_KEY_remote_session_password,
283  TR_KEY_remote_session_port,
284  TR_KEY_remote_session_requres_authentication,
285  TR_KEY_remote_session_username,
286  TR_KEY_removed,
287  TR_KEY_rename_partial_files,
288  TR_KEY_reqq,
289  TR_KEY_result,
290  TR_KEY_rpc_authentication_required,
291  TR_KEY_rpc_bind_address,
292  TR_KEY_rpc_enabled,
293  TR_KEY_rpc_password,
294  TR_KEY_rpc_port,
295  TR_KEY_rpc_url,
296  TR_KEY_rpc_username,
297  TR_KEY_rpc_version,
298  TR_KEY_rpc_version_minimum,
299  TR_KEY_rpc_whitelist,
300  TR_KEY_rpc_whitelist_enabled,
301  TR_KEY_scrape,
302  TR_KEY_scrape_paused_torrents_enabled,
303  TR_KEY_scrapeState,
304  TR_KEY_script_torrent_done_enabled,
305  TR_KEY_script_torrent_done_filename,
306  TR_KEY_seconds_active,
307  TR_KEY_secondsActive,
308  TR_KEY_secondsDownloading,
309  TR_KEY_secondsSeeding,
310  TR_KEY_seed_queue_enabled,
311  TR_KEY_seed_queue_size,
312  TR_KEY_seedIdleLimit,
313  TR_KEY_seedIdleMode,
314  TR_KEY_seedRatioLimit,
315  TR_KEY_seedRatioLimited,
316  TR_KEY_seedRatioMode,
317  TR_KEY_seederCount,
318  TR_KEY_seeding_time_seconds,
319  TR_KEY_session_count,
320  TR_KEY_sessionCount,
321  TR_KEY_show_backup_trackers,
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_start_minimized,
344  TR_KEY_startDate,
345  TR_KEY_status,
346  TR_KEY_statusbar_stats,
347  TR_KEY_tag,
348  TR_KEY_tier,
349  TR_KEY_time_checked,
350  TR_KEY_torrent_added,
351  TR_KEY_torrent_added_notification_command,
352  TR_KEY_torrent_added_notification_enabled,
353  TR_KEY_torrent_complete_notification_command,
354  TR_KEY_torrent_complete_notification_enabled,
355  TR_KEY_torrent_complete_sound_command,
356  TR_KEY_torrent_complete_sound_enabled,
357  TR_KEY_torrent_duplicate,
358  TR_KEY_torrent_get,
359  TR_KEY_torrent_set,
360  TR_KEY_torrent_set_location,
361  TR_KEY_torrentCount,
362  TR_KEY_torrentFile,
363  TR_KEY_torrents,
364  TR_KEY_totalSize,
365  TR_KEY_total_size,
366  TR_KEY_tracker_id,
367  TR_KEY_trackerAdd,
368  TR_KEY_trackerRemove,
369  TR_KEY_trackerReplace,
370  TR_KEY_trackerStats,
371  TR_KEY_trackers,
372  TR_KEY_trash_can_enabled,
373  TR_KEY_trash_original_torrent_files,
374  TR_KEY_umask,
375  TR_KEY_units,
376  TR_KEY_upload_slots_per_torrent,
377  TR_KEY_uploadLimit,
378  TR_KEY_uploadLimited,
379  TR_KEY_uploadRatio,
380  TR_KEY_uploadSpeed,
381  TR_KEY_upload_only,
382  TR_KEY_uploaded,
383  TR_KEY_uploaded_bytes,
384  TR_KEY_uploadedBytes,
385  TR_KEY_uploadedEver,
386  TR_KEY_url_list,
387  TR_KEY_use_global_speed_limit,
388  TR_KEY_use_speed_limit,
389  TR_KEY_user_has_given_informed_consent,
390  TR_KEY_ut_comment,
391  TR_KEY_ut_holepunch,
392  TR_KEY_ut_metadata,
393  TR_KEY_ut_pex,
394  TR_KEY_ut_recommend,
395  TR_KEY_utp_enabled,
396  TR_KEY_v,
397  TR_KEY_version,
398  TR_KEY_wanted,
399  TR_KEY_warning_message,
400  TR_KEY_watch_dir,
401  TR_KEY_watch_dir_enabled,
402  TR_KEY_webseeds,
403  TR_KEY_webseedsSendingToUs,
404  TR_N_KEYS
405};
406
407/**
408 * Find the quark that matches the specified string
409 *
410 * @return true if the specified string exists as a quark
411 */
412bool tr_quark_lookup (const void * str, size_t len, tr_quark * setme);
413
414/**
415 * Get the string that corresponds to the specified quark
416 */
417const char * tr_quark_get_string (tr_quark quark, size_t * len);
418
419/**
420 * Create a new quark for the specified string. If a quark already
421 * exists for that string, it is returned so that no duplicates are
422 * created.
423 */
424tr_quark tr_quark_new (const void * str, size_t len);
425
426/***
427****
428***/
429
430#ifdef __cplusplus
431}
432#endif
433
Note: See TracBrowser for help on using the repository browser.