2015-08-06 09:09:01 +00:00
|
|
|
from __future__ import (absolute_import, print_function, division)
|
2015-08-14 08:41:11 +00:00
|
|
|
|
2015-08-08 14:08:57 +00:00
|
|
|
import OpenSSL
|
|
|
|
from ..exceptions import ProtocolException
|
2015-07-24 16:29:13 +00:00
|
|
|
from ..protocol.tcp import TCPHandler
|
2015-07-25 11:31:55 +00:00
|
|
|
from .layer import Layer
|
2015-07-24 16:29:13 +00:00
|
|
|
|
|
|
|
|
2015-08-14 08:41:11 +00:00
|
|
|
class RawTcpLayer(Layer):
|
2015-07-24 16:29:13 +00:00
|
|
|
def __call__(self):
|
2015-08-18 13:59:44 +00:00
|
|
|
self.connect()
|
2015-07-24 16:29:13 +00:00
|
|
|
tcp_handler = TCPHandler(self)
|
2015-08-08 14:08:57 +00:00
|
|
|
try:
|
|
|
|
tcp_handler.handle_messages()
|
|
|
|
except OpenSSL.SSL.Error as e:
|
|
|
|
raise ProtocolException("SSL error: %s" % repr(e), e)
|
|
|
|
|
2015-07-24 16:29:13 +00:00
|
|
|
|
|
|
|
def establish_server_connection(self):
|
|
|
|
pass
|
|
|
|
# FIXME: Remove method, currently just here to mock TCPHandler's call to it.
|