types.h 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _TYPES_H
  2. #define _TYPES_H
  3. #ifdef HAVE_CONFIG_H
  4. # include "config.h"
  5. #endif
  6. #include <sys/types.h>
  7. #include <netinet/in.h>
  8. /* For local console: */
  9. #define STDIN 0
  10. #define STDOUT 1
  11. #define STDERR 2
  12. /* It's used in so many places, let's put it here */
  13. typedef int (*Function) ();
  14. #if !HAVE_SOCKLEN_T
  15. typedef int socklen_t;
  16. #endif
  17. /* 32 bit type */
  18. #if (SIZEOF_INT == 4)
  19. typedef unsigned int u_32bit_t;
  20. #else
  21. # if (SIZEOF_LONG == 4)
  22. typedef unsigned long u_32bit_t;
  23. # else
  24. # include "cant/find/32bit/type"
  25. # endif
  26. #endif
  27. typedef unsigned short int u_16bit_t;
  28. typedef unsigned char u_8bit_t;
  29. typedef u_32bit_t dword;
  30. /* port */
  31. typedef in_port_t port_t;
  32. // Signed so that it can play nice with time_t
  33. typedef int interval_t;
  34. typedef struct {
  35. int family;
  36. union {
  37. struct in_addr addr;
  38. #ifdef USE_IPV6
  39. struct in6_addr addr6;
  40. #endif
  41. } u;
  42. } my_addr_t;
  43. #endif /* !_TYPES_H */