blob: 0dae401727b2dba987d8eb8c6f538fab56807f30 [file] [log] [blame]
Russ Dill61fb4892002-10-14 21:41:28 +00001/* libbb_udhcp.h - busybox compatability wrapper */
2
Russ Dill4e864a32003-12-18 22:25:38 +00003/* bit of a hack, do this no matter what the order of the includes.
4 * (for busybox) */
5
6#ifdef CONFIG_INSTALL_NO_USR
Glenn L McGrath02265962004-03-05 14:23:16 +00007#undef DEFAULT_SCRIPT
Russ Dill4e864a32003-12-18 22:25:38 +00008#define DEFAULT_SCRIPT "/share/udhcpc/default.script"
9#endif
10
Russ Dill61fb4892002-10-14 21:41:28 +000011#ifndef _LIBBB_UDHCP_H
12#define _LIBBB_UDHCP_H
13
Russ Dill54fde9e2002-12-11 22:43:37 +000014#ifdef IN_BUSYBOX
Russ Dill4b77aca2003-12-16 02:28:20 +000015#include "busybox.h"
Russ Dill61fb4892002-10-14 21:41:28 +000016
17#ifdef CONFIG_FEATURE_UDHCP_SYSLOG
Russ Dill4e864a32003-12-18 22:25:38 +000018#define UDHCP_SYSLOG
Russ Dill61fb4892002-10-14 21:41:28 +000019#endif
20
21#ifdef CONFIG_FEATURE_UDHCP_DEBUG
Russ Dill4e864a32003-12-18 22:25:38 +000022#define UDHCP_DEBUG
Russ Dill61fb4892002-10-14 21:41:28 +000023#endif
24
25#define COMBINED_BINARY
Russ Dillda970852002-11-05 20:10:21 +000026#include "version.h"
Russ Dill61fb4892002-10-14 21:41:28 +000027
Russ Dill4b77aca2003-12-16 02:28:20 +000028#define xfopen bb_xfopen
29
"Vladimir N. Oleynik"b6284092005-09-23 11:25:29 +000030/* make safe the exported namespace */
31/* from common.h */
32#define background udhcp_background
33#define start_log_and_pid udhcp_start_log_and_pid
34/* from script.h */
35#define run_script udhcp_run_script
36/* from packet.h */
37#define init_header udhcp_init_header
38#define get_packet udhcp_get_packet
39#define checksum udhcp_checksum
40#define raw_packet udhcp_raw_packet
41#define kernel_packet udhcp_kernel_packet
42/* from pidfile.h */
43#define pidfile_acquire udhcp_pidfile_acquire
44#define pidfile_write_release udhcp_pidfile_write_release
45/* from options.h */
46#define get_option udhcp_get_option
47#define end_option udhcp_end_option
48#define add_option_string udhcp_add_option_string
49#define add_simple_option udhcp_add_simple_option
50#define option_lengths udhcp_option_lengths
51/* from socket.h */
52#define listen_socket udhcp_listen_socket
53#define read_interface udhcp_read_interface
54/* from dhcpc.h */
55#define client_config udhcp_client_config
56/* from dhcpd.h */
57#define server_config udhcp_server_config
58
Russ Dill61fb4892002-10-14 21:41:28 +000059#else /* ! BB_VER */
60
Russ Dill4b77aca2003-12-16 02:28:20 +000061#include <stdlib.h>
62#include <stdio.h>
Russ Dill5c9323f2004-05-19 09:18:04 +000063#include <sys/sysinfo.h>
Russ Dill4b77aca2003-12-16 02:28:20 +000064
Russ Dill61fb4892002-10-14 21:41:28 +000065#define TRUE 1
66#define FALSE 0
67
68#define xmalloc malloc
Russ Dill4b77aca2003-12-16 02:28:20 +000069#define xcalloc calloc
70
Russ Dill4b77aca2003-12-16 02:28:20 +000071static inline FILE *xfopen(const char *file, const char *mode)
72{
73 FILE *fp;
74 if (!(fp = fopen(file, mode))) {
75 perror("could not open input file");
76 exit(0);
77 }
78 return fp;
79}
Russ Dill61fb4892002-10-14 21:41:28 +000080
81#endif /* BB_VER */
82
83#endif /* _LIBBB_UDHCP_H */