MPMGRD.H 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef mpmgr_h
  19. #define mpmgr_h
  20. #include "connmgr.h"
  21. // maximum number of connections
  22. #define CONNECT_MAX 7
  23. #define MAX_NAME_LEN 128
  24. class MPlayerManClass : public ConnManClass {
  25. public:
  26. MPlayerManClass(void);
  27. // queues up incoming packets appropriately
  28. int Service(void);
  29. // initialization
  30. int Init(void);
  31. int Find_Num_Connections(void);
  32. void Flush_All(void);
  33. // send/receive data
  34. int Send_Private_Message(void *buf, int buflen, int ack_req = 1, int conn_id = CONNECTION_NONE);
  35. int Get_Private_Message(void *buf, int *buflen, int *conn_id);
  36. int Send_Global_Message(void *buf, int buflen, int ack_req = 0, int address = 0);
  37. int Get_Global_Message(void *buf, int *buflen, int *address = 0);
  38. // manage connections
  39. int Num_Connections(void);
  40. int Connection_ID(int index);
  41. int Connection_Index(int id);
  42. int Create_Connection(int id, char *name, int address);
  43. int Delete_Connection(int id);
  44. char *Connection_Name(int id);
  45. int Connection_Address(int id);
  46. // queueing routines
  47. int Global_Num_Send(void);
  48. int Global_Num_Receive(void);
  49. int Private_Num_Send(int id = CONNECTION_NONE);
  50. int Private_Num_Receive(int id = CONNECTION_NONE);
  51. // timing magnagement
  52. void Reset_Response_Time(void);
  53. unsigned long Response_Time(void);
  54. void Set_Timing(unsigned long retrydelta, unsigned long maxretries, unsigned long timeout);
  55. // debug
  56. void Configure_Debug(int index, int type_offset, int type_size, char **names, int namestart,
  57. int namecount);
  58. void Mono_Debug_Print(int index, int refresh);
  59. private:
  60. int _myAddr;
  61. int _Connections[CONNECT_MAX];
  62. int _ID[CONNECT_MAX];
  63. char _Names[CONNECT_MAX][MAX_NAME_LEN];
  64. int _nConnections;
  65. };
  66. #endif // mpmgr_h
  67.