-
Notifications
You must be signed in to change notification settings - Fork 8
/
transmission-2.0.vapi
2406 lines (2147 loc) · 73.9 KB
/
transmission-2.0.vapi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[CCode (cheader_filename = "libtransmission/transmission.h", lower_case_cprefix = "tr_", cprefix = "TR_")]
namespace Transmission {
[CCode (cname = "TR_SHA_DIGEST_LENGTH")]
public const int SHA_DIGEST_LENGTH;
[CCode (cname = "TR_INET6_ADDRSTRLEN")]
public const int INET6_ADDRSTRLEN;
[CCode (cname = "TR_RPC_SESSION_ID_HEADER")]
public const string RPC_SESSION_ID_HEADER;
[SimpleType]
[CCode (cname = "tr_file_index", has_type_id = false)]
public struct file_index : uint32 {}
//TODO unused
[CCode (cname = "tr_preallocation_mode", cprefix = "TR_PREALLOCATE_", has_type_id = false)]
public enum PreallocationMode {
NONE,
SPARSE,
FULL
}
[CCode (cname = "tr_encryption_mode", cprefix = "TR_", has_type_id = false)]
public enum EncryptionMode {
CLEAR_PREFERRED,
ENCRYPTION_PREFERRED,
ENCRYPTION_REQUIRED
}
/**
* Transmission's default configuration file directory.
*
* The default configuration directory is determined this way:
* # If the TRANSMISSION_HOME environment variable is set, its value is used.
* # On Darwin, "${HOME}/Library/Application Support/${appname}" is used.
* # On Windows, "${CSIDL_APPDATA}/${appname}" is used.
* # If XDG_CONFIG_HOME is set, "${XDG_CONFIG_HOME}/${appname}" is used.
* # ${HOME}/.config/${appname}" is used as a last resort.
*/
[CCode (cname = "tr_getDefaultConfigDir")]
public unowned string get_default_config_dir (string appname);
/**
* Transmisson's default download directory.
*
* The default download directory is determined this way:
* # If the HOME environment variable is set, "${HOME}/Downloads" is used.
* # On Windows, "${CSIDL_MYDOCUMENTS}/Downloads" is used.
* # Otherwise, getpwuid(getuid())->pw_dir + "/Downloads" is used.
*/
[CCode (cname = "tr_getDefaultDownloadDir")]
public unowned string get_default_download_dir ();
[CCode (cprefix = "TR_DEFAULT_")]
namespace Defaults {
public const string BIND_ADDRESS_IPV4;
public const string BIND_ADDRESS_IPV6;
public const string RPC_WHITELIST;
public const string RPC_PORT_STR;
public const string RPC_URL_STR;
public const string PEER_PORT_STR;
public const string PEER_SOCKET_TOS_STR;
public const string PEER_LIMIT_GLOBAL_STR;
public const string PEER_LIMIT_TORRENT_STR;
}
[CCode (cprefix = "TR_PREFS_KEY_")]
namespace Prefs {
public const string ALT_SPEED_ENABLED;
public const string ALT_SPEED_UP_KBps;
public const string ALT_SPEED_DOWN_KBps;
public const string ALT_SPEED_TIME_BEGIN;
public const string ALT_SPEED_TIME_ENABLED;
public const string ALT_SPEED_TIME_END;
public const string ALT_SPEED_TIME_DAY;
public const string BIND_ADDRESS_IPV4;
public const string BIND_ADDRESS_IPV6;
public const string BLOCKLIST_ENABLED;
public const string BLOCKLIST_URL;
public const string MAX_CACHE_SIZE_MB;
public const string DHT_ENABLED;
public const string UTP_ENABLED;
public const string LPD_ENABLED;
public const string PREFETCH_ENABLED;
public const string DOWNLOAD_DIR;
public const string ENCRYPTION;
public const string IDLE_LIMIT;
public const string IDLE_LIMIT_ENABLED;
public const string INCOMPLETE_DIR;
public const string INCOMPLETE_DIR_ENABLED;
public const string MSGLEVEL;
public const string PEER_LIMIT_GLOBAL;
public const string PEER_LIMIT_TORRENT;
public const string PEER_PORT;
public const string PEER_PORT_RANDOM_ON_START;
public const string PEER_PORT_RANDOM_LOW;
public const string PEER_PORT_RANDOM_HIGH;
public const string PEER_SOCKET_TOS;
public const string PEER_CONGESTION_ALGORITHM;
public const string PEX_ENABLED;
public const string PORT_FORWARDING;
public const string PREALLOCATION;
public const string RATIO;
public const string RATIO_ENABLED;
public const string RENAME_PARTIAL_FILES;
public const string RPC_AUTH_REQUIRED;
public const string RPC_BIND_ADDRESS;
public const string RPC_ENABLED;
public const string RPC_PASSWORD;
public const string RPC_PORT;
public const string RPC_USERNAME;
public const string RPC_URL;
public const string RPC_WHITELIST_ENABLED;
public const string SCRAPE_PAUSED_TORRENTS;
public const string SCRIPT_TORRENT_DONE_FILENAME;
public const string SCRIPT_TORRENT_DONE_ENABLED;
public const string RPC_WHITELIST;
public const string DSPEED_KBps;
public const string DSPEED_ENABLED;
public const string USPEED_KBps;
public const string USPEED_ENABLED;
public const string UMASK;
public const string UPLOAD_SLOTS_PER_TORRENT;
public const string START;
public const string TRASH_ORIGINAL;
}
/**
* Add libtransmission's default settings to the {@link benc} dictionary.
*/
[CCode (cname = "tr_sessionGetDefaultSettings")]
public void get_default_settings (out benc_dict dictionary);
/**
* Load settings from the configuration directory's settings.json file, using libtransmission's default settings as fallbacks for missing keys.
*
* @param dictionary where to put settings
* @param config_dir the configuration directory to find settings.json
* @param app_name if configDir is empty, appName is used to find the default dir.
* @return success true if the settings were loaded, false otherwise
*/
[CCode (cname = "tr_sessionLoadSettings")]
public bool load_default_settings (out benc_dict dictionary, string config_dir, string app_name);
[CCode (cheader_filename = "libtransmission/transmission.h,libtransmission/bencode.h", cprefix = "TR_FMT_", cname = "tr_fmt_mode", has_type_id = false)]
public enum BencFormat {
BENC,
JSON,
JSON_LEAN
}
/**
* Variant data storage
*
* An object that acts like a union for integers, strings, lists, dictionaries, booleans, and floating-point numbers. The structure is named benc due to the historical reason that it was originally tightly coupled with bencoded data. It currently supports being parsed from, and serialized to, both bencoded notation and json notation.
*
*/
[CCode (cheader_filename = "libtransmission/transmission.h,libtransmission/bencode.h", cname = "tr_benc", free_function = "tr_bencFree", has_type_id = false)]
public struct benc {
[CCode (cname = "tr_bencLoadFile")]
public static int load_file (out benc benc, BencFormat mode, string filename);
[CCode (cname = "tr_bencParse")]
public static int parse (void* buf, void* buffend, out benc benc, out unowned uint8[] end);
[CCode (cname = "tr_bencLoad")]
public static int load ([CCode (array_lengh_type = "size_t")] uint8[] buf, out benc benc, out unowned uint8[] end);
[CCode (cname = "tr_bencInitStr")]
public benc.str ([CCode (array_lengh_type = "int")] char[] raw);
[CCode (cname = "tr_bencInitRaw")]
public benc.raw ([CCode (array_lengh_type = "size_t")] uint8[] raw);
[CCode (cname = "tr_bencInitInt")]
public benc.int(int64 num);
[CCode (cname = "tr_bencInitBool")]
public benc.bool(int val);
[CCode (cname = "tr_bencInitReal")]
public benc.real (double val);
[CCode (cname = "tr_bencToFile")]
public int to_file (BencFormat mode, string filename);
[CCode (cname = "tr_bencToStr", array_length_pos = 1.9)]
public uint8[] to_string (BencFormat mode);
/**
* Get an int64 from a variant object
*
* @return true if successful, or false if the variant could not be represented as an int64
*/
[CCode (cname = "tr_bencGetInt")]
public bool get_int (out int64 val);
/**
* Get an string from a variant object
*
* @return true if successful, or false if the variant could not be represented as a string
*/
[CCode (cname = "tr_bencGetStr")]
public bool get_str (out string val);
/**
* Get a raw byte array from a variant object
*
* @return true if successful, or false if the variant could not be represented as a raw byte array
*/
[CCode (cname = "tr_bencGetRaw")]
public bool get_raw ([CCode (array_lengh_type = "size_t")] out uint8[] raw);
/**
* Get a boolean from a variant object
*
* @return true if successful, or false if the variant could not be represented as a boolean
*/
[CCode (cname = "tr_bencGetBool")]
public bool get_bool (out bool val);
/**
* Get a floating-point number from a variant object
*
* @return true if successful, or false if the variant could not be represented as a floating-point number
*/
[CCode (cname = "tr_bencGetReal")]
public bool GetReal (out double val);
[CCode (cname = "tr_bencIsInt")]
public bool is_int ();
[CCode (cname = "tr_bencIsDict")]
public bool is_dict ();
[CCode (cname = "tr_bencIsList")]
public bool is_list ();
[CCode (cname = "tr_bencIsString")]
public bool is_string ();
[CCode (cname = "tr_bencIsBool")]
public bool is_bool ();
[CCode (cname = "tr_bencIsReal")]
public bool is_real ();
}
[CCode (cheader_filename = "libtransmission/transmission.h,libtransmission/bencode.h", cname = "tr_benc", free_function = "tr_bencFree", has_type_id = false)]
public struct benc_list : benc {
[CCode (cname = "tr_bencInitList")]
public benc_list (size_t reserveCount);
[CCode (cname = "tr_bencListReserve")]
public int set_reserve (size_t reserve_count);
[CCode (cname = "tr_bencListAdd")]
public unowned benc? add_list ();
[CCode (cname = "tr_bencListAddBool")]
public unowned benc list_add_bool (bool val);
[CCode (cname = "tr_bencListAddInt")]
public unowned benc list_add_int (int64 val);
[CCode (cname = "tr_bencListAddReal")]
public unowned benc ListAddReal (double val);
[CCode (cname = "tr_bencListAddStr")]
public unowned benc ListAddStr (string val);
[CCode (cname = "tr_bencListAddRaw")]
public unowned benc ListAddRaw ([CCode (array_lengh_type = "size_t")] uint8[] val);
[CCode (cname = "tr_bencListAddList")]
public unowned benc ListAddList (size_t reserveCount);
[CCode (cname = "tr_bencListAddDict")]
public unowned benc ListAddDict (size_t reserveCount);
public size_t size {
[CCode (cname = "tr_bencListSize")]
get;
}
[CCode (cname = "tr_bencListChild")]
public unowned benc? get (size_t n);
[CCode (cname = "tr_bencListRemove")]
public bool remove (size_t n);
}
[CCode (cheader_filename = "libtransmission/transmission.h,libtransmission/bencode.h", cname = "tr_benc", free_function = "tr_bencFree", has_type_id = false)]
public struct benc_dict : benc {
[CCode (cname = "tr_bencInitDict")]
public benc_dict (size_t reserve_count);
[CCode (cname = "tr_bencDictReserve")]
public bool set_reserve (size_t reserve_count);
[CCode (cname = "tr_bencDictRemove")]
public bool remove (string key);
[CCode (cname = "tr_bencDictAdd")]
public unowned benc? add (string key);
[CCode (cname = "tr_bencDictAddReal")]
public unowned benc? add_real (string key, double val);
[CCode (cname = "tr_bencDictAddInt")]
public unowned benc? add_int (string key, int64 val);
[CCode (cname = "tr_bencDictAddBool")]
public unowned benc? add_bool (string key, bool val);
[CCode (cname = "tr_bencDictAddStr")]
public unowned benc? add_str (string key, string val);
[CCode (cname = "tr_bencDictAddList")]
public unowned benc? add_list (string key, size_t reserve);
[CCode (cname = "tr_bencDictAddDict")]
public unowned benc? add_dict (string key, size_t reserve);
[CCode (cname = "tr_bencDictAddRaw")]
public unowned benc? add_raw (string key, [CCode (array_lengh_type = "size_t")] uint8[] raw);
[CCode (cname = "tr_bencDictChild")]
public bool get_child (size_t i, out string key, out benc? val);
[CCode (cname = "tr_bencDictFind")]
public unowned benc? get (string key);
[CCode (cname = "tr_bencDictFindList")]
public bool find_list (string key, out unowned benc? val);
[CCode (cname = "tr_bencDictFindDict")]
public bool find_doc (string key, out unowned benc? val);
[CCode (cname = "tr_bencDictFindInt")]
public bool find_int (string key, out int64 val);
[CCode (cname = "tr_bencDictFindReal")]
public bool find_real (string key, out double val);
[CCode (cname = "tr_bencDictFindBool")]
public bool find_bool (string key, out bool val);
[CCode (cname = "tr_bencDictFindStr")]
public bool find_str (string key, out unowned string? val);
[CCode (cname = "tr_bencDictFindRaw")]
public bool find_raw (string key, [CCode (array_lengh_type = "size_t")] out uint8[]? raw);
}
[CCode (cname = "tr_session", cprefix = "tr_session", free_function = "tr_sessionClose", has_type_id = false)]
[Compact]
public class Session {
/**
* Add the session's current configuration settings to the benc dictionary.
*/
[CCode (cname = "tr_sessionGetSettings")]
public void get_settings (benc_dict dictionary);
/**
* Add the session's configuration settings to the benc dictionary and save it to the configuration directory's settings.json file.
*/
[CCode (cname = "tr_sessionSaveSettings")]
public void save_settings (string config_dir, benc_dict dictonary);
/**
* Initialize a libtransmission session.
*
* @param tag "gtk", "macosx", "daemon", etc... this is only for pre-1.30 resume files
* @param config_dir where Transmission will look for resume files, blocklists, etc.
* @param message_queueing if false, messages will be dumped to stderr
* @param settings libtransmission settings
*/
[CCode (cname = "tr_sessionInit")]
public Session (string tag, string config_dir, bool message_queueing, benc settings);
/**
* Update a session's settings from a benc dictionary.
*/
[CCode (cname = "tr_sessionSet")]
public void update_settings (benc_dict settings);
/**
* Rescan the blocklists directory and reload whatever blocklist files are found there
*/
[CCode (cname = "tr_sessionReloadBlocklists")]
public void reload_block_lists ();
/**
* The session's configuration directory.
*
* This is where transmission stores its .torrent files, .resume files, blocklists, etc. It's set during initialisation and is immutable during the session.
*/
public string config_dir {
[CCode (cname = "tr_sessionGetConfigDir")]
get;
}
/**
* The per-session default download folder for new torrents.
*
* This can be overridden on a per-torrent basis by {@link TorrentConstructor.set_download_dir}.
*/
public string download_dir {
[CCode (cname = "tr_sessionSetDownloadDir")]
set;
[CCode (cname = "tr_sessionGetDownloadDir")]
get;
}
/**
* The per-session incomplete download folder.
*
* When you add a new torrent and the session's incomplete directory is enabled, the new torrent will start downloading into that directory, and then be moved to downloadDir when the torrent is finished downloading.
*
* Torrents aren't moved as a result of changing the session's incomplete dir -- it's applied to new torrents, not existing ones.
*
* {@link Torrent.set_location} overrules the incomplete dir: when a user specifies a new location, that becomes the torrent's new downloadDir and the torrent is moved there immediately regardless of whether or not it's complete.
*/
public string incomplete_dir {
[CCode (cname = "tr_sessionSetIncompleteDir")]
set;
[CCode (cname = "tr_sessionGetIncompleteDir")]
get;
}
/**
* Use of the incomplete download folder
*/
public bool use_incomplete_dir {
[CCode (cname = "tr_seesionSetIncompleteDirEnabled")]
set;
[CCode (cname = "tr_sessionIsIncompleteDirEnabled")]
get;
}
/**
* If files will end in ".part" until they're complete
*
* When enabled, newly-created files will have ".part" appended to their filename until the file is fully downloaded
*
* This is not retroactive -- toggling this will not rename existing files. It only applies to new files created by Transmission after this API call.
*/
public bool incomplete_file_naming {
[CCode (cname = "tr_sessionSetIncompleteFileNamingEnabled")]
set;
[CCode (cname = "tr_sessionIsIncompleteFileNamingEnabled")]
get;
}
/**
* Whether or not RPC calls are allowed in this session.
*
* If true, libtransmission will open a server socket to listen for incoming http RPC requests as described in docs/rpc-spec.txt.
*/
public bool rpc_enabled {
[CCode (cname = "tr_sessionSetRPCEnabled")]
set;
[CCode (cname = "tr_sessionIsRPCEnabled")]
get;
}
/**
* Listen port for RPC requests on.
*/
public uint32 rpc_port {
[CCode (cname = "tr_sessionGetRPCPort")]
get;
[CCode (cname = "tr_sessionSetRPCPort")]
set;
}
/**
* Which base URL to use.
*
* The RPC API is accessible under $url/rpc, the web interface under $url/web.
*/
public string rpc_url {
[CCode (cname = "tr_sessionGetRPCUrl")]
get;
[CCode (cname = "tr_sessionSetRPCUrl")]
set;
}
/**
* A whitelist for remote RPC access
*
* The whitelist is a comma-separated list of dotted-quad IP addresses to be allowed. Wildmat notation is supported, meaning that '?' is interpreted as a single-character wildcard and '*' is interprted as a multi-character wildcard.
*/
public string rpc_whitelist {
[CCode (cname = "tr_sessionGetRPCWhitelist")]
get;
[CCode (cname = "tr_sessionSetRPCWhitelist")]
set;
}
public bool rpc_whitelist_enabled {
[CCode (cname = "tr_sessionSetRPCWhitelistEnabled")]
set;
[CCode (cname = "tr_sessionGetRPCWhitelistEnabled")]
get;
}
public string rpc_password {
[CCode (cname = "tr_sessionSetRPCPassword")]
set;
[CCode (cname = "tr_sessionGetRPCPassword")]
get;
}
public string rpc_username {
[CCode (cname = "tr_sessionSetRPCUsername")]
set;
[CCode (cname = "tr_sessionGetRPCUsername")]
get;
}
public bool rpc_password_enabled {
[CCode (cname = "tr_sessionSetRPCPasswordEnabled")]
set;
[CCode (cname = "tr_sessionIsRPCPasswordEnabled")]
get;
}
public string rpc_bind_address {
[CCode (cname = "tr_sessionGetRPCBindAddress")]
get;
}
/**
* Register to be notified whenever something is changed via RPC, such as a torrent being added, removed, started, stopped, etc.
*
* The function is invoked FROM LIBTRANSMISSION'S THREAD! This means the function must be fast (to avoid blocking peers), shouldn't call libtransmission functions (to avoid deadlock), and shouldn't modify client-level memory without using a mutex!
*/
public Callback rpc_callback {
[CCode (cname = "tr_sessionSetRPCCallback")]
set;
[CCode (cname = "tr_sessionGetRPCCallback")]
get;
}
/**
* Get bandwidth use statistics for the current session
*/
[CCode (cname = "tr_sessionGetStats")]
public void get_stats (out Stats stats);
/**
* Get cumulative bandwidth statistics for current and past sessions
*/
[CCode (cname = "tr_sessionGetCumulativeStats")]
public void get_cumulative_stats (out Stats stats);
[CCode (cname = "tr_sessionClearStats")]
public void clear_stats ();
/**
* Set whether or not torrents are allowed to do peer exchanges.
*
* PEX is always disabled in private torrents regardless of this. In public torrents, PEX is enabled by default.
*/
public bool pex_enabled {
[CCode (cname = "tr_sessionSetPexEnabled")]
set;
[CCode (cname = "tr_sessionIsPexEnabled")]
get;
}
public bool dht_enabled {
[CCode (cname = "tr_sessionSetDHTEnabled")]
set;
[CCode (cname = "tr_sessionIsDHTEnabled")]
get;
}
public bool utp_enabled {
[CCode (cname = "tr_sessionSetUTPEnabled")]
set;
[CCode (cname = "tr_sessionIsUTPEnabled")]
get;
}
public bool lpd_enabled {
[CCode (cname = "tr_sessionSetLPDEnabled")]
set;
[CCode (cname = "tr_sessionIsLPDEnabled")]
get;
}
public int cache_limit {
[CCode (cname = "tr_sessionSetCacheLimit_MB")]
set;
[CCode (cname = "tr_sessionGetCacheLimit_MB")]
get;
}
public EncryptionMode Encryption {
[CCode (cname = "tr_sessionSetEncryption")]
set;
[CCode (cname = "tr_sessionGetEncryption")]
get;
}
public bool port_forwarding_enabled {
[CCode (cname = "tr_sessionSetPortForwardingEnabled")]
set;
[CCode (cname = "tr_sessionIsPortForwardingEnabled")]
get;
}
public uint32 peer_port {
[CCode (cname = "tr_sessionSetPeerPort")]
set;
[CCode (cname = "tr_sessionGetPeerPort")]
get;
}
public bool peer_port_random_on_start {
[CCode (cname = "tr_sessionSetPeerPortRandomOnStart")]
set;
[CCode (cname = "tr_sessionGetPeerPortRandomOnStart")]
get;
}
public PortForwarding port_forwarding {
[CCode (cname = "tr_sessionGetPortForwarding")]
get;
}
[CCode (cname = "tr_sessionSetSpeedLimit_KBps")]
public void set_speed_limit (Direction direction, int kbps);
[CCode (cname = "tr_sessionGetSpeedLimit_KBps")]
public int get_speed_limit (Direction direction);
[CCode (cname = "tr_sessionLimitSpeed")]
public void set_speed_limited (Direction direction, bool limited);
[CCode (cname = "tr_sessionIsSpeedLimited")]
public bool is_speed_limited (Direction direction);
[CCode (cname = "tr_sessionSetAltSpeed_KBps")]
public void set_alt_speed (Direction direction, int bps);
[CCode (cname = "tr_sessionGetAltSpeed_KBps")]
public int get_alt_speed (Direction direction);
public bool use_alt_speed {
[CCode (cname = "tr_sessionUseAltSpeed")]
set;
[CCode (cname = "tr_sessionUsesAltSpeed")]
get;
}
public bool use_alt_time {
[CCode (cname = "tr_sessionUseAltSpeedTime")]
set;
[CCode (cname = "tr_sessionUsesAltSpeedTime")]
get;
}
public int alt_speed_begin {
[CCode (cname = "tr_sessionSetAltSpeedBegin")]
set;
[CCode (cname = "tr_sessionGetAltSpeedBegin")]
get;
}
public int alt_speed_end {
[CCode (cname = "tr_sessionSetAltSpeedEnd")]
set;
[CCode (cname = "tr_sessionGetAltSpeedEnd")]
get;
}
public ScheduleDay alt_speed_day {
[CCode (cname = "tr_sessionSetAltSpeedDay")]
set;
[CCode (cname = "tr_sessionGetAltSpeedDay")]
get;
}
[CCode (cname = "tr_sessionClearAltSpeedFunc")]
public void clear_alt_speed_func ();
[CCode (cname = "tr_sessionSetAltSpeedFunc")]
public void set_alt_speed_func (AltSpeedFunc func);
[CCode (cname = "tr_sessionGetActiveSpeedLimit_KBps")]
public bool get_active_speed_limit (Direction dir, out double limit);
[CCode (cname = "tr_sessionGetRawSpeed_KBps")]
public double get_raw_speed (Direction direction);
public bool ratio_limited {
[CCode (cname = "tr_sessionSetRatioLimited")]
set;
[CCode (cname = "tr_sessionIsRatioLimited")]
get;
}
public double ratio_limit {
[CCode (cname = "tr_sessionSetRatioLimit")]
set;
[CCode (cname = "tr_sessionGetRatioLimit")]
get;
}
public bool idle_limited {
[CCode (cname = "tr_sessionSetIdleLimited")]
set;
[CCode (cname = "tr_sessionIsIdleLimited")]
get;
}
public uint16 idle_limit {
[CCode (cname = "tr_sessionSetIdleLimit")]
set;
[CCode (cname = "tr_sessionGetIdleLimit")]
get;
}
public uint16 peer_limit {
[CCode (cname = "tr_sessionSetPeerLimit")]
set;
[CCode (cname = "tr_sessionGetPeerLimit")]
get;
}
public uint16 peer_limit_per_torrent {
[CCode (cname = "tr_sessionSetPeerLimitPerTorrent")]
set;
[CCode (cname = "tr_sessionGetPeerLimitPerTorrent")]
get;
}
public bool paused {
[CCode (cname = "tr_sessionSetPaused")]
set;
[CCode (cname = "tr_sessionGetPaused")]
get;
}
public bool delete_source {
[CCode (cname = "tr_sessionSetDeleteSource")]
set;
[CCode (cname = "tr_sessionGetDeleteSource")]
get;
}
/**
* Load all the torrents in the torrent directory.
*
* This can be used at startup to kickstart all the torrents from the previous session.
*/
[CCode (array_length_pos = 1.9, cname = "tr_sessionLoadTorrents")]
public Torrent[] load_torrents (TorrentConstructor ctor);
public bool torrent_done_script_enabled {
[CCode (cname = "tr_sessionSetTorrentDoneScriptEnabled")]
set;
[CCode (cname = "tr_sessionIsTorrentDoneScriptEnabled")]
get;
}
public string torrent_done_script {
[CCode (cname = "tr_sessionSetTorrentDoneScript")]
set;
[CCode (cname = "tr_sessionGetTorrentDoneScript")]
get;
}
[CCode (cname = "tr_torrentFindFromId")]
public unowned Torrent get (int id);
[CCode (cname = "tr_torrentFindFromHash")]
public unowned Torrent get_by_hash ([CCode (array_length = false)] uint8[] hash);
[CCode (cname = "tr_torrentFindFromMagnetLink")]
public unowned Torrent get_by_magnet (string link);
public BlockList blocklist {
[CCode (cname = "")]
get;
}
}
[CCode (cname = "tr_session", has_type_id = false)]
[Compact]
public class BlockList {
/**
* The file in the $config/blocklists/ directory that's used by {@link set_content} and "blocklist-update"
*/
public const string DEFAULT_FILENAME;
/**
* Specify a range of IPs for Transmission to block.
*
* @param filename The uncompressed ASCII file, or null to clear the blocklist. libtransmission does not keep a handle to `filename' after this call returns, so the caller is free to keep or delete `filename' as it wishes. libtransmission makes its own copy of the file massaged into a binary format easier to search.
* @return the number of rules
*/
[CCode (cname = "tr_blocklistSetContent")]
public int set_content (string? filename);
public int count {
[CCode (cname = "tr_blocklistGetRuleCount")]
get;
}
public bool exists {
[CCode (cname = "tr_blocklistExists")]
get;
}
[CCode (cname = "tr_blocklistSetEnabled")]
public bool enabled {
[CCode (cname = "tr_blocklistSetEnabled")]
set;
[CCode (cname = "tr_blocklistIsEnabled")]
get;
}
/**
* The blocklist that gets updated when an RPC client invokes the "blocklist-update" method
*/
public string url {
[CCode (cname = "tr_blocklistSetURL")]
set;
[CCode (cname = "tr_blocklistGetURL")]
get;
}
}
[CCode (cname = "tr_altSpeedFunc", has_type_id = false)]
public delegate void AltSpeedFunc (Session session, bool active, bool userDriven);
[CCode (cname = "tr_sched_day", cprefix = "TR_SCHED_", has_type_id = false)]
[Flags]
public enum ScheduleDay {
SUN,
MON,
TUES,
WED,
THURS,
FRI,
SAT,
WEEKDAY,
WEEKEND,
ALL
}
[CCode (cname = "tr_port_forwarding", cprefix = "TR_PORT_", has_type_id = false)]
public enum PortForwarding {
ERROR,
UNMAPPED,
UNMAPPING,
MAPPING,
MAPPED
}
[CCode (cname = "tr_direction", cprefix = "TR_", has_type_id = false)]
public enum Direction {
CLIENT_TO_PEER, UP,
PEER_TO_CLIENT, DOWN
}
[CCode (cname = "tr_rpc_callback_type", cprefix = "TR_RPC_", has_type_id = false)]
public enum CallbackType {
TORRENT_ADDED,
TORRENT_STARTED,
TORRENT_STOPPED,
TORRENT_REMOVING,
TORRENT_TRASHING,
TORRENT_CHANGED,
TORRENT_MOVED,
SESSION_CHANGED,
SESSION_CLOSE
}
[CCode (cname = "tr_rpc_callback_status", cprefix = "TR_RPC_", has_type_id = false)]
public enum CallbackStatus {
/**
* No special handling is needed by the caller
*/
OK,
/**
* Indicates to the caller that the client will take care of removing the torrent itself. For example the client may need to keep the torrent alive long enough to cleanly close some resources in another thread.
*/
NOREMOVE
}
[CCode (cname = "tr_rpc_func", has_type_id = false)]
public delegate CallbackStatus Callback (Session session, CallbackType type, Torrent? torrent);
[CCode (cname = "tr_session_stats", has_type_id = false)]
[Compact]
public class Stats {
public float ratio;
public uint64 uploadedBytes;
public uint64 downloadedBytes;
public uint64 filesAdded;
public uint64 sessionCount;
public uint64 secondsActive;
}
[CCode (cname = "tr_msg_level", cprefix = "TR_MSG_", has_type_id = false)]
public enum MessageLevel {
ERR,
INF,
DBG;
[CCode (cname = "tr_setMessageLevel")]
public void activate ();
[CCode (cname = "getMessageLevel", cheader_filename = "libtransmission/utils.h")]
public static MessageLevel get_current ();
[CCode (cname = "msgLoggingIsActive", cheader_filename = "libtransmission/utils.h")]
public bool is_logging_active ();
}
[CCode (cname = "tr_msg_list", free_function = "freeMessageList", has_type_id = false)]
[Compact]
public class MessageList {
public MessageList level;
/**
* The line number in the source file where this message originated
*/
public int line;
/**
* Time the message was generated
*/
public time_t when;
/**
* The torrent associated with this message, or a module name such as "Port Forwarding" for non-torrent messages, or null.
*/
public string? name;
/**
* The message
*/
public string message;
/**
* The source file where this message originated
*/
public const string file;
public MessageList next;
}
[CCode (cname = "tr_setMessageQueuing")]
public void set_message_queuing (bool is_enabled);
[CCode (cname = "tr_getMessageQueuing")]
public bool get_message_queuing ();
[CCode (cname = "tr_getQueuedMessages")]
public MessageList get_queued_messages ();
[CCode (cname = "tr_ctorMode", cprefix = "TR_", has_type_id = false)]
public enum ConstructionMode {
/**
* Indicates the constructor value should be used only in case of missing resume settings
*/
FALLBACK,
/**
* Indicates the constructor value should be used regardless of what's in the resume settings
*/
FORCE
}
/**
* Utility class to instantiate {@link Torrent}s
*
* Instantiating a {@link Torrent} had gotten more complicated as features were added. At one point there were four functions to check metainfo and five to create a {@link Torrent} object.
*
* To remedy this, a Torrent Constructor has been introduced:
* * Simplifies the API to two functions: {@link TorrentConstructor.parse} and {@link TorrentConstructor.instantiate}
* * You can set the fields you want; the system sets defaults for the rest.
* * You can specify whether or not your fields should supercede resume's.
* * We can add new features to the torrent constructor without breaking {@link TorrentConstructor.instantiate}'s API.
*
* You must call one of the {@link TorrentConstructor.set_metainfo} functions before creating a torrent with a torrent constructor. The other functions are optional.
*
* You can reuse a single tr_ctor to create a batch of torrents -- just call one of the SetMetainfo() functions between each {@link TorrentConstructor.instantiate} call.
*/
[CCode (cname = "tr_ctor", cprefix = "tr_ctor", free_function = "tr_ctorFree", has_type_id = false)]
[Compact]
public class TorrentConstructor {
/**
* The torrent's bandwidth priority.
*/
public Priority bandwidth_priority {
[CCode (cname = "tr_ctorSetBandwidthPriority")]
set;
[CCode (cname = "tr_ctorGetBandwidthPriority")]
get;
}
/**
* Create a torrent constructor object used to instantiate a {@link Torrent}
* @param session This is required if you're going to call {@link TorrentConstructor.instantiate}, but you can use null for {@link TorrentConstructor.parse}.
*/
[CCode (cname = "tr_ctorNew")]
public TorrentConstructor (Session? session);
/**
* Instantiate a single torrent.
*/
[CCode (cname = "tr_torrentNew")]
public Torrent? instantiate (out ParseResult error);
/**
* Whether or not to delete the source .torrent file when the torrent is added. (Default: False)
*/
public bool delete_source {
[CCode (cname = "tr_ctorSetDeleteSource")]
set;
[CCode (cname = "tr_ctorGetDeleteSource")]
get;
}
/**
* Set the constructor's metainfo from a magnet link
*/
[CCode (cname = "tr_ctorSetMetainfoFromMagnetLink")]
public int set_metainfo_from_magnet_link (string magnet);
/**
* Set the constructor's metainfo from a raw benc already in memory
*/
[CCode (cname = "tr_ctorSetMetainfo")]
public int set_metainfo ([CCode (array_length_type = "size_t")] uint8[] metainfo);
/**
* Set the constructor's metainfo from a local .torrent file
*/
[CCode (cname = "tr_ctorSetMetainfoFromFile")]
public int set_metainfo_from_file (string filename);
/**
* Set the metainfo from an existing file in the torrent directory.
*
* This is used by the Mac client on startup to pick and choose which
* torrents to load
*/
[CCode (cname = "tr_ctorSetMetainfoFromHash")]
public int set_metainfo_from_hash (string hash_string);
/**
* Set how many peers this torrent can connect to. (Default: 50)
*/
[CCode (cname = "tr_ctorSetPeerLimit")]
public void set_peer_limit (ConstructionMode mode, uint16 limit);
/**
* Set the download folder for the torrent being added with this ctor.