home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / arpa / h / tftp < prev   
Encoding:
Text File  |  2004-09-05  |  3.1 KB  |  87 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/arpa/tftp.h,v $
  4.  * $Date: 2002/12/22 18:32:47 $
  5.  * $Revision: 1.1 $
  6.  * $State: Exp $
  7.  * $Author: admin $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /*
  12.  * Copyright (c) 1983, 1993
  13.  *    The Regents of the University of California.  All rights reserved.
  14.  *
  15.  * Redistribution and use in source and binary forms, with or without
  16.  * modification, are permitted provided that the following conditions
  17.  * are met:
  18.  * 1. Redistributions of source code must retain the above copyright
  19.  *    notice, this list of conditions and the following disclaimer.
  20.  * 2. Redistributions in binary form must reproduce the above copyright
  21.  *    notice, this list of conditions and the following disclaimer in the
  22.  *    documentation and/or other materials provided with the distribution.
  23.  * 4. Neither the name of the University nor the names of its contributors
  24.  *    may be used to endorse or promote products derived from this software
  25.  *    without specific prior written permission.
  26.  *
  27.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  28.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  29.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  30.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  31.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  33.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  34.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  35.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  36.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  37.  * SUCH DAMAGE.
  38.  *
  39.  *    @(#)tftp.h    8.1 (Berkeley) 6/2/93
  40.  */
  41.  
  42. #ifndef _ARPA_TFTP_H
  43. #define    _ARPA_TFTP_H 1
  44.  
  45. /*
  46.  * Trivial File Transfer Protocol (IEN-133)
  47.  */
  48. #define    SEGSIZE        512        /* data segment size */
  49.  
  50. /*
  51.  * Packet types.
  52.  */
  53. #define    RRQ    01                /* read request */
  54. #define    WRQ    02                /* write request */
  55. #define    DATA    03                /* data packet */
  56. #define    ACK    04                /* acknowledgement */
  57. #define    ERROR    05                /* error code */
  58.  
  59. struct    tftphdr {
  60.     short    th_opcode;            /* packet type */
  61.     union {
  62.         unsigned short    tu_block;    /* block # */
  63.         short    tu_code;        /* error code */
  64.         char    tu_stuff[1];        /* request packet stuff */
  65.     } __attribute__ ((__packed__)) th_u;
  66.     char    th_data[1];            /* data or error string */
  67. } __attribute__ ((__packed__));
  68.  
  69. #define    th_block    th_u.tu_block
  70. #define    th_code        th_u.tu_code
  71. #define    th_stuff    th_u.tu_stuff
  72. #define    th_msg        th_data
  73.  
  74. /*
  75.  * Error codes.
  76.  */
  77. #define    EUNDEF        0        /* not defined */
  78. #define    ENOTFOUND    1        /* file not found */
  79. #define    EACCESS        2        /* access violation */
  80. #define    ENOSPACE    3        /* disk full or allocation exceeded */
  81. #define    EBADOP        4        /* illegal TFTP operation */
  82. #define    EBADID        5        /* unknown transfer ID */
  83. #define    EEXISTS        6        /* file already exists */
  84. #define    ENOUSER        7        /* no such user */
  85.  
  86. #endif /* arpa/tftp.h */
  87.