leaps_inet_info_get

This call is available only on the gateway. It gets the current runtime local network information. It reports whether the interface is up, whether WiFi or Ethernet is active, whether an IP address has been acquired, and the resolved IPv4 address, netmask, gateway, and DNS servers.


Input
  • (none)

Output
  • Status Code

  • is_up: ‘0’ | ‘1’ (‘1’ = link/interface is up)

  • is_static: ‘0’ | ‘1’ (‘0’ = DHCP, ‘1’ = static IP)

  • use_wifi: ‘0’ | ‘1’ (‘0’ = Ethernet, ‘1’ = WiFi)

  • got_ip: ‘0’ | ‘1’ (‘1’ = IP address acquired successfully, ‘0’ = not acquired)

  • addr: IPv4 address as little-endian uint32 (valid when got_ip = ‘1’)

  • netmask: IPv4 netmask as little-endian uint32 (valid when got_ip = ‘1’)

  • gw: IPv4 gateway as little-endian uint32 (valid when got_ip = ‘1’)

  • dns[0]: primary IPv4 DNS server as little-endian uint32

  • dns[1]: secondary IPv4 DNS server as little-endian uint32


Example

TLV Request

Type

Length

0xA5

0x00

Type 0xA5 (165 dec) means command leaps_inet_info_get

TLV response

Type

Length

Value

Type

Length

Value

byte 0: flags

  • Bit 0: is_up

  • Bit 1: is_static

  • Bit 2: use_wifi

  • Bit 3: got_ip

  • Bits [7:4]: reserved

bytes 1–3: reserved (0x00 0x00 0x00)
bytes 4–7: addr (IPv4, little-endian uint32)
bytes 8–11: netmask (IPv4, little-endian uint32)
bytes 12–15: gw (IPv4, little-endian uint32)
bytes 16–19: dns[0] (IPv4, little-endian uint32)
bytes 20–23: dns[1] (IPv4, little-endian uint32)

0x40

0x01

0x00

0xC6

0x18

0x09 0x00 0x00 0x00 0x2D 0x01 0xA8 0xC0 0x00 0xFF 0xFF 0xFF 0x01 0x01 0xA8 0xC0 0x08 0x08 0x08 0x08 0x00 0x00 0x00 0x00

In this example:

  • Interface is up (is_up=1)

  • Address mode is DHCP (is_static=0)

  • Active interface is Ethernet (use_wifi=0)

  • IP address was acquired successfully (got_ip=1)

  • IP address is 192.168.1.45/24

  • Gateway is 192.168.1.1

  • Primary DNS is 8.8.8.8, secondary DNS is 0.0.0.0 (not set)

Type 0x40 means status code

Type 0xC6 (198 dec) means response leaps_inet_info_get with 24-byte payload