| 1 | /* $Id: igd_desc_parse.h,v 1.14 2025/02/08 23:15:16 nanard Exp $ */ |
| 2 | /* Project : miniupnp |
| 3 | * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ |
| 4 | * Author : Thomas Bernard |
| 5 | * Copyright (c) 2005-2025 Thomas Bernard |
| 6 | * This software is subject to the conditions detailed in the |
| 7 | * LICENCE file provided in this distribution. |
| 8 | * */ |
| 9 | #ifndef IGD_DESC_PARSE_H_INCLUDED |
| 10 | #define IGD_DESC_PARSE_H_INCLUDED |
| 11 | |
| 12 | /*! \file igd_desc_parse.h |
| 13 | * \brief API to parse UPNP device description XML |
| 14 | * \todo should not be exposed in the public API |
| 15 | */ |
| 16 | |
| 17 | /*! \brief maximum lenght of URLs */ |
| 18 | #define MINIUPNPC_URL_MAXSIZE (128) |
| 19 | |
| 20 | /*! \brief Structure to store the result of the parsing of UPnP |
| 21 | * descriptions of Internet Gateway Devices services */ |
| 22 | struct IGDdatas_service { |
| 23 | /*! \brief controlURL for the service */ |
| 24 | char controlurl[MINIUPNPC_URL_MAXSIZE]; |
| 25 | /*! \brief eventSubURL for the service */ |
| 26 | char eventsuburl[MINIUPNPC_URL_MAXSIZE]; |
| 27 | /*! \brief SCPDURL for the service */ |
| 28 | char scpdurl[MINIUPNPC_URL_MAXSIZE]; |
| 29 | /*! \brief serviceType */ |
| 30 | char servicetype[MINIUPNPC_URL_MAXSIZE]; |
| 31 | /*char devicetype[MINIUPNPC_URL_MAXSIZE];*/ |
| 32 | }; |
| 33 | |
| 34 | /*! \brief Structure to store the result of the parsing of UPnP |
| 35 | * descriptions of Internet Gateway Devices */ |
| 36 | struct IGDdatas { |
| 37 | /*! \brief current element name */ |
| 38 | char cureltname[MINIUPNPC_URL_MAXSIZE]; |
| 39 | /*! \brief URLBase */ |
| 40 | char urlbase[MINIUPNPC_URL_MAXSIZE]; |
| 41 | /*! \brief presentationURL */ |
| 42 | char presentationurl[MINIUPNPC_URL_MAXSIZE]; |
| 43 | /*! \brief depth into the XML tree */ |
| 44 | int level; |
| 45 | /*! \brief "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */ |
| 46 | struct IGDdatas_service CIF; |
| 47 | /*! \brief first of "urn:schemas-upnp-org:service:WANIPConnection:1" |
| 48 | * or "urn:schemas-upnp-org:service:WANPPPConnection:1" */ |
| 49 | struct IGDdatas_service first; |
| 50 | /*! \brief second of "urn:schemas-upnp-org:service:WANIPConnection:1" |
| 51 | * or "urn:schemas-upnp-org:service:WANPPPConnection:1" */ |
| 52 | struct IGDdatas_service second; |
| 53 | /*! \brief "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" */ |
| 54 | struct IGDdatas_service IPv6FC; |
| 55 | /*! \brief currently parsed service */ |
| 56 | struct IGDdatas_service tmp; |
| 57 | }; |
| 58 | |
| 59 | /*! |
| 60 | * \brief XML start element handler |
| 61 | */ |
| 62 | void IGDstartelt(void *, const char *, int); |
| 63 | /*! |
| 64 | * \brief XML end element handler |
| 65 | */ |
| 66 | void IGDendelt(void *, const char *, int); |
| 67 | /*! |
| 68 | * \brief XML characted data handler |
| 69 | */ |
| 70 | void IGDdata(void *, const char *, int); |
| 71 | #ifdef DEBUG |
| 72 | void printIGD(struct IGDdatas *); |
| 73 | #endif /* DEBUG */ |
| 74 | |
| 75 | #endif /* IGD_DESC_PARSE_H_INCLUDED */ |
| 76 | |