util.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef HEADER_CURL_SERVER_UTIL_H
  2. #define HEADER_CURL_SERVER_UTIL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. #include "server_setup.h"
  25. char *data_to_hex(char *data, size_t len);
  26. void logmsg(const char *msg, ...);
  27. long timediff(struct timeval newer, struct timeval older);
  28. #define TEST_DATA_PATH "%s/data/test%ld"
  29. #define SERVERLOGS_LOCK "log/serverlogs.lock"
  30. /* global variable, where to find the 'data' dir */
  31. extern const char *path;
  32. /* global variable, log file name */
  33. extern const char *serverlogfile;
  34. #ifdef WIN32
  35. #include <process.h>
  36. #include <fcntl.h>
  37. #define sleep(sec) Sleep ((sec)*1000)
  38. #undef perror
  39. #define perror(m) win32_perror(m)
  40. void win32_perror(const char *msg);
  41. #endif /* WIN32 */
  42. #ifdef USE_WINSOCK
  43. void win32_init(void);
  44. void win32_cleanup(void);
  45. #endif /* USE_WINSOCK */
  46. /* returns the path name to the test case file */
  47. char *test2file(long testno);
  48. int wait_ms(int timeout_ms);
  49. int write_pidfile(const char *filename);
  50. void set_advisor_read_lock(const char *filename);
  51. void clear_advisor_read_lock(const char *filename);
  52. int strncasecompare(const char *first, const char *second, size_t max);
  53. #endif /* HEADER_CURL_SERVER_UTIL_H */