恥ずかしい勘違いから生まれた、DHCP6の不要かつ部分的な実装
Revision | ca2acefbd41244bc0bab4bb1ea4322f5f4cc355e (tree) |
---|---|
Time | 2021-08-12 19:56:59 |
Author | dyknon <dyknon@user...> |
Commiter | dyknon |
new abstruct option: Ipv6AddrList
@@ -0,0 +1,34 @@ | ||
1 | +package Net::DHCP6::AbstractOption::Ipv6AddrList; | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use Net::DHCP6::AbstractOption::Vector; | |
6 | +use Net::DHCP6::Value::Ipv6Addr; | |
7 | + | |
8 | +our $VERSION = "0.0.1"; | |
9 | +our @ISA = qw/Net::DHCP6::AbstractOption::Vector/; | |
10 | + | |
11 | +use constant len_elem => 16; | |
12 | + | |
13 | +sub serialize_elem { | |
14 | + my $class_or_self = shift; | |
15 | + shift->raw; | |
16 | +} | |
17 | + | |
18 | +sub parse_elem { | |
19 | + my $class_or_self = shift; | |
20 | + Net::DHCP6::Value::Ipv6Addr->from_bytes(shift); | |
21 | +} | |
22 | + | |
23 | +sub coerce { | |
24 | + my $class_or_self = shift; | |
25 | + Net::DHCP6::Value::Ipv6Addr->new(shift); | |
26 | +} | |
27 | + | |
28 | +sub stringify_elem { | |
29 | + my $class_or_self = shift; | |
30 | + my $elem = shift; | |
31 | + "$elem"; | |
32 | +} | |
33 | + | |
34 | +1; |
@@ -3,37 +3,14 @@ package Net::DHCP6::Option::DnsServer; | ||
3 | 3 | |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | -use Net::DHCP6::AbstractOption::Vector; | |
6 | +use Net::DHCP6::AbstractOption::Ipv6AddrList; | |
7 | 7 | use Net::DHCP6::Parameters qw/DHCP6_OPT_DNS_SERVERS/; |
8 | -use Net::DHCP6::Value::Ipv6Addr; | |
9 | 8 | |
10 | 9 | our $VERSION = "0.0.1"; |
11 | -our @ISA = qw/Net::DHCP6::AbstractOption::Vector/; | |
10 | +our @ISA = qw/Net::DHCP6::AbstractOption::Ipv6AddrList/; | |
12 | 11 | |
13 | 12 | use constant code => DHCP6_OPT_DNS_SERVERS; |
14 | 13 | use constant name => "DnsServer"; |
15 | -use constant len_elem => 16; | |
16 | - | |
17 | -sub serialize_elem { | |
18 | - my $class_or_self = shift; | |
19 | - shift->raw; | |
20 | -} | |
21 | - | |
22 | -sub parse_elem { | |
23 | - my $class_or_self = shift; | |
24 | - Net::DHCP6::Value::Ipv6Addr->from_bytes(shift); | |
25 | -} | |
26 | - | |
27 | -sub coerce { | |
28 | - my $class_or_self = shift; | |
29 | - Net::DHCP6::Value::Ipv6Addr->new(shift); | |
30 | -} | |
31 | - | |
32 | -sub stringify_elem { | |
33 | - my $class_or_self = shift; | |
34 | - my $elem = shift; | |
35 | - "$elem"; | |
36 | -} | |
37 | 14 | |
38 | 15 | __PACKAGE__->register_option; |
39 | 16 | 1; |