/modules/libjar/zipstruct.h

http://github.com/zpao/v8monkey · C Header · 142 lines · 66 code · 14 blank · 62 comment · 0 complexity · 88e45eec03bf55809a9ac0ff0e287f30 MD5 · raw file

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Mozilla Communicator client code, released
  16. * March 31, 1998.
  17. *
  18. * The Initial Developer of the Original Code is
  19. * Netscape Communications Corporation.
  20. * Portions created by the Initial Developer are Copyright (C) 1998-1999
  21. * the Initial Developer. All Rights Reserved.
  22. *
  23. * Contributor(s):
  24. * Daniel Veditz <dveditz@netscape.com>
  25. * Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
  26. *
  27. * Alternatively, the contents of this file may be used under the terms of
  28. * either the GNU General Public License Version 2 or later (the "GPL"), or
  29. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  30. * in which case the provisions of the GPL or the LGPL are applicable instead
  31. * of those above. If you wish to allow use of your version of this file only
  32. * under the terms of either the GPL or the LGPL, and not to allow others to
  33. * use your version of this file under the terms of the MPL, indicate your
  34. * decision by deleting the provisions above and replace them with the notice
  35. * and other provisions required by the GPL or the LGPL. If you do not delete
  36. * the provisions above, a recipient may use your version of this file under
  37. * the terms of any one of the MPL, the GPL or the LGPL.
  38. *
  39. * ***** END LICENSE BLOCK ***** */
  40. #ifndef _zipstruct_h
  41. #define _zipstruct_h
  42. /*
  43. * Certain constants and structures for
  44. * the Phil Katz ZIP archive format.
  45. *
  46. */
  47. typedef struct ZipLocal_
  48. {
  49. unsigned char signature [4];
  50. unsigned char word [2];
  51. unsigned char bitflag [2];
  52. unsigned char method [2];
  53. unsigned char time [2];
  54. unsigned char date [2];
  55. unsigned char crc32 [4];
  56. unsigned char size [4];
  57. unsigned char orglen [4];
  58. unsigned char filename_len [2];
  59. unsigned char extrafield_len [2];
  60. } ZipLocal;
  61. /*
  62. * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
  63. * As the internals of a jar/zip file must not depend on the target
  64. * architecture (i386, ppc, ARM, ...), use a fixed value instead.
  65. */
  66. #define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2)
  67. typedef struct ZipCentral_
  68. {
  69. unsigned char signature [4];
  70. unsigned char version_made_by [2];
  71. unsigned char version [2];
  72. unsigned char bitflag [2];
  73. unsigned char method [2];
  74. unsigned char time [2];
  75. unsigned char date [2];
  76. unsigned char crc32 [4];
  77. unsigned char size [4];
  78. unsigned char orglen [4];
  79. unsigned char filename_len [2];
  80. unsigned char extrafield_len [2];
  81. unsigned char commentfield_len [2];
  82. unsigned char diskstart_number [2];
  83. unsigned char internal_attributes [2];
  84. unsigned char external_attributes [4];
  85. unsigned char localhdr_offset [4];
  86. } ZipCentral;
  87. /*
  88. * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
  89. * As the internals of a jar/zip file must not depend on the target
  90. * architecture (i386, ppc, ARM, ...), use a fixed value instead.
  91. */
  92. #define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4)
  93. typedef struct ZipEnd_
  94. {
  95. unsigned char signature [4];
  96. unsigned char disk_nr [2];
  97. unsigned char start_central_dir [2];
  98. unsigned char total_entries_disk [2];
  99. unsigned char total_entries_archive [2];
  100. unsigned char central_dir_size [4];
  101. unsigned char offset_central_dir [4];
  102. unsigned char commentfield_len [2];
  103. } ZipEnd;
  104. /*
  105. * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
  106. * As the internals of a jar/zip file must not depend on the target
  107. * architecture (i386, ppc, ARM, ...), use a fixed value instead.
  108. */
  109. #define ZIPEND_SIZE (4+2+2+2+2+4+4+2)
  110. /* signatures */
  111. #define LOCALSIG 0x04034B50l
  112. #define CENTRALSIG 0x02014B50l
  113. #define ENDSIG 0x06054B50l
  114. /* extra fields */
  115. #define EXTENDED_TIMESTAMP_FIELD 0x5455
  116. #define EXTENDED_TIMESTAMP_MODTIME 0x01
  117. /* compression methods */
  118. #define STORED 0
  119. #define SHRUNK 1
  120. #define REDUCED1 2
  121. #define REDUCED2 3
  122. #define REDUCED3 4
  123. #define REDUCED4 5
  124. #define IMPLODED 6
  125. #define TOKENIZED 7
  126. #define DEFLATED 8
  127. #define UNSUPPORTED 0xFF
  128. #endif /* _zipstruct_h */