Module: Rex::IO::SocketAbstraction
- Included in:
- DatagramAbstraction, StreamAbstraction
- Defined in:
- lib/rex/io/socket_abstraction.rb
Overview
This class provides an abstraction to a stream based connection through the use of a streaming socketpair.
Defined Under Namespace
Modules: Ext
Instance Attribute Summary collapse
-
#lsock ⇒ Object
readonly
The left side of the stream.
-
#rsock ⇒ Object
readonly
The right side of the stream.
Instance Method Summary collapse
-
#cleanup_abstraction ⇒ Object
This method cleans up the abstraction layer.
-
#close ⇒ Object
Closes both sides of the stream abstraction.
-
#initialize_abstraction ⇒ Object
Override this method to init the abstraction.
-
#localinfo ⇒ Object
Symbolic local information.
-
#peerinfo ⇒ Object
Symbolic peer information.
-
#shutdown(how) ⇒ Object
Shuts down the local side of the stream abstraction.
-
#sysread(length) ⇒ Object
Low-level read from the local side.
-
#syswrite(buffer) ⇒ Object
Low-level write to the local side.
Instance Attribute Details
#lsock ⇒ Object
The left side of the stream.
108 109 110 |
# File 'lib/rex/io/socket_abstraction.rb', line 108 def lsock @lsock end |
#rsock ⇒ Object
The right side of the stream.
112 113 114 |
# File 'lib/rex/io/socket_abstraction.rb', line 112 def rsock @rsock end |
Instance Method Details
#cleanup_abstraction ⇒ Object
This method cleans up the abstraction layer.
54 55 56 57 58 59 60 |
# File 'lib/rex/io/socket_abstraction.rb', line 54 def cleanup_abstraction lsock.close if lsock and !lsock.closed? rsock.close if rsock and !rsock.closed? self.lsock = nil self.rsock = nil end |
#close ⇒ Object
Closes both sides of the stream abstraction.
86 87 88 89 |
# File 'lib/rex/io/socket_abstraction.rb', line 86 def close cleanup_abstraction super end |
#initialize_abstraction ⇒ Object
Override this method to init the abstraction
47 48 49 |
# File 'lib/rex/io/socket_abstraction.rb', line 47 def initialize_abstraction self.lsock, self.rsock = Rex::Compat.pipe end |
#localinfo ⇒ Object
Symbolic local information.
101 102 103 |
# File 'lib/rex/io/socket_abstraction.rb', line 101 def localinfo 'Local-side of Pipe' end |
#peerinfo ⇒ Object
Symbolic peer information.
94 95 96 |
# File 'lib/rex/io/socket_abstraction.rb', line 94 def peerinfo 'Remote-side of Pipe' end |
#shutdown(how) ⇒ Object
Shuts down the local side of the stream abstraction.
79 80 81 |
# File 'lib/rex/io/socket_abstraction.rb', line 79 def shutdown(how) lsock.shutdown(how) end |
#sysread(length) ⇒ Object
Low-level read from the local side.
72 73 74 |
# File 'lib/rex/io/socket_abstraction.rb', line 72 def sysread(length) lsock.sysread(length) end |
#syswrite(buffer) ⇒ Object
Low-level write to the local side.
65 66 67 |
# File 'lib/rex/io/socket_abstraction.rb', line 65 def syswrite(buffer) lsock.syswrite(buffer) end |