src/iputils/ipv4

  Source   Edit

Types

Ipv4 = array[4, uint8]
  Source   Edit

Procs

proc `$`(ip: Ipv4): string {....raises: [], tags: [].}
  Source   Edit
proc cmp(a, b: Ipv4): int {....raises: [], tags: [].}
Compares IPv4 a with b and returns:
  • 0, if a is equal to b;
  • 1, if a is greater than b; or
  • -1, if a is less than b.
  Source   Edit
proc ipv4ToString(ip: Ipv4): string {....raises: [], tags: [].}
Returns an IPv4 textual representation of an ip.   Source   Edit
proc ipv4ToUInt32(ip: Ipv4): uint32 {.inline, ...raises: [], tags: [].}
Turns an Ipv4 type into uint32.   Source   Edit
proc isIpv4(ip: string): bool {....raises: [], tags: [].}
Returns true if the value of ip is a valid IPv4.   Source   Edit
proc isIpv4AndStore(ip: string; stored: var Ipv4): bool {....raises: [], tags: [].}
Returns true if the value of ip is a valid IPv4 and store the value into stored.   Source   Edit
proc parseIpv4(ip: string): Ipv4 {....raises: [ValueError], tags: [].}
Parses a IPv4 value contained in ip.   Source   Edit
proc uint32ToIpv4(ip: uint32): Ipv4 {.inline, ...raises: [], tags: [].}
Turns a uint32 type into Ipv4.   Source   Edit