User`s guide
KwikNet Low Level Services
K
A
DAK
171
kn_state kn_state
Purpose Sense the Operating State of the KwikNet TCP/IP Stack
Used by
n Task o ISP o Timer Procedure o Restart Procedure n Exit Procedure
Setup Prototype is in file KN_API.H.
#include "KN_LIB.H"
unsigned int kn_state(unsigned int wstate, unsigned long mswait);
Description This function can be used to determine the current operating state of
KwikNet or to wait until KwikNet reaches a particular state.
Parameter wstate identifies the particular KwikNet state or states of
interest. If wstate is 0, the current KwikNet state will be returned to the
caller without delay. In this case, parameter mswait will be ignored.
If parameter wstate is not 0, the caller will be blocked until the KwikNet
operating state matches one or more of the specified state masks.
Wstate must be the logical OR of one or more of following masks:
KN_TS_IDLE KwikNet is idle (not in use at all).
KN_TS_START KwikNet is starting up.
KN_TS_RUN KwikNet is fully operational.
KN_TS_GODOWN KwikNet shutdown is in progress.
KN_TS_EXIT KwikNet exit is in progress.
KN_TS_STOPPED KwikNet has stopped. This state is fleeting.
KwikNet will immediately enter the idle state.
Mswait is the number of milliseconds which the caller is prepared to wait
for KwikNet to reach any of the specified states. A value of 0 indicates
that the caller will wait forever.
Returns If wstate is 0, the current KwikNet state is returned.
The value will be the logical OR of one or more of the above state masks.
If
wstate is not 0, the KwikNet state at the time of the match is returned.
If a timeout occurs or the caller cannot be blocked, the value
0 is returned.
Note States
KN_TS_IDLE, KN_TS_START, KN_TS_RUN and KN_TS_STOPPED are
mutually exclusive. State masks KN_TS_GODOWN and KN_TS_EXIT can be
set in conjunction with other state masks.
To detect that KwikNet has fully stopped and is no longer in use, you must
wait with state mask
wstate = KN_TS_IDLE.
Restriction This function will not alter the state of KwikNet. This procedure must not
be called by any function executing in the context of the
KwikNet Task.
See Also kn_ifstate()