src/weighttp.h - weighttp

Data types defined

Macros defined

Source code

  1. /*
  2. * weighttp - a lightweight and simple webserver benchmarking tool
  3. *
  4. * Author:
  5. *     Copyright (c) 2009-2011 Thomas Porzelt
  6. *
  7. * License:
  8. *     MIT, see COPYING file
  9. */

  10. #ifndef WEIGHTTP_H
  11. #define WEIGHTTP_H 1

  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <time.h>
  15. #include <errno.h>
  16. #include <string.h>

  17. #include <unistd.h>
  18. #include <stdint.h>
  19. #include <fcntl.h>
  20. #include <inttypes.h>
  21. #include <sys/socket.h>
  22. #include <netdb.h>

  23. #include <ev.h>
  24. #include <pthread.h>

  25. #define CLIENT_BUFFER_SIZE 32 * 1024

  26. #define W_MALLOC(t, n) ((t*) calloc((n), sizeof(t)))
  27. #define W_REALLOC(p, t, n) ((t*) realloc(p, (n) * sizeof(t)))
  28. #define W_ERROR(f, ...) fprintf(stderr, "error: " f "\n", __VA_ARGS__)
  29. #define UNUSED(x) ( (void)(x) )

  30. struct Config;
  31. typedef struct Config Config;
  32. struct Stats;
  33. typedef struct Stats Stats;
  34. struct Worker;
  35. typedef struct Worker Worker;
  36. struct Client;
  37. typedef struct Client Client;

  38. #include "client.h"
  39. #include "worker.h"


  40. struct Config {
  41.     uint64_t req_count;
  42.     uint8_t thread_count;
  43.     uint16_t concur_count;
  44.     uint8_t keep_alive;

  45.     char *request;
  46.     uint32_t request_size;
  47.     struct addrinfo *saddr;
  48. };

  49. uint64_t str_to_uint64(char *str);

  50. #endif