#include <syslog.h>
#endif
-#define background udhcp_background
-#define start_log_and_pid udhcp_start_log_and_pid
-
long uptime(void);
void background(const char *pidfile);
void start_log_and_pid(const char *client_server, const char *pidfile);
#include <net/if.h>
#include <errno.h>
+#include "common.h"
#include "dhcpd.h"
#include "dhcpc.h"
#include "options.h"
#include "clientsocket.h"
#include "script.h"
#include "socket.h"
-#include "common.h"
#include "signalpipe.h"
static int state;
#ifndef _DHCPC_H
#define _DHCPC_H
+#ifndef DEFAULT_SCRIPT
#define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
-
-/* allow libbb_udhcp.h to redefine DEFAULT_SCRIPT */
-#include "libbb_udhcp.h"
+#endif
#define INIT_SELECTING 0
#define REQUESTING 1
#define xfopen bb_xfopen
+/* make safe the exported namespace */
+/* from common.h */
+#define background udhcp_background
+#define start_log_and_pid udhcp_start_log_and_pid
+/* from script.h */
+#define run_script udhcp_run_script
+/* from packet.h */
+#define init_header udhcp_init_header
+#define get_packet udhcp_get_packet
+#define checksum udhcp_checksum
+#define raw_packet udhcp_raw_packet
+#define kernel_packet udhcp_kernel_packet
+/* from pidfile.h */
+#define pidfile_acquire udhcp_pidfile_acquire
+#define pidfile_write_release udhcp_pidfile_write_release
+/* from options.h */
+#define get_option udhcp_get_option
+#define end_option udhcp_end_option
+#define add_option_string udhcp_add_option_string
+#define add_simple_option udhcp_add_simple_option
+#define option_lengths udhcp_option_lengths
+/* from socket.h */
+#define listen_socket udhcp_listen_socket
+#define read_interface udhcp_read_interface
+/* from dhcpc.h */
+#define client_config udhcp_client_config
+/* from dhcpd.h */
+#define server_config udhcp_server_config
+
#else /* ! BB_VER */
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
+#include "common.h"
#include "dhcpd.h"
#include "options.h"
#include "files.h"
-#include "common.h"
/* supported options are easily added here */
struct dhcpMessage data;
};
-#define init_header udhcp_init_header
-#define get_packet udhcp_get_packet
-#define checksum udhcp_checksum
-#define raw_packet udhcp_raw_packet
-#define kernel_packet udhcp_kernel_packet
-
void init_header(struct dhcpMessage *packet, char type);
int get_packet(struct dhcpMessage *packet, int fd);
uint16_t checksum(void *addr, int count);
*/
-#define pidfile_acquire udhcp_pidfile_acquire
-#define pidfile_write_release udhcp_pidfile_write_release
-
int pidfile_acquire(const char *pidfile);
void pidfile_write_release(int pid_fd);
#include <sys/types.h>
#include <sys/wait.h>
+#include "common.h"
#include "options.h"
#include "dhcpd.h"
#include "dhcpc.h"
-#include "common.h"
#include "script.h"
/* get a rough idea of how long an option will be (rounding up...) */
#ifndef _SCRIPT_H
#define _SCRIPT_H
-#define run_script udhcp_run_script
extern void run_script(struct dhcpMessage *packet, const char *name);
#endif
#include <string.h>
#include <time.h>
+#include "common.h"
#include "serverpacket.h"
#include "dhcpd.h"
#include "options.h"
-#include "common.h"
#include "static_leases.h"
/* send a packet to giaddr using the kernel ip stack */