Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
miniupnpc-libevent.h
Go to the documentation of this file.
1
/* $Id: miniupnpc-libevent.h,v 1.13 2015/07/22 13:48:37 nanard Exp $ */
2
/* miniupnpc-libevent
3
* Copyright (c) 2008-2015, Thomas BERNARD <miniupnp@free.fr>
4
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
5
*
6
* Permission to use, copy, modify, and/or distribute this software for any
7
* purpose with or without fee is hereby granted, provided that the above
8
* copyright notice and this permission notice appear in all copies.
9
*
10
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
17
#ifndef MINIUPNPC_LIBEVENT_H_INCLUDED
18
#define MINIUPNPC_LIBEVENT_H_INCLUDED
19
20
#include <event2/event.h>
21
22
#include "
declspec.h
"
23
#include "
upnpreplyparse.h
"
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
#define MINIUPNPC_LIBEVENT_API_VERSION 1
30
31
#define UPNPC_OK 0
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)
36
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)
41
42
/* device->state masks */
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)
47
48
typedef
struct
upnpc_device
upnpc_device_t
;
49
typedef
struct
upnpc
upnpc_t
;
50
51
typedef
void(*
upnpc_callback_fn
)(int,
upnpc_t
*,
upnpc_device_t
*,
void
*);
52
#ifdef ENABLE_UPNP_EVENTS
53
typedef
void(* upnpc_event_callback_fn)(
upnpc_t
*,
upnpc_device_t
*,
void
*,
const
char
*,
const
char
*,
const
char
*);
54
#endif
/* ENABLE_UPNP_EVENTS */
55
56
struct
upnpc_device
{
57
upnpc_t
*
parent
;
58
upnpc_device_t
*
next
;
59
char
*
root_desc_location
;
60
struct
evhttp_connection *
desc_conn
;
61
char
*
control_cif_url
;
62
char
*
event_cif_url
;
63
char
*
cif_service_type
;
64
char
*
control_conn_url
;
65
char
*
event_conn_url
;
66
char
*
conn_service_type
;
67
struct
evhttp_connection *
soap_conn
;
68
struct
NameValueParserData
soap_response_data
;
69
unsigned
int
state
;
70
#ifdef ENABLE_UPNP_EVENTS
71
char
* event_conn_sid;
72
#endif
/* ENABLE_UPNP_EVENTS */
73
};
74
75
struct
upnpc
{
76
struct
event_base *
base
;
77
evutil_socket_t
ssdp_socket
;
78
struct
event *
ev_ssdp_recv
;
79
struct
event *
ev_ssdp_writable
;
80
int
discover_device_index
;
81
upnpc_device_t
*
devices
;
82
upnpc_callback_fn
ready_cb
;
83
upnpc_callback_fn
soap_cb
;
84
void
*
cb_data
;
85
#ifdef ENABLE_UPNP_EVENTS
86
struct
evhttp * http_server;
87
upnpc_event_callback_fn value_changed_cb;
88
#endif
/* ENABLE_UPNP_EVENTS */
89
char
*
local_address
;
90
uint16_t
local_port
;
91
unsigned
char
ttl
;
92
};
93
94
int
upnpc_init
(
upnpc_t
* p,
struct
event_base * base,
const
char
* multicastif,
95
upnpc_callback_fn
ready_cb,
upnpc_callback_fn
soap_cb,
void
* cb_data);
96
97
int
upnpc_set_local_address
(
upnpc_t
* p,
const
char
*
address
,
uint16_t
port);
98
99
#ifdef ENABLE_UPNP_EVENTS
100
int
upnpc_set_event_callback(
upnpc_t
* p, upnpc_event_callback_fn cb);
101
#endif
/* ENABLE_UPNP_EVENTS */
102
103
int
upnpc_start
(
upnpc_t
* p);
104
105
int
upnpc_finalize
(
upnpc_t
* p);
106
107
#ifdef ENABLE_UPNP_EVENTS
108
int
upnpc_event_subscribe(
upnpc_device_t
* p);
109
#endif
/* ENABLE_UPNP_EVENTS */
110
111
int
upnpc_get_external_ip_address
(
upnpc_device_t
* p);
112
113
int
upnpc_get_link_layer_max_rate
(
upnpc_device_t
* p);
114
115
int
upnpc_add_port_mapping
(
upnpc_device_t
* p,
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);
120
121
int
upnpc_delete_port_mapping
(
upnpc_device_t
* p,
122
const
char
* remote_host,
unsigned
short
ext_port,
123
const
char
* proto);
124
125
int
upnpc_get_status_info
(
upnpc_device_t
* p);
126
127
#ifdef __cplusplus
128
}
129
#endif
130
131
#endif
/* MINIUPNPC_LIBEVENT_H_INCLUDED */
132
upnpc_device_t
struct upnpc_device upnpc_device_t
declspec.h
upnpreplyparse.h
upnpc_get_status_info
int upnpc_get_status_info(upnpc_device_t *p)
upnpc_finalize
int upnpc_finalize(upnpc_t *p)
upnpc_init
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)
upnpc_get_link_layer_max_rate
int upnpc_get_link_layer_max_rate(upnpc_device_t *p)
upnpc_start
int upnpc_start(upnpc_t *p)
upnpc_add_port_mapping
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)
upnpc_callback_fn
void(* upnpc_callback_fn)(int, upnpc_t *, upnpc_device_t *, void *)
Definition
miniupnpc-libevent.h:51
upnpc_set_local_address
int upnpc_set_local_address(upnpc_t *p, const char *address, uint16_t port)
upnpc_delete_port_mapping
int upnpc_delete_port_mapping(upnpc_device_t *p, const char *remote_host, unsigned short ext_port, const char *proto)
upnpc_get_external_ip_address
int upnpc_get_external_ip_address(upnpc_device_t *p)
upnpc_t
struct upnpc upnpc_t
Definition
miniupnpc-libevent.h:49
uint16_t
unsigned short uint16_t
Definition
stdint.h:125
NameValueParserData
Definition
upnpreplyparse.h:21
upnpc_device
Definition
miniupnpc-async.h:43
upnpc_device::cif_service_type
char * cif_service_type
Definition
miniupnpc-libevent.h:63
upnpc_device::soap_response_data
struct NameValueParserData soap_response_data
Definition
miniupnpc-async.h:71
upnpc_device::desc_conn
struct evhttp_connection * desc_conn
Definition
miniupnpc-libevent.h:60
upnpc_device::parent
upnpc_t * parent
Definition
miniupnpc-libevent.h:57
upnpc_device::conn_service_type
char * conn_service_type
Definition
miniupnpc-libevent.h:66
upnpc_device::state
enum upnpc_device::@250160326176063334320113246365134347371017301352 state
upnpc_device::event_cif_url
char * event_cif_url
Definition
miniupnpc-libevent.h:62
upnpc_device::next
struct upnpc_device * next
Definition
miniupnpc-async.h:44
upnpc_device::control_cif_url
char * control_cif_url
Definition
miniupnpc-async.h:58
upnpc_device::event_conn_url
char * event_conn_url
Definition
miniupnpc-libevent.h:65
upnpc_device::root_desc_location
char * root_desc_location
Definition
miniupnpc-async.h:57
upnpc_device::control_conn_url
char * control_conn_url
Definition
miniupnpc-async.h:59
upnpc_device::soap_conn
struct evhttp_connection * soap_conn
Definition
miniupnpc-libevent.h:67
upnpc_t
Definition
miniupnpc-async.h:76
upnpc
Definition
miniupnpc-libevent.h:75
upnpc::discover_device_index
int discover_device_index
Definition
miniupnpc-libevent.h:80
upnpc::local_address
char * local_address
Definition
miniupnpc-libevent.h:89
upnpc::soap_cb
upnpc_callback_fn soap_cb
Definition
miniupnpc-libevent.h:83
upnpc::ev_ssdp_recv
struct event * ev_ssdp_recv
Definition
miniupnpc-libevent.h:78
upnpc::ev_ssdp_writable
struct event * ev_ssdp_writable
Definition
miniupnpc-libevent.h:79
upnpc::base
struct event_base * base
Definition
miniupnpc-libevent.h:76
upnpc::ssdp_socket
evutil_socket_t ssdp_socket
Definition
miniupnpc-libevent.h:77
upnpc::devices
upnpc_device_t * devices
Definition
miniupnpc-libevent.h:81
upnpc::ready_cb
upnpc_callback_fn ready_cb
Definition
miniupnpc-libevent.h:82
upnpc::cb_data
void * cb_data
Definition
miniupnpc-libevent.h:84
upnpc::ttl
unsigned char ttl
Definition
miniupnpc-libevent.h:91
upnpc::local_port
uint16_t local_port
Definition
miniupnpc-libevent.h:90
address
const char * address
Definition
multisig.cpp:37
external
miniupnp
miniupnpc-libevent
miniupnpc-libevent.h
Generated on
for Electroneum by
1.17.0