From b3fd60e6407b3af029672218b0bff7bb30e7a9d9 Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 30 Dec 2021 12:20:42 +0800 Subject: Add ping check (-p). Support custom error handling command (-c). Add runtime params validation for logging. --- validate.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 validate.h (limited to 'validate.h') diff --git a/validate.h b/validate.h new file mode 100644 index 0000000..f09a820 --- /dev/null +++ b/validate.h @@ -0,0 +1,18 @@ +// +// Created by Keuin on 2021/12/30. +// + +#ifndef NETMON_VALIDATE_H +#define NETMON_VALIDATE_H + +#include + +int is_valid_ipv4(const char *s); + +#define NOTNULL(ptr) do { \ + if ((ptr) == NULL) { \ + fprintf(stderr, "NotNull check failed: "#ptr " is null. (" __FILE__ ":%d)\n", __LINE__); \ + abort(); \ + } } while(0) + +#endif //NETMON_VALIDATE_H -- cgit v1.2.3