Module: PryRemoteEm::Proto

Included in:
Broker, Client::Generic, Server
Defined in:
lib/pry-remote-em/proto.rb

Instance Method Summary collapse

Instance Method Details

#receive_auth(a, b = nil) ⇒ Object



66
# File 'lib/pry-remote-em/proto.rb', line 66

def receive_auth(a, b = nil); end

#receive_banner(name, version, scheme) ⇒ Object



65
# File 'lib/pry-remote-em/proto.rb', line 65

def receive_banner(name, version, scheme); end

#receive_clear_bufferObject



74
# File 'lib/pry-remote-em/proto.rb', line 74

def receive_clear_buffer; end

#receive_completion(c) ⇒ Object



73
# File 'lib/pry-remote-em/proto.rb', line 73

def receive_completion(c); end

#receive_data(data) ⇒ Object



8
9
10
11
# File 'lib/pry-remote-em/proto.rb', line 8

def receive_data(data)
  @unpacker ||= MessagePack::Unpacker.new
  @unpacker.feed_each(data) { |object| receive_object(object) }
end

#receive_msg(m) ⇒ Object



67
# File 'lib/pry-remote-em/proto.rb', line 67

def receive_msg(m); end

#receive_msg_bcast(mb) ⇒ Object



68
# File 'lib/pry-remote-em/proto.rb', line 68

def receive_msg_bcast(mb); end

#receive_object(j) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/pry-remote-em/proto.rb', line 17

def receive_object(j)
  if !j.is_a?(Hash)
    receive_unknown(j)
  elsif j['p']
    receive_prompt(j['p'])
  elsif j['d']
    receive_raw(j['d'])
  elsif j['m']
    receive_msg(j['m'])
  elsif j['mb']
    receive_msg_bcast(j['mb'])
  elsif j['s']
    receive_shell_cmd(j['s'])
  elsif j.include?('sc')
    receive_shell_result(j['sc'])
  elsif j['g']
    receive_banner(*j['g'].split(' ', 3))
  elsif j['c']
    receive_completion(j['c'])
  elsif j['cb']
    receive_clear_buffer
  elsif j.include?('a')
    receive_auth(*Array(j['a']))
  elsif j['sd']
    receive_shell_data(j['sd'])
  elsif j['ssc']
    receive_shell_sig(j['ssc'].to_sym)
  elsif j['hb']
    receive_heartbeat(j['hb'])
  elsif j['rs']
    receive_register_server(*Array(j['rs']))
  elsif j['urs']
    receive_unregister_server(j['urs'])
  elsif j['sl']
    receive_server_list(j['sl'])
  elsif j['srl']
    receive_server_reload_list
  elsif j['tls']
    receive_start_tls
  elsif j['pc']
    receive_proxy_connection(j['pc'])
  else
    receive_unknown(j)
  end
end

#receive_prompt(p) ⇒ Object



64
# File 'lib/pry-remote-em/proto.rb', line 64

def receive_prompt(p); end

#receive_proxy_connection(url) ⇒ Object



85
# File 'lib/pry-remote-em/proto.rb', line 85

def receive_proxy_connection(url); end

#receive_raw(r) ⇒ Object



75
# File 'lib/pry-remote-em/proto.rb', line 75

def receive_raw(r); end

#receive_register_server(id, urls, name, details, metrics) ⇒ Object



80
# File 'lib/pry-remote-em/proto.rb', line 80

def receive_register_server(id, urls, name, details, metrics); end

#receive_server_list(list) ⇒ Object



82
# File 'lib/pry-remote-em/proto.rb', line 82

def receive_server_list(list); end

#receive_server_reload_listObject



83
# File 'lib/pry-remote-em/proto.rb', line 83

def receive_server_reload_list; end

#receive_shell_cmd(c) ⇒ Object



69
# File 'lib/pry-remote-em/proto.rb', line 69

def receive_shell_cmd(c); end

#receive_shell_data(d) ⇒ Object



72
# File 'lib/pry-remote-em/proto.rb', line 72

def receive_shell_data(d); end

#receive_shell_result(c) ⇒ Object



70
# File 'lib/pry-remote-em/proto.rb', line 70

def receive_shell_result(c); end

#receive_shell_sig(sym) ⇒ Object



