compress.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /* BEGIN of plug-in API description - hook yer proprietary modules here */
  10. /* returns 0 on success, -1 on failure */
  11. typedef int (*fwcf_compress_init_func)(void);
  12. /* in: *dst (malloc'd), src, size of source (max. INT_MAX) */
  13. /* returns size of destination on success, -1 on failure */
  14. typedef int (*fwcf_compress_work_func)(char **, char *, size_t)
  15. __attribute__((bounded (string, 2, 3)));
  16. /* in: dst, max size of dst, src, size of source (max. INT_MAX) */
  17. /* returns size of destination on success, -1 on failure */
  18. typedef int (*fwcf_compress_rev_func)(char *, size_t, char *, size_t)
  19. __attribute__((bounded (string, 1, 2)))
  20. __attribute__((bounded (string, 3, 4)));
  21. typedef struct FWCF_COMPRESSOR {
  22. fwcf_compress_init_func init;
  23. fwcf_compress_work_func compress;
  24. fwcf_compress_rev_func decompress;
  25. const char *name;
  26. uint8_t code;
  27. } fwcf_compressor;
  28. __BEGIN_DECLS
  29. /* 0=success 1=EINVAL 2=slot already used */
  30. int compress_register(fwcf_compressor *);
  31. __END_DECLS
  32. /* END of plug-in API description, version 1.0 */
  33. __BEGIN_DECLS
  34. /* low-level */
  35. fwcf_compressor *compress_enumerate(void);
  36. int compress_list(void);
  37. /* high-level */
  38. fwcf_compressor *compressor_get(uint8_t);
  39. int compressor_getbyname(const char *);
  40. int list_compressors(void);
  41. __END_DECLS
  42. #endif