summaryrefslogtreecommitdiff
path: root/calc.h
diff options
context:
space:
mode:
Diffstat (limited to 'calc.h')
-rw-r--r--calc.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/calc.h b/calc.h
new file mode 100644
index 0000000..ea01529
--- /dev/null
+++ b/calc.h
@@ -0,0 +1,15 @@
+#include <stdint.h>
+
+#define UINT_TO_SEGMENTS(i) (i>>24 & 0xff),(i>>16 & 0xff),(i>>8 & 0xff),(i & 0xff)
+
+int print_usage();
+uint32_t calc_netmask(unsigned int cidr);
+uint32_t segments_to_ip(unsigned int segments[4]);
+uint32_t cidr_for_netspace(unsigned int desired_netspace);
+
+typedef struct {
+ uint32_t network;
+ uint32_t netmask;
+ uint32_t subnet_mask;
+ uint32_t count;
+} CalcRequest;