SRB2/libs/miniupnpc/include/portlistingparse.h

66 lines
1.8 KiB
C
Raw Normal View History

2023-12-30 16:35:35 +00:00
/* $Id: portlistingparse.h,v 1.11 2015/07/21 13:16:55 nanard Exp $ */
2014-03-15 16:59:03 +00:00
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
2023-12-30 16:35:35 +00:00
* (c) 2011-2015 Thomas Bernard
2014-03-15 16:59:03 +00:00
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
2023-12-30 16:35:35 +00:00
#ifndef PORTLISTINGPARSE_H_INCLUDED
#define PORTLISTINGPARSE_H_INCLUDED
2014-03-15 16:59:03 +00:00
2023-12-30 16:35:35 +00:00
#include "miniupnpc_declspec.h"
2014-03-15 16:59:03 +00:00
/* for the definition of UNSIGNED_INTEGER */
#include "miniupnpctypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* sample of PortMappingEntry :
<p:PortMappingEntry>
<p:NewRemoteHost>202.233.2.1</p:NewRemoteHost>
<p:NewExternalPort>2345</p:NewExternalPort>
<p:NewProtocol>TCP</p:NewProtocol>
<p:NewInternalPort>2345</p:NewInternalPort>
<p:NewInternalClient>192.168.1.137</p:NewInternalClient>
<p:NewEnabled>1</p:NewEnabled>
<p:NewDescription>dooom</p:NewDescription>
<p:NewLeaseTime>345</p:NewLeaseTime>
</p:PortMappingEntry>
*/
typedef enum { PortMappingEltNone,
PortMappingEntry, NewRemoteHost,
NewExternalPort, NewProtocol,
NewInternalPort, NewInternalClient,
2023-12-30 16:35:35 +00:00
NewEnabled, NewDescription,
2014-03-15 16:59:03 +00:00
NewLeaseTime } portMappingElt;
struct PortMapping {
2023-12-30 16:35:35 +00:00
struct PortMapping * l_next; /* list next element */
2014-03-15 16:59:03 +00:00
UNSIGNED_INTEGER leaseTime;
unsigned short externalPort;
unsigned short internalPort;
char remoteHost[64];
char internalClient[64];
char description[64];
char protocol[4];
unsigned char enabled;
};
struct PortMappingParserData {
2023-12-30 16:35:35 +00:00
struct PortMapping * l_head; /* list head */
2014-03-15 16:59:03 +00:00
portMappingElt curelt;
};
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC void
2014-03-15 16:59:03 +00:00
ParsePortListing(const char * buffer, int bufsize,
struct PortMappingParserData * pdata);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC void
2014-03-15 16:59:03 +00:00
FreePortListing(struct PortMappingParserData * pdata);
#ifdef __cplusplus
}
#endif
#endif