aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/libbb_udhcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/libbb_udhcp.h')
-rw-r--r--networking/udhcp/libbb_udhcp.h65
1 files changed, 11 insertions, 54 deletions
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 @@
6#ifndef _LIBBB_UDHCP_H 6#ifndef _LIBBB_UDHCP_H
7#define _LIBBB_UDHCP_H 7#define _LIBBB_UDHCP_H
8 8
9#include "packet.h"
10#include "busybox.h"
11
9#ifdef CONFIG_INSTALL_NO_USR 12#ifdef CONFIG_INSTALL_NO_USR
10# define DEFAULT_SCRIPT "/share/udhcpc/default.script" 13# define DEFAULT_SCRIPT "/share/udhcpc/default.script"
11#else 14#else
12# define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" 15# define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
13#endif 16#endif
14 17
15#ifdef IN_BUSYBOX
16#include "busybox.h"
17 18
18#ifdef CONFIG_FEATURE_UDHCP_SYSLOG
19#define UDHCP_SYSLOG
20#endif
21
22#ifdef CONFIG_FEATURE_UDHCP_DEBUG
23#define UDHCP_DEBUG
24#endif
25 19
26#define COMBINED_BINARY 20#define COMBINED_BINARY
27#include "version.h"
28 21
29#define xfopen bb_xfopen 22#define xfopen bb_xfopen
30 23
31/* make safe the exported namespace */ 24void udhcp_background(const char *pidfile);
32/* from common.h */ 25void udhcp_start_log_and_pid(const char *client_server, const char *pidfile);
33#define background udhcp_background 26void udhcp_logging(int level, const char *fmt, ...);
34#define start_log_and_pid udhcp_start_log_and_pid 27
35/* from script.h */ 28void udhcp_run_script(struct dhcpMessage *packet, const char *name);
36#define run_script udhcp_run_script 29
37/* from packet.h */ 30// Still need to clean these up...
38#define init_header udhcp_init_header 31
39#define get_packet udhcp_get_packet
40#define checksum udhcp_checksum
41#define raw_packet udhcp_raw_packet
42#define kernel_packet udhcp_kernel_packet
43/* from pidfile.h */ 32/* from pidfile.h */
44#define pidfile_acquire udhcp_pidfile_acquire 33#define pidfile_acquire udhcp_pidfile_acquire
45#define pidfile_write_release udhcp_pidfile_write_release 34#define pidfile_write_release udhcp_pidfile_write_release
@@ -57,36 +46,4 @@
57/* from dhcpd.h */ 46/* from dhcpd.h */
58#define server_config udhcp_server_config 47#define server_config udhcp_server_config
59 48
60#else /* ! IN_BUSYBOX */
61
62#include <stdlib.h>
63#include <stdio.h>
64#include <sys/sysinfo.h>
65
66#ifndef ATTRIBUTE_NORETURN
67#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
68#endif /* ATTRIBUTE_NORETURN */
69
70#ifndef ATTRIBUTE_PACKED
71#define ATTRIBUTE_PACKED __attribute__ ((__packed__))
72#endif /* ATTRIBUTE_PACKED */
73
74#define TRUE 1
75#define FALSE 0
76
77#define xmalloc malloc
78#define xcalloc calloc
79
80static inline FILE *xfopen(const char *file, const char *mode)
81{
82 FILE *fp;
83 if (!(fp = fopen(file, mode))) {
84 perror("could not open input file");
85 exit(0);
86 }
87 return fp;
88}
89
90#endif /* IN_BUSYBOX */
91
92#endif /* _LIBBB_UDHCP_H */ 49#endif /* _LIBBB_UDHCP_H */