|
|
#include <module.h> |
inherit "module"; |
|
|
constant cvs_version = "$Id: location.pike,v 1.6 2004/07/08 23:32:54 _cvs_stephen Exp $"; |
constant module_type = MODULE_LOCATION; |
constant module_name = "RefDoc for MODULE_LOCATION"; |
constant module_doc = "This module does nothing, but its inlined " |
"documentation gets imported into the roxen " |
"programmer manual. You really don't want to " |
"add this module to your virtual server, promise!"; |
|
|
|
void create() |
{ |
defvar("mountpoint", |
Variable.Location("/dev/urandom/sort/of/", 0, |
"Mount point", |
"This is where the module will be inserted " |
"in the namespace of your server.")); |
} |
|
mapping|Stdio.File|void find_file( string path, RequestID id ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
return Roxen.http_string_answer(make_random_string( 17, 17 )); |
} |
|
string make_random_string(int min_len, int|void max_len) |
{ |
int length = min_len + (max_len ? random(max_len - min_len) |
: random(17)); |
return (string)allocate(length, lambda(){ return random(256); })(); |
} |
|
string query_location() |
|
|
|
|
{ |
return query( "mountpoint" ); |
} |
|
array(int)|Stat stat_file( string path, RequestID id ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
return ({ 0775, |
({ 17, -2 })[random(2)], |
963331858, |
963331858, |
963331858, |
0, |
0 }); |
} |
|
mapping(string:Stat) find_dir_stat( string path, RequestID id ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
string|void real_file( string path, RequestID id ); |
|
|
|
|
|
|
|
|
|
|
array(string)|void find_dir( string path, RequestID id ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
return allocate(random(47)+11, make_random_string)(4, 71); |
} |
|
|