Sorry for the delay. I’m going to try to answer your questions as best I can. I hope this helps …
How many routers support any of those 3 protocols? e.g. would that apply to 802.11b or newer models in general?
Nearly all routers support at least one of the 3. It doesn’t matter if the router is wired, wireless, or both.
- UPnP-IGD is the most widely supported protocol. It’s been around for a very long time, and pretty much every router I’ve come across seems to support it (except Apple routers).
- NAT-PMP is a newer protocol that’s supported by many newer routers (past 3 or 4 years maybe) – including Apple.
- PCP is the newest protocol that’s supported by a few newer routers – including Apple.
Would you say I can rely on availability of port mapping enabled routers, or should I setup relay servers (as described in ICE/TURN)?
It depends. Don’t expect things to work 100% of the time…
- you may be blocked by firewalls that are beyond your control – e.g. even though you tell your router to open up a certain port, your ISP may still block you
- ancient routers may have quirks that cause them to lose mappings or behave bizarrely
- some routers may disable these protocols by default for security reasons, or require authentication (which I don’t support yet)
You can try port mapping. If that fails, you can fallback to relay servers. Hole punching may also be an option.
How have you tested that your library works as expected? I see you have unit and integration tests, have they been tested on real routers? If yes, please list on which ones.
I have an Apple Airport router and a few other cheap routers that I test against. I also test against miniupnpd (miniupnpd is a port mapping server used by lots of routers – supports all 3 protocols). I’ve also written a small app on my phone that uses the library to map ports every time I make a new WiFi connection.