Electroneum
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,
55  EDevError = 1000
56  } state;
61  int socket_flags; /* see UPNPC_*_READABLE, etc. */
62  char * http_request;
65  char * http_response;
73  socklen_t selfaddrlen;
75 
76 typedef struct {
77  enum {
78  EUPnPInit = 1,
84  EUPnPFinalized = 99,
85  EUPnPError = 1000
86  } state;
87  int socket_flags; /* see UPNPC_*_READABLE, etc. */
90 } upnpc_t;
91 
92 int upnpc_init(upnpc_t * p, const char * multicastif);
93 
94 int upnpc_finalize(upnpc_t * p);
95 
97 
99 
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 
int upnpc_get_link_layer_max_rate(upnpc_device_t *p)
int upnpc_init(upnpc_t *p, const char *multicastif)
socklen_t selfaddrlen
char * http_response
struct upnpc upnpc_t
int http_response_content_length
int upnpc_get_external_ip_address(upnpc_device_t *p)
char * control_cif_url
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)
int http_response_chunked
upnpc_device_t * device_list
struct NameValueParserData soap_response_data
char * http_request
int upnpc_process(upnpc_t *p)
char * control_conn_url
struct sockaddr_storage selfaddr
int http_response_received
Definition: blake256.h:37
int upnpc_finalize(upnpc_t *p)
int socket_flags
struct upnpc_device * next
char * root_desc_location
int http_response_end_of_headers
int ssdp_socket
struct upnpc_device upnpc_device_t
enum upnpc_device::@2 state