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.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/networking/udhcp/libbb_udhcp.h b/networking/udhcp/libbb_udhcp.h
new file mode 100644
index 000000000..cce826786
--- /dev/null
+++ b/networking/udhcp/libbb_udhcp.h
@@ -0,0 +1,92 @@
1/* libbb_udhcp.h - busybox compatibility wrapper */
2
3/* bit of a hack, do this no matter what the order of the includes.
4 * (for busybox) */
5
6#ifndef _LIBBB_UDHCP_H
7#define _LIBBB_UDHCP_H
8
9#ifdef CONFIG_INSTALL_NO_USR
10# define DEFAULT_SCRIPT "/share/udhcpc/default.script"
11#else
12# define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
13#endif
14
15#ifdef IN_BUSYBOX
16#include "busybox.h"
17
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
26#define COMBINED_BINARY
27#include "version.h"
28
29#define xfopen bb_xfopen
30
31/* make safe the exported namespace */
32/* from common.h */
33#define background udhcp_background
34#define start_log_and_pid udhcp_start_log_and_pid
35/* from script.h */
36#define run_script udhcp_run_script
37/* from packet.h */
38#define init_header udhcp_init_header
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 */
44#define pidfile_acquire udhcp_pidfile_acquire
45#define pidfile_write_release udhcp_pidfile_write_release
46/* from options.h */
47#define get_option udhcp_get_option
48#define end_option udhcp_end_option
49#define add_option_string udhcp_add_option_string
50#define add_simple_option udhcp_add_simple_option
51#define option_lengths udhcp_option_lengths
52/* from socket.h */
53#define listen_socket udhcp_listen_socket
54#define read_interface udhcp_read_interface
55/* from dhcpc.h */
56#define client_config udhcp_client_config
57/* from dhcpd.h */
58#define server_config udhcp_server_config
59
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 */