OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [lwIP_AVR32_UC3/] [NETWORK/] [BasicTFTP/] [BasicTFTP.h] - Blame information for rev 614

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 583 jeremybenn
/*This file has been prepared for Doxygen automatic documentation generation.*/
2
/*! \file *********************************************************************
3
 *
4
 * \brief Basic TFTP Server for AVR32 UC3.
5
 *
6
 * - Compiler:           GNU GCC for AVR32
7
 * - Supported devices:  All AVR32 devices can be used.
8
 * - AppNote:
9
 *
10
 * \author               Atmel Corporation: http://www.atmel.com \n
11
 *                       Support and FAQ: http://support.atmel.no/
12
 *
13
 *****************************************************************************/
14
 
15
/* Copyright (c) 2007, Atmel Corporation All rights reserved.
16
 *
17
 * Redistribution and use in source and binary forms, with or without
18
 * modification, are permitted provided that the following conditions are met:
19
 *
20
 * 1. Redistributions of source code must retain the above copyright notice,
21
 * this list of conditions and the following disclaimer.
22
 *
23
 * 2. Redistributions in binary form must reproduce the above copyright notice,
24
 * this list of conditions and the following disclaimer in the documentation
25
 * and/or other materials provided with the distribution.
26
 *
27
 * 3. The name of ATMEL may not be used to endorse or promote products derived
28
 * from this software without specific prior written permission.
29
 *
30
 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
31
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
33
 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
34
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
39
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
 */
41
 
42
 
43
#ifndef BASIC_TFTP_SERVER_H
44
#define BASIC_TFTP_SERVER_H
45
 
46
#include "portmacro.h"
47
 
48
/* tftp_support.h */
49
 
50
/*
51
 * File transfer modes
52
 */
53
#define TFTP_NETASCII   0              // Text files
54
#define TFTP_OCTET      1              // Binary files
55
 
56
/*
57
 * Errors
58
 */
59
 
60
// These initial 7 are passed across the net in "ERROR" packets.
61
#define TFTP_ENOTFOUND   1   /* file not found */
62
#define TFTP_EACCESS     2   /* access violation */
63
#define TFTP_ENOSPACE    3   /* disk full or allocation exceeded */
64
#define TFTP_EBADOP      4   /* illegal TFTP operation */
65
#define TFTP_EBADID      5   /* unknown transfer ID */
66
#define TFTP_EEXISTS     6   /* file already exists */
67
#define TFTP_ENOUSER     7   /* no such user */
68
// These extensions are return codes in our API, *never* passed on the net.
69
#define TFTP_TIMEOUT     8   /* operation timed out */
70
#define TFTP_NETERR      9   /* some sort of network error */
71
#define TFTP_INVALID    10   /* invalid parameter */
72
#define TFTP_PROTOCOL   11   /* protocol violation */
73
#define TFTP_TOOLARGE   12   /* file is larger than buffer */
74
 
75
#define TFTP_TIMEOUT_PERIOD  5          // Seconds between retries
76
#define TFTP_TIMEOUT_MAX    50          // Max timeouts over all blocks
77
#define TFTP_RETRIES_MAX     5          // retries per block before giving up
78
 
79
/* netdb.h */
80
// Internet services
81
struct servent {
82
char *s_name; /* official service name */
83
char **s_aliases; /* alias list */
84
int s_port; /* port number */
85
char *s_proto; /* protocol to use */
86
};
87
 
88
/* arpa/tftp.h */
89
 
90
/*
91
 * Trivial File Transfer Protocol (IEN-133)
92
 */
93
#define SEGSIZE   512   /* data segment size */
94
 
95
/*
96
 * Packet types.
97
 */
98
 
99
#define th_block  th_u.tu_block
100
#define th_code   th_u.tu_code
101
#define th_stuff  th_u.tu_stuff
102
#define th_msg    th_data
103
 
104
/*
105
 * Error codes.
106
 */
107
#define EUNDEF    0   /* not defined */
108
#define ENOTFOUND 1   /* file not found */
109
#define EACCESS   2   /* access violation */
110
#define ENOSPACE  3   /* disk full or allocation exceeded */
111
#define EBADOP    4   /* illegal TFTP operation */
112
#define EBADID    5   /* unknown transfer ID */
113
#define EEXISTS   6   /* file already exists */
114
#define ENOUSER   7   /* no such user */
115
 
116
 
117
 
118
#define RRQ 01      /* read request */
119
#define WRQ 02      /* write request */
120
#define DATA  03      /* data packet */
121
#define ACK 04      /* acknowledgement */
122
#define ERROR 05      /* error code */
123
 
124
#if __ICCAVR32__
125
#pragma pack(1)
126
#endif
127
struct  tftphdr {
128
  short th_opcode;    /* packet type */
129
  union {
130
    unsigned short  tu_block; /* block # */
131
    short tu_code;  /* error code */
132
    char  tu_stuff[1];  /* request packet stuff */
133
  }
134
#if __GNUC__
135
 __attribute__ ((packed))
136
#endif 
137
   th_u;
138
  char  th_data[1];   /* data or error string */
139
}
140
#if __GNUC__
141
__attribute__ ((packed))
142
#endif 
143
;
144
#if __ICCAVR32__
145
#pragma pack()
146
#endif
147
 
148
/* The function that implements the TFTP server task. */
149
portTASK_FUNCTION_PROTO( vBasicTFTPServer, pvParameters );
150
 
151
 
152
 
153
#endif
154
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.