Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (28 sloc) 1.153 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.

License

MIT, see LICENSE.txt

Jump to Line
Something went wrong with that request. Please try again.