ddnet/src/engine/shared/fifo.h
Robert Müller 7eb5966f6f Implement FIFO on Windows using Named Pipes
Reimplement the Linux FIFO file server and client controls on Windows by using Named Pipes.

The DDNet server/client acts as a named pipe server and receives messages.
Messages can be posted to the named pipe server by connecting to it as a client.
The named pipe client can for instance be controlled from the command line with PowerShell.

The PowerShell script `scripts/send_named_pipe.ps1` is added for this purpose.
For example the PowerShell command `./send_named_pipe.ps1 "testpipe" "echo a"` sends the command `echo a` to the pipe named `testpipe`.
Multiple commands can be sent at the same time by separating them with semicolons or newlines.
2023-01-21 11:13:02 +01:00

24 lines
391 B
C++

#ifndef ENGINE_SHARED_FIFO_H
#define ENGINE_SHARED_FIFO_H
#include <engine/console.h>
class CFifo
{
IConsole *m_pConsole;
char m_aFilename[IO_MAX_PATH_LENGTH];
int m_Flag;
#if defined(CONF_FAMILY_UNIX)
int m_File;
#elif defined(CONF_FAMILY_WINDOWS)
void *m_pPipe;
#endif
public:
void Init(IConsole *pConsole, char *pFifoFile, int Flag);
void Update();
void Shutdown();
};
#endif