Module: EventMachine::Protocols::VNC::Client

Defined in:
lib/eventmachine/protocols/vnc.rb

Constant Summary collapse

VERSION =
"RFB 003.003"
SECURITY_TYPES =
{
  0 => "Invalid",
  1 => "None",
  2 => "VNC Authentication",
  5 => "RA2",
  6 => "RA2ne",
  16 => "Tight",
  17 => "Ultra",
  18 => "TLS",
  19 => "VeNCrypt",
  20 => "GTK-VNC SASL",
  21 => "MD5 hash authentication",
  22 => "Colin Dean xvp",
}
KEY_EVENT =
4
POINTER_EVENT =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



27
28
29
# File 'lib/eventmachine/protocols/vnc.rb', line 27

def name
  @name
end

#screen_heightObject

Returns the value of attribute screen_height.



26
27
28
# File 'lib/eventmachine/protocols/vnc.rb', line 26

def screen_height
  @screen_height
end

#screen_widthObject

Returns the value of attribute screen_width.



25
26
27
# File 'lib/eventmachine/protocols/vnc.rb', line 25

def screen_width
  @screen_width
end

Instance Method Details

#error(message) ⇒ Object



156
157
158
159
160
161
162
# File 'lib/eventmachine/protocols/vnc.rb', line 156

def error(message)
  if self.respond_to?(:errback)
    self.errback(message)
  else
    raise message
  end
end

#pointerevent(x, y, buttonmask) ⇒ Object



165
166
167
168
# File 'lib/eventmachine/protocols/vnc.rb', line 165

def pointerevent(x, y, buttonmask)
  message = [ POINTER_EVENT, buttonmask, x, y ].pack("CCnn")
  send_data(message)
end

#receive_data(data) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/eventmachine/protocols/vnc.rb', line 32

def receive_data(data)
  @logger ||= Logger.new(STDERR)
  @buffer ||= ''
  @state ||= :handshake
  @buffer += data
  @logger.info ("Got #{data.length} bytes: #{data}")

  # Process all data in the buffer.
  while @buffer.length > 0
    @logger.info [@state, @buffer.length].inspect
    result = send(@state)
    puts [result, @buffer.length].inspect
    break if result == :wait
  end
end