10. Protocols

  Module Protocols.HTTP


Method filename_to_type
Method extension_to_type

string Protocols.HTTP.filename_to_type(string filename)
string Protocols.HTTP.extension_to_type(string extension)

Description

Looks up the file extension in a table to return a suitable MIME type. The table is located in the [...]pike/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/extensions.txt file.


Method http_date

string Protocols.HTTP.http_date(int time)

Description

Makes a time notification suitable for the HTTP protocol.


Method http_decode_string
Method http_decode_urlencoded_query

string Protocols.HTTP.http_decode_string(string what)
mapping(string:string|array(string)) Protocols.HTTP.http_decode_urlencoded_query(string query, void|mapping dest)

Description

Decodes an URL-encoded query into a mapping.


Method get_url

object(Protocols.HTTP.Query) Protocols.HTTP.get_url(string|object(Standards.URI) url)
object(Protocols.HTTP.Query) Protocols.HTTP.get_url(string|object(Standards.URI) url, mapping query_variables)
object(Protocols.HTTP.Query) Protocols.HTTP.get_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
object(Protocols.HTTP.Query) Protocols.HTTP.get_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)

Description

Sends a HTTP GET request to the server in the URL and returns the created and initialized Protocols.HTTP.Query object. 0 is returned upon failure. If a query object having request_headers->Connection=="Keep-Alive" from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.


Method put_url

object(Protocols.HTTP.Query) Protocols.HTTP.put_url(string|object(Standards.URI) url)
object(Protocols.HTTP.Query) Protocols.HTTP.put_url(string|object(Standards.URI) url, string file)
object(Protocols.HTTP.Query) Protocols.HTTP.put_url(string|object(Standards.URI) url, string file, mapping query_variables)
object(Protocols.HTTP.Query) Protocols.HTTP.put_url(string|object(Standards.URI) url, string file, mapping query_variables, mapping request_headers)
object(Protocols.HTTP.Query) Protocols.HTTP.put_url(string|object(Standards.URI) url, string file, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)

Description

Sends a HTTP PUT request to the server in the URL and returns the created and initialized Protocols.HTTP.Query object. 0 is returned upon failure. If a query object having request_headers->Connection=="Keep-Alive" from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.


Method delete_url

object(Protocols.HTTP.Query) Protocols.HTTP.delete_url(string|object(Standards.URI) url)
object(Protocols.HTTP.Query) Protocols.HTTP.delete_url(string|object(Standards.URI) url, mapping query_variables)
object(Protocols.HTTP.Query) Protocols.HTTP.delete_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
object(Protocols.HTTP.Query) Protocols.HTTP.delete_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)

Description

Sends a HTTP DELETE request to the server in the URL and returns the created and initialized Protocols.HTTP.Query object. 0 is returned upon failure. If a query object having request_headers->Connection=="Keep-Alive" from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.


Method get_url_nice
Method get_url_data

