diff options
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r-- | plugins-root/check_icmp.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 541e795..ce88bec 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -215,7 +215,7 @@ static int wait_for_reply(int, u_int); | |||
215 | static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *, struct timeval*); | 215 | static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *, struct timeval*); |
216 | static int send_icmp_ping(int, struct rta_host *); | 216 | static int send_icmp_ping(int, struct rta_host *); |
217 | static int get_threshold(char *str, threshold *th); | 217 | static int get_threshold(char *str, threshold *th); |
218 | static int get_threshold2(char *str, size_t length, threshold *, threshold *, threshold_mode mode); | 218 | static bool get_threshold2(char *str, size_t length, threshold *, threshold *, threshold_mode mode); |
219 | static void run_checks(void); | 219 | static void run_checks(void); |
220 | static void set_source_ip(char *); | 220 | static void set_source_ip(char *); |
221 | static int add_target(char *); | 221 | static int add_target(char *); |
@@ -1842,11 +1842,18 @@ get_threshold(char *str, threshold *th) | |||
1842 | return 0; | 1842 | return 0; |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | /* not too good at checking errors, but it'll do (main() should barfe on -1) */ | 1845 | /* |
1846 | static int | 1846 | * This functions receives a pointer to a string which should contain a threshold for the |
1847 | get_threshold2(char *str, size_t length, threshold *warn, threshold *crit, threshold_mode mode) | 1847 | * rta, packet_loss, jitter, mos or score mode in the form number,number[m|%]* assigns the |
1848 | { | 1848 | * parsed number to the corresponding threshold variable. |
1849 | if (!str || !length || !warn || !crit) return -1; | 1849 | * @param[in,out] str String containing the given threshold values |
1850 | * @param[in] length strlen(str) | ||
1851 | * @param[out] warn Pointer to the warn threshold struct to which the values should be assigned | ||
1852 | * @param[out] crit Pointer to the crit threshold struct to which the values should be assigned | ||
1853 | * @param[in] mode Determines whether this a threshold vor rta, packet_loss, jitter, mos or score (exclusively) | ||
1854 | */ | ||
1855 | static bool get_threshold2(char *str, size_t length, threshold *warn, threshold *crit, threshold_mode mode) { | ||
1856 | if (!str || !length || !warn || !crit) return false; | ||
1850 | 1857 | ||
1851 | char *p = NULL; | 1858 | char *p = NULL; |
1852 | bool first_iteration = true; | 1859 | bool first_iteration = true; |
@@ -1900,7 +1907,7 @@ get_threshold2(char *str, size_t length, threshold *warn, threshold *crit, thres | |||
1900 | warn->score = atof(p); | 1907 | warn->score = atof(p); |
1901 | break; | 1908 | break; |
1902 | } | 1909 | } |
1903 | return 0; | 1910 | return true; |
1904 | } | 1911 | } |
1905 | 1912 | ||
1906 | unsigned short | 1913 | unsigned short |