1 (* Copyright 2002 b8_bavard, b8_fee_carabine, INRIA *)
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
23 open TcpBufferedSocket
28 open CommonComplexOptions
32 let server_ini = create_options_file
"server.ini"
34 let server_port = define_option
server_ini ["port"] "port to bind on"
36 let server_name = define_option
server_ini ["name"] "small name of server"
37 string_option
"mldonkey"
38 let server_desc = define_option
server_ini ["description"]
39 "small description of server" string_option
"mldonkey general server"
40 let welcome_messages = define_option
server_ini ["welcome"]
41 "list of welcome messages"
42 (list_option string_option
) [ "Welcome to my mldonkey server" ]
43 let seed_ip = define_option
server_ini ["seedIP"] "IP of server to register"
44 (option_option
Ip.option) None
45 let seed_port = define_option
server_ini ["seedPort"]
46 "Port of server to register" int_option
4661
47 let max_clients = define_option
server_ini ["maxClients"]
48 "Maximal number of clients connected" int_option
200
49 let max_files = define_option
server_ini ["maxFiles"]
50 "Maximal number of files connected" int_option
1000
51 let server_ip = define_option
server_ini ["server_ip"]
52 "The last IP used for this server" Ip.option
54 let server_md4 = define_option
server_ini ["server_md4"]
55 "The MD4 of this server" Md4.option (Md4.random
())
58 let save_log = define_option
server_ini ["save_log"]
59 "Save all request on a file log" bool_option
false
60 let log_time_out = define_option
server_ini ["log_time_out"]
61 "time for write on disk logs" float_option
10.
62 let change_log_file = define_option
server_ini ["change_log_file"] "change log file" float_option
21600.
66 (*based server option*)
67 let send_server_stat_delay = define_option
server_ini ["send_server_stat_delay"] "time out for send to client server stat (nbclients and nb files)" float_option
120.
69 let ping_known_servers = define_option
server_ini ["ping_known_servers"] "time to ping knowed server"
72 let limite_udp_received_sec = define_option
server_ini ["limite_udp_received_sec"] "limite the numbre of udp requets received from clients"
75 let process_udp_loc = define_option
server_ini ["process_udp_loc"]
76 "The server try to answer all udp location requet of md4" bool_option
true
78 let process_udp_req = define_option
server_ini ["process_udp_req"]
79 "The server try to answer all udp query and location requet of md4" bool_option
true
82 (*Options for cooperation server protocol*)
83 let relais_cooperation_protocol = define_option
server_ini
84 ["relais_cooperation_protocol"] "Your server will participate in a groupe of
85 server. All the following options are used in this case" bool_option
false
87 let relais_master = define_option
server_ini ["relais_master"] "Your server will
88 be a master of a group" bool_option
false
90 let max_servers = define_option
server_ini ["max_servers"] "Max upper bound for the number of server in the group." int_option
5
92 let max_group_clients = define_option
server_ini ["max_group_clients"] "Max number of clients in the groupe. if you are a master then the group doesn't support more clients else you can't merge a groupe with a upper bound value" int_option
5000
94 let max_group_files = define_option
server_ini ["max_group_files"] "max number of file in the groupe. The group doesn't support more files share by clients" int_option
500
96 let notify_time_out = define_option
server_ini ["notify_time_out"] "Notify other server about your client location information"
99 let connect_time_out = define_option
server_ini ["connect_time_out"] "time for reconnect deconnect servers"
102 let server_dead_time_out = define_option
server_ini ["server_dead_time_out"]
103 "Consider a server as dead after this timeout"
106 let server_group_connection_timeout =
107 define_option
server_ini ["server_group_connection_timeout"]
108 "time to wait before consider server dead in a group"
111 let known_master = define_option
server_ini ["known_master"]
112 "Connect to a group already known." (list_option
(tuple2_option
(Ip.option, int_option
)))
116 (* Subscription options *)
117 let max_subs_lifetime = define_option
server_ini ["max_subs_lifetime"] "Time (in seconds) for a maximum subscription lifetime" float_option
3600.
120 let known_server = define_option server_ini ["known_server"]
121 "Known server" (list_option (tuple2_option (Ip.option, int_option)))