Silence most of the msvc warnings
[reactos.git] / reactos / services / tcpsvcs / tcpsvcs.h
1 /*
2 * ReactOS Services
3 * Copyright (C) 2005 ReactOS Team
4 *
5 * LICENCE: GPL - See COPYING in the top level directory
6 * PROJECT: ReactOS simple TCP/IP services
7 * FILE: apps/utils/net/tcpsvcs/tcpsvcs.h
8 * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
9 * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
10 * REVISIONS:
11 * GM 04/10/05 Created
12 *
13 */
14
15 #define WIN32_LEAN_AND_MEAN
16 #include <stdio.h>
17 #include <winsock2.h>
18 #include <tchar.h>
19
20 #define UNICODE
21 #define _UNICODE
22
23 /* default port numbers */
24 #define ECHO_PORT 7
25 #define DISCARD_PORT 9
26 #define DAYTIME_PORT 13
27 #define QOTD_PORT 17
28 #define CHARGEN_PORT 19
29
30 #define NUM_SERVICES 5
31 #define BUF_SIZE 255
32 #define BUF 1024
33 #define CS_TIMEOUT 1000
34
35 /* RFC865 states no more than 512 chars per line */
36 #define MAX_QUOTE_BUF 512
37
38 /* printable ASCII's characters for chargen */
39 #define START 32
40 #define END 126
41
42 /* number of chars to put on a line */
43 #define LINESIZ 74 // 72 + /r and /n
44
45 /* data structure to pass to threads */
46 typedef struct _Services {
47 USHORT Port;
48 TCHAR *Name;
49 LPTHREAD_START_ROUTINE Service;
50 } SERVICES, *PSERVICES;
51
52 /* tcpsvcs functions */
53 //static VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
54 VOID WINAPI ServerCtrlHandler(DWORD control);
55 INT CreateServers(VOID);
56 VOID LogEvent (LPCTSTR UserMessage, INT ExitCode, BOOL PrintErrorMsg);
57 void UpdateStatus (int NewStatus, int Check);
58
59
60 /* skelserver functions */
61 DWORD WINAPI StartServer(LPVOID lpParam);
62 SOCKET SetUpListener(USHORT Port);
63 VOID AcceptConnections(SOCKET ListeningSocket,
64 LPTHREAD_START_ROUTINE Service, TCHAR *Name);
65 BOOL EchoIncomingPackets(SOCKET sd);
66 BOOL ShutdownConnection(SOCKET Sock, BOOL bRec);
67
68 /* chargen functions */
69 DWORD WINAPI ChargenHandler(VOID* Sock_);
70 BOOL GenerateChars(SOCKET Sock);
71 BOOL SendLine(SOCKET Sock, TCHAR* Line);
72
73 /* daytime functions */
74 DWORD WINAPI DaytimeHandler(VOID* Sock_);
75 BOOL SendTime(SOCKET Sock, TCHAR *time);
76
77 /* echo functions */
78 DWORD WINAPI EchoHandler(VOID* Sock_);
79 BOOL EchoIncomingPackets(SOCKET Sock);
80
81 /* discard functions */
82 DWORD WINAPI DiscardHandler(VOID* Sock_);
83 BOOL RecieveIncomingPackets(SOCKET Sock);
84
85 /* qotd functions */
86 DWORD WINAPI QotdHandler(VOID* Sock_);
87 BOOL SendQuote(SOCKET Sock, TCHAR* Quote);