|
a/libupnpp/upnpplib.hxx |
|
b/libupnpp/upnpplib.hxx |
|
... |
|
... |
30 |
public:
|
30 |
public:
|
31 |
~LibUPnP();
|
31 |
~LibUPnP();
|
32 |
|
32 |
|
33 |
/** Retrieve the singleton LibUPnP object
|
33 |
/** Retrieve the singleton LibUPnP object
|
34 |
*
|
34 |
*
|
35 |
* On the first call, this initializes libupnp and registers us as a
|
35 |
* This initializes libupnp, possibly setting an address and port, possibly
|
36 |
* client, but does not perform any other action (does not start
|
36 |
* registering a client if serveronly is false.
|
37 |
* discovery)
|
37 |
*
|
38 |
* @param server Act as server (implement device) if true, client else.
|
38 |
* @param serveronly no client init
|
39 |
* This is only used on the first call, it's ignored once the library is
|
39 |
* @param hwaddr returns the hardware address for the specified network
|
40 |
* initialized.
|
40 |
* interface, or the first one is ifname is empty. If the IP address is
|
|
|
41 |
* specified instead of the interface name, the hardware address
|
|
|
42 |
* returned is not necessarily the one matching the IP.
|
|
|
43 |
* @param ifname if not empty, network interface to use. Translated to
|
|
|
44 |
* IP address for the UpnpInit() call.
|
|
|
45 |
* @param ip if not empty, IP address to use. Only used if ifname is empty.
|
|
|
46 |
* @param port port parameter to UpnpInit() (0 for default).
|
41 |
* @return 0 for failure.
|
47 |
* @return 0 for failure.
|
42 |
*/
|
48 |
*/
|
43 |
static LibUPnP* getLibUPnP(bool server = false);
|
49 |
static LibUPnP* getLibUPnP(bool serveronly = false, std::string* hwaddr = 0,
|
|
|
50 |
const std::string ifname = string(),
|
|
|
51 |
const std::string ip = string(),
|
|
|
52 |
unsigned short port = 0);
|
44 |
|
53 |
|
45 |
/** Set libupnp log file name and activate logging.
|
54 |
/** Set libupnp log file name and activate logging.
|
46 |
*
|
55 |
*
|
47 |
* @param fn file name to use. Use empty string to turn logging off
|
56 |
* @param fn file name to use. Use empty string to turn logging off
|
48 |
*/
|
57 |
*/
|
|
... |
|
... |
65 |
return m_init_error;
|
74 |
return m_init_error;
|
66 |
}
|
75 |
}
|
67 |
|
76 |
|
68 |
/** Build a unique persistent UUID for a root device. This uses a hash
|
77 |
/** Build a unique persistent UUID for a root device. This uses a hash
|
69 |
of the input name (e.g.: friendlyName), and the host Ethernet address */
|
78 |
of the input name (e.g.: friendlyName), and the host Ethernet address */
|
70 |
static std::string makeDevUUID(const std::string& name);
|
79 |
static std::string makeDevUUID(const std::string& name, const std::string& hw);
|
71 |
|
80 |
|
72 |
/** Translate libupnp integer error code (UPNP_E_XXX) to string */
|
81 |
/** Translate libupnp integer error code (UPNP_E_XXX) to string */
|
73 |
static std::string errAsString(const std::string& who, int code);
|
82 |
static std::string errAsString(const std::string& who, int code);
|
74 |
|
83 |
|
75 |
/////////////////////////////////////////////////////////////////////////////
|
84 |
/////////////////////////////////////////////////////////////////////////////
|
|
... |
|
... |
108 |
: handler(h), cookie(c) {}
|
117 |
: handler(h), cookie(c) {}
|
109 |
Upnp_FunPtr handler;
|
118 |
Upnp_FunPtr handler;
|
110 |
void *cookie;
|
119 |
void *cookie;
|
111 |
};
|
120 |
};
|
112 |
|
121 |
|
113 |
LibUPnP(bool server);
|
122 |
|
|
|
123 |
LibUPnP(bool serveronly, std::string *hwaddr,
|
|
|
124 |
const std::string ifname, const std::string ip,
|
|
|
125 |
unsigned short port);
|
|
|
126 |
|
114 |
LibUPnP(const LibUPnP &);
|
127 |
LibUPnP(const LibUPnP &);
|
115 |
LibUPnP& operator=(const LibUPnP &);
|
128 |
LibUPnP& operator=(const LibUPnP &);
|
116 |
|
129 |
|
117 |
static int o_callback(Upnp_EventType, void *, void *);
|
130 |
static int o_callback(Upnp_EventType, void *, void *);
|
118 |
|
131 |
|