Various cleanups I made while going through Erik Hovland's patch submissions,
[oweals/busybox.git] / networking / udhcp / libbb_udhcp.h
index 73e21464f708c534f4b09954bcd86f1d1e716ba1..c47af2d0a01ec29983bad2c74be63b370a24d15b 100644 (file)
@@ -1,53 +1,49 @@
-/* libbb_udhcp.h - busybox compatability wrapper */
+/* libbb_udhcp.h - busybox compatibility wrapper */
+
+/* bit of a hack, do this no matter what the order of the includes.
+ * (for busybox) */
 
 #ifndef _LIBBB_UDHCP_H
 #define _LIBBB_UDHCP_H
 
-#ifdef IN_BUSYBOX
+#include "packet.h"
 #include "busybox.h"
 
-#ifdef CONFIG_FEATURE_UDHCP_SYSLOG
-#define SYSLOG
-#endif
-
-#ifdef CONFIG_FEATURE_UDHCP_DEBUG
-#define DEBUG
-#endif
-
-#define COMBINED_BINARY
-#include "version.h"
-
 #ifdef CONFIG_INSTALL_NO_USR
-#define DEFAULT_SCRIPT  "/share/udhcpc/default.script"
+# define DEFAULT_SCRIPT  "/share/udhcpc/default.script"
 #else
-#define DEFAULT_SCRIPT  "/usr/share/udhcpc/default.script"
+# define DEFAULT_SCRIPT  "/usr/share/udhcpc/default.script"
 #endif
 
-#define xfopen bb_xfopen
-
-#else /* ! BB_VER */
-
-#include <stdlib.h>
-#include <stdio.h>
 
-#define TRUE                   1
-#define FALSE                  0
 
-#define xmalloc malloc
-#define xcalloc calloc
-
-#define DEFAULT_SCRIPT  "/usr/share/udhcpc/default.script"
+#define COMBINED_BINARY
 
-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;
-}
+#define xfopen bb_xfopen
 
-#endif /* BB_VER */
+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
+/* 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
 
 #endif /* _LIBBB_UDHCP_H */