home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / java.z / verify.h < prev    next >
C/C++ Source or Header  |  1996-05-03  |  3KB  |  106 lines

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