Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
miniupnpc-async.h
Go to the documentation of this file.
1
/* $Id: miniupnpc-async.h,v 1.13 2014/11/07 11:25:52 nanard Exp $ */
2
/* miniupnpc-async
3
* Copyright (c) 2008-2017, 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_ASYNC_H_INCLUDED
18
#define MINIUPNPC_ASYNC_H_INCLUDED
19
20
/* for struct sockaddr_storage */
21
#include <netinet/in.h>
22
/* for fd_set */
23
#include <sys/select.h>
24
25
#include "
declspec.h
"
26
#include "
upnpreplyparse.h
"
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
31
32
#define UPNPC_OK 0
33
#define UPNPC_ERR_INVALID_ARGS (-1)
34
#define UPNPC_ERR_SOCKET_FAILED (-2)
35
#define UPNPC_ERR_BIND_FAILED (-3)
36
#define UPNPC_ERR_UNKNOWN_STATE (-4)
37
38
#define UPNPC_SSDP_READABLE 0x0001
39
#define UPNPC_SSDP_WRITEABLE 0x0100
40
#define UPNPC_HTTP_READABLE 0x0002
41
#define UPNPC_HTTP_WRITEABLE 0x0200
42
43
typedef
struct
upnpc_device
{
44
struct
upnpc_device
*
next
;
45
enum
{
46
EDevInit
= 1,
47
EDevGetDescConnect
,
48
EDevGetDescRequest
,
49
EDevGetDescResponse
,
50
EDevReady
,
51
EDevSoapConnect
,
52
EDevSoapRequest
,
53
EDevSoapResponse
,
54
EDevFinalized
= 99,
55
EDevError
= 1000
56
}
state
;
57
char
*
root_desc_location
;
58
char
*
control_cif_url
;
59
char
*
control_conn_url
;
60
int
http_socket
;
61
int
socket_flags
;
/* see UPNPC_*_READABLE, etc. */
62
char
*
http_request
;
63
int
http_request_len
;
64
int
http_request_sent
;
65
char
*
http_response
;
66
int
http_response_received
;
67
int
http_response_end_of_headers
;
68
int
http_response_content_length
;
69
int
http_response_chunked
;
70
int
http_response_code
;
71
struct
NameValueParserData
soap_response_data
;
72
struct
sockaddr_storage
selfaddr
;
73
socklen_t
selfaddrlen
;
74
}
upnpc_device_t
;
75
76
typedef
struct
{
77
enum
{
78
EUPnPInit
= 1,
79
EUPnPSendSSDP
,
80
EUPnPReceiveSSDP
,
81
EUPnPGetDesc
,
82
EUPnPReady
,
83
EUPnPProcessing
,
84
EUPnPFinalized
= 99,
85
EUPnPError
= 1000
86
}
state
;
87
int
socket_flags
;
/* see UPNPC_*_READABLE, etc. */
88
int
ssdp_socket
;
89
upnpc_device_t
*
device_list
;
90
}
upnpc_t
;
91
92
int
upnpc_init
(
upnpc_t
* p,
const
char
* multicastif);
93
94
int
upnpc_finalize
(
upnpc_t
* p);
95
96
int
upnpc_get_external_ip_address
(
upnpc_device_t
* p);
97
98
int
upnpc_get_link_layer_max_rate
(
upnpc_device_t
* p);
99
100
int
upnpc_add_port_mapping
(
upnpc_device_t
* p,
101
const
char
* remote_host,
unsigned
short
ext_port,
102
unsigned
short
int_port,
const
char
* int_client,
103
const
char
* proto,
const
char
* description,
104
unsigned
int
lease_duration);
105
106
#ifdef UPNPC_USE_SELECT
107
int
upnpc_select_fds(
upnpc_t
* p,
int
* nfds, fd_set * readfds, fd_set * writefds);
108
void
upnpc_check_select_fds(
upnpc_t
* p,
const
fd_set * readfds,
const
fd_set * writefds);
109
#endif
/* UPNPC_USE_SELECT */
110
111
int
upnpc_process
(
upnpc_t
* p);
112
113
#ifdef __cplusplus
114
}
115
#endif
116
117
#endif
/* MINIUPNPC_ASYNC_H_INCLUDED */
118
declspec.h
upnpreplyparse.h
upnpc_finalize
int upnpc_finalize(upnpc_t *p)
upnpc_process
int upnpc_process(upnpc_t *p)
upnpc_init
int upnpc_init(upnpc_t *p, const char *multicastif)
upnpc_get_link_layer_max_rate
int upnpc_get_link_layer_max_rate(upnpc_device_t *p)
upnpc_device_t
struct upnpc_device upnpc_device_t
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_get_external_ip_address
int upnpc_get_external_ip_address(upnpc_device_t *p)
NameValueParserData
Definition
upnpreplyparse.h:21
sockaddr_storage
Definition
fake-rfc2553.h:54
state
Definition
blake256.h:37
upnpc_device
Definition
miniupnpc-async.h:43
upnpc_device::selfaddrlen
socklen_t selfaddrlen
Definition
miniupnpc-async.h:73
upnpc_device::http_request_sent
int http_request_sent
Definition
miniupnpc-async.h:64
upnpc_device::http_socket
int http_socket
Definition
miniupnpc-async.h:60
upnpc_device::http_response_received
int http_response_received
Definition
miniupnpc-async.h:66
upnpc_device::http_response_chunked
int http_response_chunked
Definition
miniupnpc-async.h:69
upnpc_device::EDevError
@ EDevError
Definition
miniupnpc-async.h:55
upnpc_device::EDevFinalized
@ EDevFinalized
Definition
miniupnpc-async.h:54
upnpc_device::EDevSoapRequest
@ EDevSoapRequest
Definition
miniupnpc-async.h:52
upnpc_device::EDevReady
@ EDevReady
Definition
miniupnpc-async.h:50
upnpc_device::EDevSoapConnect
@ EDevSoapConnect
Definition
miniupnpc-async.h:51
upnpc_device::EDevInit
@ EDevInit
Definition
miniupnpc-async.h:46
upnpc_device::EDevSoapResponse
@ EDevSoapResponse
Definition
miniupnpc-async.h:53
upnpc_device::EDevGetDescConnect
@ EDevGetDescConnect
Definition
miniupnpc-async.h:47
upnpc_device::EDevGetDescRequest
@ EDevGetDescRequest
Definition
miniupnpc-async.h:48
upnpc_device::EDevGetDescResponse
@ EDevGetDescResponse
Definition
miniupnpc-async.h:49
upnpc_device::http_request_len
int http_request_len
Definition
miniupnpc-async.h:63
upnpc_device::soap_response_data
struct NameValueParserData soap_response_data
Definition
miniupnpc-async.h:71
upnpc_device::http_response
char * http_response
Definition
miniupnpc-async.h:65
upnpc_device::socket_flags
int socket_flags
Definition
miniupnpc-async.h:61
upnpc_device::http_response_code
int http_response_code
Definition
miniupnpc-async.h:70
upnpc_device::http_response_content_length
int http_response_content_length
Definition
miniupnpc-async.h:68
upnpc_device::http_request
char * http_request
Definition
miniupnpc-async.h:62
upnpc_device::http_response_end_of_headers
int http_response_end_of_headers
Definition
miniupnpc-async.h:67
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::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::selfaddr
struct sockaddr_storage selfaddr
Definition
miniupnpc-async.h:72
upnpc_t
Definition
miniupnpc-async.h:76
upnpc_t::socket_flags
int socket_flags
Definition
miniupnpc-async.h:87
upnpc_t::ssdp_socket
int ssdp_socket
Definition
miniupnpc-async.h:88
upnpc_t::EUPnPError
@ EUPnPError
Definition
miniupnpc-async.h:85
upnpc_t::EUPnPInit
@ EUPnPInit
Definition
miniupnpc-async.h:78
upnpc_t::EUPnPGetDesc
@ EUPnPGetDesc
Definition
miniupnpc-async.h:81
upnpc_t::EUPnPSendSSDP
@ EUPnPSendSSDP
Definition
miniupnpc-async.h:79
upnpc_t::EUPnPReceiveSSDP
@ EUPnPReceiveSSDP
Definition
miniupnpc-async.h:80
upnpc_t::EUPnPReady
@ EUPnPReady
Definition
miniupnpc-async.h:82
upnpc_t::EUPnPFinalized
@ EUPnPFinalized
Definition
miniupnpc-async.h:84
upnpc_t::EUPnPProcessing
@ EUPnPProcessing
Definition
miniupnpc-async.h:83
upnpc_t::device_list
upnpc_device_t * device_list
Definition
miniupnpc-async.h:89
external
miniupnp
miniupnpc-async
miniupnpc-async.h
Generated on
for Electroneum by
1.17.0