File: upnpreplyparse.h

package info (click to toggle)
miniupnpc 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ansic: 7,885; makefile: 325; xml: 207; python: 170; sh: 161; java: 89
file content (82 lines) | stat: -rw-r--r-- 1,889 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* $Id: upnpreplyparse.h,v 1.22 2025/03/29 17:58:12 nanard Exp $ */
/* MiniUPnP project
 * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
 * (c) 2006-2025 Thomas Bernard
 * This software is subject to the conditions detailed
 * in the LICENCE file provided within the distribution */

#ifndef UPNPREPLYPARSE_H_INCLUDED
#define UPNPREPLYPARSE_H_INCLUDED

/*! \file upnpreplyparse.h
 * \brief Parsing of UPnP SOAP responses
 */

#ifdef __cplusplus
extern "C" {
#endif

/*! \brief Name/Value linked list
 * not exposed in the public API
 */
struct NameValue;

/*! \brief data structure for parsing */
struct NameValueParserData {
	/*! \brief name/value linked list */
	struct NameValue * l_head;
	/*! \brief current element name */
	char curelt[64];
	/*! \brief port listing array */
	char * portListing;
	/*! \brief port listing array length */
	int portListingLength;
	/*! \brief flag indicating the current element is  */
	int topelt;
	/*! \brief top element character data */
	const char * cdata;
	/*! \brief top element character data length */
	int cdatalen;
};

/*!
 * \brief Parse XML and fill the structure
 *
 * \param[in] buffer XML data
 * \param[in] bufsize buffer length
 * \param[out] data structure to fill
 */
void
ParseNameValue(const char * buffer, int bufsize,
               struct NameValueParserData * data);

/*!
 * \brief free memory
 *
 * \param[in,out] pdata data structure
 */
void
ClearNameValueList(struct NameValueParserData * pdata);

/*!
 * \brief get a value from the parsed data
 *
 * \param[in] pdata data structure
 * \param[in] name name
 * \return the value or NULL if not found
 */
char *
GetValueFromNameValueList(struct NameValueParserData * pdata,
                          const char * name);

/* DisplayNameValueList() */
#ifdef DEBUG
void
DisplayNameValueList(char * buffer, int bufsize);
#endif

#ifdef __cplusplus
}
#endif

#endif