File Coverage

blib/lib/STIX/Observable/Extension/Socket.pm
Criterion Covered Total %
statement 29 29 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 39 39 100.0


line stmt bran cond sub pod time code
1             package STIX::Observable::Extension::Socket;
2              
3 24     24   567 use 5.010001;
  24         106  
4 24     24   158 use strict;
  24         55  
  24         698  
5 24     24   129 use warnings;
  24         70  
  24         1869  
6 24     24   765 use utf8;
  24         65  
  24         199  
7              
8 24     24   1096 use STIX::Common::Enum;
  24         70  
  24         1189  
9 24     24   153 use Types::Standard qw(Str Int Enum Bool HashRef);
  24         59  
  24         305  
10              
11 24     24   64909 use Moo;
  24         106  
  24         252  
12 24     24   12407 use namespace::autoclean;
  24         99  
  24         256  
13              
14             extends 'STIX::Object';
15              
16 24         2579 use constant PROPERTIES => (qw[
17             address_family
18             is_blocking
19             is_listening
20             options
21             socket_type
22             socket_descriptor
23             socket_handle
24 24     24   3341 ]);
  24         121  
25              
26 24     24   178 use constant EXTENSION_TYPE => 'socket-ext';
  24         68  
  24         6340  
27              
28             has address_family => (is => 'rw', required => 1, isa => Enum [STIX::Common::Enum->NETWORK_SOCKET_ADDRESS_FAMILY()]);
29             has is_blocking => (is => 'rw', isa => Bool);
30             has is_listening => (is => 'rw', isa => Bool);
31             has options => (is => 'rw', isa => HashRef);
32             has socket_type => (is => 'rw', isa => Enum [STIX::Common::Enum->NETWORK_SOCKET_TYPE()]);
33             has socket_descriptor => (is => 'rw', isa => Int);
34             has socket_handle => (is => 'rw', isa => Int);
35              
36             1;
37              
38             =encoding utf-8
39              
40             =head1 NAME
41              
42             STIX::Observable::Extension::Socket - STIX Cyber-observable Object (SCO) - Socket Extension
43              
44             =head1 SYNOPSIS
45              
46             use STIX::Observable::Extension::Socket;
47              
48             my $socket_ext = STIX::Observable::Extension::Socket->new();
49              
50              
51             =head1 DESCRIPTION
52              
53             The Network Socket extension specifies a default extension for capturing network
54             traffic properties associated with network sockets.
55              
56              
57             =head2 METHODS
58              
59             L inherits all methods from L
60             and implements the following new ones.
61              
62             =over
63              
64             =item STIX::Observable::Extension::Socket->new(%properties)
65              
66             Create a new instance of L.
67              
68             =item $socket_ext->address_family
69              
70             Specifies the address family (AF_*) that the socket is configured for
71             (see C in L).
72              
73             =item $socket_ext->is_blocking
74              
75             Specifies whether the socket is in blocking mode.
76              
77             =item $socket_ext->is_listening
78              
79             Specifies whether the socket is in listening mode.
80              
81             =item $socket_ext->options
82              
83             Specifies any options (SO_*) that may be used by the socket, as a dictionary.
84              
85             =item $socket_ext->socket_type
86              
87             Specifies the type of the socket (see C in L).
88              
89             =item $socket_ext->socket_descriptor
90              
91             Specifies the socket file descriptor value associated with the socket, as a
92             non-negative integer.
93              
94             =item $socket_ext->socket_handle
95              
96             Specifies the handle or inode value associated with the socket.
97              
98             =back
99              
100              
101             =head2 HELPERS
102              
103             =over
104              
105             =item $socket_ext->TO_JSON
106              
107             Helper for JSON encoders.
108              
109             =item $socket_ext->to_hash
110              
111             Return the object HASH.
112              
113             =item $socket_ext->to_string
114              
115             Encode the object in JSON.
116              
117             =item $socket_ext->validate
118              
119             Validate the object using JSON Schema (see L).
120              
121             =back
122              
123              
124             =head1 SUPPORT
125              
126             =head2 Bugs / Feature Requests
127              
128             Please report any bugs or feature requests through the issue tracker
129             at L.
130             You will be notified automatically of any progress on your issue.
131              
132             =head2 Source Code
133              
134             This is open source software. The code repository is available for
135             public review and contribution under the terms of the license.
136              
137             L
138              
139             git clone https://github.com/giterlizzi/perl-STIX.git
140              
141              
142             =head1 AUTHOR
143              
144             =over 4
145              
146             =item * Giuseppe Di Terlizzi
147              
148             =back
149              
150              
151             =head1 LICENSE AND COPYRIGHT
152              
153             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
154              
155             This is free software; you can redistribute it and/or modify it under
156             the same terms as the Perl 5 programming language system itself.
157              
158             =cut