Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 1 | /* leases.h */ |
| 2 | #ifndef _LEASES_H |
| 3 | #define _LEASES_H |
| 4 | |
| 5 | |
| 6 | struct dhcpOfferedAddr { |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 7 | uint8_t chaddr[16]; |
| 8 | uint32_t yiaddr; /* network order */ |
| 9 | uint32_t expires; /* host order */ |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 10 | }; |
| 11 | |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 12 | extern uint8_t blank_chaddr[]; |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 13 | |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 14 | void clear_lease(uint8_t *chaddr, uint32_t yiaddr); |
| 15 | struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease); |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 16 | int lease_expired(struct dhcpOfferedAddr *lease); |
| 17 | struct dhcpOfferedAddr *oldest_expired_lease(void); |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 18 | struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr); |
| 19 | struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr); |
| 20 | uint32_t find_address(int check_expired); |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 21 | |
| 22 | |
| 23 | #endif |