types.h 1017 B

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