Guest User

de la mn pt fratii mei de la client haideee

a guest
Jul 18th, 2019
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * networking.h
  3. *
  4. * Created on: Jul 18, 2019
  5. * Author: practica
  6. */
  7.  
  8.  
  9.  
  10.  
  11. #ifndef NETWORKING_H_
  12. #define NETWORKING_H_
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16.  
  17. #endif
  18.  
  19. #define MAX_SERVER_NAME 20
  20.  
  21. enum ServerStatus {
  22. Idle,
  23. WaitToStart,
  24. Running
  25. };
  26.  
  27. /**
  28. *
  29. */
  30.  
  31.  
  32. struct Server {
  33. int ID;
  34. int IP;
  35. enum ServerStatus status;
  36. char name[MAX_SERVER_NAME];
  37. unsigned short tcpPort;
  38. };
  39. struct Server Date[5];
  40. int server_count;
  41.  
  42. struct ServerInfo {
  43. int ID;
  44. enum ServerStatus status;
  45. char name[MAX_SERVER_NAME];
  46. unsigned short tcpPort;
  47. };
  48.  
  49. void notify(char message[50], int length); //notificare primire date
  50.  
  51. void start_server(int ID);
  52.  
  53. int stop_accepting_clients();
  54.  
  55. void register_cb_new_user();
  56.  
  57. void register_cb_notify();
  58.  
  59. void request_turn(int ID);
  60.  
  61. void send_status(char *data_buffer,int length);
  62.  
  63.  
  64. /**
  65. * Get a list of at most \p max_len discovered servers.
  66. *
  67. * @param [OUT]srvList
  68. * @param max_len maximum number of servers
  69. * @return the count (negative for error)
  70. */
  71.  
  72. int listServers(struct ServerInfo *srvList, int max_len);
  73.  
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77.  
  78.  
  79.  
  80. #endif /* NETWORKING_H_*/
RAW Paste Data