Hi there, mostly out of curiosity, I've been playing around with my wireless connection and trying to create a simple program to scan networks and connect to whichever one I choose. This doesn't directly tie in with my question, but when trying to bring up a connection manually, I'm having trouble and I don't think I'm doing everything needed. ifup works seemlessly and gives me a nicely configured wireless interface with the ESSID and such things all set automatically.
So what stages does ifup go through to get to that stage? I'm using Debian which seems to have an executable program for ifup whereas by googling it appears that other distros have a script to do it. This would be handy as I could just have a peek myself. If anyone has an ifup script that would do nicely

.
The manpages for ifup make referance to it using ifconfig and route, which makes sense. I have a feeling it is the routing part I am not doing correctly. Also, does it detect that it is configuring a wireless interface and also use iwconfig to set things up?
Does it get the ESSID and access point information via DHCP once it is connected or some other means (perhaps by scanning and picking the first/strongest access point?)
Sorry for the long waffle, I think you should gather the sort of information I'm looking for by now. Any help would be much appreciated.
Thank You, James