71
# File 'lib/pry-remote-em/proto.rb', line 71

def receive_shell_sig(sym); end

#receive_start_tlsObject



78
# File 'lib/pry-remote-em/proto.rb', line 78

def receive_start_tls; end

#receive_unknown(j) ⇒ Object



76
# File 'lib/pry-remote-em/proto.rb', line 76

def receive_unknown(j); end

#receive_unregister_server(id) ⇒ Object



81
# File 'lib/pry-remote-em/proto.rb', line 81

def receive_unregister_server(id); end

#send_auth(a) ⇒ Object



90
91
92
# File 'lib/pry-remote-em/proto.rb', line 90

def send_auth(a)
  send_object({a: a})
end

#send_banner(g) ⇒ Object



87
88
89
# File 'lib/pry-remote-em/proto.rb', line 87

def send_banner(g)
  send_object({g: g})
end

#send_clear_bufferObject



117
118
119
# File 'lib/pry-remote-em/proto.rb', line 117

def send_clear_buffer
  send_object({cb: true})
end

#send_completion(word) ⇒ Object



114
115
116
# File 'lib/pry-remote-em/proto.rb', line 114

def send_completion(word)
  send_object({c: word})
end

#send_heatbeat(url) ⇒ Object



134
135
136
# File 'lib/pry-remote-em/proto.rb', line 134

def send_heatbeat(url)
  send_object({hb: url})
end

#send_msg(m) ⇒ Object



99
100
101
# File 'lib/pry-remote-em/proto.rb', line 99

def send_msg(m)
  send_object({m: m})
end

#send_msg_bcast(m) ⇒ Object



96
97
98
# File 'lib/pry-remote-em/proto.rb', line 96

def send_msg_bcast(m)
  send_object({mb: m})
end

#send_object(object) ⇒ Object



13
14
15
# File 'lib/pry-remote-em/proto.rb', line 13

def send_object(object)
  send_data(object.to_msgpack)
end

#send_prompt(p) ⇒ Object



93
94
95
# File 'lib/pry-remote-em/proto.rb', line 93

def send_prompt(p)
  send_object({p: p})
end

#send_proxy_connection(url) ⇒ Object



144
145
146
# File 'lib/pry-remote-em/proto.rb', line 144

def send_proxy_connection(url)
  send_object({pc: url})
end

#send_raw(d) ⇒ Object



120
121
122
# File 'lib/pry-remote-em/proto.rb', line 120

def send_raw(d)
  send_object(d.is_a?(String) ? {d: d} : d)
end

#send_register_server(id, urls, name, details, metrics) ⇒ Object



128
129
130
# File 'lib/pry-remote-em/proto.rb', line 128

def send_register_server(id, urls, name, details, metrics)
  send_object({rs: [id, urls, name, details, metrics]})
end

#send_server_list(list = nil) ⇒ Object



137
138
139
# File 'lib/pry-remote-em/proto.rb', line 137

def send_server_list(list = nil)
  send_object({sl: list})
end

#send_server_reload_listObject



140
141
142
# File 'lib/pry-remote-em/proto.rb', line 140

def send_server_reload_list
  send_object({srl: true})
end

#send_shell_cmd(c) ⇒ Object



102
103
104
# File 'lib/pry-remote-em/proto.rb', line 102

def send_shell_cmd(c)
  send_object({s: c})
end

#send_shell_data(d) ⇒ Object



111
112
113
# File 'lib/pry-remote-em/proto.rb', line 111

def send_shell_data(d)
  send_object({sd: d})
end

#send_shell_result(r) ⇒ Object



105
106
107
# File 'lib/pry-remote-em/proto.rb', line 105

def send_shell_result(r)
  send_object({sc: r})
end

#send_shell_sig(sym) ⇒ Object



108
109
110
# File 'lib/pry-remote-em/proto.rb', line 108

def send_shell_sig(sym)
  send_object({ssc: sym})
end

#send_start_tlsObject



124
125
126
# File 'lib/pry-remote-em/proto.rb', line 124

def send_start_tls
  send_object({tls: true})
end

#send_unregister_server(id) ⇒ Object



131
132
133
# File 'lib/pry-remote-em/proto.rb', line 131

def send_unregister_server(id)
  send_object({urs: id})
end