File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpc / portlistingparse.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 00:36:10 2013 UTC (10 years, 10 months ago) by misho
Branches: miniupnpc, elwix, MAIN
CVS tags: v1_8p0, v1_8, HEAD
1.8

    1: /* $Id: portlistingparse.h,v 1.1.1.2 2013/07/22 00:36:10 misho Exp $ */
    2: /* MiniUPnP project
    3:  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
    4:  * (c) 2011-2012 Thomas Bernard
    5:  * This software is subject to the conditions detailed
    6:  * in the LICENCE file provided within the distribution */
    7: #ifndef PORTLISTINGPARSE_H_INCLUDED
    8: #define PORTLISTINGPARSE_H_INCLUDED
    9: 
   10: #include "declspec.h"
   11: /* for the definition of UNSIGNED_INTEGER */
   12: #include "miniupnpctypes.h"
   13: 
   14: #if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
   15: #include "bsdqueue.h"
   16: #else
   17: #include <sys/queue.h>
   18: #endif
   19: 
   20: #ifdef __cplusplus
   21: extern "C" {
   22: #endif
   23: 
   24: /* sample of PortMappingEntry :
   25:   <p:PortMappingEntry>
   26:     <p:NewRemoteHost>202.233.2.1</p:NewRemoteHost>
   27:     <p:NewExternalPort>2345</p:NewExternalPort>
   28:     <p:NewProtocol>TCP</p:NewProtocol>
   29:     <p:NewInternalPort>2345</p:NewInternalPort>
   30:     <p:NewInternalClient>192.168.1.137</p:NewInternalClient>
   31:     <p:NewEnabled>1</p:NewEnabled>
   32:     <p:NewDescription>dooom</p:NewDescription>
   33:     <p:NewLeaseTime>345</p:NewLeaseTime>
   34:   </p:PortMappingEntry>
   35:  */
   36: typedef enum { PortMappingEltNone,
   37:        PortMappingEntry, NewRemoteHost,
   38:        NewExternalPort, NewProtocol,
   39:        NewInternalPort, NewInternalClient,
   40:        NewEnabled, NewDescription,
   41:        NewLeaseTime } portMappingElt;
   42: 
   43: struct PortMapping {
   44: 	LIST_ENTRY(PortMapping) entries;
   45: 	UNSIGNED_INTEGER leaseTime;
   46: 	unsigned short externalPort;
   47: 	unsigned short internalPort;
   48: 	char remoteHost[64];
   49: 	char internalClient[64];
   50: 	char description[64];
   51: 	char protocol[4];
   52: 	unsigned char enabled;
   53: };
   54: 
   55: struct PortMappingParserData {
   56: 	LIST_HEAD(portmappinglisthead, PortMapping) head;
   57: 	portMappingElt curelt;
   58: };
   59: 
   60: LIBSPEC void
   61: ParsePortListing(const char * buffer, int bufsize,
   62:                  struct PortMappingParserData * pdata);
   63: 
   64: LIBSPEC void
   65: FreePortListing(struct PortMappingParserData * pdata);
   66: 
   67: #ifdef __cplusplus
   68: }
   69: #endif
   70: 
   71: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>