Class: TTTLS13::Message::Extension::RecordSizeLimit
- Inherits:
-
Object
- Object
- TTTLS13::Message::Extension::RecordSizeLimit
- Defined in:
- lib/tttls1.3/message/extension/record_size_limit.rb
Instance Attribute Summary collapse
-
#extension_type ⇒ Object
readonly
Returns the value of attribute extension_type.
-
#record_size_limit ⇒ Object
readonly
Returns the value of attribute record_size_limit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(record_size_limit) ⇒ RecordSizeLimit
constructor
A new instance of RecordSizeLimit.
- #serialize ⇒ String
Constructor Details
#initialize(record_size_limit) ⇒ RecordSizeLimit
Returns a new instance of RecordSizeLimit.
15 16 17 18 19 20 |
# File 'lib/tttls1.3/message/extension/record_size_limit.rb', line 15 def initialize(record_size_limit) @extension_type = ExtensionType::RECORD_SIZE_LIMIT @record_size_limit = record_size_limit raise Error::ErrorAlerts, :internal_error \ if @record_size_limit < 64 || @record_size_limit > 2**14 + 1 end |
Instance Attribute Details
#extension_type ⇒ Object (readonly)
Returns the value of attribute extension_type.
9 10 11 |
# File 'lib/tttls1.3/message/extension/record_size_limit.rb', line 9 def extension_type @extension_type end |
#record_size_limit ⇒ Object (readonly)
Returns the value of attribute record_size_limit.
10 11 12 |
# File 'lib/tttls1.3/message/extension/record_size_limit.rb', line 10 def record_size_limit @record_size_limit end |
Class Method Details
.deserialize(binary) ⇒ TTTLS13::Message::Extensions::RecordSizeLimit?
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/tttls1.3/message/extension/record_size_limit.rb', line 34 def self.deserialize(binary) raise Error::ErrorAlerts, :internal_error if binary.nil? return nil if binary.length != 2 record_size_limit = Convert.bin2i(binary) raise Error::ErrorAlerts, :illegal_parameter if record_size_limit < 64 RecordSizeLimit.new(record_size_limit) end |
Instance Method Details
#serialize ⇒ String
23 24 25 26 27 |
# File 'lib/tttls1.3/message/extension/record_size_limit.rb', line 23 def serialize binary = @record_size_limit.to_uint16 @extension_type + binary.prefix_uint16_length end |