util.h 817 B

1234567891011121314151617181920212223242526272829303132333435
  1. #define nil NULL
  2. #define nelem(p) (sizeof (p)/sizeof (p)[0])
  3. typedef unsigned char uchar;
  4. /*
  5. typedef unsigned short ushort;
  6. typedef unsigned int uint;
  7. typedef unsigned long ulong;
  8. */
  9. typedef unsigned long long uvlong;
  10. typedef long long vlong;
  11. int vfprint(int fd, char *fmt, va_list ap);
  12. int fprint(int fd, char *fmt, ...);
  13. int print(char *fmt, ...);
  14. long readn(int fd, void *buf, long n);
  15. char *estrdup(char *s);
  16. void randominit(void);
  17. void randombuf(uchar *p, int n);
  18. char *hex(uchar *buf, int n);
  19. int eq(char *a, char *b);
  20. int memeq(void *a, void *b, int n);
  21. int min(int a, int b);
  22. char *remoteaddr(int fd);
  23. enum {
  24. Deskeylen = 7,
  25. };
  26. void passtokey(uchar *key, char *pw);
  27. void des64key(uchar *k56, uchar *k64);
  28. void authencrypt(uchar *key, uchar *buf, int n);
  29. void authdecrypt(uchar *key, uchar *buf, int n);