⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhcp-lease.h

📁 this is sample about DHCP-agent
💻 H
字号:
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-lease.h,v 1.5 2003/07/13 05:44:30 actmodern Exp $ *  * Copyright 2002 Thamer Alharbash <tmh@whitefang.com> *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *  * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. *  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *  * DHCP lease data structures and routines. */#ifndef DHCP_LEASE_H#define DHCP_LEASE_H/* constraints placed on a lease. */typedef struct {    int constraint_type;                    /* constraint type. */    union {        eth_addr_t hw_address;              /* hardware address. */        char *hostname;                     /* hostname.         */    } data;} lease_constraint_t;/* lease defintion. */typedef struct {    int lease_type;    lease_constraint_t *constraint;        /* constraints if any. */    union {        ip_addr_t address;                /* single ip address. */        struct {            ip_addr_t bottom_range;            ip_addr_t top_range;        } address_range;                  /* range of addresses. */    } address_info;    list_t *options;                       /* options to be passed. */    uint32_t lease_expiry;                 /* lease expiry time. */    uint32_t renew_time;                   /* renewal time. */    uint32_t rebind_time;                  /* rebind time. */} lease_definition_t;/* assigned lease data. */typedef struct {    lease_definition_t *definition;         /* lease definition. */    time_t ini_assigned;                   /* initially assigned timestamp. */    time_t last_assigned;                  /* last assigned timestamp. */} assigned_lease_data_t;/* constants. */enum lease_constraint_type { LEASE_CONSTRAINT_NONE = 0, LEASE_CONSTRAINT_HARDWARE_ADDRESS, LEASE_CONSTRAINT_HOSTNAME };enum lease_type { LEASE_SINGLE_ADDRESS = 0, LEASE_RANGE_ADDRESS };/* prototypes. */extern lease_constraint_t *lease_constraint_create(int constraint_type, void *data);extern void lease_constraint_destroy(lease_constraint_t *lease_constraint);extern lease_definition_t *lease_definition_create(lease_constraint_t *constraint,                                                   int lease_type,                                                   void *data,                                                   list_t *options,                                                   uint32_t lease_expiry,                                                   uint32_t renew_time,                                                   uint32_t rebind_time);extern void lease_definition_destroy(lease_definition_t *lease_def);extern const char *lease_constraint_type_to_string(lease_constraint_t *constraint);extern int lease_constraint_get_type(lease_constraint_t *constraint);extern const char *lease_constraint_get_hostname(lease_constraint_t *constraint);extern eth_addr_t lease_constraint_get_hw_address(lease_constraint_t *constraint);extern const char *lease_constraint_get_hostname(lease_constraint_t *constraint);extern eth_addr_t lease_constraint_get_hw_address(lease_constraint_t *constraint);extern const char *lease_type_to_string(lease_definition_t *lease);extern int lease_definition_get_type(lease_definition_t *lease);extern lease_constraint_t *lease_definition_get_constraint(lease_definition_t *lease);extern const char *lease_constraint_get_hostname(lease_constraint_t *constraint);extern ip_addr_t lease_definition_get_bottom_addr(lease_definition_t *lease);extern ip_addr_t lease_definition_get_top_addr(lease_definition_t *lease);extern ip_addr_t lease_definition_get_addr(lease_definition_t *lease);extern void pretty_print_lease_def(lease_definition_t *lease_def);#endif /* DHCP_LEASE_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -