server.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. MSP430 Emulator
  3. Copyright (C) 2020 Rudolf Geosits (rgeosits@live.esu.edu)
  4. "MSP430 Emulator" is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. "MSP430 Emulator" is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef _SERVER_H_
  16. #define _SERVER_H_
  17. #include <string.h>
  18. #include <stdint.h>
  19. #include <stdio.h>
  20. #include <stdbool.h>
  21. #include <signal.h>
  22. #include <sys/wait.h>
  23. #include <errno.h>
  24. #include <stdlib.h>
  25. #include <libwebsockets.h>
  26. extern int callback_http (
  27. struct lws *wsi,
  28. enum lws_callback_reasons reason,
  29. void *user, void *in, size_t len);
  30. extern int callback_emu (
  31. struct lws *wsi,
  32. enum lws_callback_reasons reason,
  33. void *user, void *in, size_t len);
  34. static struct lws_protocols protocols [] =
  35. {
  36. {
  37. "http-only",
  38. callback_http,
  39. 0
  40. },
  41. {
  42. "emu-protocol",
  43. callback_emu,
  44. 0,
  45. 1024 * 4,
  46. 0,
  47. },
  48. {
  49. NULL, NULL, 0, 0
  50. }
  51. };
  52. #endif