summaryrefslogtreecommitdiff
path: root/validate.h
diff options
context:
space:
mode:
Diffstat (limited to 'validate.h')
-rw-r--r--validate.h18
1 files changed, 18 insertions, 0 deletions
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 <stdlib.h>
+
+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