Options
All
  • Public
  • Public/Protected
  • All
Menu

Class IPv4Prefix

Represents the prefix portion in the CIDR notation for representing IP ranges

The IPv4 prefix portion represents the subnet mask. It is the number of continuous bits turned on (with value 1) counting from the left side of an 8 bit value.

{@see https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing} for more information on CIDR

Hierarchy

  • IPv4Prefix

Index

Constructors

constructor

  • Constructor for an instance of IPv4 prefix from a decimal number

    Parameters

    • rawValue: number

      the decimal value to construct the IPv4 prefix from.

    Returns IPv4Prefix

    the instance of an IPv4 prefix

Properties

value

value: number

The decimal value of the 8bit number representing the prefix

Methods

getValue

  • getValue(): number
  • Gets the decimal value of the IPv4 prefix

    Returns number

    the decimal value of the IPv4 prefix

Private toDecimalNotation

  • toDecimalNotation(bits: string): string
  • Parameters

    • bits: string

    Returns string

toString

  • toString(): string
  • Gets the decimal value of the IPv4 prefix as string

    Returns string

    he decimal value of the IPv4 prefix as string

toSubnetMask

  • Converts the IPv4 prefix to a IPv4SubnetMask

    The IPv4 Subnet mask is the representation of the prefix in the dot-decimal notation

    Returns IPv4SubnetMask

    the subnet mask representation of the prefix

Static fromNumber

  • Convenience method for constructing an instance of IPv4 prefix from a decimal number

    Parameters

    • rawValue: number

      the decimal value to construct the IPv4 prefix from.

    Returns IPv4Prefix

    the instance of an IPv4 prefix

Generated using TypeDoc