|
a/libupnpp/upnpplib.hxx |
|
b/libupnpp/upnpplib.hxx |
|
... |
|
... |
51 |
const std::string ifname = std::string(),
|
51 |
const std::string ifname = std::string(),
|
52 |
const std::string ip = std::string(),
|
52 |
const std::string ip = std::string(),
|
53 |
unsigned short port = 0);
|
53 |
unsigned short port = 0);
|
54 |
|
54 |
|
55 |
/** Set libupnp log file name and activate logging.
|
55 |
/** Set libupnp log file name and activate logging.
|
|
|
56 |
* This does nothing if libupnp was built with logging disabled.
|
56 |
*
|
57 |
*
|
57 |
* @param fn file name to use. Use empty string to turn logging off
|
58 |
* @param fn file name to use. Use empty string to turn logging off
|
58 |
*/
|
59 |
*/
|
59 |
enum LogLevel {LogLevelNone, LogLevelError, LogLevelDebug};
|
60 |
enum LogLevel {LogLevelNone, LogLevelError, LogLevelDebug};
|
60 |
bool setLogFileName(const std::string& fn, LogLevel level = LogLevelError);
|
61 |
bool setLogFileName(const std::string& fn, LogLevel level = LogLevelError);
|
|
... |
|
... |
62 |
|
63 |
|
63 |
/** Set max library buffer size for reading content from servers. */
|
64 |
/** Set max library buffer size for reading content from servers. */
|
64 |
void setMaxContentLength(int bytes);
|
65 |
void setMaxContentLength(int bytes);
|
65 |
|
66 |
|
66 |
/** Check state after initialization */
|
67 |
/** Check state after initialization */
|
67 |
bool ok() const
|
68 |
bool ok() const;
|
68 |
{
|
|
|
69 |
return m_ok;
|
|
|
70 |
}
|
|
|
71 |
|
69 |
|
72 |
/** Retrieve init error if state not ok */
|
70 |
/** Retrieve init error if state not ok */
|
73 |
int getInitError() const
|
71 |
int getInitError() const;
|
74 |
{
|
|
|
75 |
return m_init_error;
|
|
|
76 |
}
|
|
|
77 |
|
72 |
|
78 |
/** Build a unique persistent UUID for a root device. This uses a hash
|
73 |
/** Build a unique persistent UUID for a root device. This uses a hash
|
79 |
of the input name (e.g.: friendlyName), and the host Ethernet address */
|
74 |
of the input name (e.g.: friendlyName), and the host Ethernet address */
|
80 |
static std::string makeDevUUID(const std::string& name,
|
75 |
static std::string makeDevUUID(const std::string& name,
|
81 |
const std::string& hw);
|
76 |
const std::string& hw);
|
|
... |
|
... |
98 |
/** Translate libupnp event type as string */
|
93 |
/** Translate libupnp event type as string */
|
99 |
static std::string evTypeAsString(Upnp_EventType);
|
94 |
static std::string evTypeAsString(Upnp_EventType);
|
100 |
|
95 |
|
101 |
int setupWebServer(const std::string& description, UpnpDevice_Handle *dvh);
|
96 |
int setupWebServer(const std::string& description, UpnpDevice_Handle *dvh);
|
102 |
|
97 |
|
103 |
UpnpClient_Handle getclh()
|
98 |
UpnpClient_Handle getclh();
|
104 |
{
|
99 |
|
105 |
return m_clh;
|
|
|
106 |
}
|
|
|
107 |
private:
|
100 |
private:
|
|
|
101 |
class Internal;
|
|
|
102 |
Internal *m;
|
108 |
|
103 |
|
109 |
// A Handler object records the data from registerHandler.
|
|
|
110 |
class Handler {
|
|
|
111 |
public:
|
|
|
112 |
Handler()
|
|
|
113 |
: handler(0), cookie(0) {}
|
|
|
114 |
Handler(Upnp_FunPtr h, void *c)
|
|
|
115 |
: handler(h), cookie(c) {}
|
|
|
116 |
Upnp_FunPtr handler;
|
|
|
117 |
void *cookie;
|
|
|
118 |
};
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
LibUPnP(bool serveronly, std::string *hwaddr,
|
104 |
LibUPnP(bool serveronly, std::string *hwaddr,
|
122 |
const std::string ifname, const std::string ip,
|
105 |
const std::string ifname, const std::string ip,
|
123 |
unsigned short port);
|
106 |
unsigned short port);
|
124 |
|
|
|
125 |
LibUPnP(const LibUPnP &);
|
107 |
LibUPnP(const LibUPnP &);
|
126 |
LibUPnP& operator=(const LibUPnP &);
|
108 |
LibUPnP& operator=(const LibUPnP &);
|
127 |
|
109 |
|
128 |
static int o_callback(Upnp_EventType, void *, void *);
|
110 |
static int o_callback(Upnp_EventType, void *, void *);
|
129 |
|
|
|
130 |
bool m_ok;
|
|
|
131 |
int m_init_error;
|
|
|
132 |
UpnpClient_Handle m_clh;
|
|
|
133 |
PTMutexInit m_mutex;
|
|
|
134 |
std::map<Upnp_EventType, Handler> m_handlers;
|
|
|
135 |
};
|
111 |
};
|
136 |
|
112 |
|
137 |
} // namespace UPnPP
|
113 |
} // namespace UPnPP
|
138 |
|
114 |
|
139 |
#endif /* _LIBUPNP.H_X_INCLUDED_ */
|
115 |
#endif /* _LIBUPNP.H_X_INCLUDED_ */
|