| 1 | package Net::ISC::DHCPd::OMAPI::Host; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Net::ISC::DHCPd::OMAPI::Host - OMAPI host class | ||
| 6 | |||
| 7 | =head1 SEE ALSO | ||
| 8 | |||
| 9 | L<Net::ISC::DHCPd::OMAPI::Actions>. | ||
| 10 | L<Net::ISC::DHCPd::OMAPI::Meta::Attribute>. | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | use Net::ISC::DHCPd::OMAPI; | ||
| 15 | |||
| 16 | $omapi = Net::ISC::DHCPd::OMAPI->new(...); | ||
| 17 | $omapi->connect | ||
| 18 | $host = $omapi->new_object("host", { $attr => $value }); | ||
| 19 | $host->read; # retrieve server information | ||
| 20 | $host->$attr($value); # update a value | ||
| 21 | $host->write; # write to server | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | 2 | ▶ | use Net::ISC::DHCPd::OMAPI::Sugar; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | 2 | with 'Net::ISC::DHCPd::OMAPI::Actions'; | |
| 29 | |||
| 30 | =head1 ATTRIBUTES | ||
| 31 | |||
| 32 | =head2 dhcp_client_identifier | ||
| 33 | |||
| 34 | $self->dhcp_client_identifier(??); | ||
| 35 | ?? = $self->dhcp_client_identifier; | ||
| 36 | |||
| 37 | The client identifier that the client used when it acquired the host. | ||
| 38 | Not all clients send client identifiers, so this may be empty. | ||
| 39 | |||
| 40 | Actions: examine, lookup, modify. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 2 | omapi_attr dhcp_client_identifier => ( | |
| 45 | isa => 'Str', | ||
| 46 | actions => [qw/examine lookup modify/], | ||
| 47 | ); | ||
| 48 | |||
| 49 | =head2 group | ||
| 50 | |||
| 51 | $self->group(??); | ||
| 52 | ?? = $self->group; | ||
| 53 | |||
| 54 | The named group associated with the host declaration, if there is one. | ||
| 55 | |||
| 56 | Actions: examine, modify. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | 2 | omapi_attr group => ( | |
| 61 | isa => 'Any', | ||
| 62 | actions => [qw/examine modify/], | ||
| 63 | ); | ||
| 64 | |||
| 65 | =head2 hardware_address | ||
| 66 | |||
| 67 | $self->hardware_address($str); | ||
| 68 | $str = $self->hardware_address; | ||
| 69 | |||
| 70 | The hardware address (chaddr) field sent by the client when it acquired | ||
| 71 | its host. | ||
| 72 | |||
| 73 | Actions: examine, lookup, modify. | ||
| 74 | |||
| 75 | =cut | ||
| 76 | |||
| 77 | 2 | omapi_attr hardware_address => ( | |
| 78 | isa => Mac, | ||
| 79 | actions => [qw/examine lookup modify/], | ||
| 80 | ); | ||
| 81 | |||
| 82 | =head2 hardware_type | ||
| 83 | |||
| 84 | $self->hardware_type($str); | ||
| 85 | $str = $self->hardware_type; | ||
| 86 | |||
| 87 | The type of the network interface that the client reported when it | ||
| 88 | acquired its host. | ||
| 89 | |||
| 90 | Actions: examine, lookup, modify. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 2 | omapi_attr hardware_type => ( | |
| 95 | isa => HexInt, | ||
| 96 | actions => [qw/examine lookup modify/], | ||
| 97 | ); | ||
| 98 | |||
| 99 | =head2 ip_address | ||
| 100 | |||
| 101 | $self->ip_address($ip_addr_obj); | ||
| 102 | $self->ip_address("127.0.0.1"); # standard ip | ||
| 103 | $self->ip_address("22:33:aa:bb"); # hex | ||
| 104 | $std_ip_str = $self->ip_address; | ||
| 105 | |||
| 106 | The IP address of the host. | ||
| 107 | |||
| 108 | Actions: examine, modify. | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | 2 | omapi_attr ip_address => ( | |
| 113 | isa => Ip, | ||
| 114 | actions => [qw/examine modify/], | ||
| 115 | ); | ||
| 116 | |||
| 117 | =head2 known | ||
| 118 | |||
| 119 | $self->known($bool); | ||
| 120 | $bool = $self->known; | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | 2 | omapi_attr known => ( | |
| 125 | isa => 'Bool', | ||
| 126 | actions => [qw/examine modify/], | ||
| 127 | ); | ||
| 128 | |||
| 129 | =head2 name | ||
| 130 | |||
| 131 | $self->name($str); | ||
| 132 | $str = $self->name; | ||
| 133 | |||
| 134 | The name of the host declaration. This name must be unique among all | ||
| 135 | host declarations. | ||
| 136 | |||
| 137 | Actions: examine, lookup, modify. | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | 2 | omapi_attr name => ( | |
| 142 | isa => 'Str', | ||
| 143 | actions => [qw/examine lookup modify/], | ||
| 144 | ); | ||
| 145 | |||
| 146 | =head2 statements | ||
| 147 | |||
| 148 | $self->statements("foo,bar"); | ||
| 149 | $self->statements(\@statements); | ||
| 150 | $str = $self->statements; | ||
| 151 | |||
| 152 | A list of statements in the format of the dhcpd.conf file that will | ||
| 153 | be executed whenever a message from the client is being processed. | ||
| 154 | |||
| 155 | Actions: modify | ||
| 156 | |||
| 157 | =cut | ||
| 158 | |||
| 159 | 2 | omapi_attr statements => ( | |
| 160 | isa => Statements, | ||
| 161 | actions => [qw/modify/], | ||
| 162 | ); | ||
| 163 | |||
| 164 | =head1 ACKNOWLEDGEMENTS | ||
| 165 | |||
| 166 | Most of the documentation is taken from C<dhcpd(8)>. | ||
| 167 | |||
| 168 | =head1 COPYRIGHT & LICENSE | ||
| 169 | |||
| 170 | =head1 AUTHOR | ||
| 171 | |||
| 172 | See L<Net::ISC::DHCPd>. | ||
| 173 | |||
| 174 | =cut | ||
| 175 | 2 | __PACKAGE__->meta->make_immutable; | |
| 176 | 2 | 1; | |