Ifconfig inet

From Spectrum
(Redirected from Get ifconfig gw)
Jump to navigation Jump to search

ifconfig_inet (IXCALL 0x3E48) - configure the internet protocol address

ifconfig_netmask (IXCALL 0x3E4B) - configure the netmask

ifconfig_gw (IXCALL 0x3E43) - configure the default gateway

get_ifconfig_inet (HLCALL 0x3E6F) - read the internet protocol address

get_ifconfig_netmask (HLCALL 0x3E72) - read the netmask

get_ifconfig_gw (HLCALL 0x3E75) - read the default gateway

deconfig (HLCALL 0x3E57) - Deconfigure all internet address settings

Synopsis

Assembly language

    ; all the functions use 4 byte buffers for the
    ; big endian address (inet_addr_t)
    ld hl, inet_addr
    ld ix, IFCONFIG_INET
    call IXCALL

    ld hl, inet_netmask
    ld ix, IFCONFIG_NETMASK
    call IXCALL

    ld hl, inet_gw
    ld ix, IFCONFIG_GW
    call IXCALL
    ld de, inet_addr
    ld hl, GET_IFCONFIG_INET
    call HLCALL

    ld de, inet_netmask
    ld hl, GET_IFCONFIG_NETMASK
    call HLCALL

    ld de, inet_gw
    ld hl, GET_IFCONFIG_GW
    call HLCALL
    ld hl, DECONFIG
    call HLCALL

C

    #include <sys/types.h>
    #include <spectranet.h>

    void ifconfig_inet(in_addr_t *inet_addr);
    void ifconfig_netmask(in_addr_t *inet_netmask);
    void ifconfig_gw(in_addr_t *inet_gw);

    void get_ifconfig_inet(in_addr_t *inet_addr);
    void get_ifconfig_netmask(in_addr_t *inet_netmask);
    void get_ifconfig_gw(in_addr_t *inet_gw);

    void deconfig();

Description

The ifconfig_inet(), ifconfig_netmask() and ifconfig_gw() functions set the interface configuration for internet addresses. The functions take a pointer to a 4 byte big endian internet address, netmask or gateway, defined as in_addr_t. The functions make an immediate change to the relevant interface configuration, however, the change is not permanent and will be lost when the power is cycled or if the built in DHCP client runs on reset. Permanent changes must be made in the configuration stored in flash.

The get_ifconfig_inet(), get_ifconfig_netmask() and get_ifconfig_gw() functions fill a 4 byte buffer with the current IP address, netmask and gateway respectively, in big endian form.

The deconfig() function resets the IP address, default gateway and netmask with immediate effect. The change is not permament.

Return values

None.