-2

i am working in an ARM based media processor. I need to implement upnp for the device. Advertisement is only needed, i.e device discovery so IP address of the device can be found. I was able to implement the advertisement but i am failed when the IP of the device changes. Is there a way i could detect the change in IP and change the advertisement of device. Thanks in advance

Anjo John
  • 23
  • 1
  • 1
  • 4
  • 1
    You are asking for a feature that's bound to be Operating System and programming language specific, please specify them. – Jussi Kukkonen Feb 15 '15 at 12:27
  • it's based on ti's EZSDK, and want to be in c – Anjo John Feb 16 '15 at 03:20
  • Not familiar with EZSDK but on most networked linux installs I'd hope to find some kind of a connection manager (e.g. Connman or NetworkManager). They provide APIs for this sort of thing. If your system does not have a connection manager, you may have to start periodically polling whatever method you currently use to find out your IP address. – Jussi Kukkonen Feb 16 '15 at 09:01
  • thanks for the reply. i was hoping was there any method to do this within the uPnP ? – Anjo John Feb 17 '15 at 06:13

1 Answers1

0

There is nothing 'in UPnP' that will handle this for you -- that makes sense as UPnP is a media sharing protocol and finding out the current IPs is something quite unrelated to media sharing as well as entirely Operating System specific.

If you were using a decent UPnP-library, then I would expect the library to provide this sort of functionality to you. But since you are saying you are implementing UPnP yourself... well, then you get to implement all of it yourself.

My first suggestion is Don't implement UPnP yourself. It may look simple but it really isn't. Find libraries that "invent the wheels" for you and concentrate on actually solving the problem you're trying to solve. I understand that getting libraries on to an embedded device is not always easy, but I can guarantee that implementing UPnP in even a half-assed way is quite difficult.

Assuming the first suggestion is not viable: Take a look at how GUPnP handles this: There are ContextManagers (that handle network contexts) for Connman, NetworkManager and generic Linux. The latter might be a useful starting point for you: https://git.gnome.org/browse/gupnp/tree/libgupnp/gupnp-linux-context-manager.c : the "context-available" signal is emitted when a network interface is up. Note that the code is licensed under LGPL.

Jussi Kukkonen
  • 13,857
  • 1
  • 37
  • 54