Class: RubySMB::SMB1::ParameterBlock
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- RubySMB::SMB1::ParameterBlock
- Defined in:
- lib/ruby_smb/smb1/parameter_block.rb
Overview
Represents the ParameterBlock portion of an SMB1 Packet. The ParameterBlock will always contain a word_count field that gives the size of the rest of the data block in words.
Direct Known Subclasses
RubySMB::SMB1::Packet::CloseRequest::ParameterBlock, RubySMB::SMB1::Packet::CloseResponse::ParameterBlock, RubySMB::SMB1::Packet::EchoRequest::ParameterBlock, RubySMB::SMB1::Packet::EchoResponse::ParameterBlock, RubySMB::SMB1::Packet::LogoffRequest::ParameterBlock, RubySMB::SMB1::Packet::LogoffResponse::ParameterBlock, RubySMB::SMB1::Packet::NegotiateResponse::ParameterBlock, RubySMB::SMB1::Packet::NegotiateResponseExtended::ParameterBlock, RubySMB::SMB1::Packet::NtCreateAndxRequest::ParameterBlock, RubySMB::SMB1::Packet::NtCreateAndxResponse::ParameterBlock, RubySMB::SMB1::Packet::NtTrans::Request::ParameterBlock, RubySMB::SMB1::Packet::NtTrans::Response::ParameterBlock, RubySMB::SMB1::Packet::ReadAndxRequest::ParameterBlock, RubySMB::SMB1::Packet::ReadAndxResponse::ParameterBlock, RubySMB::SMB1::Packet::SessionSetupLegacyRequest::ParameterBlock, RubySMB::SMB1::Packet::SessionSetupLegacyResponse::ParameterBlock, RubySMB::SMB1::Packet::SessionSetupRequest::ParameterBlock, RubySMB::SMB1::Packet::SessionSetupResponse::ParameterBlock, RubySMB::SMB1::Packet::Trans2::Request::ParameterBlock, RubySMB::SMB1::Packet::Trans2::RequestSecondary::ParameterBlock, RubySMB::SMB1::Packet::Trans2::Response::ParameterBlock, RubySMB::SMB1::Packet::Trans::Request::ParameterBlock, RubySMB::SMB1::Packet::Trans::Response::ParameterBlock, RubySMB::SMB1::Packet::TreeConnectRequest::ParameterBlock, RubySMB::SMB1::Packet::TreeConnectResponse::ParameterBlock, RubySMB::SMB1::Packet::TreeDisconnectRequest::ParameterBlock, RubySMB::SMB1::Packet::TreeDisconnectResponse::ParameterBlock, RubySMB::SMB1::Packet::WriteAndxRequest::ParameterBlock, RubySMB::SMB1::Packet::WriteAndxResponse::ParameterBlock
Class Method Summary collapse
-
.calculate_word_count ⇒ Object
Class method to stub word count calculation during lazy evaluation.
-
.parameter_fields ⇒ Array<Symbol>
Returns the name of all fields, other than word_count, in the ParameterBlock as symbols.
Instance Method Summary collapse
-
#calculate_word_count ⇒ Integer
Calculates the size of the other fields in the ParameterBlock in Words.
Class Method Details
.calculate_word_count ⇒ Object
Class method to stub word count calculation during lazy evaluation.
15 16 17 |
# File 'lib/ruby_smb/smb1/parameter_block.rb', line 15 def self.calculate_word_count 0 end |
.parameter_fields ⇒ Array<Symbol>
Returns the name of all fields, other than word_count, in the ParameterBlock as symbols.
23 24 25 26 |
# File 'lib/ruby_smb/smb1/parameter_block.rb', line 23 def self.parameter_fields fields = self.fields.collect(&:name) fields.reject { |field| field == :word_count } end |
Instance Method Details
#calculate_word_count ⇒ Integer
Calculates the size of the other fields in the ParameterBlock in Words.
32 33 34 35 36 37 38 39 |
# File 'lib/ruby_smb/smb1/parameter_block.rb', line 32 def calculate_word_count total_count = 0 self.class.parameter_fields.each do |field_name| field_value = send(field_name) total_count += field_value.do_num_bytes end total_count.to_i / 2 end |