unbound: util/rfc_1982.h File Reference

unbound 0.1

Functions
rfc_1982.h File Reference

This file contains functions for RFC 1982 serial number arithmetic. More...

## Functions
int | compare_1982 (uint32_t a, uint32_t b)
| RFC 1982 comparison, uses unsigned integers, and tries to avoid compiler optimization (eg.
uint32_t | subtract_1982 (uint32_t a, uint32_t b)
| RFC 1982 subtraction, uses unsigned integers, and tries to avoid compiler optimization (eg.

## Detailed Description

This file contains functions for RFC 1982 serial number arithmetic.

## Function Documentation

## ◆ compare_1982()

int compare_1982 | ( | uint32_t | a,
|  | uint32_t | b )

RFC 1982 comparison, uses unsigned integers, and tries to avoid compiler optimization (eg.

by avoiding a-b<0 comparisons).

Parameters

  a | value to compare.
  b | value to compare.

Returns
  0 if equal, 1 if a > b, else -1.

Referenced by check_dates(), and edns_cookie_server_validate().

## ◆ subtract_1982()

uint32_t subtract_1982 | ( | uint32_t | a,
|  | uint32_t | b )

RFC 1982 subtraction, uses unsigned integers, and tries to avoid compiler optimization (eg.

by avoiding a-b<0 comparisons).

Parameters

  a | value to subtract from.
  b | value to subtract.

Returns
  the difference between them if we know that b is larger than a, that is the distance between them in serial number arithmetic.

Referenced by check_dates(), and edns_cookie_server_validate().