Crate transmission_sys
source ·Structs
@brief Structure holding error information.
@brief a part of tr_info that represents a single file of the torrent’s content
@brief information about a torrent that comes from its metainfo file
tr_peer_stat
@brief a part of tr_info that represents a single piece of the torrent’s content
@brief Used by tr_sessionGetStats () and tr_sessionGetCumulativeStats ()
@brief Used by tr_torrentStat () to tell clients about a torrent’s state and statistics
@brief a part of tr_info that represents a single tracker
Constants
Statics
Functions
time⚠
@brief convenience function to determine if an address is an IP address (IPv4 or IPv6)
Specify a range of IPs for Transmission to block.
@brief The blocklist that ges updated when an RPC client
invokes the “blocklist-update” method
@brief build a filename from a series of elements using the
platform’s correct directory separator.
@brief Free a torrent constructor object
@brief Get the torrent’s bandwidth priority.
@brief Get the “delete .torrent file” flag from this peer constructor
@brief Get the download path from this peer constructor
@brief Get the incomplete directory from this peer constructor
@brief Get the metainfo from this peer constructor
@brief Get the “isPaused” flag from this peer constructor
@brief Get this peer constructor’s peer limit
@brief Get the tr_session poiner from this peer constructor
@brief Get the .torrent file that this ctor’s metainfo came from,
or NULL if tr_ctorSetMetainfoFromFile () wasn’t used
@brief Create a torrent constructor object used to instantiate a tr_torrent
@param session the tr_session. This is required if you’re going to call
tr_torrentNew (), but you can use NULL for tr_torrentParse ().
@see tr_torrentNew (), tr_torrentParse ()
@brief Set the torrent’s bandwidth priority.
@brief Set whether or not to delete the source .torrent file
when the torrent is added. (Default: False)
@brief Set the download folder for the torrent being added with this ctor.
@see tr_ctorSetDownloadDir ()
@see tr_sessionInit ()
@brief Set the priorities for files in a torrent
@brief Set the download flag for files in a torrent
@brief Set the incompleteDir for this torrent.
@brief Set the constructor’s metainfo from a raw benc already in memory
@brief Set the constructor’s metainfo from a local .torrent file
@brief Set the metainfo from an existing file in tr_getTorrentDir ().
@brief Set the constructor’s metainfo from a magnet link
Set whether or not the torrent begins downloading/seeding when created.
(Default: not paused)
@brief Set how many peers this torrent can connect to. (Default: 50)
@brief Get environment variable value as int.
@brief Get environment variable value as string (should be freed afterwards).
@brief Check if environment variable exists.
@brief Clear error object.
@brief Free memory used by error object.
@brief Create new error object using
printf
-style formatting.@brief Create new error object using literal error message.
@brief Create new error object using
vprintf
-style formatting.@brief Prefix message of exising error object.
@brief Propagate existing error object upwards.
@brief Prefix message and propagate existing error object upwards.
@brief Create and set new error object using
printf
-style formatting.@brief Create and set new error object using literal error message.
@brief Portability wrapper around free () in which `NULL’ is a safe argument
@brief returns Transmission’s default configuration file directory.
@brief returns Transmisson’s default download directory.
@brief Get available disk space (in bytes) for the specified folder.
@return zero or positive integer on success, -1 in case of error.
@brief return TR_RATIO_NA, TR_RATIO_INF, or a number in [0..1]
@return TR_RATIO_NA, TR_RATIO_INF, or a number in [0..1]
@brief similar to getopt ()
@return TR_GETOPT_DONE, TR_GETOPT_ERR, TR_GETOPT_UNK, or the matching tr_option’s `val’ field
@brief prints the `Usage’ help section to stdout
@brief Portability wrapper for gettimeofday (), with tz argument dropped
@brief Portability wrapper for htonll () that uses the system implementation if available
@brief Loads a file and returns its contents.
On failure, NULL is returned and errno is set.
@brief Portability wrapper for localtime_r () that uses the system implementation if available
@brief similar to bsearch () but returns the index of the lower bound
@brief create a new .torrent file
@brief Portability wrapper around malloc () in which `0’ is a safe argument
@brief Portability wrapper around calloc () in which `0’ is a safe argument
@brief make a newly-allocated copy of a chunk of memory
@param src the memory to copy
@param byteCount the number of bytes to copy
@return a newly-allocated copy of `src’ that can be freed with tr_free ()
@brief Portability wrapper for memmem () that uses the system implementation if available
Call this before tr_makeMetaInfo() to override the builder.pieceSize
and builder.pieceCount values that were set by tr_metainfoBuilderCreate()
@brief free a metainfo
@see tr_torrentParse
@brief move a file
@return
True
on success, false
otherwise (with error
set accordingly).@brief Portability wrapper for htonll () that uses the system implementation if available
@brief Given a string like “1-4” or “1-4,6,9,14-51”, this returns a
newly-allocated array of all the integers in the set.
@return a newly-allocated array of integers that must be freed with tr_free (),
or NULL if a fragment of the string can’t be parsed.
Get the string that corresponds to the specified quark
Find the quark that matches the specified string
Create a new quark for the specified string. If a quark already
exists for that string, it is returned so that no duplicates are
created.
@brief moves the best k items to the first slots in the array. O(n)
@brief Portability wrapper around reallocf () in which `0’ is a safe argument
@brief convenience function to remove an item from an array
@brief End a libtransmission session
@see tr_sessionInit ()
@brief Return the session’s configuration directory.
@brief Get cumulative bandwidth statistics for current and past sessions
Add libtransmission’s default settings to the benc dictionary.
@brief Get available disk space (in bytes) for the specified directory.
@return zero or positive integer on success, -1 in case of error.
@brief Get the default download folder for new torrents.
@brief get the per-session incomplete download folder
@brief Return true if we’re limiting how many torrents can concurrently download (TR_DOWN) or seed (TR_UP) at the same time
@brief Return the number of torrents allowed to download (if direction is TR_DOWN) or seed (if direction is TR_UP) at the same time
@return true if we’re torrents idle for over N minutes will be flagged as ‘stalled’
@return the number of minutes a torrent can be idle before being considered as stalled
@brief get the password used to restrict RPC requests.
@return the password string.
@see tr_sessionInit ()
@see tr_sessionSetRPCPassword ()
@brief Get which port to listen for RPC requests on.
@see tr_sessionInit ()
@see tr_sessionSetRPCPort
@brief Get the base URL.
@see tr_sessionInit ()
@see tr_sessionSetRPCUrl
@brief get the Access Control List for allowing/denying RPC requests.
@return a comma-separated string of whitelist domains.
@see tr_sessionInit
@see tr_sessionSetRPCWhitelist
Add the session’s current configuration settings to the benc dictionary.
@brief Get bandwidth use statistics for the current session
@brief Initialize a libtransmission session.
@brief get whether or not the incomplete download folder is enabled
@brief return true if files will end in “.part” until they’re complete
@brief Get whether or not RPC calls are allowed in this session.
@see tr_sessionInit ()
@see tr_sessionSetRPCEnabled ()
Load settings from the configuration directory’s settings.json file,
using libtransmission’s default settings as fallbacks for missing keys.
Load all the torrents in tr_getTorrentDir ().
This can be used at startup to kickstart all the torrents
from the previous session.
@brief Rescan the blocklists directory and
reload whatever blocklist files are found there
Add the session’s configuration settings to the benc dictionary
and save it to the configuration directory’s settings.json file.
@brief Update a session’s settings from a benc dictionary
like to the one used in tr_sessionInit ()
Alternative speed limits that are used during scheduled times
@brief Set the per-session default download folder for new torrents.
@see tr_sessionInit ()
@see tr_sessionGetDownloadDir ()
@see tr_ctorSetDownloadDir ()
@brief set the per-session incomplete download folder.
@brief enable or disable use of the incomplete download folder
@brief When enabled, newly-created files will have “.part” appended
to their filename until the file is fully downloaded
@brief Set whether or not torrents are allowed to do peer exchanges.
Incoming Peer Connections Port
@brief Set whether or not to limit how many torrents can download (TR_DOWN) or seed (TR_UP) at the same time
@brief Set the number of torrents allowed to download (if direction is TR_DOWN) or seed (if direction is TR_UP) at the same time
@brief Set whether or not to count torrents idle for over N minutes as ‘stalled’
@brief Consider torrent as ‘stalled’ when it’s been inactive for N minutes.
Stalled torrents are left running but are not counted by tr_sessionGetQueueSize ().
Register to be notified whenever something is changed via RPC,
such as a torrent being added, removed, started, stopped, etc.
@brief Set whether or not RPC calls are allowed in this session.
@brief Specify which port to listen for RPC requests on.
@see tr_sessionInit ()
@see tr_sessionGetRPCPort
@brief Specify which base URL to use.
@brief Specify a whitelist for remote RPC access
Primary session speed limits
@brief Portability wrapper for snprintf () that uses the system implementation if available
@brief Returns true if the string ends with the specified case-insensitive suffix
@brief like strcmp () but gracefully handles NULL strings
@brief make a newly-allocated copy of a string
@param in is a void* so that callers can pass in both signed & unsigned without a cast
@return a newly-allocated copy of `in’ that can be freed with tr_free ()
@brief sprintf () a string into a newly-allocated buffer large enough to hold it
@return a newly-allocated string that can be freed with tr_free ()
@brief Convenience wrapper around strerorr () guaranteed to not return NULL
@param errno
@brief Portability wrapper for strlcpy () that uses the system implementation if available
@brief make a newly-allocated copy of a substring
@param in is a void* so that callers can pass in both signed & unsigned without a cast
@param len length of the substring to copy. if a length less than zero is passed in, strlen (len) is used
@return a newly-allocated copy of `in’ that can be freed with tr_free ()
@param buf the buffer to write the string to
@param buflef buf’s size
@param ratio the ratio to convert to a string
@param the string represntation of “infinity”
@brief Portability wrapper for strsep () that uses the system implementation if available
@brief strips leading and trailing whitspace from a string
@return the stripped string
@brief Portability wrapper for
closedir ()
.@brief Like
mkdir ()
, but makes parent directories if needed.@brief Portability wrapper for
mkdtemp ()
.@brief Portability wrapper for
getcwd ()
.@brief Portability wrapper for
opendir ()
.@brief Portability wrapper for
readdir ()
.@brief Portability wrapper for
close ()
.@brief Portability wrapper for
fsync ()
.@brief Portability wrapper for
fstat ()
.@brief Get handle to one of standard I/O files.
@brief Portability wrapper for
mmap ()
for files.@brief Portability wrapper for
open ()
.@brief Portability wrapper for
mkstemp ()
.@brief Preallocate file to specified size in full or sparse mode.
@brief Tell system to prefetch some part of file which is to be read soon.
@brief Portability wrapper for
read ()
.@brief Like
pread ()
, except that the position is undefined afterwards.
Not thread-safe.@brief Portability wrapper for
fgets ()
, removing EOL internally.@brief Portability wrapper for
lseek ()
.@brief Portability wrapper for
ftruncate ()
.@brief Portability wrapper for
munmap ()
for files.@brief Portability wrapper for
write ()
.@brief Like
pwrite ()
, except that the position is undefined afterwards.
Not thread-safe.@brief Portability wrapper for
fprintf ()
.@brief Portability wrapper for
fputs ()
, appending EOL internally.@brief Portability wrapper for
basename ()
.@brief Portability wrapper for
dirname ()
.@brief Portability wrapper for
access ()
.@brief Portability wrapper for
stat ()
.@brief Check whether path is relative.
@brief Test to see if the two filenames point to the same file.
@brief Portability wrapper for
remove ()
.@brief Portability wrapper for
rename ()
.@brief Portability wrapper for
realpath ()
.@brief return the current date in milliseconds
@brief Convenience wrapper around timer_add () to have a timer wake up in a number of seconds and microseconds
@param timer
@param seconds
@param microseconds
@brief Convenience wrapper around timer_add () to have a timer wake up in a number of milliseconds
@param timer
@param milliseconds
tr_torrentAvailability
@brief find the location of a torrent’s file by looking with and without
the “.part” suffix, looking in downloadDir and incompleteDir, etc.
@return a newly-allocated string (that must be tr_freed () by the caller
when done) that gives the location of this file on disk,
or NULL if no file exists yet.
@param tor the torrent whose file we’re looking for
@param fileNum the fileIndex, in [0…tr_info.fileCount)
@brief Convenience function similar to tr_torrentFindFromHash ()
Returns the root directory of where the torrent is.
@brief Get this torrent’s file priorities.
@brief Return the queued torrent’s position in the queue it’s in. [0…n)
@brief Returns this torrent’s unique ID.
MANUAL ANNOUNCE
@return this torrent’s name.
Instantiate a single torrent.
@brief Parses the specified metainfo
@brief Removes our .torrent and .resume files for this torrent
@brief Rename a file or directory in a torrent.
@deprecated
@deprecated
@brief Modify a torrent’s tracker list.
Register to be notified whenever a torrent’s “completeness”
changes. This will be called, for example, when a torrent
finishes downloading and changes from TR_LEECH to
either TR_SEED or TR_PARTIAL_SEED.
@deprecated
@brief Set a batch of files to be downloaded or not.
@brief Set a batch of files to a particular priority.
Register to be notified whenever a torrent’s idle limit
has been hit. This will be called when the seeding torrent’s
idle time has met or exceeded the designated idle limit.
@brief Tell transmsision where to find this torrent’s local data.
Register to be notified whenever a torrent changes from
having incomplete metadata to having complete metadata.
This happens when a magnet link finishes downloading
metadata from its peers.
Peer Limits
@brief Set the queued torrent’s position in the queue it’s in.
Special cases: pos <= 0 moves to the front; pos >= queue length moves to the back
@brief Set a callback that is invoked when the queue starts a torrent
Register to be notified whenever a torrent’s ratio limit
has been hit. This will be called when the torrent’s
ul/dl ratio has met or exceeded the designated ratio limit.
Torrent speed limits
@brief Start a torrent
@brief Like tr_torrentStart (), but resumes right away regardless of the queues.
Return a pointer to an tr_stat structure with updated information
on the torrent. This is typically called by the GUI clients every
second or so to get a new snapshot of the torrent’s status.
Like tr_torrentStat (), but only recalculates the statistics if it’s
been longer than a second since they were last calculated. This can
reduce the CPU load if you’re calling tr_torrentStat () frequently.
@brief Stop (pause) a torrent
Queue a torrent for verification.
@brief get the download speeds for each of this torrent’s webseed sources.
@brief Convenience function for moving a batch of torrents to the back of their queue (s)
@brief Convenience function for moving a batch of torrents back one step in their queue (s)
@brief Convenience function for moving a batch of torrents to the front of their queue (s)
@brief Convenience function for moving a batch of torrents ahead one step in their queue (s)
@brief truncate a double value at a given number of decimal places.
@brief return true if the url is a [ http, https, ftp, sftp ] url that Transmission understands
@brief return true if the url is a http or https or UDP url that Transmission understands
@brief parse a URL into its component parts
@return True on success or false if an error occurred
@brief make a copy of ‘str’ whose non-utf8 content has been corrected or stripped
@return a newly-allocated string that must be freed with tr_free ()
@param str the string to make a clean copy of
@param len the length of the string to copy. If -1, the entire string is used.
@brief sleep the specified number of milliseconds
@brief Rich Salz’s classic implementation of shell-style pattern matching for ?, , [], and * characters.
@return 1 if the pattern matches, 0 if it doesn’t, or -1 if an error occured
Type Definitions
File Priorities
@addtogroup tr_ctor Torrent Constructors
@{
@addtogroup tr_torrent Torrents
@{
Idle Time Limits
Message Logging
Ratio Limits
@addtogroup tr_variant Variant
@brief Platform-specific directory descriptor type.
@brief Platform-specific file descriptor type.
What the torrent is doing right now.
@param wasRunning whether or not the torrent was running when
it changed its completeness state
tr_tracker_stat
Serialization / Deserialization
Callback function invoked when a torrent finishes being verified.