dhcpd-pools
3.0
ISC dhcpd lease usage analyser
|
Functions to sort output. More...
#include <config.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "error.h"
#include "progname.h"
#include "quote.h"
#include "xalloc.h"
#include "dhcpd-pools.h"
Functions | |
int | ipcomp_init (const union ipaddr_t *restrict a __attribute__((unused)), const union ipaddr_t *restrict b __attribute__((unused))) |
Compare IP address, with IPv4/v6 determination. More... | |
int | ipcomp_v4 (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) |
int | ipcomp_v6 (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) |
int | leasecomp_init (const struct leases_t *restrict a __attribute__((unused)), const struct leases_t *restrict b __attribute__((unused))) |
Compare IP address in leases_t structure, with IPv4/v6 determination. More... | |
int | leasecomp_v4 (const struct leases_t *restrict a, const struct leases_t *restrict b) |
int | leasecomp_v6 (const struct leases_t *restrict a, const struct leases_t *restrict b) |
int | rangecomp (const void *restrict r1, const void *restrict r2) |
Compare IP address in leases. More... | |
int | comp_double (double f1, double f2) |
Compare two doubles. More... | |
int | comp_ip (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their first_ip. More... | |
int | comp_max (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their capacity. More... | |
int | comp_cur (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their current usage. More... | |
int | comp_percent (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their current usage percentage. More... | |
int | comp_touched (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their touched addresses. More... | |
int | comp_tc (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their touched and in use addresses. More... | |
int | comp_tcperc (struct range_t *r1, struct range_t *r2) |
Compare two range_t by their touched and in use percentage. More... | |
double | ret_percent (struct range_t r) |
Percentage in use in range. More... | |
double | ret_tc (struct range_t r) |
Touched and in use in range. More... | |
double | ret_tcperc (struct range_t r) |
Return percentage of addresses touched and in use in range. More... | |
comparer_t | field_selector (char c) |
Sort field selector. More... | |
static int | merge (struct conf_t *state, struct range_t *restrict left, struct range_t *restrict right) |
Perform requested sorting. More... | |
void | mergesort_ranges (struct conf_t *state, struct range_t *restrict orig, unsigned int size, struct range_t *restrict temp, const int root_call) |
Mergesort for range table. More... | |
Functions to sort output.
Compare two range_t by their current usage.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
int comp_double | ( | double | f1, |
double | f2 | ||
) |
Compare two doubles.
f1,f2 | Data to compare. |
Referenced by comp_cur(), comp_max(), comp_percent(), comp_tc(), comp_tcperc(), and comp_touched().
Compare two range_t by their first_ip.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
Compare two range_t by their capacity.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
Compare two range_t by their current usage percentage.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
Compare two range_t by their touched and in use addresses.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
Compare two range_t by their touched and in use percentage.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
Compare two range_t by their touched addresses.
r1,r2 | Pointers to data to compare. |
Referenced by field_selector().
comparer_t field_selector | ( | char | c | ) |
Sort field selector.
c | Symbolic name of a sort by character. The sort algorithms are stabile, which means multiple sorts can be specified and they do not mess the result of previous sort. The sort algorithms are used via function pointer, that gets to be reassigned. |
Referenced by parse_command_line_opts().
int ipcomp_init | ( | const union ipaddr_t *restrict a | __attribute__(unused), |
const union ipaddr_t *restrict b | __attribute__(unused) | ||
) |
Compare IP address, with IPv4/v6 determination.
a | Binary IP address. |
b | Binary IP address. |
Referenced by set_ipv_functions().
Referenced by set_ipv_functions().
int leasecomp_init | ( | const struct leases_t *restrict a | __attribute__(unused), |
const struct leases_t *restrict b | __attribute__(unused) | ||
) |
Compare IP address in leases_t structure, with IPv4/v6 determination.
a | Binary IP address. |
b | Binary IP address. |
Referenced by set_ipv_functions().
Referenced by set_ipv_functions().
Referenced by set_ipv_functions().
|
static |
Perform requested sorting.
left | The left side of the merge sort. |
right | The right side of the merge sort. |
Referenced by mergesort_ranges().
Compare IP address in leases.
Suitable for sorting range table.
r1 | A range structure. |
r2 | A range structure. |
double ret_percent | ( | struct range_t | r | ) |
Percentage in use in range.
r | A range structure. |
Referenced by comp_percent().
double ret_tc | ( | struct range_t | r | ) |
Touched and in use in range.
r | A range structure. |
Referenced by comp_tc(), and ret_tcperc().
double ret_tcperc | ( | struct range_t | r | ) |
Return percentage of addresses touched and in use in range.
r | A range structure. |
Referenced by comp_tcperc().