Committer: Diego Biurrun <diego@xxxxxxxxxx> Date: 21/05/2010 at 13:38:04 Revision: 4568 Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: the grand #include cleanup - part III: lib/tool/ directory + collateral damage Add required headers, remove unnecessary headers, reorder #includes. Modified: M firewall/cache_port.c M firewall/opptcp.c M hipd/hit_to_ip.c M hipd/init.c M hipd/netdev.c M lib/core/conf.c M lib/core/debug.c M lib/core/message.c M lib/core/message.h M lib/tool/checksum.c M lib/tool/checksum.h M lib/tool/lutil.c M lib/tool/lutil.h M lib/tool/nlink.c M lib/tool/nlink.h M lib/tool/pk.c M lib/tool/pk.h M lib/tool/xfrmapi.c M lib/tool/xfrmapi.h M test/certteststub.c === modified file 'firewall/cache_port.c' --- firewall/cache_port.c 2010-05-18 12:53:55 +0000 +++ firewall/cache_port.c 2010-05-21 10:36:58 +0000 @@ -21,10 +21,14 @@ */ #include <stdio.h> +#include <string.h> +#include "lib/core/builder.h" +#include "lib/core/debug.h" +#include "lib/core/hashtable.h" +#include "lib/tool/lutil.h" #include "cache_port.h" #include "cache.h" -#include "lib/tool/lutil.h" === modified file 'firewall/opptcp.c' --- firewall/opptcp.c 2010-04-15 23:29:06 +0000 +++ firewall/opptcp.c 2010-05-21 10:36:58 +0000 @@ -42,6 +42,7 @@ #include "lib/core/protodefs.h" #include "lib/core/builder.h" #include "lib/core/message.h" +#include "lib/tool/nlink.h" #include "common_hipd_msg.h" #include "firewall.h" === modified file 'hipd/hit_to_ip.c' --- hipd/hit_to_ip.c 2010-05-17 14:56:20 +0000 +++ hipd/hit_to_ip.c 2010-05-21 10:36:58 +0000 @@ -13,8 +13,9 @@ #define _BSD_SOURCE +#include <netdb.h> +#include <string.h> #include <netinet/in.h> -#include <string.h> #include <sys/socket.h> #include "hit_to_ip.h" === modified file 'hipd/init.c' --- hipd/init.c 2010-05-17 22:11:11 +0000 +++ hipd/init.c 2010-05-21 10:36:58 +0000 @@ -18,6 +18,7 @@ #include <sys/syscall.h> #include <sys/types.h> #include <netinet/icmp6.h> +#include <linux/rtnetlink.h> #include <linux/unistd.h> #include "config.h" === modified file 'hipd/netdev.c' --- hipd/netdev.c 2010-05-17 18:24:10 +0000 +++ hipd/netdev.c 2010-05-21 10:36:58 +0000 @@ -26,6 +26,7 @@ #include <netinet/in.h> #include <sys/ioctl.h> #include <ifaddrs.h> +#include <linux/rtnetlink.h> #include "config.h" #include "lib/tool/nlink.h" === modified file 'lib/core/conf.c' --- lib/core/conf.c 2010-05-18 11:19:26 +0000 +++ lib/core/conf.c 2010-05-21 10:36:58 +0000 @@ -35,18 +35,32 @@ #define _BSD_SOURCE #include <errno.h> +#include <netdb.h> +#include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <stdlib.h> +#include <strings.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <net/if.h> +#include <netinet/in.h> #include <sys/ioctl.h> +#include <sys/socket.h> +#include <sys/types.h> -#include "config.h" -#include "conf.h" #include "lib/core/builder.h" #include "lib/core/debug.h" -#include "lib/core/straddr.h" -#include "lib/core/prefix.h" #include "lib/core/hostid.h" +#include "lib/core/ife.h" #include "lib/core/message.h" +#include "lib/core/prefix.h" +#include "lib/core/protodefs.h" +#include "lib/core/straddr.h" +#include "lib/tool/lutil.h" +#include "config.h" +#include "conf.h" + + #include "lib/core/crypto.h" /** === modified file 'lib/core/debug.c' --- lib/core/debug.c 2010-05-17 22:11:11 +0000 +++ lib/core/debug.c 2010-05-21 10:36:58 +0000 @@ -48,11 +48,21 @@ #define _BSD_SOURCE -#include "config.h" -#include "conf.h" +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include <arpa/inet.h> +#include <sys/socket.h> +#include <sys/types.h> + +#include "lib/tool/lutil.h" +#include "builder.h" +#include "ife.h" +#include "state.h" +#include "straddr.h" #include "debug.h" -#include "straddr.h" -#include "lib/tool/lutil.h" /* must be in the same order as enum debug_level (straight mapping) */ const int debug2syslog_map[] = { LOG_ALERT, === modified file 'lib/core/message.c' --- lib/core/message.c 2010-05-17 22:11:11 +0000 +++ lib/core/message.c 2010-05-21 10:36:58 +0000 @@ -53,9 +53,28 @@ #define _BSD_SOURCE +#include <error.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> #include <unistd.h> +#include <arpa/inet.h> +#include <netinet/in.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/types.h> + +#include "lib/tool/nlink.h" +#include "builder.h" +#include "debug.h" +#include "hip_udp.h" +#include "icomm.h" +#include "ife.h" +#include "prefix.h" +#include "protodefs.h" #include "message.h" -#include "hip_udp.h" + /** * Finds out how much data is coming from a socket === modified file 'lib/core/message.h' --- lib/core/message.h 2010-05-17 14:56:20 +0000 +++ lib/core/message.h 2010-05-21 10:36:58 +0000 @@ -10,14 +10,13 @@ #ifndef HIP_LIB_CORE_MESSAGE_H #define HIP_LIB_CORE_MESSAGE_H -#include <errno.h> +#include <stdint.h> #include <netinet/in.h> - -#include "config.h" -#include "lib/tool/nlink.h" -#include "conf.h" -#include "debug.h" -#include "icomm.h" +#include <sys/socket.h> + +#include "lib/core/protodefs.h" +#include "lib/core/state.h" + #define HIP_DEFAULT_MSG_TIMEOUT 4000000000ul /* nanosecs */ === modified file 'lib/tool/checksum.c' --- lib/tool/checksum.c 2010-05-21 10:34:45 +0000 +++ lib/tool/checksum.c 2010-05-21 10:36:58 +0000 @@ -11,12 +11,16 @@ #define _BSD_SOURCE +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <arpa/inet.h> +#include <netinet/in.h> #include <netinet/ip.h> -#include <sys/types.h> -#include <string.h> -#include "config.h" + +#include "lib/core/debug.h" +#include "lib/core/protodefs.h" #include "checksum.h" -#include "lib/core/debug.h" struct pseudo_header { unsigned char src_addr[4]; === modified file 'lib/tool/checksum.h' --- lib/tool/checksum.h 2010-04-21 14:47:24 +0000 +++ lib/tool/checksum.h 2010-05-21 10:36:58 +0000 @@ -3,10 +3,10 @@ #define _BSD_SOURCE -#include <sys/types.h> +#include <stdint.h> #include <netinet/in.h> #include <netinet/ip.h> -#include "lib/core/protodefs.h" +#include <sys/socket.h> uint16_t ipv4_checksum(uint8_t protocol, void *s, void *d, void *c, uint16_t len); uint16_t ipv6_checksum(uint8_t protocol, === modified file 'lib/tool/lutil.c' --- lib/tool/lutil.c 2010-05-17 14:56:20 +0000 +++ lib/tool/lutil.c 2010-05-21 10:36:58 +0000 @@ -8,6 +8,12 @@ * is borrowed from glibc project. */ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> + #include "lutil.h" #include "lib/core/conf.h" === modified file 'lib/tool/lutil.h' --- lib/tool/lutil.h 2010-04-22 10:12:54 +0000 +++ lib/tool/lutil.h 2010-05-21 10:36:58 +0000 @@ -8,18 +8,9 @@ #ifndef HIP_LIB_TOOL_LUTIL_H #define HIP_LIB_TOOL_LUTIL_H -#include <dirent.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/param.h> +#include <stdint.h> #include <stdio.h> -#include <stdlib.h> -#include <malloc.h> - -#include "config.h" -#include "lib/core/builder.h" -#include "lib/core/debug.h" +#include <sys/time.h> #define MAX_ITEM_LEN 256 === modified file 'lib/tool/nlink.c' --- lib/tool/nlink.c 2010-05-17 22:11:11 +0000 +++ lib/tool/nlink.c 2010-05-21 10:36:58 +0000 @@ -29,13 +29,26 @@ #define _BSD_SOURCE +#include <errno.h> +#include <limits.h> +#include <stdint.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <linux/netlink.h> +#include <linux/rtnetlink.h> #include <net/if.h> #include <sys/ioctl.h> -#include <unistd.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <sys/uio.h> -#include "config.h" +#include "lib/core/debug.h" #include "lib/core/hip_udp.h" +#include "lib/core/ife.h" #include "nlink.h" #define HIP_MAX_NETLINK_PACKET 65537 === modified file 'lib/tool/nlink.h' --- lib/tool/nlink.h 2010-05-17 18:24:10 +0000 +++ lib/tool/nlink.h 2010-05-21 10:36:58 +0000 @@ -1,16 +1,13 @@ #ifndef HIP_LIB_TOOL_NLINK_H #define HIP_LIB_TOOL_NLINK_H -#include <stdio.h> #include <stdint.h> -#include <net/if.h> #include <netinet/in.h> #include <linux/netlink.h> #include <linux/xfrm.h> -#include <linux/rtnetlink.h> +#include <sys/socket.h> +#include <sys/types.h> -#include "lib/core/builder.h" -#include "lib/core/debug.h" #define HIP_OPTION_KIND 30 #define HIP_NETLINK_TALK_ACK 0 /* see netlink_talk */ === modified file 'lib/tool/pk.c' --- lib/tool/pk.c 2010-04-16 01:30:31 +0000 +++ lib/tool/pk.c 2010-05-21 10:36:58 +0000 @@ -10,9 +10,24 @@ * @author Miika Komu <miika@xxxxxx> */ +#include <errno.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <netinet/in.h> +#include <openssl/bn.h> +#include <openssl/dsa.h> +#include <openssl/rsa.h> + +#include "lib/core/builder.h" +#include "lib/core/crypto.h" +#include "lib/core/debug.h" +#include "lib/core/ife.h" +#include "lib/core/performance.h" +#include "lib/core/prefix.h" +#include "lib/core/protodefs.h" #include "config.h" #include "pk.h" -#include "lib/core/performance.h" /** * sign a HIP control message with a private RSA key === modified file 'lib/tool/pk.h' --- lib/tool/pk.h 2010-02-17 17:38:08 +0000 +++ lib/tool/pk.h 2010-05-21 10:36:58 +0000 @@ -1,8 +1,9 @@ #ifndef HIP_LIB_TOOL_PK_H #define HIP_LIB_TOOL_PK_H -#include "hipd/hidb.h" -#include "lib/core/crypto.h" +#include <openssl/bn.h> + +#include "lib/core/protodefs.h" int hip_dsa_verify(void *priv_key, struct hip_common *msg); int hip_dsa_sign(void *peer_pub, struct hip_common *msg); === modified file 'lib/tool/xfrmapi.c' --- lib/tool/xfrmapi.c 2010-05-17 18:24:10 +0000 +++ lib/tool/xfrmapi.c 2010-05-21 10:36:58 +0000 @@ -13,15 +13,25 @@ * * @author Miika Komu <miika@xxxxxx> */ + #define _BSD_SOURCE -#include "config.h" -#include "lib/tool/nlink.h" +#include <stdint.h> +#include <string.h> +#include <netinet/in.h> +#include <linux/netlink.h> +#include <linux/xfrm.h> + +#include "lib/core/crypto.h" +#include "lib/core/debug.h" #include "lib/core/hip_udp.h" +#include "lib/core/ife.h" #include "lib/core/keylen.h" - +#include "lib/core/prefix.h" +#include "nlink.h" #include "xfrmapi.h" + #define RTA_BUF_SIZE 2048 /* New OSes have this, but older ones don't */ === modified file 'lib/tool/xfrmapi.h' --- lib/tool/xfrmapi.h 2010-04-22 10:12:54 +0000 +++ lib/tool/xfrmapi.h 2010-05-21 10:36:58 +0000 @@ -7,16 +7,10 @@ #ifndef HIP_LIB_TOOL_XFRMAPI_H #define HIP_LIB_TOOL_XFRMAPI_H -#include <time.h> -#include <netdb.h> -#include <errno.h> - -#include "hipd/netdev.h" -#include "lib/core/debug.h" -#include "lib/core/hashtable.h" -#include "hipd/hadb.h" -#include "hipd/user.h" - +#include <stdint.h> +#include <netinet/in.h> + +#include "lib/core/protodefs.h" #include "lib/core/state.h" #include "nlink.h" === modified file 'test/certteststub.c' --- test/certteststub.c 2010-05-17 22:14:29 +0000 +++ test/certteststub.c 2010-05-21 10:36:58 +0000 @@ -18,6 +18,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include <arpa/inet.h> #include <openssl/conf.h> #include <openssl/ossl_typ.h>