Please note that these functions are available globally, you do not
need to import System to use these functions.
This function only exists on systems that have the chroot(2)
system call.
The second variant only works on systems that also have
the fchroot(2) system call.
The returned array contains the same information as that returned
by gethostbyname().
The array contains three elements:
The first element is the hostname.
The second element is an array(string) of IP numbers for the host.
The third element is an array(string) of aliases for the host.
The ident argument specifies an identifier to tag all log entries
with.
options is a bit field specifying the behavior of the message
logging. Valid options are:
facility specifies what subsystem you want to log as. Valid
facilities are:
The mapping contains the following fields:
int chroot(object(File) obj);
LOG_PID Log the process ID with each message. LOG_CONS Write messages to the console if they can't be sent to syslogd. LOG_NDELAY Open the connection to syslogd now and not later. LOG_NOWAIT Do not wait for subprocesses talking to syslogd.
LOG_AUTH Authorization subsystem LOG_AUTHPRIV LOG_CRON Crontab subsystem LOG_DAEMON System daemons LOG_KERN Kernel subsystem (NOT USABLE) LOG_LOCAL For local use LOG_LOCAL[1-7] For local use LOG_LPR Line printer spooling system LOG_MAIL Mail subsystem LOG_NEWS Network news subsystem LOG_SYSLOG LOG_USER LOG_UUCP UUCP subsystem
"sysname": Operating system name "nodename": "release": "version": "machine": Host name Release of this OS Version number of this OS Machine architecture
.(["env" : getenv() + (["TERM":"vt100"])
|
args is per default no argument(s),
env is reset to the given mapping, or kept if the argument is 0. fds is your stdin, stdout and stderr. Default is local pipes (see stdin et al). fds_to_close is file descriptors that are closed in the forked branch when the program is executed (ie, the other end of the pipes).
A regular expression is actually a string, then compiled into an object. The string contains characters that make up a pattern for other strings to match. Normal characters, such as A through Z only match themselves, but some characters have special meaning.
|
|
Note that \ can be used to quote these characters in which case they match themselves, nothing else. Also note that when quoting these something in Pike you need two \ because Pike also uses this character for quoting.
To make make regexps fast, they are compiled in a similar way that Pike is, they can then be used over and over again without needing to be recompiled. To give the user full control over the compilations and use of regexp an object oriented interface is provided.
You might wonder what regexps are good for, hopefully it should be more clear
when you read about the following functions:
void create(string regexp);
object(Regexp) Regexp();
object(Regexp) Regexp(string regexp);
The Gmp library can handle large integers, floats and rational numbers, but
currently Pike only has support for large integers. The others will be added
later or when demand arises. Large integers are implemented as objects cloned
from Gmp.Mpz.
The mpz object implements all the normal integer operations.
(except xor) There are also some extra operators:
object Mpz(int|object|float i);
object Mpz(string digits, int base);
(string) mpz
(int) mpz
(float) mpz
string digits(int|void base);
string size(int|void base);
This is the an interface to the gdbm library. This module might or
might not be available in your Pike depending on whether the gdbm library
was available on your system when Pike was compiled.
int create(string file);
int create(string file, string mode);
object(Gdbm) Gdbm();
object(Gdbm) Gdbm(string file);
object(Gdbm) Gdbm(string file, string mode);
r open database for reading w open database for writing c create database if it does not exist t overwrite existing database f fast mode
The fast mode prevents the database from synchronizing each change in the database immediately. This is dangerous because the database can be left in an unusable state if Pike is terminated abnormally.
The default mode is "rwc".
mixed find_option(array(string) argv,
Also, as an extra bonus: shortform, longform and envvar can all be arrays, in which case either of the options in the array will be accpted.
/* This program tests two different options. One is called -f or * --foo and the other is called -b or --bar and can also be given * by using the BAR_OPTION environment variable. */
int main(int argc, array(string) argv)
{
if(find_option(argv,"f","foo"))
werror("The FOO option was given.\n");
werror("The BAR option got the "+
find_option(argv,"b","bar","BAR_OPTION","default")+
" argument.\n");
}
Each element in the array options should be an array on the following form:
> Getopt.find_all_options(({"test","-dd"}), >> ({ ({ "debug", Getopt.NO_ARG, ({"-d","--debug"}), "DEBUG", 1}) })); Result: ({ ({ "debug", 1 }), ({ "debug", 1 }) })
This is what it would look like in real code:
import Getopt;
int debug=0;
int main(int argc, array(string) argv
{
foreach(find_all_options(argv, ({
({ "debug", MAY_HAVE_ARG, ({"-d","--debug"}), "DEBUG", 1}),
({ "version", NO_ARG, ({"-v","--version" }) }) })),
mixed option)
{
switch(option[0])
{
case "debug": debug+=option[1]; break;
case "version":
write("Test program version 1.0\n");
exit(1);
}
}
argv=Getopt.get_args(argv);
}
int main(int argc, array(string) argv)
{
if(find_option(argv,"f","foo"))
werror("The FOO option was given.\n");
argv=get_args(argv);
werror("The arguments are: "+(argv*" ")+".\n");
}
This function can also be used to re-initialize a Gz.deflate object
so it can be re-used.
object(Gz.deflate) Gz.deflate(int X)
Gz.NO_FLUSH Only data that doesn't fit in the internal buffers is returned. Gz.PARTIAL_FLUSH All input is packed and returned. Gz.SYNC_FLUSH All input is packed and returned. Gz.FINISH All input is packed and an 'end of data' marker is appended.
Using flushing will degrade packing. Normally NO_FLUSH should be used until the end of the data when FINISH should be used. For interactive data PARTIAL_FLUSH should be used.
// streaming (blocks)
function inflate=Gz.inflate()->inflate;
while(string s=stdin->read(8192))
If there is no YP server available for the domain, this function call will block until there is one. If no server appears in about ten minutes or so, an error will be returned. The timeout is not configurable from the C interface to Yp either.
If no domain is given, the default domain will be used. (As returned by Yp.default_yp_domain)
arguments is the map Yp-map to search in. This must be a full map name, for example, you should use passwd.byname instead of just passwd. key is the key to search for. The key must match exactly, no pattern matching of any kind is done.
object dom = Yp.YpDomain();
write(dom->match("passwd.byname", "root"));
If there is no YP server available for the domain, this function call will block until there is one. If no server appears in about ten minutes or so, an error will be returned. The timeout is not configurable from the C-yp interface either. map is the YP-map to bind to. This must be the full map name, as an example, passwd.byname instead of just passwd. If no domain is specified, the default domain will be used. This is usually best.
import Yp;
void print_entry(string key, string val)
{
val = (val/":")[4];
if(strlen(val))
{
string q = ".......... ";
werror(key+q[strlen(key)..]+val+"\n");
}
}
void main(int argc, array(string) argv)
{
object (YpMap) o = YpMap("passwd.byname");
werror("server.... "+ o->server() + "\n"
"age....... "+ (-o->order()+time()) + "\n"
"per....... "+ o["per"] + "\n"
"size...... "+ sizeof(o) + "\n");
o->map(print_entry); // Print username/GECOS pairs
}
All column references are case insensitive. A column can be referred to by its position (starting from zero). All operations are non-destructive. That means that a new table object will be returned after, for example, a sort.
An example is available at the end of this section.
object t = ADT.Table.table( ({ ({ "Blixt", "Gordon" }),
({ "Buck", "Rogers" }) }),
({ "First name", "Last name" }) );
object group(funcion f, array(string|int)|string|int columns, mixed ... arg);
array(string) cols = ({ "Fruit", "Provider", "Quantity" });
array(mapping) types = ({ 0, 0, ([ "type":"num" ]) });
array(array) table = ({ ({ "Avocado", "Frukt AB", 314 }),
({ "Banana", "Banankompaniet", 4276 }),
({ "Orange", "Frukt AB", 81 }),
({ "Banana", "Frukt AB", 1174 }),
({ "Orange", "General Food", 523 }) });
object t = ADT.Table.table(table, cols, types);
write("FRUITS\n\n");
write(ADT.Table.ASCII.encode(t, ([ "indent":4 ])));
write("\nPROVIDERS\n\n");
write(ADT.Table.ASCII.encode(t->select("provider", "quantity")->
sum("quantity")->rsort("quantity")));
write("\nBIG PROVIDERS\n\n"+
ADT.Table.ASCII.encode(t->select("provider", "quantity")->
sum("quantity")->
where("quantity", `>, 1000)->
rsort("quantity")));
write("\nASSORTMENT\n\n");
write(ADT.Table.ASCII.encode(t->select("fruit")->distinct("fruit")->
sort("fruit"), ([ "indent":4 ])));
Some effort has been made to make sure that Yabu is crash safe. This means that the database should survive process kills, core dumps and such -- although this is not something that can be absolutely guaranteed. Also, all non-commited and pending transactions will be cancelled in case of a crash.
Yabu uses three types of objects, listed below:
A simple example is illustrated below.
// Create a database called "my.database" in write/create mode.
object db = Yabu.db("my.database", "wc");
// Create a table called "fruit".
object table = db["fruit"];
// Store a record called "orange" with the value "yummy".
table["orange"] = "yummy";
// Store a record called "apple" with the value 42.
table["apple"] = 42;
Transactions are slightly more complex, but not much so. See example below.
// Create a database called "my.database"
// in write/create/transaction mode.
object db = Yabu.db("my.database", "wct");
// Create a table called "fruit".
object table = db["fruit"];
// Create a transaction object for table "fruit".
object transaction = table->transaction();
// Store a record called "orange" with
// the value "yummy". Note that this record
// is only visible through the transaction object.
transaction["orange"] = "yummy";
// Store a record called "apple" with the value 42.
// As with "orange", this record is invisible
// for all objects except this transaction object.
transaction["apple"] = 42;
// Commit the records "orange" and "apple".
// These records are now a part of the database.
transaction->commit();
A Yabu database can operate in two basic modes:
// Open a database in create/write/transaction mode.
object db = Yabu.db("my.database", "cwt");
// Open a database in read mode.
object db = Yabu.db("my.database", "r");
// Open a database in create/write/compress mode.
object db = Yabu.db("my.database", "cwC");
object(table) `[](string table_name);
array(string) _indices();
This method returns a transaction object.
Rollbacks always succeeds. However, with commit that is not always the case. A commit will fail if:
The Message class does not make any interpretation of the body data, unless
the content type is multipart. A multipart message contains several
individual messages separated by boundary strings. The create
method of the Message class will divide a multipart body on these boundaries,
and then create individual Message objects for each part. These objects
will be collected in the array body_parts within the original
Message object. If any of the new Message objects have a body of type
multipart, the process is of course repeated recursively. The following
figure illustrates a multipart message containing three parts, one of
which contains plain text, one containing a graphical image, and the third
containing raw uninterpreted data:
The result is returned in the form of an array containing two elements.
The first element is a mapping containing the headers found. The second
element is a string containing the body.
Should the function succeed in reconstructing the original message, a
new MIME.Message object is returned. Note that this message may
in turn be a part of another, larger, fragmented message.
If the function fails to reconstruct an original message, it returns an
integer indicating the reason for its failure:
The set of special-characters is the one specified in RFC1521 (i.e. "<",
">", "@", ",", ";", ":", "\", "/", "?", "="), and not the one
specified in RFC822.
14.11.1 Global functions
The encoding string is not case sensitive.
> Array.map("=?iso-8859-1?b?S2lscm95?= was =?us-ascii?q?h=65re?="/" ",
MIME.decode_word);
Result: ({ /* 3 elements */
({ /* 2 elements */
"Kilroy",
"iso-8859-1"
}),
({ /* 2 elements */
"was",
0
}),
({ /* 2 elements */
"here",
"us-ascii"
})
})
void|int no_linebreaks);
The encoding string is not case sensitive. For the x-uue encoding,
an optional filename string may be supplied. If a nonzero value is passed
as no_linebreaks, the result string will not contain any linebreaks
(base64 and quoted-printable only).
> MIME.encode_word( ({ "Quetzalcoatl", "iso-8859-1" }), "base64" );
Result: =?iso-8859-1?b?UXVldHphbGNvYXRs?=
> MIME.encode_word( ({ "Foo", 0 }), "base64" );
Result: Foo
type subtype text plain message rfc822 multipart mixed
> MIME.quote( ({ "attachment", ';', "filename", '=', "/usr/dict/words" }) );
Result: attachment;filename="/usr/dict/words"
This function will analyze a string containing the header value, and produce
an array containing the lexical elements. Individual special characters
will be returned as characters (i.e. ints). Quoted-strings,
domain-literals and atoms will be decoded and returned as strings.
Comments are not returned in the array at all.
> MIME.tokenize("multipart/mixed; boundary=\"foo/bar\" (Kilroy was here)");
Result: ({ /* 7 elements */
"multipart",
47,
"mixed",
59,
"boundary",
61,
"foo/bar"
})
> object msg = MIME.Message( "Hello, world!",
([ "MIME-Version" : "1.0",
"Content-Type":"text/plain",
"Content-Transfer-Encoding":"base64" ]) );
Result: object
> (string )msg;
Result: Content-Type: text/plain
Content-Length: 20
Content-Transfer-Encoding: base64
MIME-Version: 1.0
SGVsbG8sIHdvcmxkIQ==
> object msg = MIME.Message( "Hello, world!", ([ "MIME-Version" : "1.0", "Content-Type" : "text/plain; charset=iso-8859-1" ]) ); Result: object > msg->charset; Result: iso-8859-1
Simulate inherits the Array, Stdio, String and Process modules, so
importing he Simulate module also imports all identifiers from these
modules. In addition, these functions are available:
This function is the same as multiplication.
array filter_array(array(object) arr,string fun,mixed ... args);
array filter_array(array(function) arr,-1,mixed ... args);
Result: foo-bar-gazonk
> ({ "a","b","c" })*" and ";
Result: a and b and c
>
array map_array(array(object) arr,string fun,mixed ... args);
array map_array(array(function) arr,-1,mixed ... arg);
float sum(float ... f);
string sum(string|float|int ... p);
array sum(array ... a);
mapping sum(mapping ... m);
list sum(multiset ... l);
void add_efun(string func_name)
> mklist( ({1,2,3}) );
Result: (< /* 3 elements */
1,
2,
3
>)
argument(s) | description |
string q | The SQL query This function sends an SQL query to the Mysql-server. The result of the query is returned as a Mysql.mysql_result object. Returns 0 if the query didn't return any result (e.g. INSERT or similar). |
argument(s) | description |
string database | Name of the database to be created This function creates a new database in the Mysql-server. |
argument(s) | description |
string database | Name of database to be dropped This function drops a database from a Mysql-server. |
"name": string The name of the field. "table": string The name of the table. "default": string The default value for the field. "type": string The type of the field. "length": int The length of the field. "max_length": int The length of the longest element in this field. "flags": multiset(string) Some flags. "decimals": int The number of decimalplaces.The type of the field can be any of: "decimal", "char", "short", "long", "float", "double", "null", "time", "longlong", "int24", "tiny blob", "medium blob", "long blob", "var string", "string" or "unknown". The flags multiset can contain any of "primary_key": This field is part of the primary key for this table. "not_null": This field may not be NULL. "blob": This field is a blob field.
argument(s) | description |
string table | Name of table to list the fields of |
string wild | Wildcard to filter the result with |
show fields in 'table' like "wild"
argument(s) | description |
string wild | Wildcard to filter with. Returns a table containing the names of all tables in the current database. If an argument is given, only those matching wild are returned. |
int main() { write(mysql()->statistics()); return(0); }
although most applications will not use the Crypto.des class directly.Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef"))
->crypt_block("Pike DES")
Crypto.md5()->update(s)->digest()
to convert it a DER-encoded ASN.1 bitstring.Standards.ASN1.Types.asn1_bit_string(rsa->sign(...))->get_der()
If domainname is a non-empty string and has been bound previously, bindtextdomain() replaces the old binding with dirname. The dirname argument can be an absolute or relative pathname being resolved when gettext(), dgettext(), or dcgettext() are called. If domainname is null pointer or an empty string, bindtextdomain() returns 0. User defined domain names cannot begin with the string SYS_. Domain names beginning with this string are reserved for system use. The return value from bindtextdomain() is a string containing dirname or the directory binding associated with domainname if dirname is void. If no binding is found, the default locale path is returned. If domainname is void or an empty string, bindtextdomain() takes no action and returns a 0.
argument(s) | description |
string domainname | The domain to query or bind a path to. |
string dirname | The directory name to bind to the choosen domain. |
argument(s) | description |
string domain | The domain to lookup the message in. |
string msg | The message to translate. |
int category | The category which locale should be used. |
argument(s) | description |
string domain | The domain to lookup the message in. |
string msg | The message to translate. |
argument(s) | description |
string msg | The message to translate. |
string decimal_point: The decimal-point character used to format non-monetary quantities.
string thousands_sep: The character used to separate groups of digits to the left of the decimal-point character in formatted non-monetary quantities.
string int_curr_symbol: The international currency symbol applicable to the current locale, left-justified within a four-character space-padded field. The character sequences should match with those specified in ISO 4217 Codes for the Representation of Currency and Funds.
string currency_symbol: The local currency symbol applicable to the current locale.
string mon_decimal_point: The decimal point used to format monetary quantities.
string mon_thousands_sep: The separator for groups of digits to the left of the decimal point in formatted monetary quantities.
string positive_sign: The string used to indicate a non-negative-valued formatted monetary quantity.
string negative_sign: The string used to indicate a negative-valued formatted monetary quantity.
int int_frac_digits: The number of fractional digits (those to the right of the decimal point) to be displayed in an internationally formatted monetary quantity.
int frac_digits: The number of fractional digits (those to the right of the decimal point) to be displayed in a formatted monetary quantity.
int p_cs_precedes: Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a non-negative formatted monetary quantity.
int p_sep_by_space: Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a non-negative formatted monetary quantity.
int n_cs_precedes: Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a negative formatted monetary quantity.
int n_sep_by_space: Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a negative formatted monetary quantity.
int p_sign_posn: Set to a value indicating the positioning of the positive_sign for a non-negative formatted monetary quantity. The value of p_sign_posn is interpreted according to the following:
0 - Parentheses surround the quantity and currency_symbol.
1 - The sign string precedes the quantity and currency_symbol.
2 - The sign string succeeds the quantity and currency_symbol.
3 - The sign string immediately precedes the currency_symbol.
4 - The sign string immediately succeeds the currency_symbol.
int n_sign_posn: Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity. The value of n_sign_posn is interpreted according to the rules described under p_sign_posn.
If locale is "", the locale is set to the default locale which is selected from the environment variable LANG.
The argument category determines which functions are influenced by the new locale: Locale.Gettext.LC_ALL for all of the locale.
Locale.Gettext.LC_COLLATE for the functions strcoll() and strxfrm() (used by pike, but not directly accessible).
Locale.Gettext.LC_CTYPE for the character classification and conversion routines.
Locale.Gettext.LC_MONETARY for localeconv(). Locale.Gettext.LC_NUMERIC for the decimal character. Locale.Gettext.LC_TIME for strftime() (currently not accessible from Pike).
argument(s) | description |
int category | The category in which to set the locale. |
string locale | The locale to change to |
The domainname argument is the unique name of a domain on the system. If there are multiple versions of the same domain on one system, namespace collisions can be avoided by using bindtextdomain(). If textdomain() is not called, a default domain is selected. The setting of domain made by the last valid call to textdomain() remains valid across subsequent calls to setlocale, and gettext(). The normal return value from textdomain() is a string containing the current setting of the domain. If domainname is void, textdomain() returns a string containing the current domain. If textdomain() was not previously called and domainname is void, the name of the default domain is returned.
argument(s) | description |
string domainname | The name of the domain to be made the current domain. |
Ie:
array(string) lesser() - gives back a list of possible xxx's. object xxxs() - gives back a list of possible n's. object xxx(mixed n) - gives back xxx n object xxx(object(Xxx) o) - gives back the corresponing xxx
The list of n's (as returned from xxxs) are always in order.
There are two n's with special meaning, 0 and -1. 0 always gives the first xxx, equal to my_obj->xxx(my_obj->xxxs()[0]), and -1 gives the last, equal to my_obj->xxx(my_obj->xxxs()[-1]).
To get all xxxs in the object, do something like Array.map(my_obj->xxxs(),my_obj->xxx).
xxx(object) may return zero, if there was no correspondning xxx.
Lesser units: Month, Week, Day Greater units: none
function datetime(int|void unix_time) Replacement for localtime.
function datetime_name(int|void unix_time) Replacement for ctime.
function datetime_short_name(int|void unix_time) Replacement for ctime.
It can only - for speed and simplicity - hold floating point numbers and are only in 2 dimensions.
The normal operation is to create the matrix object with a double array, like Math.Matrix( ({({1,2}),({3,4})}) ).
Another use is to create a special type of matrix, and this is told as third argument.
Currently there are only the "identity" type, which gives a matrix of zeroes except in the diagonal, where the number one (1.0) is. This is the default, too.
The third use is to give all indices in the matrix the same value, for instance zero or 42.
The forth use is some special matrixes. First the square identity matrix again, then the rotation matrix.
This equals |A| or sqrt( A02 + A12 + ... + An2 ).
It is only usable with 1xn or nx1 matrices.
m->normv() is equal to m*(1.0/m->norm()), with the exception that the zero vector will still be the zero vector (no error).
Ie:
array(string) lesser() - gives back a list of possible xxx's. object xxxs() - gives back a list of possible n's. object xxx(mixed n) - gives back xxx n object xxx(object(Xxx) o) - gives back the corresponing xxx
The list of n's (as returned from xxxs) are always in order.
There are two n's with special meaning, 0 and -1. 0 always gives the first xxx, equal to my_obj->xxx(my_obj->xxxs()[0]), and -1 gives the last, equal to my_obj->xxx(my_obj->xxxs()[-1]).
To get all xxxs in the object, do something like Array.map(my_obj->xxxs(),my_obj->xxx).
xxx(object) may return zero, if there was no correspondning xxx.
Lesser units: Month, Week, Day Greater units: none
function datetime(int|void unix_time) Replacement for localtime.
function datetime_name(int|void unix_time) Replacement for ctime.
function datetime_short_name(int|void unix_time) Replacement for ctime.
variable float lat variable float long Longitude (W--E) and latitude (N--S) of the position, float value in degrees. Positive number is north and east, respectively. Negative number is south and west, respectively.
n format - 17°42.19'N 42°22.2'W 1 17.703°N 42.37°W 2 17°42.18'N 42°22.2'W 3 17°42'10.4"N 42°22'12"W -1 17.703 -42.37
And that USA has three domains, Great Britain two:
> Geographical.Countries.se; Result: Country(Sweden) > Geographical.Countries.djibouti; Result: Country(Djibouti) > Geographical.Countries.com; Result: Country(United States) > Geographical.Countries.wallis_and_futuna_islands->iso2; Result: "WF"
It's used like this:
array res=Parser.SGML()->feed(string)->finish()->result();
The resulting structure is an array of atoms, where the atom can be a string or a tag. A tag contains a similar array, as data.
Example: A string "<gat> <gurka> </gurka> <banan> <kiwi> </gat>" results in
({ tag "gat" object with data: ({ tag "gurka" object with data: ({ " " }) tag "banan" object with data: ({ " " tag "kiwi" object with data: ({ " " }) }) }) })
ie, simple "tags" (not containers) are not detected, but containers are ended implicitely by a surrounding container _with_ an end tag.
The 'tag' is an object with the following variables:
string name; - name of tag mapping args; - argument to tag int line,char,column; - position of tag string file; - filename (see create) array(SGMLatom) data; - contained data
Both finish() and result() returns the computed data.
feed() returns the called object.
Example:
> Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) ); Result: "lilith=blue&anna=eva" > Protocols.HTTP.http_encode_query( (["&":"&","'=\"":"\0\0\0"]) ); Result: "%26amp%3b=%26&%27%3d%22=%00%00%00"
Do not use this function to protect URLs, since it will protect URL characters like '/' and '?'.
request_ok(object httpquery,...extra args) will be called when connection is complete, and headers are parsed.
request_fail(object httpquery,...extra args) is called if the connection fails.
variable int ok Tells if the connection is successfull. variable int errno Errno copied from the connection.
variable mapping headers Headers as a mapping. All header names are in lower case, for convinience.
variable string protocol Protocol string, ie "HTTP/1.0".
variable int status variable string status_desc Status number and description (ie, 200 and "ok").
variable mapping hostname_cache Set this to a global mapping if you want to use a cache, prior of calling *request().
variable mapping async_dns Set this to an array of Protocols.DNS.async_clients, if you wish to limit the number of outstanding DNS requests. Example: async_dns=allocate(20,Protocols.DNS.async_client)();
The query is executed in a background thread; call '() in this object to wait for the request to complete.
'query' is the first line sent to the HTTP server; for instance "GET /index.html HTTP/1.1".
headers will be encoded and sent after the first line, and data will be sent after the headers.
object(pseudofile) file() object(pseudofile) file(mapping newheaders,void|mapping removeheaders) object(pseudofile) datafile(); Gives back a pseudo-file object, with the method read() and close(). This could be used to copy the file to disc at a proper tempo.
datafile() doesn't give the complete request, just the data.
newheaders, removeheaders is applied as: (oldheaders|newheaders))-removeheaders Make sure all new and remove-header indices are lower case.
void async_fetch(function done_callback); Fetch all data in background.
options is a mapping of options,
([ "login" : int|string login as this person number (get number from name) "create" : string create a new person and login with it "password" : string send this login password "invisible" : int(0..1) if set, login invisible advanced "port" : int(0..65535) server port (default is 4894) "whoami" : string present as this user (default is from uid/getpwent and hostname) ])
if "callback" are given, this function will be called when the text is created, with the text as first argument. Otherwise, the new text is returned.
options is a mapping that may contain:
([ "recpt" : Conference|array(Conference) recipient conferences "cc" : Conference|array(Conference) cc-recipient conferences "bcc" : Conference|array(Conference) bcc-recipient conferences * "comm_to" : Text|array(Text) what text(s) is commented "foot_to" : Text|array(Text) what text(s) is footnoted "anonymous" : int(0..1) send text anonymously ])
options is a mapping that may contain:
([ "recpt" : Conference recipient conference ])
The first method is a synchronous call. This will send the command, wait for the server to execute it, and then return the result.
The last two is asynchronous calls, returning the initialised request object.
variable int protocol_level variable string session_software variable string software_version Description of the connected server.
([ "login" : int|string login as this person number (get number from name) "password" : string send this login password "invisible" : int(0..1) if set, login invisible advanced "port" : int(0..65535) server port (default is 4894) "whoami" : string present as this user (default is from uid/getpwent and hostname) ])
variable int ok tells if the call is executed ok variable object error how the call failed The call is completed if (ok||error).
({ string hostname [0] hostname array(string) ip [1] ip number(s) array(string) ip [2] dns name(s) })