compress.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* $MirOS: contrib/hosted/fwcf/compress.h,v 1.10 2007/03/09 22:35:13 tg Exp $ */
  2. /*
  3. * This file is part of the FreeWRT project. FreeWRT is copyrighted
  4. * material, please see the LICENCE file in the top-level directory
  5. * or at http://www.freewrt.org/licence for details.
  6. */
  7. #ifndef COMPRESS_H
  8. #define COMPRESS_H
  9. #include <sys/types.h>
  10. /* BEGIN of plug-in API description - hook yer proprietary modules here */
  11. /* returns 0 on success, -1 on failure */
  12. typedef int (*fwcf_compress_init_func)(void);
  13. /* in: *dst (malloc'd), src, size of source (max. INT_MAX) */
  14. /* returns size of destination on success, -1 on failure */
  15. typedef int (*fwcf_compress_work_func)(char **, char *, size_t)
  16. __attribute__((bounded (string, 2, 3)));
  17. /* in: dst, max size of dst, src, size of source (max. INT_MAX) */
  18. /* returns size of destination on success, -1 on failure */
  19. typedef int (*fwcf_compress_rev_func)(char *, size_t, char *, size_t)
  20. __attribute__((bounded (string, 1, 2)))
  21. __attribute__((bounded (string, 3, 4)));
  22. typedef struct FWCF_COMPRESSOR {
  23. fwcf_compress_init_func init;
  24. fwcf_compress_work_func compress;
  25. fwcf_compress_rev_func decompress;
  26. const char *name;
  27. u_int8_t code;
  28. } fwcf_compressor;
  29. /* 0=success 1=EINVAL 2=slot already used */
  30. int compress_register(fwcf_compressor *);
  31. /* END of plug-in API description, version 1.0 */
  32. /* low-level */
  33. fwcf_compressor *compress_enumerate(void);
  34. int compress_list(void);
  35. /* high-level */
  36. fwcf_compressor *compressor_get(u_int8_t);
  37. int compressor_getbyname(const char *);
  38. int list_compressors(void);
  39. #endif