comp.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef HEADER_COMP_H
  2. # define HEADER_COMP_H
  3. # include <openssl/crypto.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct comp_ctx_st COMP_CTX;
  8. typedef struct comp_method_st {
  9. int type; /* NID for compression library */
  10. const char *name; /* A text string to identify the library */
  11. int (*init) (COMP_CTX *ctx);
  12. void (*finish) (COMP_CTX *ctx);
  13. int (*compress) (COMP_CTX *ctx,
  14. unsigned char *out, unsigned int olen,
  15. unsigned char *in, unsigned int ilen);
  16. int (*expand) (COMP_CTX *ctx,
  17. unsigned char *out, unsigned int olen,
  18. unsigned char *in, unsigned int ilen);
  19. /*
  20. * The following two do NOTHING, but are kept for backward compatibility
  21. */
  22. long (*ctrl) (void);
  23. long (*callback_ctrl) (void);
  24. } COMP_METHOD;
  25. struct comp_ctx_st {
  26. COMP_METHOD *meth;
  27. unsigned long compress_in;
  28. unsigned long compress_out;
  29. unsigned long expand_in;
  30. unsigned long expand_out;
  31. CRYPTO_EX_DATA ex_data;
  32. };
  33. COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
  34. void COMP_CTX_free(COMP_CTX *ctx);
  35. int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
  36. unsigned char *in, int ilen);
  37. int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
  38. unsigned char *in, int ilen);
  39. COMP_METHOD *COMP_rle(void);
  40. COMP_METHOD *COMP_zlib(void);
  41. void COMP_zlib_cleanup(void);
  42. # ifdef HEADER_BIO_H
  43. # ifdef ZLIB
  44. BIO_METHOD *BIO_f_zlib(void);
  45. # endif
  46. # endif
  47. /* BEGIN ERROR CODES */
  48. /*
  49. * The following lines are auto generated by the script mkerr.pl. Any changes
  50. * made after this point may be overwritten when the script is next run.
  51. */
  52. void ERR_load_COMP_strings(void);
  53. /* Error codes for the COMP functions. */
  54. /* Function codes. */
  55. # define COMP_F_BIO_ZLIB_FLUSH 99
  56. # define COMP_F_BIO_ZLIB_NEW 100
  57. # define COMP_F_BIO_ZLIB_READ 101
  58. # define COMP_F_BIO_ZLIB_WRITE 102
  59. /* Reason codes. */
  60. # define COMP_R_ZLIB_DEFLATE_ERROR 99
  61. # define COMP_R_ZLIB_INFLATE_ERROR 100
  62. # define COMP_R_ZLIB_NOT_SUPPORTED 101
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif