[erlang-questions] Using eTorrent UPNP implementation
Edward Wang
edward.yu.wang@REDACTED
Wed Mar 14 11:15:51 CET 2012
Hi Naif,
Edward here. To use etorrent upnp implementation, you need to include
following source files
(https://github.com/edwardw/etorrent/tree/master/apps/etorrent/src):
etorrent_upnp_sup.erl
etorrent_upnp_proto.erl
etorrent_upnp_net.erl
etorrent_upnp_handler.erl
etorrent_upnp_entity.erl
And also:
- add its dependencies, cowboy and lhttpc
(https://github.com/jlouis/etorrent/blob/master/rebar.config#L17)
- add it to your app.src
(https://github.com/jlouis/etorrent/blob/master/apps/etorrent/src/etorrent.app.src#L29)
- start upnp supervisor when your application starts
(https://github.com/jlouis/etorrent/blob/master/apps/etorrent/src/etorrent_sup.erl#L74).
Once started, the upnp supervisor will take care of the first step of
upnp protocol, i.e. discovery.
- then you are ready to call whatever upnp actions out there.
Currently etorrent upnp implements one of them, AddPortMapping, as
defined in following specification:
http://upnp.org/specs/gw/UPnP-gw-WANIPConnection-v1-Service.pdf
It is also what you are looking for, I believe. The erlang
implementation for it is here:
https://github.com/jlouis/etorrent/blob/master/apps/etorrent/src/etorrent_upnp_net.erl#L153
It is very straightforward to implement other upnp actions modeling after this.
Hope this helps. Fell free to ask questions if you have any.
Regards,
Edward
On Wed, Mar 14, 2012 at 8:20 AM, Naif M. Otaibi <otaibinm@REDACTED> wrote:
> Hey all,
>
> I have been trying to wrap my head around how upnp is implemented in
> etorrent as I wish to use the implementation to do NAT-traveral for my
> application. The thing is, no documentation exists to help me.
>
> I've been advised that Edward Wang wrote the code for upnp. If anybody can
> please shed some light on which upnp modules to import in my application and
> which functions to call. I looked at the etorrent_upnp_*.erl files and made
> little sense of them.
>
> Best regards,
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list