mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
imported the MT snapshot of the GPL tftp-server for win32 from sourceforge. Minor changes such as formatting and renaming the files, totally untested except for building, will be used later to serve up ReactOS images to PXE boot
svn path=/trunk/; revision=40919
This commit is contained in:
parent
9e1d61edc1
commit
5a40435d8d
5 changed files with 2424 additions and 0 deletions
|
@ -25,6 +25,9 @@
|
|||
<directory name="telnetd">
|
||||
<xi:include href="telnetd/telnetd.rbuild" />
|
||||
</directory>
|
||||
<directory name="tftpd">
|
||||
<xi:include href="tftpd/tftpd.rbuild" />
|
||||
</directory>
|
||||
<directory name="umpnpmgr">
|
||||
<xi:include href="umpnpmgr/umpnpmgr.rbuild" />
|
||||
</directory>
|
||||
|
|
3
reactos/base/services/tftpd/README.txt
Normal file
3
reactos/base/services/tftpd/README.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
This is a snapshot from the 1.6 release of tftp-server for win32 from sourceforge.
|
||||
|
||||
http://tftp-server.sourceforge.net
|
2245
reactos/base/services/tftpd/tftpd.cpp
Normal file
2245
reactos/base/services/tftpd/tftpd.cpp
Normal file
File diff suppressed because it is too large
Load diff
161
reactos/base/services/tftpd/tftpd.h
Normal file
161
reactos/base/services/tftpd/tftpd.h
Normal file
|
@ -0,0 +1,161 @@
|
|||
/**************************************************************************
|
||||
* Copyright (C) 2005 by Achal Dhir *
|
||||
* achaldhir@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
// TFTPServer.cpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strcasecmp _stricmp
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#pragma comment(lib, "iphlpapi.lib")
|
||||
#endif
|
||||
|
||||
//Constants
|
||||
#define my_inet_addr inet_addr
|
||||
#define MAX_SERVERS 8
|
||||
|
||||
//Structs
|
||||
struct home
|
||||
{
|
||||
char alias[64];
|
||||
char target[256];
|
||||
};
|
||||
|
||||
struct tftpConnType
|
||||
{
|
||||
SOCKET sock;
|
||||
sockaddr_in addr;
|
||||
DWORD server;
|
||||
WORD port;
|
||||
};
|
||||
|
||||
struct acknowledgement
|
||||
{
|
||||
WORD opcode;
|
||||
WORD block;
|
||||
};
|
||||
|
||||
struct message
|
||||
{
|
||||
WORD opcode;
|
||||
char buffer[514];
|
||||
};
|
||||
|
||||
struct tftperror
|
||||
{
|
||||
WORD opcode;
|
||||
WORD errorcode;
|
||||
char errormessage[512];
|
||||
};
|
||||
|
||||
struct packet
|
||||
{
|
||||
WORD opcode;
|
||||
WORD block;
|
||||
char buffer;
|
||||
};
|
||||
|
||||
struct data12
|
||||
{
|
||||
DWORD rangeStart;
|
||||
DWORD rangeEnd;
|
||||
};
|
||||
|
||||
struct request
|
||||
{
|
||||
timeval tv;
|
||||
fd_set readfds;
|
||||
time_t expiry;
|
||||
SOCKET sock;
|
||||
SOCKET knock;
|
||||
BYTE sockInd;
|
||||
BYTE attempt;
|
||||
char path[256];
|
||||
FILE *file;
|
||||
char *filename;
|
||||
char *mode;
|
||||
char *alias;
|
||||
DWORD tsize;
|
||||
DWORD fblock;
|
||||
int bytesReady;
|
||||
int bytesRecd;
|
||||
int bytesRead[2];
|
||||
packet* pkt[2];
|
||||
sockaddr_in client;
|
||||
socklen_t clientsize;
|
||||
union
|
||||
{
|
||||
tftperror serverError;
|
||||
message mesout;
|
||||
acknowledgement acout;
|
||||
};
|
||||
union
|
||||
{
|
||||
tftperror clientError;
|
||||
message mesin;
|
||||
acknowledgement acin;
|
||||
};
|
||||
WORD blksize;
|
||||
WORD timeout;
|
||||
WORD block;
|
||||
WORD tblock;
|
||||
};
|
||||
|
||||
struct data2
|
||||
{
|
||||
WSADATA wsaData;
|
||||
tftpConnType tftpConn[MAX_SERVERS];
|
||||
DWORD servers[MAX_SERVERS];
|
||||
WORD ports[MAX_SERVERS];
|
||||
home homes[8];
|
||||
FILE *logfile;
|
||||
data12 hostRanges[32];
|
||||
char fileRead;
|
||||
char fileWrite;
|
||||
char fileOverwrite;
|
||||
int minport;
|
||||
int maxport;
|
||||
SOCKET maxFD;
|
||||
BYTE logLevel;
|
||||
};
|
||||
|
||||
struct data15
|
||||
{
|
||||
union
|
||||
{
|
||||
//DWORD ip;
|
||||
unsigned ip:32;
|
||||
BYTE octate[4];
|
||||
};
|
||||
};
|
||||
|
||||
//Functions
|
||||
void runProg();
|
||||
void processRequest(LPVOID lpParam);
|
||||
char* myGetToken(char*, BYTE);
|
||||
void init();
|
||||
bool cleanReq(request*);
|
||||
bool getSection(char*, char*, BYTE, char*);
|
||||
bool isIP(char*s);
|
||||
char* myLower(char*);
|
||||
char* myUpper(char*);
|
||||
char* IP2String(char*, DWORD);
|
||||
void printWindowsError();
|
||||
void logMess(request*, BYTE);
|
||||
void logMess(char*, BYTE);
|
12
reactos/base/services/tftpd/tftpd.rbuild
Normal file
12
reactos/base/services/tftpd/tftpd.rbuild
Normal file
|
@ -0,0 +1,12 @@
|
|||
<module name="tftpd" type="win32cui" installbase="system32" installname="tftpd.exe" allowwarnings="true" unicode="no">
|
||||
<include base="reactos"></include>
|
||||
<include base="telnetd">..</include>
|
||||
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>ws2_32</library>
|
||||
<library>wine</library>
|
||||
|
||||
<file>tftpd.cpp</file>
|
||||
</module>
|
Loading…
Reference in a new issue