From 3f78561d63290c53ca8bb3cd6314ca7357a617ee Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 28 May 2006 01:06:36 +0000 Subject: My first bout of untangling udhcp. Make lots of gratuitous #defines go away, substitutie BB_VER for an external VERSION, use busybox CONFIG symbols rather than checking for them then defining others, etc. Lots more cleanup to do... --- networking/udhcp/libbb_udhcp.h | 65 +++++++----------------------------------- 1 file changed, 11 insertions(+), 54 deletions(-) (limited to 'networking/udhcp/libbb_udhcp.h') diff --git a/networking/udhcp/libbb_udhcp.h b/networking/udhcp/libbb_udhcp.h index cce826786..c47af2d0a 100644 --- a/networking/udhcp/libbb_udhcp.h +++ b/networking/udhcp/libbb_udhcp.h @@ -6,40 +6,29 @@ #ifndef _LIBBB_UDHCP_H #define _LIBBB_UDHCP_H +#include "packet.h" +#include "busybox.h" + #ifdef CONFIG_INSTALL_NO_USR # define DEFAULT_SCRIPT "/share/udhcpc/default.script" #else # define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" #endif -#ifdef IN_BUSYBOX -#include "busybox.h" -#ifdef CONFIG_FEATURE_UDHCP_SYSLOG -#define UDHCP_SYSLOG -#endif - -#ifdef CONFIG_FEATURE_UDHCP_DEBUG -#define UDHCP_DEBUG -#endif #define COMBINED_BINARY -#include "version.h" #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 +void udhcp_background(const char *pidfile); +void udhcp_start_log_and_pid(const char *client_server, const char *pidfile); +void udhcp_logging(int level, const char *fmt, ...); + +void udhcp_run_script(struct dhcpMessage *packet, const char *name); + +// Still need to clean these up... + /* from pidfile.h */ #define pidfile_acquire udhcp_pidfile_acquire #define pidfile_write_release udhcp_pidfile_write_release @@ -57,36 +46,4 @@ /* from dhcpd.h */ #define server_config udhcp_server_config -#else /* ! IN_BUSYBOX */ - -#include -#include -#include - -#ifndef ATTRIBUTE_NORETURN -#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -#endif /* ATTRIBUTE_NORETURN */ - -#ifndef ATTRIBUTE_PACKED -#define ATTRIBUTE_PACKED __attribute__ ((__packed__)) -#endif /* ATTRIBUTE_PACKED */ - -#define TRUE 1 -#define FALSE 0 - -#define xmalloc malloc -#define xcalloc calloc - -static inline FILE *xfopen(const char *file, const char *mode) -{ - FILE *fp; - if (!(fp = fopen(file, mode))) { - perror("could not open input file"); - exit(0); - } - return fp; -} - -#endif /* IN_BUSYBOX */ - #endif /* _LIBBB_UDHCP_H */ -- cgit v1.2.3