diff options
author | Keuin <[email protected]> | 2021-12-30 12:20:42 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-12-30 12:20:42 +0800 |
commit | b3fd60e6407b3af029672218b0bff7bb30e7a9d9 (patch) | |
tree | 1536fec6761b9913a47117725fd5b4b5f70caa62 /validate.h | |
parent | 5651bc231389ebfa05e3750a431b33c28f4ed205 (diff) |
Add ping check (-p).
Support custom error handling command (-c).
Add runtime params validation for logging.
Diffstat (limited to 'validate.h')
-rw-r--r-- | validate.h | 18 |
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 |