Class: Baykit::BayServer::Protocol::ProtocolHandler
- Inherits:
-
Object
- Object
- Baykit::BayServer::Protocol::ProtocolHandler
- Includes:
- Util, Util::Reusable
- Defined in:
- lib/baykit/bayserver/protocol/protocol_handler.rb
Instance Attribute Summary collapse
-
#command_handler ⇒ Object
readonly
Returns the value of attribute command_handler.
-
#command_packer ⇒ Object
readonly
Returns the value of attribute command_packer.
-
#command_unpacker ⇒ Object
readonly
Returns the value of attribute command_unpacker.
-
#packet_packer ⇒ Object
readonly
Returns the value of attribute packet_packer.
-
#packet_unpacker ⇒ Object
readonly
Returns the value of attribute packet_unpacker.
-
#server_mode ⇒ Object
readonly
Returns the value of attribute server_mode.
-
#ship ⇒ Object
Returns the value of attribute ship.
Instance Method Summary collapse
-
#bytes_received(buf) ⇒ Object
Other methods.
- #init(sip) ⇒ Object
-
#initialize(pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, cmd_handler, svr_mode) ⇒ ProtocolHandler
constructor
A new instance of ProtocolHandler.
-
#max_req_packet_data_size ⇒ Object
Get max of request data size (maybe not packet size).
-
#max_res_packet_data_size ⇒ Object
Get max of response data size (maybe not packet size).
- #post(cmd, &lis) ⇒ Object
-
#protocol ⇒ Object
Abstract methods.
-
#reset ⇒ Object
Implements Reusable.
- #to_s ⇒ Object
Constructor Details
#initialize(pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, cmd_handler, svr_mode) ⇒ ProtocolHandler
Returns a new instance of ProtocolHandler.
19 20 21 22 23 24 25 26 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 19 def initialize(pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, cmd_handler, svr_mode) @packet_unpacker = pkt_unpacker @packet_packer = pkt_packer @command_unpacker = cmd_unpacker @command_packer = cmd_packer @command_handler = cmd_handler @server_mode = svr_mode end |
Instance Attribute Details
#command_handler ⇒ Object (readonly)
Returns the value of attribute command_handler.
15 16 17 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 15 def command_handler @command_handler end |
#command_packer ⇒ Object (readonly)
Returns the value of attribute command_packer.
14 15 16 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 14 def command_packer @command_packer end |
#command_unpacker ⇒ Object (readonly)
Returns the value of attribute command_unpacker.
13 14 15 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 13 def command_unpacker @command_unpacker end |
#packet_packer ⇒ Object (readonly)
Returns the value of attribute packet_packer.
12 13 14 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 12 def packet_packer @packet_packer end |
#packet_unpacker ⇒ Object (readonly)
Returns the value of attribute packet_unpacker.
11 12 13 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 11 def packet_unpacker @packet_unpacker end |
#server_mode ⇒ Object (readonly)
Returns the value of attribute server_mode.
16 17 18 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 16 def server_mode @server_mode end |
#ship ⇒ Object
Returns the value of attribute ship.
17 18 19 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 17 def ship @ship end |
Instance Method Details
#bytes_received(buf) ⇒ Object
Other methods
72 73 74 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 72 def bytes_received(buf) return @packet_unpacker.bytes_received(buf) end |
#init(sip) ⇒ Object
31 32 33 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 31 def init(sip) @ship = sip end |
#max_req_packet_data_size ⇒ Object
Get max of request data size (maybe not packet size)
58 59 60 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 58 def max_req_packet_data_size() raise NotImplementedError.new end |
#max_res_packet_data_size ⇒ Object
Get max of response data size (maybe not packet size)
65 66 67 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 65 def max_res_packet_data_size() raise NotImplementedError.new end |
#post(cmd, &lis) ⇒ Object
76 77 78 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 76 def post(cmd, &lis) @command_packer.post(@ship, cmd, &lis) end |
#protocol ⇒ Object
Abstract methods
51 52 53 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 51 def protocol() raise NotImplementedError.new end |
#reset ⇒ Object
Implements Reusable
38 39 40 41 42 43 44 45 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 38 def reset() @command_unpacker.reset @command_packer.reset @packet_unpacker.reset @packet_packer.reset @command_handler.reset @ship = nil end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/baykit/bayserver/protocol/protocol_handler.rb', line 27 def to_s() return ClassUtil.get_local_name(self.class) + " ship=" + ship.to_s end |