Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "common"

Index

Variables

Const oidReg

oidReg: RegExp = /^[0-9.]+$/

Const oids

oids: object = Object.create(null)

Type declaration

  • [index: string]: string

Functions

bytesFromIP

  • bytesFromIP(ip: string): Buffer | null
  • Converts IP string into buffer, 4 bytes for IPv4, and 16 bytes for IPv6. It will return null when IP string invalid.

    console.log(bytesFromIP('::1')) // <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01>

    Parameters

    • ip: string

      IP string to convert

    Returns Buffer | null

bytesToIP

  • bytesToIP(bytes: Buffer): string
  • Converts 4-bytes into an IPv4 string representation or 16-bytes into an IPv6 string representation. The bytes must be in network order.

    console.log(bytesToIP(Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))) // '::1'

    Parameters

    • bytes: Buffer

      buffer to convert

    Returns string

getOID

  • getOID(nameOrId: string): string
  • Returns Object Identifier (dot-separated numeric string) that registered by initOID function. It will return empty string if not exists.

    Parameters

    • nameOrId: string

      OID name or OID

    Returns string

getOIDName

  • getOIDName(nameOrId: string): string
  • Returns Object Identifier name that registered by initOID function. It will return the argument nameOrId if not exists.

    Parameters

    • nameOrId: string

      OID name or OID

    Returns string

initOID

  • initOID(oid: string, name: string): void
  • Register OID and name

    Parameters

    • oid: string

      Object Identifier

    • name: string

      Object Identifier name

    Returns void

Generated using TypeDoc