ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

tftpd.h
Go to the documentation of this file.
00001 /**************************************************************************
00002 *   Copyright (C) 2005 by Achal Dhir                                      *
00003 *   achaldhir@gmail.com                                                   *
00004 *                                                                         *
00005 *   This program is free software; you can redistribute it and/or modify  *
00006 *   it under the terms of the GNU General Public License as published by  *
00007 *   the Free Software Foundation; either version 2 of the License, or     *
00008 *   (at your option) any later version.                                   *
00009 *                                                                         *
00010 *   This program is distributed in the hope that it will be useful,       *
00011 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013 *   GNU General Public License for more details.                          *
00014 *                                                                         *
00015 *   You should have received a copy of the GNU General Public License     *
00016 *   along with this program; if not, write to the                         *
00017 *   Free Software Foundation, Inc.,                                       *
00018 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019 ***************************************************************************/
00020 // TFTPServer.cpp
00021 
00022 #ifdef _MSC_VER
00023    #define strcasecmp _stricmp
00024    #define _CRT_SECURE_NO_WARNINGS
00025    #pragma comment(lib, "ws2_32.lib")
00026    #pragma comment(lib, "iphlpapi.lib")
00027 #endif
00028 
00029 //Constants
00030 #define my_inet_addr     inet_addr
00031 #define MAX_SERVERS 8
00032 
00033 //Structs
00034 struct home
00035 {
00036     char alias[64];
00037     char target[256];
00038 };
00039 
00040 struct tftpConnType
00041 {
00042     SOCKET sock;
00043     sockaddr_in addr;
00044     DWORD server;
00045     WORD port;
00046 };
00047 
00048 struct acknowledgement
00049 {
00050     WORD opcode;
00051     WORD block;
00052 };
00053 
00054 struct message
00055 {
00056     WORD opcode;
00057     char buffer[514];
00058 };
00059 
00060 struct tftperror
00061 {
00062     WORD opcode;
00063     WORD errorcode;
00064     char errormessage[512];
00065 };
00066 
00067 struct packet
00068 {
00069     WORD opcode;
00070     WORD block;
00071     char buffer;
00072 };
00073 
00074 struct data12
00075 {
00076     DWORD rangeStart;
00077     DWORD rangeEnd;
00078 };
00079 
00080 struct request
00081 {
00082     timeval tv;
00083     fd_set readfds;
00084     time_t expiry;
00085     SOCKET sock;
00086     SOCKET knock;
00087     BYTE sockInd;
00088     BYTE attempt;
00089     char path[256];
00090     FILE *file;
00091     char *filename;
00092     char *mode;
00093     char *alias;
00094     DWORD tsize;
00095     DWORD fblock;
00096     int bytesReady;
00097     int bytesRecd;
00098     int bytesRead[2];
00099     packet* pkt[2];
00100     sockaddr_in client;
00101     socklen_t clientsize;
00102     union
00103     {
00104         tftperror serverError;
00105         message mesout;
00106         acknowledgement acout;
00107     };
00108     union
00109     {
00110         tftperror clientError;
00111         message mesin;
00112         acknowledgement acin;
00113     };
00114     WORD blksize;
00115     WORD timeout;
00116     WORD block;
00117     WORD tblock;
00118 };
00119 
00120 struct data2
00121 {
00122     WSADATA wsaData;
00123     tftpConnType tftpConn[MAX_SERVERS];
00124     DWORD servers[MAX_SERVERS];
00125     WORD ports[MAX_SERVERS];
00126     home homes[8];
00127     FILE *logfile;
00128     data12 hostRanges[32];
00129     char fileRead;
00130     char fileWrite;
00131     char fileOverwrite;
00132     int minport;
00133     int maxport;
00134     SOCKET maxFD;
00135     BYTE logLevel;
00136 };
00137 
00138 struct data15
00139 {
00140     union
00141     {
00142         //DWORD ip;
00143         unsigned ip:32;
00144         BYTE octate[4];
00145     };
00146 };
00147 
00148 //Functions
00149 void runProg(void);
00150 void processRequest(LPVOID lpParam);
00151 char* myGetToken(char*, BYTE);
00152 void init(void);
00153 bool cleanReq(request*);
00154 bool getSection(const char*, char*, BYTE, char*);
00155 bool isIP(char*s);
00156 char* myLower(char*);
00157 char* myUpper(char*);
00158 char* IP2String(char*, DWORD);
00159 void printWindowsError(void);
00160 void logMess(request*, BYTE);
00161 void logMess(char*, BYTE);

Generated on Sat May 26 2012 04:16:39 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.