#lang at-exp racket/base
(require (planet neil/mcfly)
(doc (section "Introduction")
This is a Racket library for discovering, accessing and invoking
This UPnP library currently only implements the client side, that
is the service consumer.
(doc (section "How it works")
First you must initiate a search with @racket[upnp-discovery] which will begin
to collect service advertisements via UDP, when you are ready you can
search for a UPnP service by service ID or type. Finally you create a
"service wrapper" from a UPnP service.
(define d (upnp-discovery))
(define s (upnp-search-service-srvid d "urn:upnp-org:serviceId:WANIPConn1"))
(define c (upnp-make-service-wrapper s))
With the service wrapper, you can create functions that wrap SOAP
request calls to the UPnP service:
(c "GetExternalIPAddress" '("NewExternalIPAddress")))
(c "AddPortMapping" '()
"NewRemoteHost" "NewExternalPort" "NewProtocol"
"NewInternalPort" "NewInternalClient" "NewEnabled"
And then use @racket[(get-external-ip)] to get the external ip, or use
@racket[(add-port-mapping ...)] with the parameters.
(doc (section "Known Issues")
At this moment, this library seems to work fine to grab an IP address on my
personal router :). This library is relatively new, so certain things might
not work quite right or might not work at all with different brands of
routers, other networking equipment and anything else that might provide UPnP
(#:planet 1:0 #:date "2012-11-16"