Re: [System Configuration] What is the correct notification key to be informed when a new Network Interface is made available or disappear?
Re: [System Configuration] What is the correct notification key to be informed when a new Network Interface is made available or disappear?
- Subject: Re: [System Configuration] What is the correct notification key to be informed when a new Network Interface is made available or disappear?
- From: Allan Nathanson <email@hidden>
- Date: Thu, 29 Mar 2007 12:49:42 -0400
On Mar 29, 2007, at 12:37 PM, Stephane wrote:
On Mar 29, 2007, at 5:07 , Allan Nathanson wrote:
On Mar 29, 2007, at 10:55 AM, Stephane Sudre wrote:
I want to maintain a list of all the potential/capable network
interface. I need/would like to be informed when a new interface
is made available or disappear (WiFi PCMCI card, Bluetooth Dongle,
etc…).
I can get the list of all the network interfaces with
SCNetworkInterfaceCopyAll.
What I can't figure out is whether there is a key to be informed
by the Dynamic Store about such modification and which one it
would be.
I've looked for one in SCNetworkConfiguration.h and
SCDynamicStoreKey. Google did not prove very helpful.
Does such a key exist?
Yes/No. Watching the SCDynamicStore's "State:/Network/Interface"
key you can look at the "Interfaces" (kSCPropNetInterfaces)
property to see the BSD interfaces (en#, fw#, bond#, vlan#, and the
ppp# interfaces as they are created/removed). What's not posted
here is the availability of Modems, Bluetooth devices, etc. For
those, you'd have to watch the IORegistry.
Thanks.
So if I understand it correctly, it will trigger a "notification"
when a BSD interface is matched for a Bluetooth port but not when
you plug a Bluetooth dongle into a Mac for the first time (this
event creates the Bluetooth port in Network Pref Pane). A bit like
the notification you get when an interface is attached or detached
at the kernel level.
This is fine for what I want to do.
The "Interfaces" list tracks the BSD interfaces that have been
attached or detached (I update the list when I see KEV_DL_IF_ATTACHED
and KEV_DL_IF_DETACHED kernel events). For the Bluetooth port, you
won't see an attach until a PPP interface is created which uses that
port. The gotcha is that won't happen until you actually try to
establish a PPP connection. If you are looking for "dongle plugged
in" than you'll need to watch the IORegistry.
- Allan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden