| 12. Protocols |
| Module Protocols.HTTP |
string Protocols.HTTP.filename_to_type(string filename)
string Protocols.HTTP.extension_to_type(string extension)
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.
string Protocols.HTTP.http_date(int time)
Makes a time notification suitable for the HTTP protocol.
string Protocols.HTTP.http_decode_string(string what)
mapping(string:string|array(string)) Protocols.HTTP.http_decode_urlencoded_query(string query, void|mapping dest)
Decodes an URL-encoded query into a mapping.
Protocols.HTTP.Query Protocols.HTTP.get_url(string|Standards.URI url)
Protocols.HTTP.Query Protocols.HTTP.get_url(string|Standards.URI url, mapping query_variables)
Protocols.HTTP.Query Protocols.HTTP.get_url(string|Standards.URI url, mapping query_variables, mapping request_headers)
Protocols.HTTP.Query Protocols.HTTP.get_url(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
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.
Protocols.HTTP.Query Protocols.HTTP.put_url(string|Standards.URI url)
Protocols.HTTP.Query Protocols.HTTP.put_url(string|Standards.URI url, string file)
Protocols.HTTP.Query Protocols.HTTP.put_url(string|Standards.URI url, string file, mapping query_variables)
Protocols.HTTP.Query Protocols.HTTP.put_url(string|Standards.URI url, string file, mapping query_variables, mapping request_headers)
Protocols.HTTP.Query Protocols.HTTP.put_url(string|Standards.URI url, string file, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
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.
Protocols.HTTP.Query Protocols.HTTP.delete_url(string|Standards.URI url)
Protocols.HTTP.Query Protocols.HTTP.delete_url(string|Standards.URI url, mapping query_variables)
Protocols.HTTP.Query Protocols.HTTP.delete_url(string|Standards.URI url, mapping query_variables, mapping request_headers)
Protocols.HTTP.Query Protocols.HTTP.delete_url(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
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.
array(string) Protocols.HTTP.get_url_nice(string|Standards.URI url, mapping query_variables)
array(string) Protocols.HTTP.get_url_nice(string|Standards.URI url, mapping query_variables, mapping request_headers)
array(string) Protocols.HTTP.get_url_nice(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
string Protocols.HTTP.get_url_data(string|Standards.URI url, mapping query_variables)
string Protocols.HTTP.get_url_data(string|Standards.URI url, mapping query_variables, mapping request_headers)
string Protocols.HTTP.get_url_data(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
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.
array(string) Protocols.HTTP.post_url_nice(string|Standards.URI url, mapping query_variables)
array(string) Protocols.HTTP.post_url_nice(string|Standards.URI url, mapping query_variables, mapping request_headers)
array(string) Protocols.HTTP.post_url_nice(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
string Protocols.HTTP.post_url_data(string|Standards.URI url, mapping query_variables)
string Protocols.HTTP.post_url_data(string|Standards.URI url, mapping query_variables, mapping request_headers)
string Protocols.HTTP.post_url_data(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
Protocols.HTTP.Query Protocols.HTTP.post_url(string|Standards.URI url, mapping query_variables)
Protocols.HTTP.Query Protocols.HTTP.post_url(string|Standards.URI url, mapping query_variables, mapping request_headers)
Protocols.HTTP.Query Protocols.HTTP.post_url(string|Standards.URI url, mapping query_variables, mapping request_headers, Protocols.HTTP.Query query)
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.
string Protocols.HTTP.unentity(string s)
Helper function for replacing HTML entities with the corresponding iso-8859-1 characters.
All characters aren't replaced, only those with corresponding iso-8859-1 characters.
string Protocols.HTTP.http_encode_query(mapping(string:int|string) variables)
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"
string Protocols.HTTP.http_encode_string(string in)
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 |
Fast HTTP header parser.
| CLASS Protocols.HTTP.Query |
Open and execute an HTTP query.
int errno
Errno copied from the connection.
int ok
Tells if the connection is successfull.
mapping headers
Headers as a mapping. All header names are in lower case, for convinience.
string protocol
Protocol string, ie "HTTP/1.0".
int status
string status_desc
Status number and description (eg 200 and "ok").
mapping hostname_cache
Set this to a global mapping if you want to use a cache, prior of calling *request().
array 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)();
Protocols.HTTP.Query set_callbacks(function request_ok, function request_fail, mixed ... extra)
Protocols.HTTP.Query async_request(string server, int port, string query)
Protocols.HTTP.Query async_request(string server, int port, string query, mapping headers, string|void data)
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 the called object
Protocols.HTTP.Query thread_request(string server, int port, string query)
Protocols.HTTP.Query thread_request(string server, int port, string query, mapping headers, void|string data)
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 the called object.
int `()()
Wait for connection to complete.
Returns 1 on successfull connection, 0 on failure.
string data(int|void max_length)
Gives back the data as a string.
int downloaded_bytes()
Gives back the number of downloaded bytes.
int total_bytes()
Gives back the size of a file if a content-length header is present and parsed at the time of evaluation. Otherwise returns -1.
array cast("array")
Gives back ({mapping headers, string data,
string protocol, int status, string status_desc});
mapping cast("mapping")
Gives back
headers |
(["protocol":protocol,
"status":status number,
"status_desc":status description,
"data":data]);
string cast("string")
Gives back the answer as a string.
Protocols.HTTP.Query.PseudoFile file()
Protocols.HTTP.Query.PseudoFile file(mapping newheaders, void|mapping removeheaders)
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:
Make sure all new and remove-header indices are lower case.(oldheaders|newheaders))-removeheaders
Protocols.HTTP.Query.datafile
Protocols.HTTP.Query.PseudoFile datafile()
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.
Protocols.HTTP.Query.file
void async_fetch(function callback, mixed ... extra)
Fetch all data in background.
| Module Protocols.HTTP.Server |
| CLASS Protocols.HTTP.Server.Port |
The simplest server possible. Binds a port and calls a callback with Protocols.HTTP.Server.Request objects.
void Protocols.HTTP.Server.Port(function(, Request:void) callback)
void Protocols.HTTP.Server.Port(function(, Request:void) callback, int portno, void|string interface)
void close()
Closes the HTTP port.
| CLASS Protocols.HTTP.Server.Request |
string raw
raw unparsed full request (headers and body)
string body_raw
raw unparsed body of the request (Protocols.HTTP.Server.Request.raw minus request line and headers)
string request_raw
full request line (Protocols.HTTP.Server.Request.request_type + Protocols.HTTP.Server.Request.full_query + Protocols.HTTP.Server.Request.protocol)
string request_type
HTTP request method, eg. POST, GET, etc.
string full_query
full resource requested, including attached GET query
string not_query
resource requested minus any attached query
string query
query portion of requested resource, starting after the first "?"
string protocol
request protocol and version, eg. HTTP/1.0
mapping(string:string|array(string)) request_headers
all headers included as part of the HTTP request, ie content-type.
mapping(string:string|array(string)) variables
all variables included as part of a GET or POST request.
mapping(string:string) cookies
cookies set by client
mapping misc
external use only
void response_and_finish(mapping m, function|void _log_cb)
return a properly formatted response to the HTTP client
Contains elements for generating a response to the client.
|
| Module SSL |
| CLASS SSL.alert |
Alert package.
void SSL.alert(int level, int description, string|void message, mixed|void trace)
| CLASS SSL.cipher |
Encryption and MAC algorithms used in SSL.
| CLASS SSL.connection |
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.
void set_alert_callback(function(object:void) callback)
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.
object recv_packet(string data)
Low-level recieve handler. Returns a packet, an alert, or zero if more data is needed to get a complete packet.
void send_packet(object packet, int|void priority)
Queues a packet for write. Handshake and and change cipher must use the same priority, so must application data and close_notifies.
string|int to_write()
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.
void send_close()
Initiate close.
string|int got_data(string|int s)
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.constants |
Protocol constants
| CLASS SSL.context |
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.
object rsa
The server's private key
object long_rsa
object short_rsa
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.
function(int:string) random
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.
array(string) certificates
The server's certificate, or a chain of X509.v3 certificates, with the server's certificate first and root certificate last.
array(int) preferred_auth_methods
For client authentication. Used only if auth_level is AUTH_ask or AUTH_require.
array(int) preferred_suites
Cipher suites we want the server to support, best first.
array(int) preferred_compressors
Always ({ COMPRESSION_null })
int use_cache
Non-zero to enable cahing of sessions
int session_lifetime
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.
object lookup_session(string id)
Lookup a session identifier in the cache. Returns the corresponding session, or zero if it is not found or caching is disabled.
object new_session()
Create a new session.
void record_session(object s)
Add a session to the cache (if caching is enabled).
void purge_session(object s)
Remove a session from the cache.
| CLASS SSL.handshake |
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.
int auth_level
Policy for client authentication. One of AUTHLEVEL_none, AUTHLEVEL_ask and AUTHLEVEL_require.
array(string) authorities
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 client_random
string server_random
Random cookies, sent and received with the hello-messages.
int(-1..1) handle_handshake(int type, string data, string raw)
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.https |
Dummy HTTPS server
| CLASS SSL.packet |
SSL Record Layer. Handle formatting and parsing of packets.
| CLASS SSL.session |
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.
string identity
Identifies the session to the server
int compression_algorithm
Always COMPRESSION_null.
int cipher_suite
Constant defining a choice of keyexchenge, encryption and mac algorithm.
object cipher_spec
Information about the encryption method derived from the cipher_suite.
int ke_method
Key exchange method, also derived from the cipher_suite.
string master_secret
48 byte secret shared between the client and the server. Used for deriving the actual keys.
void set_cipher_suite(int suite, int version)
void set_compression_method(int compr)
array new_server_states(string client_random, string server_random, array(int) version)
Computes a new set of encryption stetes, derived from the client_random, server_random and master_secret strings.
| ||||||
array new_client_states(string client_random, string server_random, array(int) version)
Computes a new set of encryption stetes, derived from the client_random, server_random and master_secret strings.
| ||||||
| CLASS SSL.sslfile |
Interface similar to Stdio.File.
| CLASS SSL.sslport |
Interface similar to Stdio.Port.
| CLASS SSL.state |
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.
object session
Information about the used algorithms.
object mac
Message Authentication Code
object crypt
Encryption or decryption object.
Gmp.mpz|int seq_num
64-bit sequence number.
object decrypt_packet(object packet, int version)
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.
object encrypt_packet(object packet, int version)
Encrypts a packet (including deflating and MAC-generation).
| Module Protocols.LysKOM |
| CLASS Protocols.LysKOM.Connection |
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.
mixed XXX(mixed ... args)
object async_XXX(mixed ... args)
object async_cb_XXX(function callback, mixed ... args)
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 protocol_level
string session_software
string software_version
Description of the connected server.
void Protocols.LysKOM.Connection(string server)
void Protocols.LysKOM.Connection(string server, mapping options)
The options argument is a mapping with the following members:
|
| CLASS Protocols.LysKOM.Session |
object user
This variable contains the Protocols.LysKOM.Session.Person that is logged in.
void Protocols.LysKOM.Session(string server)
void Protocols.LysKOM.Session(string server, mapping options)
Initializes the session object, and opens a connection to that server.
options is a mapping of options:
|
Protocols.LysKOM.Connection
Text text(int no)
Returns the text no.
Person person(int no)
Returns the person no.
Conference conference(int no)
Returns conference number no.
array(ProtocolTypes.ConfZInfo) try_complete_person(string orig)
Runs a LysKOM completion on the given string, returning an array of confzinfos of the match.
object login(int user_no, string password)
object login(int user_no, string password, int invisible)
Performs a login. Throws a lyskom error if unsuccessful.
The session object logged in.
object create_person(string name, string password)
Create a person, which will be logged in. returns the new person object
object logout()
Logouts from the server. returns the called object
object create_text(string subject, string body, mapping options)
object create_text(string subject, string body, mapping options, function callback, mixed ... extra)
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:
|
The items above marked with '*' are only available on protocol 10 servers. A LysKOM error will be thrown if the call fails.
Protocols.LysKOM.Session.Conference.create_text, Protocols.LysKOM.Session.Text.comment, Protocols.LysKOM.Session.Text.footnote
object|void send_message(string textstring, mapping options)
Sends a message.
options is a mapping that may contain:
|
void register_async_message_callback(function(int:void) cb)
| CLASS Protocols.LysKOM.Session.AuxItemInput |
Undocumented
| CLASS Protocols.LysKOM.Session.AuxItems |
Undocumented
| CLASS Protocols.LysKOM.Session.Text |
All variables in this class is read only.
Undocumented
int no
The text number, as spicified to Protocols.LysKOM.Session.Text.create.
object err
Undocumented
void Protocols.LysKOM.Session.Text(string textnumber)
Initializes a Text object.
void mark_as_read()
Undocumented.
mixed prefetch_text
mixed prefetch_stat
mixed lines
mixed characters
mixed clear_stat
mixed aux_items
Undocumented
string text
The actual text (or body if you wish).
string subject
The message subject.
string author
The author of the text.
mixed misc
Misc info, including what conferences the message is posted to.
Needs a more complete description.
int marks
The number of marks on this text.
mixed creation_time
The time the text was created on the server.
| CLASS Protocols.LysKOM.Session.Membership |
All variables in this class is read only.
object last_time_read
int(0..255) priority
int last_text_read
array(int) read_texts
object added_at
multiset(string) type
int position
object conf
int number_unread()
void query_read_texts()
array(object) unread_texts()
| CLASS Protocols.LysKOM.Session.Person |
int no
void Protocols.LysKOM.Session.Person(int no)
mixed prefetch_stat
mixed prefetch_conf
mixed prefetch_membership
Undocumented
object error
Text user_area
mixed username
mixed privileges
mixed flags
mixed last_login
mixed total_time_present
mixed sessions
mixed created_lines
mixed created_bytes
mixed read_texts
mixed no_of_text_fetches
mixed created_persons
mixed created_confs
mixed first_created_local_no
mixed no_of_created_texts
mixed no_of_marks
mixed no_of_confs
mixed unread
int(0..0) clear_membership
mixed membership
Undocumented
| CLASS Protocols.LysKOM.Session.Conference |
void Protocols.LysKOM.Session.Conference(int no)
| Module Protocols.LysKOM.Request |
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 |
This is the main request class. All lyskom request classes inherit this class.
void async(mixed ... args)
mixed sync(mixed ... args)
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.
void _async(int call, mixed_data)
mixed _sync(int call, mixed_data)
Initialise an asynchronous or a synchronous call, the latter is also evaluating the result. These are called by async and sync respectively.
mixed _reply(object|array what)
mixed reply(object|array what)
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.
mixed `()()
Wait for the call to finish.
int(0..1) ok
Tells if the call has executed ok
object error
How the call failed.
The call has completed if
.(ok||error)
| Module Protocols.DNS |
$Id: DNS.pmod,v 1.62 2002/03/09 18:27:04 nilsson Exp $
| CLASS Protocols.DNS.client |
Synchronous DNS client.
void Protocols.DNS.client()
void Protocols.DNS.client(void|string|array server, void|int|array domain)
array gethostbyname(string hostname)
array gethostbyaddr(string hostip)
Querys the host name or ip from the default or given DNS server. The result is an array with three elements,
| ||||||||
string get_primary_mx(string hostname)
Querys the primary mx for the host.
Returns the hostname of the primary mail exchanger.
| Module Protocols |
| Module Protocols.LDAP |
| CLASS Protocols.LDAP.client |
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.
mapping info
Several information about code itself and about active connection too
void Protocols.LDAP.client()
void Protocols.LDAP.client(string url)
void Protocols.LDAP.client(string url, object context)
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.
LDAP server URL in form "ldap://hostname/basedn?attrlist?scope?ext"
TLS context of connection
LDAP.client.bind, LDAP.client.search
int bind()
int bind(string dn, string password)
int bind(string dn, string password, int version)
Authenticates connection to the direcory.
First form uses default value previously entered in create.
Second form uses value from parameters:
The distinguished name (DN) of an entry aginst which will be made authentication.
Password used for authentication.
Third form allows specify the version of LDAP protocol used by connection to the LDAP server.
Only 2 or 3 can be entered.
Returns 1 on success, 0 otherwise.
Only simple authentication type is implemented. So be warned clear text passwords are sent to the directory server.
The API change: the returning code was changed in Pike 7.3+ to follow his logic better.
int unbind()
Unbinds from the directory and close the connection.
int delete(string dn)
Deletes entry from the LDAP server.
The distinguished name of deleted entry.
Returns 1 on success, 0 otherwise.
The API change: the returning code was changed in Pike 7.3+ to follow his logic better.
int compare(string dn, array(string) aval)
Compares given attribute value with one in the directory.
The distinguished name of compared entry.
The mapping of compared attributes and theirs values.
Returns 1 on success, 0 otherwise.
The API change: the returning code was changed in Pike 7.3+ to follow his logic better.
int add(string dn, mapping(string:array(string)) attrs)
The Add Operation allows a client to request the addition of an entry into the directory
The Distinguished Name of the entry to be added.
The mapping of attributes and their values that make up the content of the entry being added.
Returns 1 on success, 0 otherwise.
The API change: the returning code was changed in Pike 7.3+ to follow his logic better.
object|int search(string|void filter, array(string)|void attrs, int|void attrsonly)
Search LDAP directory.
Search filter used when searching directory objects.
The array of attribute names which will be returned by server. for every entry.
The flag causes server return only attribute name but not the attribute values.
Returns object LDAP.client.result on success, 0 otherwise.
For syntax of search filter see at RFC 1960 (http://community.roxen.com/developers/idocs/rfc/rfc1960.html).
The API change: the returning code was changed in Pike 7.3+ to follow his logic better.
LDAP.client.result, LDAP.client.result.fetch
string set_basedn(string base_dn)
base DN for search
int set_scope(int|string scope)
Sets value of scope for search operation.
Value can be integer or its corresponding string value. 0: base, 1: one, 2: sub
int set_option(int opttype, int value)
LDAP_OPT_xxx
new value for option
int get_option(int opttype)
LDAP_OPT_xxx