Class: ZMQ::Message
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- ZMQ::Message
- Defined in:
- lib/binproxy/parsers/zmq.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#next_state(s) ⇒ Object
States are (G)reeting 1/2/3 (see above), (H)andshake, and (T)raffic.
-
#update_state ⇒ Object
Protocol is symmetrical.
Class Method Details
.initial_state ⇒ Object
42 |
# File 'lib/binproxy/parsers/zmq.rb', line 42 def self.initial_state; {'client'=>'G1','server'=>'G1'}; end |
Instance Method Details
#next_state(s) ⇒ Object
States are (G)reeting 1/2/3 (see above), (H)andshake, and (T)raffic.
41 |
# File 'lib/binproxy/parsers/zmq.rb', line 41 def next_state(s); {'G1'=>'G2','G2'=>'G3','G3'=>'H', 'H'=>'T', 'T'=>'T'}[s]; end |
#update_state ⇒ Object
Protocol is symmetrical. Each endpoint has its own state. This is a bit clunky and maybe should be abstracted into a module? Or update parser.rb to differentiate between proto-shared and endpoint-separate state?
47 48 49 50 51 52 |
# File 'lib/binproxy/parsers/zmq.rb', line 47 def update_state current_state.dup.tap do |s| src = eval_parameter :src s[src] = next_state s[src] end end |