00001 #ifndef HEADER_CURL_SERVER_TFTP_H 00002 #define HEADER_CURL_SERVER_TFTP_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. 00011 * 00012 * This software is licensed as described in the file COPYING, which 00013 * you should have received as part of this distribution. The terms 00014 * are also available at https://curl.haxx.se/docs/copyright.html. 00015 * 00016 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00017 * copies of the Software, and permit persons to whom the Software is 00018 * furnished to do so, under the terms of the COPYING file. 00019 * 00020 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00021 * KIND, either express or implied. 00022 * 00023 ***************************************************************************/ 00024 #include "server_setup.h" 00025 00026 /* This file is a rewrite/clone of the arpa/tftp.h file for systems without 00027 it. */ 00028 00029 #define SEGSIZE 512 /* data segment size */ 00030 00031 #if defined(__GNUC__) && ((__GNUC__ >= 3) || \ 00032 ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7))) 00033 # define PACKED_STRUCT __attribute__((__packed__)) 00034 #else 00035 # define PACKED_STRUCT /*NOTHING*/ 00036 #endif 00037 00038 /* Using a packed struct as binary in a program is begging for problems, but 00039 the tftpd server was written like this so we have this struct here to make 00040 things build. */ 00041 00042 struct tftphdr { 00043 short th_opcode; /* packet type */ 00044 unsigned short th_block; /* all sorts of things */ 00045 char th_data[1]; /* data or error string */ 00046 } PACKED_STRUCT; 00047 00048 #define th_stuff th_block 00049 #define th_code th_block 00050 #define th_msg th_data 00051 00052 #define EUNDEF 0 00053 #define ENOTFOUND 1 00054 #define EACCESS 2 00055 #define ENOSPACE 3 00056 #define EBADOP 4 00057 #define EBADID 5 00058 #define EEXISTS 6 00059 #define ENOUSER 7 00060 00061 #endif /* HEADER_CURL_SERVER_TFTP_H */