Class: Netlink::NlMsgError
- Inherits:
-
Object
- Object
- Netlink::NlMsgError
- Defined in:
- lib/netlink/nlmsghdr.rb
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#orig_header ⇒ Object
readonly
Returns the value of attribute orig_header.
Class Method Summary collapse
Instance Method Summary collapse
- #ack? ⇒ Boolean
-
#initialize(error_code, orig_header) ⇒ NlMsgError
constructor
A new instance of NlMsgError.
- #to_s ⇒ Object
Constructor Details
#initialize(error_code, orig_header) ⇒ NlMsgError
Returns a new instance of NlMsgError.
56 57 58 59 |
# File 'lib/netlink/nlmsghdr.rb', line 56 def initialize(error_code, orig_header) @error_code = error_code @orig_header = orig_header end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
48 49 50 |
# File 'lib/netlink/nlmsghdr.rb', line 48 def error_code @error_code end |
#orig_header ⇒ Object (readonly)
Returns the value of attribute orig_header.
48 49 50 |
# File 'lib/netlink/nlmsghdr.rb', line 48 def orig_header @orig_header end |
Class Method Details
.from_string(msg) ⇒ Object
50 51 52 53 54 |
# File 'lib/netlink/nlmsghdr.rb', line 50 def self.from_string(msg) error_code = msg[0, 4].unpack1('L') orig_header = NlMsgHdr.from_string(msg[4, NlMsgHdr::SIZE]) new(error_code, orig_header) end |
Instance Method Details
#ack? ⇒ Boolean
65 66 67 |
# File 'lib/netlink/nlmsghdr.rb', line 65 def ack? @error_code.zero? end |
#to_s ⇒ Object
61 62 63 |
# File 'lib/netlink/nlmsghdr.rb', line 61 def to_s [@error_code].pack('L') << @orig_header.to_s end |