| 1 | package YaraFFI::Record::YR_RULE; | ||
| 2 | |||
| 3 | 1 | $YaraFFI::Record::YR_RULE::VERSION = '0.07'; | |
| 4 | 1 | $YaraFFI::Record::YR_RULE::AUTHORITY = 'cpan:MANWAR'; | |
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | YaraFFI::Record::YR_RULE - FFI Record for YARA rule structure | ||
| 9 | |||
| 10 | =head1 VERSION | ||
| 11 | |||
| 12 | Version 0.07 | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | use YaraFFI::Record::YR_RULE; | ||
| 17 | |||
| 18 | # In YARA callback, cast rule pointer to record | ||
| 19 | my $rule = $ffi->cast('opaque', 'record(YaraFFI::Record::YR_RULE)*', $rule_ptr); | ||
| 20 | |||
| 21 | # Access rule fields safely | ||
| 22 | my $name_ptr = $rule->identifier; | ||
| 23 | my $metas_ptr = $rule->metas; | ||
| 24 | my $strings_ptr = $rule->strings; | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | Represents the YR_RULE structure from YARA's libyara. This is a partial | ||
| 29 | definition focusing on commonly accessed fields. The actual YARA structure | ||
| 30 | is larger and more complex. | ||
| 31 | |||
| 32 | =head1 STRUCTURE FIELDS | ||
| 33 | |||
| 34 | =over 4 | ||
| 35 | |||
| 36 | =item g_flags (sint32) | ||
| 37 | |||
| 38 | Global flags for the rule | ||
| 39 | |||
| 40 | =item t_flags (sint32) | ||
| 41 | |||
| 42 | Thread-specific flags | ||
| 43 | |||
| 44 | =item identifier (opaque) | ||
| 45 | |||
| 46 | Pointer to the rule name string | ||
| 47 | |||
| 48 | =item tags (opaque) | ||
| 49 | |||
| 50 | Pointer to tags array | ||
| 51 | |||
| 52 | =item metas (opaque) | ||
| 53 | |||
| 54 | Pointer to metadata array (YR_META structures) | ||
| 55 | |||
| 56 | =item strings (opaque) | ||
| 57 | |||
| 58 | Pointer to strings array (YR_STRING structures) | ||
| 59 | |||
| 60 | =item ns (opaque) | ||
| 61 | |||
| 62 | Pointer to namespace structure | ||
| 63 | |||
| 64 | =back | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | 1 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 69 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 70 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 71 | 1 | ▶ | use FFI::Platypus::Record; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 72 | |||
| 73 | # YR_RULE structure (partial - only fields we can safely access) | ||
| 74 | 1 | record_layout_1( | |
| 75 | sint32 => 'g_flags', # Global flags | ||
| 76 | sint32 => 't_flags', # Thread flags | ||
| 77 | opaque => 'identifier', # Pointer to rule name string | ||
| 78 | opaque => 'tags', # Pointer to tags | ||
| 79 | opaque => 'metas', # Pointer to metadata array | ||
| 80 | opaque => 'strings', # Pointer to strings array | ||
| 81 | opaque => 'ns', # Pointer to namespace | ||
| 82 | ); | ||
| 83 | |||
| 84 | 1 | 1; # End of YaraFFI::Record::YR_RULE | |