]> git.gsnw.org Git - fping.git/commitdiff
Move the most function declarations from fping.c to fping.h
authorGerman Service Network <support@gsnw.de>
Sun, 11 Jan 2026 09:19:26 +0000 (10:19 +0100)
committerSebastian <176771227+gsnw-sebast@users.noreply.github.com>
Fri, 23 Jan 2026 07:19:53 +0000 (08:19 +0100)
CHANGELOG.md
src/fping.c
src/fping.h

index 84129ebeaa1a967a53907aa6239d81ed4e6b2bf8..6d5743ad9e51064cee77a70e4f71ccf9caa87018 100644 (file)
@@ -10,6 +10,7 @@ Next
   recvmsg with MSG_DONTWAIT instead (#449)
 - Improved compatibility with NetBSD (#452, thanks @auerswal)
 - Consistent variable names for command-line options (#453, thanks @gsnw-sebast)
+- Move the most function declarations from fping.c to fping.h (#454, thanks @gsnw-sebast)
 - Avoid crash with option `-0` (#457, thanks @auerswal)
 
 fping 5.5 (2025-12-31)
index 064da20b72ad20fde878e0dc7584d6c5d447d530..3623ce0af6751184e9ac7e124b82dc2695a3423f 100644 (file)
@@ -458,53 +458,6 @@ unsigned int fwmark = 0;
 char *filename = NULL; /* file containing hosts to ping */
 
 /*** forward declarations ***/
-
-void add_name(char *name);
-void add_addr(char *name, char *host, struct sockaddr *ipaddr, socklen_t ipaddr_len);
-char *na_cat(char *name, struct in_addr ipaddr);
-void crash_and_burn(char *message);
-void errno_crash_and_burn(char *message);
-char *get_host_by_address(struct in_addr in);
-int send_ping(HOST_ENTRY *h, int index);
-void usage(int);
-int wait_for_reply(int64_t);
-void print_recv(HOST_ENTRY *h, int64_t recv_time, int result, int this_count, int64_t this_reply, int avg);
-void print_timeout(HOST_ENTRY *h, int ping_index);
-void print_recv_ext(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t this_reply);
-void print_recv_ext_json(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t this_reply);
-void print_per_system_stats(void);
-void print_per_system_stats_json(void);
-void print_per_system_splits(void);
-void print_per_system_splits_json(void);
-void stats_reset_interval(HOST_ENTRY *h);
-void print_netdata(void);
-void print_global_stats(void);
-void print_global_stats_json(void);
-void main_loop();
-void signal_handler(int);
-void finish();
-const char *sprint_tm(int64_t t);
-void ev_enqueue(struct event_queue *queue, struct event *event);
-struct event *ev_dequeue(struct event_queue *queue);
-void ev_remove(struct event_queue *queue, struct event *event);
-void add_cidr(char *);
-void add_cidr_ipv4(unsigned long, unsigned long);
-void add_range(char *, char *);
-void add_addr_range_ipv4(unsigned long, unsigned long);
-#ifdef IPV6
-uint64_t be_octets_to_uint64(uint8_t*);
-void uint64_to_be_octets(uint64_t, uint8_t*);
-void add_cidr_ipv6(uint64_t, uint64_t, unsigned long, const char *);
-void add_addr_range_ipv6(uint64_t, uint64_t, uint64_t, uint64_t, const char *);
-#endif
-void print_warning(char *fmt, ...);
-int addr_cmp(struct sockaddr *a, struct sockaddr *b);
-void host_add_ping_event(HOST_ENTRY *h, int index, int64_t ev_time);
-void host_add_timeout_event(HOST_ENTRY *h, int index, int64_t ev_time);
-struct event *host_get_timeout_event(HOST_ENTRY *h, int index);
-void stats_add(HOST_ENTRY *h, int index, int success, int64_t latency);
-void update_current_time();
-void print_timestamp_format(int64_t current_time_ns, int timestamp_format);
 static uint32_t ms_since_midnight_utc(int64_t time_val);
 
 /************************************************************
index ab7c6c9bde7726949e210cc1c2c98f667280e69d..419b56e89a8ebb5ad946f63eb81998bc671324e5 100644 (file)
@@ -3,6 +3,7 @@
 
 #define __APPLE_USE_RFC_3542 1
 
+#include <stdint.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -19,10 +20,59 @@ extern int opt_debug_trace_on;
 
 
 /* fping.c */
+typedef struct host_entry HOST_ENTRY;
+struct event;
+struct event_queue;
+typedef struct ip_header_result IP_HEADER_RESULT;
+extern int opt_random_data_on;
+
+void add_name(char *name);
+void add_addr(char *name, char *host, struct sockaddr *ipaddr, socklen_t ipaddr_len);
+char *na_cat(char *name, struct in_addr ipaddr);
+char *get_host_by_address(struct in_addr in);
+int send_ping(HOST_ENTRY *h, int index);
+void usage(int);
+int wait_for_reply(int64_t);
+void print_recv(HOST_ENTRY *h, int64_t recv_time, int result, int this_count, int64_t this_reply, int avg);
+void print_timeout(HOST_ENTRY *h, int ping_index);
+void print_recv_ext(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t this_reply);
+void print_recv_ext_json(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t this_reply);
+void print_per_system_stats(void);
+void print_per_system_stats_json(void);
+void print_per_system_splits(void);
+void print_per_system_splits_json(void);
+void stats_reset_interval(HOST_ENTRY *h);
+void print_netdata(void);
+void print_global_stats(void);
+void print_global_stats_json(void);
+void main_loop();
+void signal_handler(int);
+void finish();
+const char *sprint_tm(int64_t t);
+void ev_enqueue(struct event_queue *queue, struct event *event);
+struct event *ev_dequeue(struct event_queue *queue);
+void ev_remove(struct event_queue *queue, struct event *event);
+void add_cidr(char *);
+void add_cidr_ipv4(unsigned long, unsigned long);
+void add_range(char *, char *);
+void add_addr_range_ipv4(unsigned long, unsigned long);
+#ifdef IPV6
+uint64_t be_octets_to_uint64(uint8_t*);
+void uint64_to_be_octets(uint64_t, uint8_t*);
+void add_cidr_ipv6(uint64_t, uint64_t, unsigned long, const char *);
+void add_addr_range_ipv6(uint64_t, uint64_t, uint64_t, uint64_t, const char *);
+#endif
+void print_warning(char *fmt, ...);
+int addr_cmp(struct sockaddr *a, struct sockaddr *b);
+void host_add_ping_event(HOST_ENTRY *h, int index, int64_t ev_time);
+void host_add_timeout_event(HOST_ENTRY *h, int index, int64_t ev_time);
+struct event *host_get_timeout_event(HOST_ENTRY *h, int index);
+void stats_add(HOST_ENTRY *h, int index, int success, int64_t latency);
+void update_current_time();
+void print_timestamp_format(int64_t current_time_ns, int timestamp_format);
 void crash_and_burn( char *message );
 void errno_crash_and_burn( char *message );
 int in_cksum( unsigned short *p, int n );
-extern int opt_random_data_on;
 
 /* socket.c */
 int  open_ping_socket_ipv4(int *socktype);