Merge config.h into ndhc.h.
This commit is contained in:
parent
84a68001d3
commit
c81e9f9a28
@ -43,7 +43,6 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "dhcp.h"
|
#include "dhcp.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "ndhc.h"
|
|
||||||
#include "ifchange.h"
|
#include "ifchange.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "leasefile.h"
|
#include "leasefile.h"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "ndhc.h"
|
||||||
#include "dhcp.h"
|
#include "dhcp.h"
|
||||||
|
|
||||||
struct arpMsg {
|
struct arpMsg {
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
/* config.h - internal configuration and state for ndhc
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004-2011 Nicholas J. Kain <njkain at gmail dot com>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* - 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.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NDHC_CONFIG_H_
|
|
||||||
#define NDHC_CONFIG_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include "random.h"
|
|
||||||
|
|
||||||
struct client_state_t {
|
|
||||||
unsigned long long leaseStartTime;
|
|
||||||
int dhcpState;
|
|
||||||
int arpPrevState;
|
|
||||||
int ifsPrevState;
|
|
||||||
int listenMode;
|
|
||||||
int epollFd, signalFd, listenFd, arpFd, nlFd;
|
|
||||||
int nlPortId;
|
|
||||||
uint32_t clientAddr, serverAddr, routerAddr;
|
|
||||||
uint32_t lease, renewTime, rebindTime, xid;
|
|
||||||
struct nk_random_state_u32 rnd32_state;
|
|
||||||
uint8_t routerArp[6], serverArp[6];
|
|
||||||
uint8_t using_dhcp_bpf, init, got_router_arp, got_server_arp;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct client_config_t {
|
|
||||||
char foreground; // Do not fork
|
|
||||||
char quit_after_lease; // Quit after obtaining lease
|
|
||||||
char abort_if_no_lease; // Abort if no lease
|
|
||||||
char background_if_no_lease; // Fork to background if no lease
|
|
||||||
char clientid_mac; // If true, then the clientid is a MAC addr
|
|
||||||
char interface[IFNAMSIZ]; // The name of the interface to use
|
|
||||||
char clientid[64]; // Optional client id to use
|
|
||||||
char hostname[64]; // Optional hostname to use
|
|
||||||
char vendor[64]; // Vendor identification that will be sent
|
|
||||||
int ifindex; // Index number of the interface to use
|
|
||||||
uint8_t arp[6]; // Our arp address
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct client_config_t client_config;
|
|
||||||
|
|
||||||
#endif /* NDHC_CONFIG_H_ */
|
|
||||||
|
|
@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
#include <netinet/udp.h>
|
#include <netinet/udp.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
|
#include "ndhc.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#define DHCP_SERVER_PORT 67
|
#define DHCP_SERVER_PORT 67
|
||||||
#define DHCP_CLIENT_PORT 68
|
#define DHCP_CLIENT_PORT 68
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "ndhc.h"
|
#include "ndhc.h"
|
||||||
#include "config.h"
|
|
||||||
#include "dhcp.h"
|
#include "dhcp.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "arp.h"
|
#include "arp.h"
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#include "ifset.h"
|
#include "ifset.h"
|
||||||
#include "ifchd.h"
|
#include "ifchd.h"
|
||||||
#include "config.h"
|
#include "ndhc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "ifch_proto.h"
|
#include "ifch_proto.h"
|
||||||
#include "strl.h"
|
#include "strl.h"
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
|
|
||||||
#include "ndhc.h"
|
#include "ndhc.h"
|
||||||
#include "ndhc-defines.h"
|
#include "ndhc-defines.h"
|
||||||
#include "config.h"
|
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "dhcp.h"
|
#include "dhcp.h"
|
||||||
|
34
ndhc/ndhc.h
34
ndhc/ndhc.h
@ -28,7 +28,41 @@
|
|||||||
#ifndef NJK_NDHC_NDHC_H_
|
#ifndef NJK_NDHC_NDHC_H_
|
||||||
#define NJK_NDHC_NDHC_H_
|
#define NJK_NDHC_NDHC_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <net/if.h>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
|
struct client_state_t {
|
||||||
|
unsigned long long leaseStartTime;
|
||||||
|
int dhcpState;
|
||||||
|
int arpPrevState;
|
||||||
|
int ifsPrevState;
|
||||||
|
int listenMode;
|
||||||
|
int epollFd, signalFd, listenFd, arpFd, nlFd;
|
||||||
|
int nlPortId;
|
||||||
|
uint32_t clientAddr, serverAddr, routerAddr;
|
||||||
|
uint32_t lease, renewTime, rebindTime, xid;
|
||||||
|
struct nk_random_state_u32 rnd32_state;
|
||||||
|
uint8_t routerArp[6], serverArp[6];
|
||||||
|
uint8_t using_dhcp_bpf, init, got_router_arp, got_server_arp;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct client_config_t {
|
||||||
|
char foreground; // Do not fork
|
||||||
|
char quit_after_lease; // Quit after obtaining lease
|
||||||
|
char abort_if_no_lease; // Abort if no lease
|
||||||
|
char background_if_no_lease; // Fork to background if no lease
|
||||||
|
char clientid_mac; // If true, then the clientid is a MAC addr
|
||||||
|
char interface[IFNAMSIZ]; // The name of the interface to use
|
||||||
|
char clientid[64]; // Optional client id to use
|
||||||
|
char hostname[64]; // Optional hostname to use
|
||||||
|
char vendor[64]; // Vendor identification that will be sent
|
||||||
|
int ifindex; // Index number of the interface to use
|
||||||
|
uint8_t arp[6]; // Our arp address
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct client_config_t client_config;
|
||||||
|
|
||||||
extern int pToIfchR;
|
extern int pToIfchR;
|
||||||
extern int pToIfchW;
|
extern int pToIfchW;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#ifndef NDHC_STATE_H_
|
#ifndef NDHC_STATE_H_
|
||||||
#define NDHC_STATE_H_
|
#define NDHC_STATE_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "ndhc.h"
|
||||||
#include "dhcp.h"
|
#include "dhcp.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -26,15 +26,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/signalfd.h>
|
#include <sys/signalfd.h>
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "config.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
void epoll_add(int epfd, int fd)
|
void epoll_add(int epfd, int fd)
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "ndhc-defines.h"
|
#include "ndhc-defines.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
static inline unsigned long long curms()
|
static inline unsigned long long curms()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user