patch 7593
[mldonkey.git] / src / daemon / common / commonFile.mli
blob875f5e837e08ad7da3cbc05c081937970ceea8f2
1 (* Copyright 2001, 2002 b52_simon :), b8_bavard, b8_fee_carabine, INRIA *)
2 (*
3 This file is part of mldonkey.
5 mldonkey is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 mldonkey is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mldonkey; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 type 'a file_impl = {
21 mutable impl_file_owner : CommonTypes.userdb;
22 mutable impl_file_group : CommonTypes.groupdb option;
23 mutable impl_file_update : int;
24 mutable impl_file_state : CommonTypes.file_state;
26 mutable impl_file_comment : string;
27 mutable impl_file_num : int;
28 mutable impl_file_val : 'a;
29 mutable impl_file_ops : 'a file_ops;
30 mutable impl_file_size : int64;
31 mutable impl_file_age : int;
32 mutable impl_file_fd : Unix32.t option;
33 mutable impl_file_downloaded : int64;
34 mutable impl_file_received : int64;
35 impl_file_last_received : (int64 * int) Queue.t;
36 mutable impl_file_last_rate : float;
37 mutable impl_file_best_name : string;
38 mutable impl_file_filenames : string list;
39 mutable impl_file_magic : string option;
40 mutable impl_file_priority : int;
41 mutable impl_file_release : bool;
42 mutable impl_file_last_seen : int;
43 mutable impl_file_probable_name : string option;
45 and 'a file_ops = {
46 mutable op_file_network : CommonTypes.network;
47 mutable op_file_commit : 'a -> string -> unit;
48 mutable op_file_save_as : 'a -> string -> unit;
49 mutable op_file_shared : 'a -> CommonTypes.shared option;
50 mutable op_file_to_option : 'a -> (string * Options.option_value) list;
51 mutable op_file_cancel : 'a -> unit;
52 mutable op_file_pause : 'a -> unit;
53 mutable op_file_queue : 'a -> unit;
54 mutable op_file_resume : 'a -> unit;
55 mutable op_file_download_order : 'a -> CommonTypes.swarming_strategy option -> CommonTypes.swarming_strategy option;
56 mutable op_file_info : 'a -> GuiTypes.file_info;
57 mutable op_file_set_format : 'a -> CommonTypes.format -> unit;
58 mutable op_file_check : 'a -> unit;
59 mutable op_file_recover : 'a -> unit;
60 mutable op_file_all_sources : 'a -> CommonTypes.client list;
61 mutable op_file_active_sources : 'a -> CommonTypes.client list;
62 mutable op_file_comment : 'a -> string;
63 mutable op_file_print: 'a -> CommonTypes.ui_conn -> unit;
64 mutable op_file_print_sources : 'a -> CommonTypes.ui_conn -> unit;
65 mutable op_file_files : ('a -> 'a file_impl -> CommonTypes.file list);
66 mutable op_file_debug : 'a -> string;
67 mutable op_file_proposed_filenames : 'a -> string list;
69 val as_file : 'a file_impl -> CommonTypes.file
70 val as_file_impl : CommonTypes.file -> 'a file_impl
71 val file_num : CommonTypes.file -> int
72 val dummy_file_impl : unit -> int file_impl
73 val dummy_file : CommonTypes.file
74 val file_counter : int ref
75 val ni : CommonTypes.network -> string -> string
76 val fni : CommonTypes.network -> string -> 'a
77 val ni_ok : CommonTypes.network -> string -> unit
78 val file_must_update : CommonTypes.file -> unit
79 val file_must_update_downloaded : CommonTypes.file -> unit
80 val update_file_num : 'a file_impl -> unit
81 val update_file_state : 'a file_impl -> CommonTypes.file_state -> unit
82 val file_to_option : CommonTypes.file -> (string * Options.option_value) list
83 val file_save_as : CommonTypes.file -> string -> unit
84 val file_shared : CommonTypes.file -> CommonTypes.shared option
85 val file_comment : CommonTypes.file -> string
86 val file_network : CommonTypes.file -> CommonTypes.network
87 val file_info : CommonTypes.file -> GuiTypes.file_info
88 val file_pause : CommonTypes.file -> CommonTypes.userdb -> unit
89 val file_queue : CommonTypes.file -> unit
90 val file_resume : CommonTypes.file -> CommonTypes.userdb -> unit
91 val set_file_release : CommonTypes.file -> bool -> CommonTypes.userdb -> unit
92 val file_release : CommonTypes.file -> bool
93 val set_file_state : CommonTypes.file -> CommonTypes.file_state -> unit
94 val file_best_name : CommonTypes.file -> string
95 val set_file_best_name : CommonTypes.file -> string -> string -> int -> unit
96 val add_file_filenames : CommonTypes.file -> string -> unit
97 val shorten_all_file_filenames : int -> unit
98 val set_file_format : CommonTypes.file -> CommonTypes.format -> unit
99 val file_check : CommonTypes.file -> unit
100 val file_recover : CommonTypes.file -> unit
101 val file_preview : CommonTypes.file -> unit
102 val file_all_sources : CommonTypes.file -> CommonTypes.client list
103 val file_active_sources : CommonTypes.file -> CommonTypes.client list
104 val file_print_sources : CommonTypes.file -> CommonTypes.ui_conn -> unit
105 val files_ops : (int file_ops * int file_ops) list ref
106 val new_file_ops : CommonTypes.network -> 'a file_ops
107 val check_file_implementations : unit -> unit
108 val file_find : int -> CommonTypes.file
109 val file_state : CommonTypes.file -> CommonTypes.file_state
110 val file_add_source : CommonTypes.file -> CommonTypes.client -> unit
111 val file_remove_source : CommonTypes.file -> CommonTypes.client -> unit
112 val sample_timer : unit -> unit
113 val file_download_rate : 'a file_impl -> float
114 val add_file_downloaded : CommonTypes.file -> Int64.t -> unit
115 val file_downloaders : CommonTypes.file -> CommonTypes.ui_conn -> int -> bool
116 val colored_chunks : VerificationBitmap.t -> string
117 val file_print : CommonTypes.file -> CommonTypes.ui_conn -> unit
118 val file_print_ed2k_link : string -> int64 -> Md4.Md4.t -> string
119 val file_size : CommonTypes.file -> int64
120 val file_disk_name : CommonTypes.file -> string
121 val file_fd : CommonTypes.file -> Unix32.t
122 val set_file_fd : CommonTypes.file -> Unix32.t -> unit
123 val set_file_disk_name : CommonTypes.file -> string -> unit
124 val file_downloaded : CommonTypes.file -> int64
125 val file_network : CommonTypes.file -> CommonTypes.network
126 val file_priority : CommonTypes.file -> int
127 val file_download_order : CommonTypes.file -> CommonTypes.swarming_strategy option -> CommonTypes.swarming_strategy option
128 val file_print_download_order : CommonTypes.file -> string
129 val set_file_priority : CommonTypes.file -> int -> unit
130 val set_file_last_seen : CommonTypes.file -> int -> unit
131 val file_debug : CommonTypes.file -> string
132 val set_file_comment : CommonTypes.file -> string -> unit
133 val file_comment : CommonTypes.file -> string
134 val file_magic : CommonTypes.file -> string option
135 val check_magic : CommonTypes.file -> unit
136 val recover_bytes : CommonTypes.file -> (int64 * int64) list
137 val file_write : CommonTypes.file -> int64 -> string -> int -> int -> unit
138 val file_verify : CommonTypes.file ->
139 CommonTypes.uid_type -> int64 -> int64 -> bool
140 val file_mtime : CommonTypes.file -> float
141 val file_copy :
142 CommonTypes.file -> CommonTypes.file -> int64 -> int64 -> int64 -> unit
143 val file_files : CommonTypes.file -> CommonTypes.file list
144 val propose_filenames : unit -> unit
145 val propose_filename : CommonTypes.file -> unit
147 val forceable_download : CommonTypes.result_info list ref
148 val impl_file_info : 'a file_impl -> GuiTypes.file_info
150 val user2_filter_files : CommonTypes.file list -> CommonTypes.userdb -> CommonTypes.file list
151 val user2_num_user_dls : CommonTypes.userdb -> int
152 val user2_num_group_dls : CommonTypes.groupdb -> int
153 val user2_allow_file_admin : CommonTypes.file -> CommonTypes.userdb -> bool
154 val set_file_owner : CommonTypes.file -> CommonTypes.userdb -> unit
155 val file_owner : CommonTypes.file -> CommonTypes.userdb
156 val set_file_group : CommonTypes.file -> CommonTypes.groupdb option -> unit
157 val file_group : CommonTypes.file -> CommonTypes.groupdb option
158 val lprintf_file_nl : CommonTypes.file -> ('a, unit, unit) Pervasives.format -> 'a
160 (** [concat_file dir filename] sanitizes [filename] and appends it to [dir] *)
161 val concat_file : string -> string -> string