| 1 | package Net::ISC::DHCPd::Role::Lease; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Net::ISC::DHCPd::Role::Lease - Role for dhcpd lease | ||
| 6 | |||
| 7 | =head1 DESCRIPTION | ||
| 8 | |||
| 9 | See L<Net::ISC::DHCPd::Leases::Lease>, L<Net::ISC::DHCPd::OMAPI::Lease> | ||
| 10 | and L<Net::ISC::DHCPd::OMAPI::Actions>. | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | 7 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 7 | ▶ | use Net::ISC::DHCPd::OMAPI::Sugar; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | =head1 ATTRIBUTES | ||
| 18 | |||
| 19 | =head2 atsfp | ||
| 20 | |||
| 21 | $int = $self->atsfp; | ||
| 22 | $self->atsfp($int); | ||
| 23 | |||
| 24 | The actual tsfp value sent from the peer. This value is forgotten when a | ||
| 25 | lease binding state change is made, to facillitate retransmission logic. | ||
| 26 | |||
| 27 | Actions: examine. | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | 7 | omapi_attr atsfp => ( | |
| 32 | isa => Time, | ||
| 33 | actions => [qw/examine/], | ||
| 34 | ); | ||
| 35 | |||
| 36 | =head2 billing_class | ||
| 37 | |||
| 38 | ?? = $self->billing_class; | ||
| 39 | $self->billing_class(??); | ||
| 40 | |||
| 41 | The handle to the class to which this lease is currently billed, | ||
| 42 | if any (The class object is not currently supported). | ||
| 43 | |||
| 44 | Actions: none. | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | 7 | omapi_attr billing_class => ( | |
| 49 | isa => 'Any', | ||
| 50 | ); | ||
| 51 | |||
| 52 | =head2 circuit_id | ||
| 53 | |||
| 54 | $str => $self->circuit_id; | ||
| 55 | $self->circuit_id($str); | ||
| 56 | |||
| 57 | Circuit ID from Relay Agent Option 82. | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | 7 | omapi_attr circuit_id => ( | |
| 62 | is => 'rw', | ||
| 63 | isa => 'Str', | ||
| 64 | ); | ||
| 65 | |||
| 66 | =head2 client_hostname | ||
| 67 | |||
| 68 | $self->client_hostname($str); | ||
| 69 | $str = $self->client_hostname; | ||
| 70 | |||
| 71 | The value the client sent in the host-name option. | ||
| 72 | |||
| 73 | Actions: examine, modify. | ||
| 74 | |||
| 75 | =cut | ||
| 76 | |||
| 77 | 7 | omapi_attr client_hostname => ( | |
| 78 | isa => 'Str', | ||
| 79 | actions => [qw/examine modify/], | ||
| 80 | ); | ||
| 81 | |||
| 82 | =head2 cltt | ||
| 83 | |||
| 84 | $int = $self->cltt; | ||
| 85 | $self->cltt($int); | ||
| 86 | |||
| 87 | The time of the last transaction with the client on this lease. | ||
| 88 | |||
| 89 | Actions: examine. | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | 7 | omapi_attr cltt => ( | |
| 94 | isa => Time, | ||
| 95 | actions => [qw/examine/], | ||
| 96 | ); | ||
| 97 | |||
| 98 | =head2 dhcp_client_identifier | ||
| 99 | |||
| 100 | $self->dhcp_client_identifier(??); | ||
| 101 | ?? = $self->dhcp_client_identifier; | ||
| 102 | |||
| 103 | The client identifier that the client used when it acquired the lease. | ||
| 104 | Not all clients send client identifiers, so this may be empty. | ||
| 105 | |||
| 106 | Actions: examine, lookup, modify. | ||
| 107 | |||
| 108 | =cut | ||
| 109 | |||
| 110 | 7 | omapi_attr dhcp_client_identifier => ( | |
| 111 | isa => 'Str', | ||
| 112 | actions => [qw/examine lookup modify/], | ||
| 113 | ); | ||
| 114 | |||
| 115 | =head2 ends | ||
| 116 | |||
| 117 | $self->ends($int); | ||
| 118 | $int = $self->ends; | ||
| 119 | |||
| 120 | The time when the current state of the lease ends, as understood by the client. | ||
| 121 | Setting this to "0" will effectively makes the DHCP server drop the lease. | ||
| 122 | |||
| 123 | Actions: examine, modify. | ||
| 124 | |||
| 125 | Note: This attribute can only be modified from ISC-DHCP-4.1.0. | ||
| 126 | |||
| 127 | =cut | ||
| 128 | |||
| 129 | 7 | omapi_attr ends => ( | |
| 130 | isa => Time, | ||
| 131 | actions => [qw/examine modify/], | ||
| 132 | ); | ||
| 133 | |||
| 134 | =head2 flags | ||
| 135 | |||
| 136 | ?? = $self->flags; | ||
| 137 | $self->flags(??); | ||
| 138 | |||
| 139 | Actions: none. | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | 7 | omapi_attr flags => ( | |
| 144 | isa => 'Str', | ||
| 145 | ); | ||
| 146 | |||
| 147 | =head2 host | ||
| 148 | |||
| 149 | $self->host(??); | ||
| 150 | ?? = $self->host; | ||
| 151 | |||
| 152 | The host declaration associated with this lease, if any. | ||
| 153 | |||
| 154 | Actions: examine. | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | 7 | omapi_attr host => ( | |
| 159 | isa => 'Any', | ||
| 160 | actions => [qw/examine/], | ||
| 161 | ); | ||
| 162 | |||
| 163 | =head2 ip_address | ||
| 164 | |||
| 165 | $self->ip_address($ip_addr_obj); | ||
| 166 | $self->ip_address("127.0.0.1"); # standard ip | ||
| 167 | $self->ip_address("22:33:aa:bb"); # hex | ||
| 168 | $std_ip_str = $self->ip_address; | ||
| 169 | |||
| 170 | The IP address of the lease. | ||
| 171 | |||
| 172 | Actions: examine, lookup. | ||
| 173 | |||
| 174 | =cut | ||
| 175 | |||
| 176 | 7 | omapi_attr ip_address => ( | |
| 177 | isa => Ip, | ||
| 178 | actions => [qw/examine lookup/], | ||
| 179 | ); | ||
| 180 | |||
| 181 | =head2 pool | ||
| 182 | |||
| 183 | ?? = $self->pool; | ||
| 184 | $self->pool(??); | ||
| 185 | |||
| 186 | The pool object associted with this lease (The pool object is not | ||
| 187 | currently supported). | ||
| 188 | |||
| 189 | Actions: examine. | ||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | 7 | omapi_attr pool => ( | |
| 194 | isa => 'Any', | ||
| 195 | actions => [qw/examine/], | ||
| 196 | ); | ||
| 197 | |||
| 198 | =head2 remote_id | ||
| 199 | |||
| 200 | $str = $self->remote_id; | ||
| 201 | $self->remote_id($str); | ||
| 202 | |||
| 203 | Remote ID from Relay Agent Option 82. | ||
| 204 | |||
| 205 | =cut | ||
| 206 | |||
| 207 | 7 | omapi_attr remote_id => ( | |
| 208 | is => 'rw', | ||
| 209 | isa => 'Str', | ||
| 210 | ); | ||
| 211 | |||
| 212 | =head2 starts | ||
| 213 | |||
| 214 | $self->starts($int); | ||
| 215 | $int = $self->starts; | ||
| 216 | |||
| 217 | The time when the lease's current state ends, as understood by the server. | ||
| 218 | |||
| 219 | Actions: examine. | ||
| 220 | |||
| 221 | =cut | ||
| 222 | |||
| 223 | 7 | omapi_attr starts => ( | |
| 224 | isa => Time, | ||
| 225 | actions => [qw/examine/], | ||
| 226 | ); | ||
| 227 | |||
| 228 | =head2 state | ||
| 229 | |||
| 230 | $self->state($str); | ||
| 231 | $str = $self->state; | ||
| 232 | |||
| 233 | Valid states: free, active, expired, released, abandoned, reset, backup, | ||
| 234 | reserved, bootp. | ||
| 235 | |||
| 236 | Actions: examine, lookup. | ||
| 237 | |||
| 238 | =cut | ||
| 239 | |||
| 240 | 7 | omapi_attr state => ( | |
| 241 | isa => State, | ||
| 242 | actions => [qw/examine lookup/], | ||
| 243 | ); | ||
| 244 | |||
| 245 | =head2 subnet | ||
| 246 | |||
| 247 | ?? = $self->subnet; | ||
| 248 | $self->subnet(??); | ||
| 249 | |||
| 250 | The subnet object associated with this lease. (The subnet object is not | ||
| 251 | currently supported). | ||
| 252 | |||
| 253 | Actions: examine. | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | 7 | omapi_attr subnet => ( | |
| 258 | isa => 'Any', | ||
| 259 | actions => [qw/examine/], | ||
| 260 | ); | ||
| 261 | |||
| 262 | =head2 tsfp | ||
| 263 | |||
| 264 | $self->tsfp($int); | ||
| 265 | $int = $self->tsfp; | ||
| 266 | |||
| 267 | The adjusted time when the lease's current state ends, as understood by | ||
| 268 | the failover peer (if there is no failover peer, this value is undefined). | ||
| 269 | Generally this value is only adjusted for expired, released, or reset | ||
| 270 | leases while the server is operating in partner-down state, and otherwise | ||
| 271 | is simply the value supplied by the peer. | ||
| 272 | |||
| 273 | Actions: examine. | ||
| 274 | |||
| 275 | =cut | ||
| 276 | |||
| 277 | 7 | omapi_attr tsfp => ( | |
| 278 | isa => Time, | ||
| 279 | actions => [qw/examine/], | ||
| 280 | ); | ||
| 281 | |||
| 282 | =head2 tstp | ||
| 283 | |||
| 284 | $self->tstp($int); | ||
| 285 | $int = $self->tstp; | ||
| 286 | |||
| 287 | The time when the lease's current state ends, as understood by the server. | ||
| 288 | |||
| 289 | Actions: examine. | ||
| 290 | |||
| 291 | =cut | ||
| 292 | |||
| 293 | 7 | omapi_attr tstp => ( | |
| 294 | isa => Time, | ||
| 295 | actions => [qw/examine/], | ||
| 296 | ); | ||
| 297 | |||
| 298 | =head2 hardware_address | ||
| 299 | |||
| 300 | $self->hardware_address($str); | ||
| 301 | $str = $self->hardware_address; | ||
| 302 | |||
| 303 | The hardware address (chaddr) field sent by the client when it acquired | ||
| 304 | its lease. | ||
| 305 | |||
| 306 | Actions: examine, modify. | ||
| 307 | |||
| 308 | =cut | ||
| 309 | |||
| 310 | 7 | omapi_attr hardware_address => ( | |
| 311 | isa => Mac, | ||
| 312 | actions => [qw/examine lookup modify/], | ||
| 313 | ); | ||
| 314 | |||
| 315 | =head2 hardware_type | ||
| 316 | |||
| 317 | $self->hardware_type($str); | ||
| 318 | $str = $self->hardware_type; | ||
| 319 | |||
| 320 | The type of the network interface that the client reported when it | ||
| 321 | acquired its lease. | ||
| 322 | |||
| 323 | Actions: examine, modify. | ||
| 324 | |||
| 325 | =cut | ||
| 326 | |||
| 327 | 7 | omapi_attr hardware_type => ( | |
| 328 | isa => HexInt, | ||
| 329 | actions => [qw/examine modify/], | ||
| 330 | ); | ||
| 331 | |||
| 332 | =head1 ACKNOWLEDGEMENTS | ||
| 333 | |||
| 334 | Most of the documentation is taken from C<dhcpd(8)>. | ||
| 335 | |||
| 336 | =head1 COPYRIGHT & LICENSE | ||
| 337 | |||
| 338 | =head1 AUTHOR | ||
| 339 | |||
| 340 | See L<Net::ISC::DHCPd>. | ||
| 341 | |||
| 342 | =cut | ||
| 343 | |||
| 344 | 7 | 1; | |