--- googlecode.com/svn/trunk/Meteor/Config.pm 2007/05/20 14:03:10 23 +++ googlecode.com/svn/trunk/Meteor/Config.pm 2008/02/04 22:23:52 48 @@ -60,11 +60,12 @@ 'Name of index file to serve when a directory is requested from the static file web server', DirectoryIndex => 'index.html', -'Header to be served with static documents. ~server~ and ~status~ will be replaced by the appropriate values', - DocumentHeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n', - 'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values. **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template= to their GET request. If *HeaderTemplate* is not found, the system will use the default HeaderTemplate (no number)', - HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', + HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', + +'Template for each line in channelinfo', + + ChannelInfoTemplate => '~name~ ~messageCount~ ~lastMsgID~\r\n', 'Print out this help message', Help => '', @@ -87,6 +88,10 @@ 'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.', PingInterval => 5, +'Persistence of a connection. Note: some modes have this hardcoded!', + + Persist => 0, + 'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds', PingMessage => '\r\n', @@ -107,12 +112,20 @@ 'The syslog facility to use', SyslogFacility => 'daemon', + +'IP address for udp server (leave empty for all local addresses)', + UDPIP => '', + +'Port number for udp connections, set to 0 to disable', + UDPPort => 0, + ); our %ConfigFileData=(); our %CommandLine=(); our %Defaults=(); our %ExtraKeys=(); + our %Modes=(); for(my $i=0;$i1 && $_[0]!~/^\-(?!\-)/) { my $param=shift; $param=~s/^\-\-/\-/; - $CommandLine{$key}=$param; + $CommandLine{"$key$mode"}=$param; } } @@ -275,6 +320,8 @@ my $path=$class->valueForKey('ConfigFileLocation'); return unless(defined($path) && -f $path); + my $mode=''; + open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); while() { @@ -283,6 +330,12 @@ s/[\r\n]*$//; + if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/) + { + $Modes{".$1"}=1; + next; + } + unless(/^(\S+)\s*(.*)/) { &usage("Invalid configuration file parameter line '$_'"); @@ -300,7 +353,7 @@ { unless(exists($Defaults{$key})) { - &usage("Unknown configuration file parameter name '$key'"); + &usage("Unknown configuration file parameter name '$key$mode'"); } if($key eq 'ConfigFileLocation') { @@ -310,7 +363,7 @@ $val=~s/^--/-/; - $ConfigFileData{$key}=$val; + $ConfigFileData{"$key$mode"}=$val; } close(CONFIG); } @@ -330,7 +383,7 @@ print STDERR <<"EOT"; -Meteor server v1.0 (release date: 1 Dec 2006) +Meteor server v$::VERSION (release date: $::RELEASE_DATE) Licensed under the terms of the GNU General Public Licence (2.0) Usage: