events when (de)associating or when cable is (un)plugged
Dirk-Willem van Gulik
dirkx at webweaving.org
Fri Mar 26 16:39:42 PST 2004
On Mar 27, 2004, at 12:17 AM, Suleiman Souhlal wrote:
>> Looking for suggestions on a 'clean' and generic way to allow for
>> notifications when a 802.11 association is made or lost, or when
>> a ethernet cable is (un)plugged. I.e.akin to the events 'usbd(8) get
>> when you sit on /dev/usb. This is for 5.2.1 or beyond.
>
> I am not too sure about 802.11, but to detect when the ethernet cable
> is
> (un)plugged, you can use kqueue(2) with the EVFILT_NETDEV filter.
Ok - that looks like a good match - so I guess it would make sense
then to make
the #define of:
#define ieee80211_new_state(_ic, _nstate, _arg) \
(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
into something a bit more like a function:
extern int ieee80211_new_state(struct ieee80211com *, enum
ieee80211_state , int);
and then make the latter do something like
void
ieee80211_new_state(struct ieee80211com * ic, enum ieee80211_state
nstate , int arg)
{
/* Callback into the real driver */
int err = (ic->ic_newstate)(ic, nstate, arg);
#ifdef IEEE80211_DEBUG
printf("Transition to state %x(%d) %s\n",nstate,arg, err ? "Failed" :
"ok");
#endif /* DEBUG */
if (right args == some-assoc-change)
KNOTE(ic->ifp->if_klist, arg ? NOTE_LINKDOWN : NOTE_LINKUP); /* ??
locking ?? */
}
Thanks - hacking away.
Dw
More information about the freebsd-hackers
mailing list