Package ldaptor :: Package protocols :: Package ldap :: Module ldapclient :: Class LDAPClient
[hide private]
[frames] | no frames]

Class LDAPClient

source code

twisted.internet.protocol.BaseProtocol --+    
                                         |    
        twisted.internet.protocol.Protocol --+
                                             |
                                            LDAPClient

An LDAP client

Instance Methods [hide private]
 
__init__(self) source code
 
dataReceived(self, recd)
Called whenever data is received.
source code
 
connectionMade(self)
TCP connection has opened
source code
 
connectionLost(self, reason=<twisted.python.failure.Failure twisted.internet.error.Connect...)
Called when TCP connection has been lost
source code
 
_send(self, op) source code
 
_cbSend(self, msg, d) source code
Deferred LDAPProtocolResponse
send(self, op)
Send an LDAP operation to the server.
source code
Deferred LDAPProtocolResponse
send_multiResponse(self, op, handler, *args, **kwargs)
Send an LDAP operation to the server, expecting one or more responses.
source code
 
send_noResponse(self, op)
Send an LDAP operation to the server, with no response expected.
source code
 
unsolicitedNotification(self, msg) source code
 
handle(self, msg) source code
 
bind(self, dn='', auth='') source code
 
_handle_bind_msg(self, msg) source code
 
unbind(self) source code
 
_cbStartTLS(self, msg, ctx) source code
 
startTLS(self, ctx=None)
Start Transport Layer Security.
source code
 
_startTLS(self, ctx) source code

Inherited from twisted.internet.protocol.BaseProtocol: __providedBy__, makeConnection

Class Variables [hide private]
  debug = False
  berdecoder = <LDAPBERDecoderContext_TopLevel identities={0x10:...

Inherited from twisted.internet.protocol.Protocol: __implemented__, __provides__

Inherited from twisted.internet.protocol.BaseProtocol: connected, transport

Method Details [hide private]

dataReceived(self, recd)

source code 

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.

Parameters:
  • data - a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
Overrides: twisted.internet.protocol.Protocol.dataReceived
(inherited documentation)

connectionMade(self)

source code 

TCP connection has opened

Overrides: twisted.internet.protocol.BaseProtocol.connectionMade

connectionLost(self, reason=<twisted.python.failure.Failure twisted.internet.error.Connect...)

source code 

Called when TCP connection has been lost

Overrides: twisted.internet.protocol.Protocol.connectionLost

send(self, op)

source code 

Send an LDAP operation to the server.

Parameters:
  • op (LDAPProtocolRequest) - the operation to send
Returns: Deferred LDAPProtocolResponse
the response from server

send_multiResponse(self, op, handler, *args, **kwargs)

source code 

Send an LDAP operation to the server, expecting one or more responses.

Parameters:
  • op (LDAPProtocolRequest) - the operation to send
  • handler - a callable that will be called for each response. It should return a boolean, whether this was the final response.
  • args - positional arguments to pass to handler
  • kwargs - keyword arguments to pass to handler
Returns: Deferred LDAPProtocolResponse
the result from the last handler as a deferred that completes when the last response has been received

send_noResponse(self, op)

source code 

Send an LDAP operation to the server, with no response expected.

Parameters:
  • op (LDAPProtocolRequest) - the operation to send

bind(self, dn='', auth='')

source code 

Deprecated: Use e.bind(auth).

To Do: Remove this method when there are no callers.

startTLS(self, ctx=None)

source code 

Start Transport Layer Security.

It is the callers responsibility to make sure other things are not happening at the same time.

To Do: server hostname check, see rfc2830 section 3.6.


Class Variable Details [hide private]

berdecoder

Value:
<LDAPBERDecoderContext_TopLevel identities={0x10: LDAPMessage} fallbac\
k=None inherit=<LDAPBERDecoderContext_LDAPMessage identities={0x80: LD\
APControls} fallback=<LDAPBERDecoderContext identities={0x40: LDAPBind\
Request, 0x41: LDAPBindResponse, 0x42: LDAPUnbindRequest, 0x43: LDAPSe\
archRequest, 0x44: LDAPSearchResultEntry, 0x45: LDAPSearchResultDone, \
0x46: LDAPModifyRequest, 0x47: LDAPModifyResponse, 0x48: LDAPAddReques\
t, 0x49: LDAPAddResponse, 0x4a: LDAPDelRequest, 0x4b: LDAPDelResponse,\
 0x4c: LDAPModifyDNRequest, 0x4d: LDAPModifyDNResponse, 0x83: LDAPRefe\
...