38 if (m_pipe!=INVALID_HANDLE_VALUE)
44 if (m_pipe==INVALID_HANDLE_VALUE)
47 DWORD mode=PIPE_READMODE_MESSAGE|PIPE_NOWAIT;
48 SetNamedPipeHandleState(m_pipe,&mode,
NULL,
NULL);
51 if (!ReadFile(m_pipe,buf,maxchar-1,&read,
NULL))
53 mode=PIPE_READMODE_MESSAGE|PIPE_WAIT;
54 SetNamedPipeHandleState(m_pipe,&mode,
NULL,
NULL);
61 if (m_pipe==INVALID_HANDLE_VALUE)
65 WriteFile(m_pipe,&type,1,&dummy,
NULL);
68 len=src?strlen(src):0;
69 WriteFile(m_pipe,&len,4,&dummy,
NULL);
71 WriteFile(m_pipe,src,len,&dummy,
NULL);
74 WriteFile(m_pipe,&len,4,&dummy,
NULL);
76 WriteFile(m_pipe,str,len,&dummy,
NULL);
84 unsigned argn,
const char *
const * argv)
86 if (!cmd||!strcmp(cmd,
"help"))
88 dbg <<
"net I/O help:\n"
89 " add [ <machine> ]\n"
90 " create net I/O (optionally specifying the machine to connect to)\n";
92 else if (!strcmp(cmd,
"add"))
94 const char *machine=argn?argv[0]:
".";
97 wsprintf(buf,
"\\\\%s\\pipe\\ea_debug_v1",machine);
98 m_pipe=CreateFile(buf,GENERIC_READ|GENERIC_WRITE,
100 if (m_pipe==INVALID_HANDLE_VALUE)
102 dbg <<
"Could not connect to given machine.\n";
107 DWORD mode=PIPE_READMODE_MESSAGE;
108 SetNamedPipeHandleState(m_pipe,&mode,
NULL,
NULL);
113 GetComputerName(comp,&mode);
114 wsprintf(buf,
"Client at %s\n",comp);
Debug module main class (singleton).
StringType
List of possible log string types.
@ Other
some other message
static DebugIOInterface * Create(void)
virtual void Write(StringType type, const char *src, const char *str)
Write out some characters differentiated by the log string type.
virtual void Delete(void)
Destroys the current I/O class instance.
virtual int Read(char *buf, int maxchar)
Retrieves up to the given number of characters from a command input source.
virtual void Execute(class Debug &dbg, const char *cmd, bool structuredCmd, unsigned argn, const char *const *argv)
I/O class specific command.
virtual void EmergencyFlush(void)
Emergency shutdown function.
void * DebugAllocMemory(unsigned numBytes)
void DebugFreeMemory(void *ptr)