2014-02-03 17:02:27 +00:00
|
|
|
#ifndef _TCPSVCS_H
|
|
|
|
#define _TCPSVCS_H
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <stdarg.h>
|
2014-01-13 12:57:08 +00:00
|
|
|
|
|
|
|
#define WIN32_NO_STATUS
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#define _INC_WINDOWS
|
2006-02-16 23:23:37 +00:00
|
|
|
#include <winsock2.h>
|
|
|
|
#include <tchar.h>
|
2018-08-28 10:45:03 +00:00
|
|
|
#include <strsafe.h>
|
2006-02-16 23:23:37 +00:00
|
|
|
|
2008-04-02 16:54:55 +00:00
|
|
|
#define LOG_FILE 1
|
|
|
|
#define LOG_EVENTLOG 2
|
|
|
|
#define LOG_ERROR 4
|
|
|
|
#define LOG_ALL (LOG_FILE | LOG_EVENTLOG | LOG_ERROR)
|
|
|
|
|
2006-02-16 23:23:37 +00:00
|
|
|
/* default port numbers */
|
|
|
|
#define ECHO_PORT 7
|
|
|
|
#define DISCARD_PORT 9
|
|
|
|
#define DAYTIME_PORT 13
|
|
|
|
#define QOTD_PORT 17
|
|
|
|
#define CHARGEN_PORT 19
|
|
|
|
|
|
|
|
#define NUM_SERVICES 5
|
|
|
|
#define CS_TIMEOUT 1000
|
|
|
|
|
|
|
|
|
|
|
|
/* data structure to pass to threads */
|
2008-09-01 12:51:49 +00:00
|
|
|
typedef struct _Services
|
|
|
|
{
|
2006-02-16 23:23:37 +00:00
|
|
|
USHORT Port;
|
2008-09-01 12:51:49 +00:00
|
|
|
LPWSTR lpName;
|
|
|
|
LPTHREAD_START_ROUTINE lpService;
|
2006-02-16 23:23:37 +00:00
|
|
|
} SERVICES, *PSERVICES;
|
|
|
|
|
2008-04-02 16:54:55 +00:00
|
|
|
extern volatile BOOL bShutdown;
|
|
|
|
extern volatile BOOL bPause;
|
|
|
|
|
|
|
|
/* logging functions */
|
2011-03-13 17:59:02 +00:00
|
|
|
BOOL InitLogging(VOID);
|
|
|
|
VOID UninitLogging(VOID);
|
2008-09-01 12:51:49 +00:00
|
|
|
VOID LogEvent(LPCWSTR lpMsg, DWORD errNum, DWORD exitCode, UINT flags);
|
2006-02-16 23:23:37 +00:00
|
|
|
|
|
|
|
/* skelserver functions */
|
|
|
|
DWORD WINAPI StartServer(LPVOID lpParam);
|
|
|
|
BOOL ShutdownConnection(SOCKET Sock, BOOL bRec);
|
|
|
|
|
2007-07-09 23:13:09 +00:00
|
|
|
/* server thread handlers */
|
2008-04-02 16:54:55 +00:00
|
|
|
DWORD WINAPI ChargenHandler(VOID* sock_);
|
|
|
|
DWORD WINAPI DaytimeHandler(VOID* sock_);
|
|
|
|
DWORD WINAPI EchoHandler(VOID* sock_);
|
|
|
|
DWORD WINAPI DiscardHandler(VOID* sock_);
|
|
|
|
DWORD WINAPI QotdHandler(VOID* sock_);
|
2014-02-03 17:02:27 +00:00
|
|
|
|
|
|
|
#endif /* _TCPSVCS_H */
|