home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jruntime.z / verify.h < prev    next >
C/C++ Source or Header  |  1997-08-25  |  3KB  |  109 lines

  1. /*
  2.  * @(#)verify.h    1.9 96/11/23
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. #ifndef _VERIFY_
  24. #define _VERIFY_
  25.  
  26. /*
  27.  * Limits. I have just picked some values for these, they
  28.  * probably should be more constraint.
  29.  */
  30.  
  31. #define DEFAULTMAX    (1 << 15)
  32.  
  33. #define MINCLASSSIZE    sizeof(ClassClass)
  34. #define MAXCLASSSIZE    DEFAULTMAX
  35. #define MINCONSTANTS    2
  36. #define MAXCONSTANTS    DEFAULTMAX
  37. #define MININTERFACES    0
  38. #define MAXINTERFACES    DEFAULTMAX
  39. #define MINFIELDS    0
  40. #define MAXFIELDS    DEFAULTMAX
  41. #define MINMETHODS    0
  42. #define MAXMETHODS    DEFAULTMAX
  43. #define MINATTR        0
  44. #define MAXATTR        DEFAULTMAX
  45. #define MINATTRLEN    0
  46. #define MAXATTRLEN    DEFAULTMAX
  47. #define MINCODELEN    1
  48. #define MAXCODELEN    DEFAULTMAX
  49. #define MINEXCEPTIONS    0
  50. #define MAXEXCEPTIONS    DEFAULTMAX
  51. #define MINLINENO    0
  52. #define MAXLINENO    DEFAULTMAX
  53. #define MINLOCALVAR    0
  54. #define MAXLOCALVAR    256
  55. #define MINSTRING    0
  56. #define MAXSTRING    DEFAULTMAX
  57. #define MINSTACK    0
  58. #define MAXSTACK    DEFAULTMAX
  59. #define MINLOCALS    0
  60. #define MAXLOCALS    256
  61. #define MINMETHSIZE    1
  62. #define MAXMETHSIZE    DEFAULTMAX
  63. #define MINARGSIZE    0
  64. #define MAXARGSIZE    256
  65.  
  66. typedef unsigned char     uchar;
  67.  
  68. /*
  69.  * data
  70.  */
  71. extern int verify_verbose;
  72. extern int verify_errors;
  73. extern char verify_error_message[];
  74. extern char *opnames[];
  75.  
  76. /*
  77.  * functions
  78.  */
  79.  
  80. extern long get_ubyte(uchar *ptr);
  81. extern long get_ushort(uchar *ptr);
  82. extern long get_uint(uchar *ptr);
  83. extern long get_byte(uchar *ptr);
  84. extern long get_short(uchar *ptr);
  85. extern long get_int(uchar *ptr);
  86.  
  87. extern long read_ubyte(uchar **pptr);
  88. extern long read_ushort(uchar **pptr);
  89. extern long read_uint(uchar **pptr);
  90. extern long read_byte(uchar **pptr);
  91. extern long read_short(uchar **pptr);
  92. extern long read_int(uchar **pptr);
  93.  
  94. extern int verify_field_signature(char *sig, int len);
  95. extern int verify_method_signature(char *sig, int len);
  96.  
  97. extern int verify_Asciz(int nconstants, uchar **cpool, uint n);
  98. extern int verify_Class(int nconstants, uchar **cpool, uint n);
  99. extern int verify_NameAndType(int nconstants, uchar **cpool, uint n);
  100. extern int verify_Fieldref(int nconstants, uchar **cpool, uint n);
  101. extern int verify_Methodref(int nconstants, uchar **cpool, uint n);
  102. extern int verify_InterfaceMethodref(int nconstants, uchar **cpool, uint n);
  103.  
  104. extern void verify_error(char *fmt, ...);
  105. extern int verify_data(uchar *data, int length);
  106. extern int verify_code(int nconst, uchar **cpool, int name, int sig, uchar *data, int length);
  107.  
  108. #endif
  109.