17 #ifndef MINIUPNPC_LIBEVENT_H_INCLUDED
18 #define MINIUPNPC_LIBEVENT_H_INCLUDED
20 #include <event2/event.h>
29 #define MINIUPNPC_LIBEVENT_API_VERSION 1
32 #define UPNPC_ERR_INVALID_ARGS (-1)
33 #define UPNPC_ERR_SOCKET_FAILED (-2)
34 #define UPNPC_ERR_BIND_FAILED (-3)
35 #define UPNPC_ERR_REQ_IN_PROGRESS (-4)
37 #define UPNPC_ERR_NO_DEVICE_FOUND (-100)
38 #define UPNPC_ERR_ROOT_DESC_ERROR (-101)
39 #define UPNPC_ERR_NOT_IGD (-102)
40 #define UPNPC_ERR_NOT_CONNECTED (-103)
43 #define UPNPC_DEVICE_SOAP_REQ (0x0001)
44 #define UPNPC_DEVICE_GETSTATUS (0x0002)
45 #define UPNPC_DEVICE_CONNECTED (0x4000)
46 #define UPNPC_DEVICE_READY (0x8000)
52 #ifdef ENABLE_UPNP_EVENTS
53 typedef void(* upnpc_event_callback_fn)(
upnpc_t *,
upnpc_device_t *,
void *,
const char *,
const char *,
const char *);
70 #ifdef ENABLE_UPNP_EVENTS
71 char * event_conn_sid;
85 #ifdef ENABLE_UPNP_EVENTS
86 struct evhttp * http_server;
87 upnpc_event_callback_fn value_changed_cb;
99 #ifdef ENABLE_UPNP_EVENTS
100 int upnpc_set_event_callback(
upnpc_t * p, upnpc_event_callback_fn cb);
107 #ifdef ENABLE_UPNP_EVENTS
116 const char * remote_host,
unsigned short ext_port,
117 unsigned short int_port,
const char * int_client,
118 const char * proto,
const char * description,
119 unsigned int lease_duration);
122 const char * remote_host,
unsigned short ext_port,
int upnpc_get_status_info(upnpc_device_t *p)
int upnpc_finalize(upnpc_t *p)
int upnpc_init(upnpc_t *p, struct event_base *base, const char *multicastif, upnpc_callback_fn ready_cb, upnpc_callback_fn soap_cb, void *cb_data)
int upnpc_get_link_layer_max_rate(upnpc_device_t *p)
int upnpc_start(upnpc_t *p)
int upnpc_add_port_mapping(upnpc_device_t *p, const char *remote_host, unsigned short ext_port, unsigned short int_port, const char *int_client, const char *proto, const char *description, unsigned int lease_duration)
void(* upnpc_callback_fn)(int, upnpc_t *, upnpc_device_t *, void *)
int upnpc_set_local_address(upnpc_t *p, const char *address, uint16_t port)
int upnpc_delete_port_mapping(upnpc_device_t *p, const char *remote_host, unsigned short ext_port, const char *proto)
int upnpc_get_external_ip_address(upnpc_device_t *p)
boost::endian::big_uint16_t port
struct NameValueParserData soap_response_data
struct evhttp_connection * desc_conn
char * root_desc_location
struct evhttp_connection * soap_conn
int discover_device_index
upnpc_callback_fn soap_cb
struct event * ev_ssdp_recv
struct event * ev_ssdp_writable
evutil_socket_t ssdp_socket
upnpc_callback_fn ready_cb