MPMGRD.H 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. #ifndef mpmgr_h
  15. #define mpmgr_h
  16. #include "connmgr.h"
  17. // maximum number of connections
  18. #define CONNECT_MAX 7
  19. #define MAX_NAME_LEN 128
  20. class MPlayerManClass : public ConnManClass {
  21. public:
  22. MPlayerManClass(void);
  23. // queues up incoming packets appropriately
  24. int Service(void);
  25. // initialization
  26. int Init(void);
  27. int Find_Num_Connections(void);
  28. void Flush_All(void);
  29. // send/receive data
  30. int Send_Private_Message(void *buf, int buflen, int ack_req = 1, int conn_id = CONNECTION_NONE);
  31. int Get_Private_Message(void *buf, int *buflen, int *conn_id);
  32. int Send_Global_Message(void *buf, int buflen, int ack_req = 0, int address = 0);
  33. int Get_Global_Message(void *buf, int *buflen, int *address = 0);
  34. // manage connections
  35. int Num_Connections(void);
  36. int Connection_ID(int index);
  37. int Connection_Index(int id);
  38. int Create_Connection(int id, char *name, int address);
  39. int Delete_Connection(int id);
  40. char *Connection_Name(int id);
  41. int Connection_Address(int id);
  42. // queueing routines
  43. int Global_Num_Send(void);
  44. int Global_Num_Receive(void);
  45. int Private_Num_Send(int id = CONNECTION_NONE);
  46. int Private_Num_Receive(int id = CONNECTION_NONE);
  47. // timing magnagement
  48. void Reset_Response_Time(void);
  49. unsigned long Response_Time(void);
  50. void Set_Timing(unsigned long retrydelta, unsigned long maxretries, unsigned long timeout);
  51. // debug
  52. void Configure_Debug(int index, int type_offset, int type_size, char **names, int namestart,
  53. int namecount);
  54. void Mono_Debug_Print(int index, int refresh);
  55. private:
  56. int _myAddr;
  57. int _Connections[CONNECT_MAX];
  58. int _ID[CONNECT_MAX];
  59. char _Names[CONNECT_MAX][MAX_NAME_LEN];
  60. int _nConnections;
  61. };
  62. #endif // mpmgr_h
  63.