1 |
<?xml version="1.0"?> |
2 |
<!DOCTYPE methoddef SYSTEM "rpc-method.dtd"> |
3 |
<!-- |
4 |
Generated automatically by etc\make_method v1.09, Fri May 31 04:39:52 2002 |
5 |
|
6 |
Any changes made here will be lost. |
7 |
--> |
8 |
<methoddef> |
9 |
<name>system.status</name> |
10 |
<version>1.1</version> |
11 |
<signature>struct</signature> |
12 |
<help> |
13 |
Report on the various status markers of the server itself. The return value is |
14 |
a STRUCT with the following members: |
15 |
|
16 |
Key Type Value |
17 |
|
18 |
host STRING Name of the (possibly virtual) host name to which |
19 |
requests are sent. |
20 |
port INT TCP/IP port the server is listening on. |
21 |
name STRING The name of the server software, as it identifies |
22 |
itself in transport headers. |
23 |
version STRING The software version. Note that this is defined as |
24 |
a STRING, not a DOUBLE, to allow for non-numeric |
25 |
values. |
26 |
path STRING URL path portion, for use when sending POST |
27 |
request messages. |
28 |
date ISO8601 The current date and time on the server, as an |
29 |
ISO 8601 date string. |
30 |
date_int INT The current date as a UNIX time() value. This is |
31 |
encoded as an INT rather than the dateTime.int |
32 |
type, so that it is readable by older clients. |
33 |
started ISO8601 The date and time when the current server started |
34 |
accepting connections, as an ISO 8601 string. |
35 |
started_int |
36 |
INT The server start-time as a UNIX time() value. This |
37 |
is also encoded as INT for the same reasons as |
38 |
the "date_int" value above. |
39 |
total_requests |
40 |
INT Total number of requests served thus far |
41 |
(including the current one). This will not include |
42 |
requests for which there was no matching method, |
43 |
or HTTP-HEAD requests. |
44 |
methods_known |
45 |
INT The number of different methods the server has |
46 |
registered for serving requests. |
47 |
</help> |
48 |
<code language="perl"> |
49 |
<![CDATA[ |
50 |
#!perl |
51 |
############################################################################### |
52 |
# |
53 |
# Sub Name: status |
54 |
# |
55 |
# Description: Create a status-reporting struct and returns it. |
56 |
# |
57 |
# Arguments: NAME IN/OUT TYPE DESCRIPTION |
58 |
# $srv in ref Server object instance |
59 |
# |
60 |
# Globals: None. |
61 |
# |
62 |
# Environment: None. |
63 |
# |
64 |
# Returns: hashref |
65 |
# |
66 |
############################################################################### |
67 |
sub status |
68 |
{ |
69 |
use strict; |
70 |
|
71 |
my $srv = shift; |
72 |
|
73 |
my $status = {}; |
74 |
my $time = time; |
75 |
my $URI; |
76 |
|
77 |
require URI; |
78 |
|
79 |
$status->{name} = ref($srv); |
80 |
$status->{version} = new RPC::XML::string $srv->version; |
81 |
$status->{host} = $srv->host || $srv->{host} || ''; |
82 |
$status->{port} = $srv->port || $srv->{port} || ''; |
83 |
$status->{path} = new RPC::XML::string $srv->path; |
84 |
$status->{date} = RPC::XML::datetime_iso8601 |
85 |
->new(RPC::XML::time2iso8601($time)); |
86 |
$status->{started} = RPC::XML::datetime_iso8601 |
87 |
->new(RPC::XML::time2iso8601($srv->started)); |
88 |
$status->{date_int} = $time; |
89 |
$status->{started_int} = $srv->started; |
90 |
$status->{total_requests} = $srv->requests() + 1; |
91 |
$status->{methods_known} = scalar($srv->list_methods); |
92 |
|
93 |
$status; |
94 |
} |
95 |
|
96 |
__END__ |
97 |
]]></code> |
98 |
</methoddef> |