Module Expr Str Import alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr Call NameLoad NameLoad For NameStore AttributeLoad AttributeLoad NameLoad attr attr body If BoolOpAnd CompareNotEq NameLoad NameLoad CompareNotEq NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Break orelse Raise Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr If CompareNotEq NameLoad NameLoad body Return NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr If CompareNotEq NameLoad NameLoad body Return NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body If BoolOpOr CompareLt NameLoad Num CompareEq AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Assign NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list
N/A N/A TLS Lite + asyncore. N/A asyncore gdata.tlslite.TLSConnection TLSConnection AsyncStateMachine AsyncStateMachine TLSAsyncDispatcherMixIn N/A AsyncStateMachine N/A N/A This class can be "mixed in" with an
    L{asyncore.dispatcher} to add TLS support.

    This class essentially sits between the dispatcher and the select
    loop, intercepting events and only calling the dispatcher when
    applicable.

    In the case of handle_read(), a read operation will be activated,
    and when it completes, the bytes will be placed in a buffer where
    the dispatcher can retrieve them by calling recv(), and the
    dispatcher's handle_read() will be called.

    In the case of handle_write(), the dispatcher's handle_write() will
    be called, and when it calls send(), a write operation will be
    activated.

    To use this class, you must combine it with an asyncore.dispatcher,
    and pass in a handshake operation with setServerHandshakeOp().

    Below is an example of using this class with medusa.  This class is
    mixed in with http_channel to create http_tls_channel.  Note:
     1. the mix-in is listed first in the inheritance list

     2. the input buffer size must be at least 16K, otherwise the
       dispatcher might not read all the bytes from the TLS layer,
       leaving some bytes in limbo.

     3. IE seems to have a problem receiving a whole HTTP response in a
     single TLS record, so HTML pages containing '\r\n\r\n' won't
     be displayed on IE.

    Add the following text into 'start_medusa.py', in the 'HTTP Server'
    section::

        from tlslite.api import *
        s = open("./serverX509Cert.pem").read()
        x509 = X509()
        x509.parse(s)
        certChain = X509CertChain([x509])

        s = open("./serverX509Key.pem").read()
        privateKey = parsePEMKey(s, private=True)

        class http_tls_channel(TLSAsyncDispatcherMixIn,
                               http_server.http_channel):
            ac_in_buffer_size = 16384

            def __init__ (self, server, conn, addr):
                http_server.http_channel.__init__(self, server, conn, addr)
                TLSAsyncDispatcherMixIn.__init__(self, conn)
                self.tlsConnection.ignoreAbruptClose = True
                self.setServerHandshakeOp(certChain=certChain,
                                          privateKey=privateKey)

        hs.channel_class = http_tls_channel

    If the TLS layer raises an exception, the exception will be caught
    in asyncore.dispatcher, which will call close() on this class.  The
    TLS layer always closes the TLS connection before raising an
    exception, so the close operation will complete right away, causing
    asyncore.dispatcher.close() to be called, which closes the socket
    and removes this instance from the asyncore loop.

     __init__ N/A N/A self sock N/A None N/A N/A N/A N/A AsyncStateMachine __init__ self N/A sock N/A N/A N/A self tlsConnection N/A TLSConnection sock N/A cl N/A N/A self __class__ __bases__ N/A N/A N/A N/A cl TLSAsyncDispatcherMixIn N/A cl AsyncStateMachine N/A N/A N/A self siblingClass cl N/A N/A N/A N/A AssertionError N/A readable N/A N/A self N/A N/A N/A result N/A N/A self wantsReadEvent N/A N/A result None N/A N/A result N/A N/A N/A N/A self siblingClass readable self N/A writable N/A N/A self N/A N/A N/A result N/A N/A self wantsWriteEvent N/A N/A result None N/A N/A result N/A N/A N/A N/A self siblingClass writable self N/A handle_read N/A N/A self N/A N/A N/A N/A N/A self inReadEvent N/A handle_write N/A N/A self N/A N/A N/A N/A N/A self inWriteEvent N/A outConnectEvent N/A N/A self N/A N/A N/A N/A N/A N/A self siblingClass handle_connect self N/A outCloseEvent N/A N/A self N/A N/A N/A N/A N/A N/A asyncore dispatcher close self N/A outReadEvent N/A N/A self readBuffer N/A N/A N/A N/A self readBuffer readBuffer N/A N/A N/A N/A self siblingClass handle_read self N/A outWriteEvent N/A N/A self N/A N/A N/A N/A N/A N/A self siblingClass handle_write self N/A recv N/A N/A self bufferSize N/A 16384 N/A N/A N/A N/A bufferSize 16384 N/A N/A self readBuffer None N/A N/A N/A AssertionError N/A returnValue N/A self readBuffer N/A N/A self readBuffer None N/A returnValue N/A send N/A N/A self writeBuffer N/A N/A N/A N/A N/A self setWriteOp writeBuffer N/A N/A len writeBuffer N/A close N/A N/A self N/A N/A N/A N/A hasattr self tlsConnection N/A N/A N/A N/A self setCloseOp N/A N/A N/A N/A N/A asyncore dispatcher close self N/A N/A