User`s guide

KwikNet Low Level Services
K
A
DAK
141
Network States
A network interface is always in one of three states. The interface is down when first
added to the KwikNet list of network interfaces. The network goes in transit as soon as
the network is opened. The network stays in transit until a valid IP address has been
assigned to the network interface at which point the network is declared up. The network
remains up until you close it at which time it once again goes in transit. The network
stays in transit until the device driver (and modem driver) have been closed and detached
from the interface at which point the interface once again is considered down.
If any network interface fails to successfully open and go up, the interface will be closed
and the network will revert to the down state. Note that an Ethernet network interface
may stay in transit indefinitely if its DHCP, BOOT or Auto IP negotiation fails to acquire
an IP address.
If an Ethernet network loses its lease on an IP address granted by a DHCP server, the
interface will go in transit as it once again attempts to acquire the same IP address or,
failing that, acquire a new IP address. Only if an IP address is eventually acquired will
the interface once again be declared up.
When a SLIP or PPP network is opened, it will revert to the down state if it cannot
successfully initialize its device driver. It will also reenter the down state if a modem is
being used and the modem cannot establish a connection with the remote system. A PPP
interface will go down if it cannot successfully negotiate a PPP connection with its peer.
If a SLIP or PPP network interface with a modem connection is up, it will go in transit if
the modem loses its connection. The network interface will be automatically closed and
the network will eventually be declared down.
If a PPP connection is closed by the network's PPP peer, the interface will go in transit.
The PPP connection will be torn down, the interface will be closed and the network will
eventually be declared down.
Monitoring Network Events
Your application can use
KwikNet procedure kn_ifstate() to determine the current
operating state of a network interface. Note that the state information does not indicate
whether an interface that is in transit is going up or down. To gain this information, you
must provide a network event notification function to monitor network state transitions as
they occur. The prototype for this function is as follows:
void kn_netevent(KN_NETDP netdp, int eventid);
This function receives the network descriptor pointer identifying the network interface on
which a significant event has occurred and an event identifier. Events include network
interface state transitions as well as DHCP and Auto IP success and failure notifications.
The event identifiers are specified in the description of this procedure in Chapter 4.6.
Note that although this function is one that you must write, it is documented as though it
were a KwikNet procedure.