Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

IP

...

Functions

...

NetIP_CfgAddrAdd()

...

12647581264758Add a static IP host address, subnet mask, and default gateway to an interface. Anchor10915841091584

Files

...

1091585net_ip.h/net_ip.c Anchor10915861091586 Prototype

...

rowspan5

...

Prototype

 

Arguments

if_nbr Anchor12549841254984

Interface number to configure.

Anchor10915941091594addr_host Anchor12549911254991

Desired IP address to add to this interface.

Anchor10915951091595addr_subnet_maskanchor12549981254998

Desired IP address subnet mask.

Anchor11875961187596addr_dflt_gatewayanchor12550051255005

Desired IP default gateway address.

...

perr Anchor12550121255012

Pointer to variable that will receive the error code from this function:

...

...

NET_IP_ERR_NONE

...

NET_IP_ERR_INVALID_ADDR_HOST

...

...

NET_IP_ERR_INVALID_ADDR_GATEWAY

...

NET_IP_ERR_ADDR_CFG_STATE

...

NET_IP_ERR_ADDR_TBL_FULL

...

NET_IP_ERR_ADDR_CFG_IN_USE

...

NET_IF_ERR_INVALID_IF

...

NET_OS_ERR_LOCK

...

Returned Value

Anchor10916081091608DEF_OK, Anchor12551871255187

if valid IP address, subnet mask, and default gateway statically-configured;

Anchor10916091091609DEF_FAIL,anchor12551941255194

otherwise.

...

Required Configuration

...

10916111091611None. Anchor10916121091612

Notes / Warnings

...

10916131091613IP addresses must be configured in host-order.anchor

10916141091614An interface may be configured with either: Anchor11185131118513

...

If an interface’s address(es) are dynamically-configured, no statically-configured address(es) may be added until all dynamically-configured address(es) are removed.

Anchor10916181091618The maximum number of IP address(es) configured on any interface is limited to NET_IP_CFG_IF_MAX_NBR_ADDR (see section D-9-1 on page 752). Anchor

10916191091619Note that on the default interface, the first IP address added will be the default address used for all default communication. See also section C-9-1 on page 498. Anchor10916201091620

A host may be configured without a gateway address to allow communication only with other hosts on its local network. However, any configured gateway address must be on the same network as the configured host IP address (i.e., the network portion of the configured IP address and the configured gateway addresses must be identical).