2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

78 wiersze
1.8 KiB

  1. #ifndef IZ_WSSERVER_H
  2. #define IZ_WSSERVER_H
  3. #include <sys/stat.h>
  4. #include "libwebsockets.h"
  5. #include <string.h>
  6. #include "../../IZ_common.h"
  7. #include "../../IZ_config.h"
  8. #include "../core/IZ_websocket.h"
  9. #ifndef S_ISDIR
  10. #define S_ISDIR(s) s & S_IFDIR
  11. #endif
  12. /* one of these is created for each client connecting to us */
  13. typedef struct IZ_WSServerSessionData {
  14. struct IZ_WSServerSessionData* pss_list;
  15. struct lws* wsi;
  16. u32 tail;
  17. u8 culled: 1;
  18. } IZ_WSServerSessionData;
  19. /* one of these is created for each vhost our protocol is used with */
  20. typedef struct {
  21. struct lws_context *context;
  22. struct lws_vhost *vhost;
  23. const struct lws_protocols *protocol;
  24. IZ_WSServerSessionData *pss_list; /* linked-list of live pss*/
  25. struct lws_ring *ring; /* ringbuffer holding unsent messages */
  26. u16* port;
  27. const void* app;
  28. } IZ_WSServerVHostData;
  29. typedef struct {
  30. u16 port;
  31. char server_name[64];
  32. } IZ_WSServerInitializeParams;
  33. typedef struct {
  34. IZ_WSServerInitializeParams config;
  35. void* userdata;
  36. IZ_Websocket ws;
  37. } IZ_WSServerState;
  38. static IZ_WSServerState IZ_DEFAULT_STATE = {
  39. .config = {
  40. .port = 42069,
  41. .server_name = NULL,
  42. },
  43. .userdata = NULL,
  44. .ws = {
  45. .interrupted = false,
  46. .context = NULL,
  47. },
  48. };
  49. IZ_ProcedureResult IZ_WSServerInitialize(IZ_WSServerState*, void*, const char*, u8, const char**);
  50. IZ_ProcedureResult IZ_WSServerHandle(IZ_WSServerState*);
  51. void IZ_WSServerTeardown(IZ_WSServerState*);
  52. void IZ_WSServerCancelService(IZ_WSServerState*);
  53. IZ_ProcedureResult IZ_WSServerProtocolInitialize(struct lws*, void*);
  54. void IZ_WSServerProtocolTeardown(struct lws*);
  55. IZ_ProcedureResult IZ_WSServerWritable(struct lws*, IZ_WSServerSessionData*);
  56. IZ_ProcedureResult IZ_WSServerOnReceive(struct lws*, void*, size_t);
  57. void IZ_WSServerOnOpen(struct lws*, IZ_WSServerSessionData*);
  58. void IZ_WSServerOnClose(struct lws*, IZ_WSServerSessionData*);
  59. #endif