comp.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. {
  10. int type; /* NID for compression library */
  11. const char *name; /* A text string to identify the library */
  12. int (*init)(COMP_CTX *ctx);
  13. void (*finish)(COMP_CTX *ctx);
  14. int (*compress)(COMP_CTX *ctx,
  15. unsigned char *out, unsigned int olen,
  16. unsigned char *in, unsigned int ilen);
  17. int (*expand)(COMP_CTX *ctx,
  18. unsigned char *out, unsigned int olen,
  19. unsigned char *in, unsigned int ilen);
  20. /* The following two do NOTHING, but are kept for backward compatibility */
  21. long (*ctrl)(void);
  22. long (*callback_ctrl)(void);
  23. } COMP_METHOD;
  24. struct comp_ctx_st
  25. {
  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. /* The following lines are auto generated by the script mkerr.pl. Any changes
  49. * made after this point may be overwritten when the script is next run.
  50. */
  51. void ERR_load_COMP_strings(void);
  52. /* Error codes for the COMP functions. */
  53. /* Function codes. */
  54. #define COMP_F_BIO_ZLIB_FLUSH 99
  55. #define COMP_F_BIO_ZLIB_NEW 100
  56. #define COMP_F_BIO_ZLIB_READ 101
  57. #define COMP_F_BIO_ZLIB_WRITE 102
  58. /* Reason codes. */
  59. #define COMP_R_ZLIB_DEFLATE_ERROR 99
  60. #define COMP_R_ZLIB_INFLATE_ERROR 100
  61. #define COMP_R_ZLIB_NOT_SUPPORTED 101
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif