PageRenderTime 23ms CodeModel.GetById 18ms RepoModel.GetById 2ms app.codeStats 0ms

/thirdparty/libportfwd/third-party/miniupnpc-1.6/portlistingparse.h

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