YaraFFI/Record/YR_META.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« YaraFFI/Record/YR_MATCH.pm ↑ Summary YaraFFI/Record/YR_RULE.pm »
1 package YaraFFI::Record::YR_META;
2  
3 1 $YaraFFI::Record::YR_META::VERSION = '0.07';
4 1 $YaraFFI::Record::YR_META::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 YaraFFI::Record::YR_META - FFI Record for YARA metadata structure
9  
10 =head1 VERSION
11  
12 Version 0.07
13  
14 =head1 SYNOPSIS
15  
16 use YaraFFI::Record::YR_META;
17 use FFI::Platypus;
18  
19 my $ffi = FFI::Platypus->new(api => 2);
20  
21 # In a YARA callback, cast metadata pointer to record
22 my $meta = $ffi->cast('opaque', 'record(YaraFFI::Record::YR_META)*', $meta_ptr);
23  
24 # Access fields safely
25 my $type = $meta->type;
26 my $id_ptr = $meta->identifier;
27  
28 =head1 DESCRIPTION
29  
30 Represents the YR_META structure from YARA's libyara. This allows safe
31 access to rule metadata through FFI::Platypus records.
32  
33 =head1 STRUCTURE FIELDS
34  
35 =over 4
36  
37 =item type (sint32)
38  
39 Metadata type: 1=INTEGER, 2=STRING, 3=BOOLEAN
40  
41 =item identifier (opaque)
42  
43 Pointer to the metadata identifier string
44  
45 =item string (opaque)
46  
47 Pointer to string value (when type is STRING)
48  
49 =item integer (sint64)
50  
51 Integer value (when type is INTEGER)
52  
53 =back
54  
55 =cut
56  
57 1 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 1 ▶use FFI::Platypus::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
61  
62 1 record_layout_1(
63 sint32 => 'type', # META_TYPE_* constants
64 sint32 => '_padding', # Padding for alignment
65 opaque => 'identifier', # Pointer to string
66 opaque => 'string', # Pointer to string value (for string type)
67 sint64 => 'integer', # Integer value (for integer type)
68 );
69  
70 1 1; # End of YaraFFI::Record::YR_META
« YaraFFI/Record/YR_MATCH.pm ↑ Summary YaraFFI/Record/YR_RULE.pm »