From 3cca9577f7e3a150798186711e5bbe0df7cd6f01 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 19 Sep 2016 21:08:26 +0200 Subject: libnet: Make netapps.h includable from .code files Unfortunately netapps.h currently can't be included from .code Forth-to-C wrapper files - it includes tftp.h which in turn includes ipv6.h, and that header contains some constructs which can't be used in .code files. So let's make netapps.h independent from tftp.h and add some "extern" keywords like it is done with the other header files already that are included from .code files. Signed-off-by: Thomas Huth Signed-off-by: Alexey Kardashevskiy --- lib/libnet/netapps.h | 13 +++++++------ lib/libnet/netload.c | 3 ++- lib/libnet/tftp.h | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/libnet/netapps.h b/lib/libnet/netapps.h index 8fceba8..693de69 100644 --- a/lib/libnet/netapps.h +++ b/lib/libnet/netapps.h @@ -13,14 +13,15 @@ #ifndef _NETAPPS_H_ #define _NETAPPS_H_ -#include - #define F_IPV4 4 #define F_IPV6 6 -int netboot(int argc, char *argv[]); -int netsave(int argc, char *argv[]); -int ping(int argc, char *argv[]); -int dhcp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries, int flags); +struct filename_ip; + +extern int netboot(int argc, char *argv[]); +extern int netsave(int argc, char *argv[]); +extern int ping(int argc, char *argv[]); +extern int dhcp(char *ret_buffer, struct filename_ip *fn_ip, + unsigned int retries, int flags); #endif diff --git a/lib/libnet/netload.c b/lib/libnet/netload.c index 7ded3e4..1b7c1bc 100644 --- a/lib/libnet/netload.c +++ b/lib/libnet/netload.c @@ -328,7 +328,8 @@ parse_args(const char *arg_str, obp_tftp_args_t *obp_tftp_args) * @return ZERO - IP and configuration info obtained; * NON ZERO - error condition occurs. */ -int dhcp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries, int flags) +int dhcp(char *ret_buffer, struct filename_ip *fn_ip, unsigned int retries, + int flags) { int i = (int) retries+1; int rc = -1; diff --git a/lib/libnet/tftp.h b/lib/libnet/tftp.h index 6b5996c..303feaf 100644 --- a/lib/libnet/tftp.h +++ b/lib/libnet/tftp.h @@ -22,7 +22,7 @@ struct tftphdr { uint16_t th_data; }; -typedef struct { +struct filename_ip { uint32_t own_ip; ip6_addr_t own_ip6; uint32_t server_ip; @@ -30,7 +30,8 @@ typedef struct { ip6_addr_t dns_ip6; int8_t filename[256]; int fd; -} __attribute__ ((packed)) filename_ip_t ; +} __attribute__ ((packed)); +typedef struct filename_ip filename_ip_t; typedef struct { uint32_t bad_tftp_packets; -- cgit v1.1