Class: SeccompTools::Instruction::Base
- Inherits:
-
Object
- Object
- SeccompTools::Instruction::Base
- Includes:
- Const::BPF
- Defined in:
- lib/seccomp-tools/instruction/base.rb
Overview
Base class of instructions.
Subclasses must implement #branch and #symbolize.
Constant Summary
Constants included from Const::BPF
Const::BPF::ACTION, Const::BPF::COMMAND, Const::BPF::JMP, Const::BPF::MISCOP, Const::BPF::MODE, Const::BPF::OP, Const::BPF::PR_SET_SECCOMP, Const::BPF::SECCOMP_MODE_FILTER, Const::BPF::SECCOMP_MODE_STRICT, Const::BPF::SECCOMP_RET_ACTION_FULL, Const::BPF::SECCOMP_RET_DATA, Const::BPF::SECCOMP_SET_MODE_FILTER, Const::BPF::SECCOMP_SET_MODE_STRICT, Const::BPF::SIZEOF_SECCOMP_DATA, Const::BPF::SRC
Instance Method Summary collapse
-
#branch(_state) ⇒ Array<(Integer, Symbolic::State)>
Returns the possible branches after executing this instruction.
-
#initialize(bpf) ⇒ Base
constructor
Instantiate a Base object.
-
#invalid(msg = 'unknown') ⇒ Object
Helper to raise exception with message.
-
#symbolize ⇒ Array<Symbol, Integer>
Returns tokens that represent this instruction.
Methods included from Const::BPF
Constructor Details
#initialize(bpf) ⇒ Base
Instantiate a SeccompTools::Instruction::Base object.
21 22 23 |
# File 'lib/seccomp-tools/instruction/base.rb', line 21 def initialize(bpf) @bpf = bpf end |
Instance Method Details
#branch(_state) ⇒ Array<(Integer, Symbolic::State)>
Returns the possible branches after executing this instruction.
Each branch is the line number to be executed next, paired with the Symbolic::State that reaching that line implies. Non-jump instructions have exactly one branch, the following line.
49 50 |
# File 'lib/seccomp-tools/instruction/base.rb', line 49 def branch(_state); raise NotImplementedError end |
#invalid(msg = 'unknown') ⇒ Object
Helper to raise exception with message.
29 30 31 |
# File 'lib/seccomp-tools/instruction/base.rb', line 29 def invalid(msg = 'unknown') raise ArgumentError, "Line #{line} is invalid: #{msg}" end |
#symbolize ⇒ Array<Symbol, Integer>
Returns tokens that represent this instruction.
61 62 |
# File 'lib/seccomp-tools/instruction/base.rb', line 61 def symbolize; raise NotImplementedError end |