Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (28 sloc) 1.13 KB

UPnP Library for Racket

What is it

This is a Racket library for discovering, accessing and invoking UPnP services.

How it works:

First you must initiate a search with 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:

(define get-external-ip
  (c "GetExternalIPAddress" '("NewExternalIPAddress")))

(define add-port-mapping
  (c "AddPortMapping" '()
     "NewRemoteHost" "NewExternalPort" "NewProtocol"
     "NewInternalPort" "NewInternalClient" "NewEnabled"
     "NewPortMappingDescription" "NewLeaseDuration"))

And then use (get-external-ip) to get the external ip, or use (add-port-mapping ...) with the parameters.


MIT, see LICENSE.txt