summaryrefslogtreecommitdiff
path: root/calc.h
blob: ea01529f80faef6f8dd68237b4980367275ce949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;