array(string) Protocols.HTTP.get_url_nice(string|object(Standards.URI) url, mapping query_variables)
array(string) Protocols.HTTP.get_url_nice(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
array(string) Protocols.HTTP.get_url_nice(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)
string Protocols.HTTP.get_url_data(string|object(Standards.URI) url, mapping query_variables)
string Protocols.HTTP.get_url_data(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
string Protocols.HTTP.get_url_data(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)

Description

Returns an array of ({content_type,data}) and just the data string respective, after calling the requested server for the information. 0 is returned upon failure.


Method post_url_nice
Method post_url_data
Method post_url

array(string) Protocols.HTTP.post_url_nice(string|object(Standards.URI) url, mapping query_variables)
array(string) Protocols.HTTP.post_url_nice(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
array(string) Protocols.HTTP.post_url_nice(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)
string Protocols.HTTP.post_url_data(string|object(Standards.URI) url, mapping query_variables)
string Protocols.HTTP.post_url_data(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
string Protocols.HTTP.post_url_data(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)
object(Protocols.HTTP.Query) Protocols.HTTP.post_url(string|object(Standards.URI) url, mapping query_variables)
object(Protocols.HTTP.Query) Protocols.HTTP.post_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers)
object(Protocols.HTTP.Query) Protocols.HTTP.post_url(string|object(Standards.URI) url, mapping query_variables, mapping request_headers, object(Protocols.HTTP.Query) query)

Description

Similar to the Protocols.HTTP.get_url class of functions, except that the query variables is sent as a POST request instead of as a GET.


Method unentity

string Protocols.HTTP.unentity(string s)

Description

Helper function for replacing HTML entities with the corresponding iso-8859-1 characters.

Note

All characters aren't replaced, only those with corresponding iso-8859-1 characters.


Method http_encode_query

string Protocols.HTTP.http_encode_query(mapping(string:int|string) variables)

Description

Encodes a query mapping to a string; this protects odd - in http perspective - characters like '&' and '#' and control characters, and packs the result together in a HTTP query string.

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"
	


Method http_encode_string

string Protocols.HTTP.http_encode_string(string in)

Description

This protects all odd - see Protocols.HTTP.http_encode_query - characters for transfer in HTTP.

Do not use this function to protect URLs, since it will protect URL characters like '/' and '?'.

  CLASS Protocols.HTTP.HeaderParser

Description

Fast HTTP header parser.

  CLASS Protocols.HTTP.Query

Description

Open and execute an HTTP query.


Variable errno

int Protocols.HTTP.Query()->errno

Description

Errno copied from the connection.


Variable ok

int Protocols.HTTP.Query()->ok

Description

Tells if the connection is successfull.


Variable headers

mapping Protocols.HTTP.Query()->headers

Description

Headers as a mapping. All header names are in lower case, for convinience.


Variable protocol

string Protocols.HTTP.Query()->protocol

Description

Protocol string, ie "HTTP/1.0".


int Protocols.HTTP.Query()->status
string Protocols.HTTP.Query()->status_desc

Description

Status number and description (eg 200 and "ok").


Variable hostname_cache

mapping Protocols.HTTP.Query()->hostname_cache

Description

Set this to a global mapping if you want to use a cache, prior of calling *request().


Variable async_dns

array Protocols.HTTP.Query()->async_dns

Description

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)();


Method set_callbacks
Method async_request

object(Protocols.HTTP.Query) Protocols.HTTP.Query()->set_callbacks(function request_ok, function request_fail, mixed ... extra)
object(Protocols.HTTP.Query) Protocols.HTTP.Query()->async_request(string server, int port, string query)
object(Protocols.HTTP.Query) Protocols.HTTP.Query()->async_request(string server, int port, string query, mapping headers, string|void data)

Description

Setup and run an asynchronous request, otherwise similar to Protocols.HTTP.Query.thread_request.

request_ok(Protocols.HTTP.Query httpquery,...extra args) will be called when connection is complete, and headers are parsed.

request_fail(Protocols.HTTP.Query httpquery,...extra args) is called if the connection fails.

Returns

Returns the called object


Method thread_request

object(Protocols.HTTP.Query) Protocols.HTTP.Query()->thread_request(string server, int port, string query)
object(Protocols.HTTP.Query) Protocols.HTTP.Query()->thread_request(string server, int port, string query, mapping headers, void|string data)

Description

Create a new query object and begin the query.

The query is executed in a background thread; call Protocols.HTTP.Query.`() in the 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.

Returns

Returns the called object.


Method `()

int Protocols.HTTP.Query()->`()()

Description

Wait for connection to complete.

Returns

Returns 1 on successfull connection, 0 on failure.


Method data

string Protocols.HTTP.Query()->data(int|void max_length)

Description

Gives back the data as a string.


Method downloaded_bytes

int Protocols.HTTP.Query()->downloaded_bytes()

Description

Gives back the number of downloaded bytes.


Method total_bytes

int Protocols.HTTP.Query()->total_bytes()

Description

Gives back the size of a file if a content-length header is present and parsed at the time of evaluation. Otherwise returns -1.


Method cast

array Protocols.HTTP.Query()->cast("array")

Description

Gives back

({mapping headers, string data,
		           string protocol, int status, string status_desc});


Method cast

mapping Protocols.HTTP.Query()->cast("mapping")

Description

Gives back

 headers |
	(["protocol":protocol,
	  "status":status number,
	  "status_desc":status description,
	  "data":data]); 


Method cast

string Protocols.HTTP.Query()->cast("string")

Description

Gives back the answer as a string.


Method file

object(Protocols.HTTP.Query.PseudoFile) Protocols.HTTP.Query()->file()
object(Protocols.HTTP.Query.PseudoFile) Protocols.HTTP.Query()->file(mapping newheaders, void|mapping removeheaders)

Description

Gives back a pseudo-file object, with the methods read() and close(). This could be used to copy the file to disc at a proper tempo.

newheaders, removeheaders is applied as:

(oldheaders|newheaders))-removeheaders
Make sure all new and remove-header indices are lower case.

See also

Protocols.HTTP.Query.datafile


Method datafile

object(Protocols.HTTP.Query.PseudoFile) Protocols.HTTP.Query()->datafile()

Description

Gives back a pseudo-file object, with the methods read() and close(). This could be used to copy the file to disc at a proper tempo.

Protocols.HTTP.Query.datafile doesn't give the complete request, just the data.

See also

Protocols.HTTP.Query.file


Method async_fetch

void Protocols.HTTP.Query()->async_fetch(function callback, mixed ... extra)

Description

Fetch all data in background.

  Module Protocols.HTTP.Server

  CLASS Protocols.HTTP.Server.Port

Description

The simplest server possible. Binds a port and calls a callback with Request objects.


Method create
Method close

void Protocols.HTTP.Server.Port()->create(function(, object(Request):void) callback)
void Protocols.HTTP.Server.Port()->create(function(, object(Request):void) callback, int portno, void|string interface)
void Protocols.HTTP.Server.Port()->close()

Description

Closes the HTTP port.

  Module SSL

  CLASS SSL.session

Description

The most important information in a session object is a choice of encryption algorithms and a "master secret" created by keyexchange with a client. Each connection can either do a full key exchange to established a new session, or reuse a previously established session. That is why we have the session abstraction and the session cache. Each session is used by one or more connections, in sequence or simultaneously.

It is also possible to change to a new session in the middle of a connection.

Inherits

  • "cipher"

Variable identity

string SSL.session()->identity

Description

Identifies the session to the server


Variable compression_algorithm

int SSL.session()->compression_algorithm

Description

Always COMPRESSION_null.


Variable cipher_suite

int SSL.session()->cipher_suite

Description

Constant defining a choice of keyexchenge, encryption and mac algorithm.


Variable cipher_spec

object SSL.session()->cipher_spec

Description

Information about the encryption method derived from the cipher_suite.


Variable ke_method

int SSL.session()->ke_method

Description

Key exchange method, also derived from the cipher_suite.


Variable master_secret

string SSL.session()->master_secret

Description

48 byte secret shared between the client and the server. Used for deriving the actual keys.


Method set_cipher_suite

void SSL.session()->set_cipher_suite(int suite, int version)


Method set_compression_method

void SSL.session()->set_compression_method(int compr)


Method new_server_states

array SSL.session()->new_server_states(string client_random, string server_random, array(int) version)

Description

Computes a new set of encryption stetes, derived from the client_random, server_random and master_secret strings.

Returns
Array
object(State) read_state

Read state

object(State) write_state

Write state



Method new_client_states

array SSL.session()->new_client_states(string client_random, string server_random, array(int) version)

Description

Computes a new set of encryption stetes, derived from the client_random, server_random and master_secret strings.

Returns
Array
object(State) read_state

Read state

object(State) write_state

Write state


  CLASS SSL.constants

Description

Protocol constants

  CLASS SSL.handshake

Description

SSL.handshake keeps the state relevant for SSL handshaking. This includes a pointer to a context object (which doesn't change), various buffers, a pointer to a session object (reuse or created as appropriate), and pending read and write states being negotiated.

Each connection will have two sets or read and write state: The current read and write states used for encryption, and pending read and write states to be taken into use when the current keyexchange handshake is finished.

Inherits

  • "cipher"

Variable auth_level

int SSL.handshake()->auth_level

Description

Policy for client authentication. One of AUTHLEVEL_none, AUTHLEVEL_ask and AUTHLEVEL_require.


Variable authorities

array(string) SSL.handshake()->authorities

Description

Array of authorities that are accepted for client certificates. The client will only send certificates that are signed by any of these authorities. The string is the DER-encoded issuer.


string SSL.handshake()->client_random
string SSL.handshake()->server_random

Description

Random cookies, sent and received with the hello-messages.


Method handle_handshake

int(-1..1) SSL.handshake()->handle_handshake(int type, string data, string raw)

Description

Do handshake processing. Type is one of HANDSHAKE_*, data is the contents of the packet, and raw is the raw packet received (needed for supporting SSLv2 hello messages).

This function returns 0 if hadshake is in progress, 1 if handshake is finished, and -1 if a fatal error occured. It uses the send_packet() function to trasnmit packets.

  CLASS SSL.alert

Description

Alert package.

Inherits

  • "packet"

Method create

void SSL.alert()->create(int level, int description, string|void message, mixed|void trace)

  CLASS SSL.connection

Description

SSL packet layer. SSL.connection inherits SSL.handshake, and in addition to the state in the handshake super class, it contains the current read and write states, packet queues. This object is responsible for receiving and sending packets, processing handshake packets, and providing a clear text packages for some application.

Inherits

  • "constants"
  • "handshake"
  • Queue
  • Queue
  • Queue

Method set_alert_callback

void SSL.connection()->set_alert_callback(function(object:void) callback)

Description

Called with alert object, sequence number of bad packet, and raw data as arguments, if a bad packet is received.

Can be used to support a fallback redirect https->http.


Method recv_packet

object SSL.connection()->recv_packet(string data)

Description

Low-level recieve handler. Returns a packet, an alert, or zero if more data is needed to get a complete packet.


Method send_packet

void SSL.connection()->send_packet(object packet, int|void priority)

Description

Queues a packet for write. Handshake and and change cipher must use the same priority, so must application data and close_notifies.


Method to_write

string|int SSL.connection()->to_write()

Description

Extracts data from the packet queues. Returns a string of data to be written, "" if there are no pending packets, 1 of the connection is being closed politely, and -1 if the connection died unexpectedly.

This function is intended to be called from an i/o write callback.


Method send_close

void SSL.connection()->send_close()

Description

Initiate close.


Method got_data

string|int SSL.connection()->got_data(string|int s)

Description

Main receive handler. Returns a string of received application data, or 1 if a close was received, or -1 if an error occured.

This function is intended to be called from an i/o read callback.

  CLASS SSL.sslfile

Description

Interface similar to Stdio.File.

Inherits

  • "connection"
  CLASS SSL.context

Description

Keeps the state that is shared by all SSL-connections for one server (or one port). It includes policy configuration, a server certificate, the server's private key(s), etc. It also includes the session cache.

Inherits

  • "constants"

Variable rsa

object SSL.context()->rsa

Description

The server's private key


object SSL.context()->long_rsa
object SSL.context()->short_rsa

Description

Temporary, non-certified, private keys, used with a server_key_exchange message. The rules are as follows:

If the negotiated cipher_suite has the "exportable" property, and short_rsa is not zero, send a server_key_exchange message with the (public part of) the short_rsa key.

If the negotiated cipher_suite does not have the exportable property, and long_rsa is not zero, send a server_key_exchange message with the (public part of) the long_rsa key.

Otherwise, dont send any server_key_exchange message.


Variable random

function(int:string) SSL.context()->random

Description

Used to generate random cookies for the hello-message. If we use the RSA keyexchange method, and this is a server, this random number generator is not used for generating the master_secret.


Variable certificates

array(string) SSL.context()->certificates

Description

The server's certificate, or a chain of X509.v3 certificates, with the server's certificate first and root certificate last.


Variable preferred_auth_methods

array(int) SSL.context()->preferred_auth_methods

Description

For client authentication. Used only if auth_level is AUTH_ask or AUTH_require.


Variable preferred_suites

array(int) SSL.context()->preferred_suites

Description

Cipher suites we want the server to support, best first.


Variable preferred_compressors

array(int) SSL.context()->preferred_compressors

Description

Always ({ COMPRESSION_null })


Variable use_cache

int SSL.context()->use_cache

Description

Non-zero to enable cahing of sessions


Variable session_lifetime

int SSL.context()->session_lifetime

Description

Sessions are removed from the cache when they are older than this limit (in seconds). Sessions are also removed from the cache if a connection using the session dies unexpectedly.


Method lookup_session

object SSL.context()->lookup_session(string id)

Description

Lookup a session identifier in the cache. Returns the corresponding session, or zero if it is not found or caching is disabled.


Method new_session

object SSL.context()->new_session()

Description

Create a new session.


Method record_session

void SSL.context()->record_session(object s)

Description

Add a session to the cache (if caching is enabled).


Method purge_session

void SSL.context()->purge_session(object s)

Description

Remove a session from the cache.

  CLASS SSL.packet

Description

SSL Record Layer. Handle formatting and parsing of packets.

Inherits

  • "constants"
  CLASS SSL.state

Description

A connection switches from one set of state objects to another, one or more times during its lifetime. Each state object handles a one-way stream of packets, and operates in either decryption or encryption mode.

Inherits

  • "constants"

Variable session

object SSL.state()->session

Description

Information about the used algorithms.


Variable mac

object SSL.state()->mac

Description

Message Authentication Code


Variable crypt

object SSL.state()->crypt

Description

Encryption or decryption object.


Variable seq_num

object(Gmp.mpz)|int SSL.state()->seq_num

Description

64-bit sequence number.


Method decrypt_packet

object SSL.state()->decrypt_packet(object packet, int version)

Description

Destructively decrypts a packet (including inflating and MAC-verification, if needed). On success, returns the decrypted packet. On failure, returns an alert packet. These cases are distinguished by looking at the is_alert attribute of the returned packet.


Method encrypt_packet

object SSL.state()->encrypt_packet(object packet, int version)

Description

Encrypts a packet (including deflating and MAC-generation).

  CLASS SSL.sslport

Description

Interface similar to Stdio.Port.

Inherits

  • Stdio.Port
  • "context"
  • ADT.Queue
  CLASS SSL.https

Description

Dummy HTTPS server

Inherits

  • "sslport"
  CLASS SSL.cipher

Description

Encryption and MAC algorithms used in SSL.

Inherits

  • "constants"
  Module Protocols.LysKOM

  CLASS Protocols.LysKOM.Session


Variable user

object Protocols.LysKOM.Session()->user

Description

This variable contains the Protocols.LysKOM.Session.Person that is logged in.


Method create

void Protocols.LysKOM.Session()->create(string server)
void Protocols.LysKOM.Session()->create(string server, mapping options)

Description

Initializes the session object, and opens a connection to that server.

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.

"port" : int(0..65535)

server port (default is 4894).

"whoami" : string

present as this user (default is from uid/getpwent and hostname).


See also

Protocols.LysKOM.Connection


Method text

object(Text) Protocols.LysKOM.Session()->text(int no)

Description

Returns the text no.


Method person

object(Person) Protocols.LysKOM.Session()->person(int no)

Description

Returns the person no.


Method conference

object(Conference) Protocols.LysKOM.Session()->conference(int no)

Description

Returns conference number no.


Method try_complete_person

array(object(ProtocolTypes.ConfZInfo)) Protocols.LysKOM.Session()->try_complete_person(string orig)

Description

Runs a LysKOM completion on the given string, returning an array of confzinfos of the match.


Method login

object Protocols.LysKOM.Session()->login(int user_no, string password)
object Protocols.LysKOM.Session()->login(int user_no, string password, int invisible)

Description

Performs a login. Throws a lyskom error if unsuccessful.

Returns

The session object logged in.


Method create_person

object Protocols.LysKOM.Session()->create_person(string name, string password)

Description

Create a person, which will be logged in. returns the new person object


Method logout

object Protocols.LysKOM.Session()->logout()

Description

Logouts from the server. returns the called object


Method create_text

object Protocols.LysKOM.Session()->create_text(string subject, string body, mapping options)
object Protocols.LysKOM.Session()->create_text(string subject, string body, mapping options, function callback, mixed ... extra)

Description

Creates a new text.

if callback is given, the function will be called when the text has been created, with the text as first argument. Otherwise, the new text is returned.

options is a mapping that may contain:

"recpt" : object(Conference)|array(object(Conference))

recipient conferences.

"cc" : object(Conference)|array(object(Conference))

cc-recipient conferences.

"bcc" : object(Conference)|array(object(Conference))

bcc-recipient conferences*.

"comm_to" : object(Text)|array(object(Text))

The text(s) to be commented.

"foot_to" : object(Text)|array(object(Text))

The text(s) to be footnoted.

"anonymous" : int(0..1)

send text anonymously.

"aux_items" : array(object(AuxItemInput))

AuxItems you want to set for the text*.


Note

The items above marked with '*' are only available on protocol 10 servers. A LysKOM error will be thrown if the call fails.

See also

Protocols.LysKOM.Session.Conference.create_text, Protocols.LysKOM.Session.Text.comment, Protocols.LysKOM.Session.Text.footnote


Method send_message

object|void Protocols.LysKOM.Session()->send_message(string textstring, mapping options)

Description

Sends a message.

options is a mapping that may contain:

"recpt" : object(Conference)

recipient conference.



Method register_async_message_callback

void Protocols.LysKOM.Session()->register_async_message_callback(function(int:void) cb)

  CLASS Protocols.LysKOM.Session.AuxItemInput

FIXME

Undocumented

Inherits

  • ProtocolTypes.AuxItemInput
  CLASS Protocols.LysKOM.Session.AuxItems

FIXME

Undocumented

  CLASS Protocols.LysKOM.Session.Text

Description

All variables in this class is read only.

FIXME

Undocumented


Variable no

int Protocols.LysKOM.Session.Text()->no

Description

The text number, as spicified to Protocols.LysKOM.Session.Text.create.


Variable err

object Protocols.LysKOM.Session.Text()->err

Description

Undocumented


Method create

void Protocols.LysKOM.Session.Text()->create(string textnumber)

Description

Initializes a Text object.


Method mark_as_read

void Protocols.LysKOM.Session.Text()->mark_as_read()

FIXME

Undocumented.


mixed Protocols.LysKOM.Session.Text()->prefetch_text
mixed Protocols.LysKOM.Session.Text()->prefetch_stat
mixed Protocols.LysKOM.Session.Text()->lines
mixed Protocols.LysKOM.Session.Text()->characters
mixed Protocols.LysKOM.Session.Text()->clear_stat
mixed Protocols.LysKOM.Session.Text()->aux_items

FIXME

Undocumented


Variable text

string Protocols.LysKOM.Session.Text()->text

Description

The actual text (or body if you wish).


Variable subject

string Protocols.LysKOM.Session.Text()->subject

Description

The message subject.


Variable author

string Protocols.LysKOM.Session.Text()->author

Description

The author of the text.


Variable misc

mixed Protocols.LysKOM.Session.Text()->misc

Description

Misc info, including what conferences the message is posted to.

FIXME

Needs a more complete description.


Variable marks

int Protocols.LysKOM.Session.Text()->marks

Description

The number of marks on this text.


Variable creation_time

mixed Protocols.LysKOM.Session.Text()->creation_time

Description

The time the text was created on the server.

  CLASS Protocols.LysKOM.Session.Membership

Description

All variables in this class is read only.


Variable last_time_read

object Protocols.LysKOM.Session.Membership()->last_time_read


Variable priority

int(0..255) Protocols.LysKOM.Session.Membership()->priority


Variable last_text_read

int Protocols.LysKOM.Session.Membership()->last_text_read


Variable read_texts

array(int) Protocols.LysKOM.Session.Membership()->read_texts


Variable added_at

object Protocols.LysKOM.Session.Membership()->added_at


Variable type

multiset(string) Protocols.LysKOM.Session.Membership()->type


Variable position

int Protocols.LysKOM.Session.Membership()->position


Variable conf

object Protocols.LysKOM.Session.Membership()->conf


Method number_unread

int Protocols.LysKOM.Session.Membership()->number_unread()


Method query_read_texts

void Protocols.LysKOM.Session.Membership()->query_read_texts()


Method unread_texts

array(object) Protocols.LysKOM.Session.Membership()->unread_texts()

  CLASS Protocols.LysKOM.Session.Person


Variable no

int Protocols.LysKOM.Session.Person()->no


Method create

void Protocols.LysKOM.Session.Person()->create(int no)


mixed Protocols.LysKOM.Session.Person()->prefetch_stat
mixed Protocols.LysKOM.Session.Person()->prefetch_conf
mixed Protocols.LysKOM.Session.Person()->prefetch_membership

FIXME

Undocumented


object Protocols.LysKOM.Session.Person()->error
object(Text) Protocols.LysKOM.Session.Person()->user_area
mixed Protocols.LysKOM.Session.Person()->username
mixed Protocols.LysKOM.Session.Person()->privileges
mixed Protocols.LysKOM.Session.Person()->flags
mixed Protocols.LysKOM.Session.Person()->last_login
mixed Protocols.LysKOM.Session.Person()->total_time_present
mixed Protocols.LysKOM.Session.Person()->sessions
mixed Protocols.LysKOM.Session.Person()->created_lines
mixed Protocols.LysKOM.Session.Person()->created_bytes
mixed Protocols.LysKOM.Session.Person()->read_texts
mixed Protocols.LysKOM.Session.Person()->no_of_text_fetches
mixed Protocols.LysKOM.Session.Person()->created_persons
mixed Protocols.LysKOM.Session.Person()->created_confs
mixed Protocols.LysKOM.Session.Person()->first_created_local_no
mixed Protocols.LysKOM.Session.Person()->no_of_created_texts
mixed Protocols.LysKOM.Session.Person()->no_of_marks
mixed Protocols.LysKOM.Session.Person()->no_of_confs
mixed Protocols.LysKOM.Session.Person()->unread
int(0..0) Protocols.LysKOM.Session.Person()->clear_membership
mixed Protocols.LysKOM.Session.Person()->membership

FIXME

Undocumented

  CLASS Protocols.LysKOM.Session.Conference


Method create

void Protocols.LysKOM.Session.Conference()->create(int no)

  CLASS Protocols.LysKOM.Connection

Description

This class contains nice abstraction for calls into the server. They are named "call", "async_call" or "async_cb_call", depending on how you want the call to be done.


Method XXX
Method async_XXX
Method async_cb_XXX

mixed Protocols.LysKOM.Connection()->XXX(mixed ... args)
object Protocols.LysKOM.Connection()->async_XXX(mixed ... args)
object Protocols.LysKOM.Connection()->async_cb_XXX(function callback, mixed ... args)

Description

Do a call to the server. This really clones a Protocols.LysKOM.Request object, and initialises it. XXX is to be read as one of the calls in the lyskom protocol. ('-' is replaced with '_'.) (ie, logout, async_login or async_cb_get_conf_stat.)

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 are asynchronous calls, returning an initialised Protocols.LysKOM.Request object.


int Protocols.LysKOM.Connection()->protocol_level
string Protocols.LysKOM.Connection()->session_software
string Protocols.LysKOM.Connection()->software_version

Description

Description of the connected server.


Method create

void Protocols.LysKOM.Connection()->create(string server)
void Protocols.LysKOM.Connection()->create(string server, mapping options)

Description

The options argument is a mapping with the following members:

"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.

"port" : int(0..65535)

server port (default is 4894).

"whoami" : string

present as this user (default is from uid/getpwent and hostname).


  Module Protocols.LysKOM.Request

Description

This module contains nice abstraction for calls into the server. They are named "call", "async_call" or "async_cb_call", depending on how you want the call to be done.

  CLASS Protocols.LysKOM.Request._Request

Description

This is the main request class. All lyskom request classes inherit this class.


Method async
Method sync

void Protocols.LysKOM.Request._Request()->async(mixed ... args)
mixed Protocols.LysKOM.Request._Request()->sync(mixed ... args)

Description

Initialise an asynchronous or a synchronous call, the latter is also evaluating the result. This calls indata() in itself, to get the correct arguments to the lyskom protocol call.


Method _async
Method _sync

void Protocols.LysKOM.Request._Request()->_async(int call, mixed_data)
mixed Protocols.LysKOM.Request._Request()->_sync(int call, mixed_data)

Description

Initialise an asynchronous or a synchronous call, the latter is also evaluating the result. These are called by async and sync respectively.


Method _reply
Method reply

mixed Protocols.LysKOM.Request._Request()->_reply(object|array what)
mixed Protocols.LysKOM.Request._Request()->reply(object|array what)

Description

Protocols.LysKOM.Request._Request._reply is called as callback to evaluate the result, and calls Protocols.LysKOM.Request._Request.reply in itself to do the real work.


Method `()

mixed Protocols.LysKOM.Request._Request()->`()()

Description

Wait for the call to finish.


Variable ok

int(0..1) Protocols.LysKOM.Request._Request()->ok

Description

Tells if the call has executed ok


Variable error

object Protocols.LysKOM.Request._Request()->error

Description

How the call failed. The call has completed if

(ok||error)
.

  Module Protocols.DNS

Description

$Id: DNS.pmod,v 1.62 2002/03/09 18:27:04 nilsson Exp $

  CLASS Protocols.DNS.client

Description

Synchronous DNS client.

Inherits

  • protocol

Method create

void Protocols.DNS.client()->create()
void Protocols.DNS.client()->create(void|string|array server, void|int|array domain)


Method gethostbyname
Method gethostbyaddr

array Protocols.DNS.client()->gethostbyname(string hostname)
array Protocols.DNS.client()->gethostbyaddr(string hostip)

Description

Querys the host name or ip from the default or given DNS server. The result is an array with three elements,

Array
string hostname

Hostname.

array(string) ip

IP number(s).

array(string) aliases

DNS name(s).



Method get_primary_mx

string Protocols.DNS.client()->get_primary_mx(string hostname)

Description

Querys the primary mx for the host.

Returns

Returns the hostname of the primary mail exchanger.

  Module Protocols

  Module Protocols.LDAP

  CLASS Protocols.LDAP.client

Description

Contains the client implementation of the LDAP protocol. All of the version 2 protocol features are implemented but only the base parts of the version 3.

Inherits

  • .protocol

Variable info

mapping Protocols.LDAP.client()->info

Description

Several information about code itself and about active connection too


Method create

void Protocols.LDAP.client()->create()
void Protocols.LDAP.client()->create(string url)
void Protocols.LDAP.client()->create(string url, object context)

Description

Create object. The first optional argument can be used later for subsequence operations. The second one can specify TLS context of connection. The default context only allows 128-bit encryption methods, so you may need to provide your own context if your LDAP server supports only export encryption.

Parameter url

LDAP server URL in form "ldap://hostname/basedn?attrlist?scope?ext"

Parameter context

TLS context of connection

See also

LDAP.client.bind, LDAP.client.search


Method bind

int Protocols.LDAP.client()->bind()
int Protocols.LDAP.client()->bind(string dn, string password)
int Protocols.LDAP.client()->bind(string dn, string password, int version)

Description

Authenticates connection to the direcory.

First form uses default value previously entered in create.

Second form uses value from parameters:

Parameter dn

The distinguished name (DN) of an entry aginst which will be made authentication.

Parameter password

Password used for authentication.

Third form allows specify the version of LDAP protocol used by connection to the LDAP server.

Parameter version

Only 2 or 3 can be entered.

Note

Only simple authentication type is implemented. So be warned clear text passwords are sent to the directory server.


Method unbind

int Protocols.LDAP.client()->unbind()

Description

Unbinds from the directory and close the connection.


Method delete

int Protocols.LDAP.client()->delete(string dn)

Description

Deletes entry from the LDAP server.

Parameter dn

The distinguished name of deleted entry.


Method compare

int Protocols.LDAP.client()->compare(string dn, array(string) aval)

Description

Compares given attribute value with one in the directory.

Parameter dn

The distinguished name of compared entry.

Parameter aval

The mapping of compared attributes and theirs values.


Method add

int Protocols.LDAP.client()->add(string dn, mapping(string:array(string)) attrs)

Description

The Add Operation allows a client to request the addition of an entry into the directory

Parameter dn

The Distinguished Name of the entry to be added.

Parameter attrs

The mapping of attributes and their values that make up the content of the entry being added.


Method search

object|int Protocols.LDAP.client()->search(string|void filter, int|void attrsonly, array(string)|void attrs)

Parameter filter

search filter

Parameter attrsonly

flag

Parameter attrs

attribute(s) name


Method set_basedn

string Protocols.LDAP.client()->set_basedn(string base_dn)

Parameter base_dn

base DN for search


Method set_scope

int Protocols.LDAP.client()->set_scope(int|string scope)

Description

Sets value of scope for search operation.

Parameter scope

Value can be integer or its corresponding string value. 0: base, 1: one, 2: sub


Method set_option

int Protocols.LDAP.client()->set_option(int opttype, int value)

Parameter option_type

LDAP_OPT_xxx

Parameter value

new value for option


Method get_option

int Protocols.LDAP.client()->get_option(int opttype)

Parameter option_type

LDAP_OPT_xxx


Method modifydn

int Protocols.LDAP.client()->modifydn(string dn, string newrdn, int deleteoldrdn, string|void newsuperior)

Description

The Modify DN Operation allows a client to change the leftmost (least significant) component of the name of an entry in the directory, or to move a subtree of entries to a new location in the directory.

Parameter dn

DN of source object

Parameter newrdn

RDN of destination

Parameter deleteoldrdn

The parameter controls whether the old RDN attribute values are to be retained as attributes of the entry, or deleted from the entry.

Parameter newsuperior

If present, this is the Distinguished Name of the entry which becomes the immediate superior of the existing entry.


Method modify

int Protocols.LDAP.client()->modify(string dn, mapping(string:array(mixed)) attropval)

Description

The Modify Operation allows a client to request that a modification of an entry be performed on its behalf by a server.

Parameter dn

The distinguished name of modified entry.

Parameter attropval

The mapping of attributes with requested operation and attribute's values.

attropval=([ attribute: ({operation, value1, value2, ...}) ])

where operation is one of the following: 0 (LDAP_OPERATION_ADD) - add values listed to the given attribute, creating the attribute if necessary 1 (LDAP_OPERATION_DELETE) - delete values listed from the given attribute, removing the entire attribute if no values are listed, or if all current values of the attribute are listed for deletion 2 (LDAP_OPERATION_REPLACE) - replace all existing values of the given attribute with the new values listed, creating the attribute if it did not already exist. A replace with no value will delete the entire attribute if it exists, and is ignored if the attribute does not exist


Method parse_url

mapping|int Protocols.LDAP.client()->parse_url(string ldapuri)

Parameter ldapuri

LDAP URL

  CLASS Protocols.LDAP.client.result

Description

Contains the result of a LDAP search.

See also

LDAP.client.search, LDAP.client.result.fetch


Method create

object|int Protocols.LDAP.client.result()->create(array rawres, int|void stuff)

Description

You can't create instances of this object yourself. The only way to create it is via a search of a LDAP server.


Method error_number

int Protocols.LDAP.client.result()->error_number()

Description

Returns error number of search result.

See also

LDAP.client.result.error_string


Method error_string

string Protocols.LDAP.client.result()->error_string()

Description

Returns error description of search result.

See also

LDAP.client.result.error_number


Method num_entries

int Protocols.LDAP.client.result()->num_entries()

Description

Returns the number of entries.

See also

LDAP.client.result.count_entries


Method count_entries

int Protocols.LDAP.client.result()->count_entries()

Description

Returns the number of entries from current cursor possition till end of the list.

See also

LDAP.client.result.first, LDAP.client.result.next


Method fetch

int|mapping(string:array(string)) Protocols.LDAP.client.result()->fetch(int|void idx)

Description

Returns a mapping with an entry for each attribute. Each entry is an array of values of the attribute.

Parameter index

Optional argument can be used for direct access to the entry other then currently pointed by cursor.


Method get_dn

string Protocols.LDAP.client.result()->get_dn()

Description

Returns distinguished name (DN) of the current entry in the result list. N