diff options
author | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-10-09 13:53:47 +0000 |
---|---|---|
committer | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-10-09 13:53:47 +0000 |
commit | 922a0672749ba9d496d1dd8f6596bb4f8035e71d (patch) | |
tree | ccd4b351bd5acd5cc3b8b1cc358c712d6c0c116d /src/nat/upnp-reply-parse.h | |
parent | dc24b5bf44bf8d9460b2571fe529403637aa3e16 (diff) | |
download | gnunet-922a0672749ba9d496d1dd8f6596bb4f8035e71d.tar.gz gnunet-922a0672749ba9d496d1dd8f6596bb4f8035e71d.zip |
rework UPnP code to use GNUnet scheduler and network API
disable NAT-PMP support for now
Diffstat (limited to 'src/nat/upnp-reply-parse.h')
-rw-r--r-- | src/nat/upnp-reply-parse.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/nat/upnp-reply-parse.h b/src/nat/upnp-reply-parse.h new file mode 100644 index 000000000..e5bedbd8f --- /dev/null +++ b/src/nat/upnp-reply-parse.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009, 2010 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Code in this file is originally inspired by the miniupnp library. | ||
23 | * Copyright (c) 2005-2009, Thomas BERNARD. All rights reserved. | ||
24 | * | ||
25 | * Original licence: | ||
26 | * | ||
27 | * Redistribution and use in source and binary forms, with or without | ||
28 | * modification, are permitted provided that the following conditions are met: | ||
29 | * | ||
30 | * * Redistributions of source code must retain the above copyright notice, | ||
31 | * this list of conditions and the following disclaimer. | ||
32 | * * Redistributions in binary form must reproduce the above copyright notice, | ||
33 | * this list of conditions and the following disclaimer in the documentation | ||
34 | * and/or other materials provided with the distribution. | ||
35 | * * The name of the author may not be used to endorse or promote products | ||
36 | * derived from this software without specific prior written permission. | ||
37 | * | ||
38 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
39 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
41 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
42 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
43 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
44 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
45 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
46 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
47 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
48 | * POSSIBILITY OF SUCH DAMAGE. | ||
49 | */ | ||
50 | |||
51 | /** | ||
52 | * @file nat/upnp-reply-parse.h | ||
53 | * @brief Parser for XML replies to UPnP commands | ||
54 | * | ||
55 | * @author Milan Bouchet-Valat | ||
56 | */ | ||
57 | |||
58 | #ifndef UPNP_PARSE_REPLY_H | ||
59 | #define UPNP_PARSE_REPLY_H | ||
60 | |||
61 | #include "bsdqueue.h" | ||
62 | |||
63 | /** | ||
64 | * Name-value pair used by UPNP_REPLY_NameValueList. | ||
65 | */ | ||
66 | struct UPNP_REPLY_NameValue_ | ||
67 | { | ||
68 | LIST_ENTRY (UPNP_REPLY_NameValue_) entries; | ||
69 | char name[64]; | ||
70 | char value[64]; | ||
71 | }; | ||
72 | |||
73 | /** | ||
74 | * Name-value list to store data parsed from a UPnP reply. | ||
75 | */ | ||
76 | struct UPNP_REPLY_NameValueList_ | ||
77 | { | ||
78 | LIST_HEAD (listhead, UPNP_REPLY_NameValue_) head; | ||
79 | char curelt[64]; | ||
80 | }; | ||
81 | |||
82 | /** | ||
83 | * Parse UPnP XML reply to a name-value list. | ||
84 | */ | ||
85 | void | ||
86 | UPNP_REPLY_parse_ (const char *buffer, int buf_size, | ||
87 | struct UPNP_REPLY_NameValueList_ *data); | ||
88 | |||
89 | /** | ||
90 | * Free name-value list obtained using UPNP_REPLY_parse(). | ||
91 | */ | ||
92 | void UPNP_REPLY_free_ (struct UPNP_REPLY_NameValueList_ *pdata); | ||
93 | |||
94 | /** | ||
95 | * Get value corresponding to name from a name-value list. | ||
96 | */ | ||
97 | char *UPNP_REPLY_get_value_ (struct UPNP_REPLY_NameValueList_ *pdata, | ||
98 | const char *name); | ||
99 | |||
100 | #if DEBUG_UPNP | ||
101 | /** | ||
102 | * Parse a UPnP XMl reply and print the result as names-value pairs. | ||
103 | */ | ||
104 | void UPNP_REPLY_print_ (char *buffer, int buf_size); | ||
105 | #endif | ||
106 | |||
107 | #endif | ||