NetworkInador/lib/dhcpc_defs.h

78 lines
1.8 KiB
C
Raw Normal View History

/*
* dhcpc_defs.h
* This file is part of Network-inador
*
* Copyright (C) 2023 - Félix Arreola Rodríguez
*
* Network-inador is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Network-inador is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Network-inador; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __DHCPC_DEFS_H__
#define __DHCPC_DEFS_H__
#include <stdint.h>
#include "flist.h"
#include "struct_addr_union.h"
/* Información del proceso de DHCP */
enum {
IFACE_NO_DHCP = 0,
IFACE_ISC_DHCLIENT,
IFACE_BUSYBOX_UDHCPC
};
/* FIXME: Revisar estos estados */
enum {
DHCP_CLIENT_SELECTING,
DHCP_CLIENT_BOUND,
DHCP_CLIENT_RENEWED,
DHCP_CLIENT_EXPIRED,
DHCP_CLIENT_FAILED,
DHCP_CLIENT_KILLED,
};
#define DHCP_CLIENT_FLAG_AUTO_RESTART 0x0001
#define DHCP_CLIENT_FLAG_DONT_ADD_DNS_INFO 0x0002
#define DHCP_CLIENT_FLAG_DONT_ADD_ROUTE_INFO 0x0004
#define DHCP_CLIENT_FLAG_DONT_ADD_IP_INFO 0x0008
typedef struct {
int type;
uint32_t flags;
int dhcp_state;
/* Para vigilar el proceso */
pid_t process_pid;
unsigned int process_watch;
/* La información obtenida desde el cliente */
struct_addr ip, broadcast;
struct_addr gateways[7], dns[7];
char domain_name[256];
int gw_c, dns_c;
int prefix;
struct_addr dhcp_server_ip;
uint32_t lease_time;
} InterfaceDHCPClientInfo;
#endif /* __DHCPC_DEFS_H__ */