1 #ifndef _TCPSVCS_H 2 #define _TCPSVCS_H 3 4 #include <stdarg.h> 5 6 #define WIN32_NO_STATUS 7 #include <windef.h> 8 #include <winbase.h> 9 #define _INC_WINDOWS 10 #include <winsock2.h> 11 #include <tchar.h> 12 #include <strsafe.h> 13 14 #define LOG_FILE 1 15 #define LOG_EVENTLOG 2 16 #define LOG_ERROR 4 17 #define LOG_ALL (LOG_FILE | LOG_EVENTLOG | LOG_ERROR) 18 19 /* default port numbers */ 20 #define ECHO_PORT 7 21 #define DISCARD_PORT 9 22 #define DAYTIME_PORT 13 23 #define QOTD_PORT 17 24 #define CHARGEN_PORT 19 25 26 #define NUM_SERVICES 5 27 #define CS_TIMEOUT 1000 28 29 30 /* data structure to pass to threads */ 31 typedef struct _Services 32 { 33 USHORT Port; 34 LPWSTR lpName; 35 LPTHREAD_START_ROUTINE lpService; 36 } SERVICES, *PSERVICES; 37 38 extern volatile BOOL bShutdown; 39 extern volatile BOOL bPause; 40 41 /* logging functions */ 42 BOOL InitLogging(VOID); 43 VOID UninitLogging(VOID); 44 VOID LogEvent(LPCWSTR lpMsg, DWORD errNum, DWORD exitCode, UINT flags); 45 46 /* skelserver functions */ 47 DWORD WINAPI StartServer(LPVOID lpParam); 48 BOOL ShutdownConnection(SOCKET Sock, BOOL bRec); 49 50 /* server thread handlers */ 51 DWORD WINAPI ChargenHandler(VOID* sock_); 52 DWORD WINAPI DaytimeHandler(VOID* sock_); 53 DWORD WINAPI EchoHandler(VOID* sock_); 54 DWORD WINAPI DiscardHandler(VOID* sock_); 55 DWORD WINAPI QotdHandler(VOID* sock_); 56 57 #endif /* _TCPSVCS_H */ 58