A clone of btpd with my configuration changes.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

57 rindas
1.6 KiB

  1. #ifndef BTPD_SUBR_H
  2. #define BTPD_SUBR_H
  3. #include <stdarg.h>
  4. #include <stdio.h>
  5. #include <stdint.h>
  6. #define max(x, y) ((x) >= (y) ? (x) : (y))
  7. #define min(x, y) ((x) <= (y) ? (x) : (y))
  8. #define SHAHEXSIZE 41
  9. void *memfind(const void *sub, size_t sublen, const void *mem, size_t memlen);
  10. uint32_t dec_be32(const void *buf);
  11. uint64_t dec_be64(const void *buf);
  12. void enc_be32(void *buf, uint32_t num);
  13. void enc_be64(void *buf, uint64_t num);
  14. int set_nonblocking(int fd);
  15. int set_blocking(int fd);
  16. int mkdirs(char *path, int mode);
  17. __attribute__((format (printf, 3, 0)))
  18. int vaopen(int *resfd, int flags, const char *fmt, va_list ap);
  19. __attribute__((format (printf, 3, 4)))
  20. int vopen(int *resfd, int flags, const char *fmt, ...);
  21. __attribute__((format (printf, 3, 4)))
  22. int vfopen(FILE **ret, const char *mode, const char *fmt, ...);
  23. int vfsync(const char *fmt, ...);
  24. void set_bit(uint8_t *bits, unsigned long index);
  25. int has_bit(const uint8_t *bits, unsigned long index);
  26. void clear_bit(uint8_t *bits, unsigned long index);
  27. char *bin2hex(const uint8_t *bin, char *hex, size_t bsize);
  28. uint8_t *hex2bin(const char *hex, uint8_t *bin, size_t bsize);
  29. uint8_t hex2i(char c);
  30. int ishex(char *str);
  31. long rand_between(long min, long max);
  32. int read_fully(int fd, void *buf, size_t len);
  33. int write_fully(int fd, const void *buf, size_t len);
  34. void *read_file(const char *path, void *buf, size_t *size);
  35. char *find_btpd_dir(void);
  36. int make_abs_path(const char *in, char *out);
  37. #ifndef HAVE_ASPRINTF
  38. __attribute__((format (printf, 2, 3)))
  39. int asprintf(char **strp, const char *fmt, ...);
  40. #endif
  41. #endif