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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [common/] [v2_0/] [include/] [tftp_support.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/tftp_support.h
4
//
5
//      TFTP support
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-04-06
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
#ifndef _TFTP_SUPPORT_H_
33
#define _TFTP_SUPPORT_H_
34
 
35
/*
36
 * File transfer modes
37
 */
38
#define TFTP_NETASCII   0              // Text files
39
#define TFTP_OCTET      1              // Binary files
40
 
41
/*
42
 * Errors
43
 */
44
 
45
// These initial 7 are passed across the net in "ERROR" packets.
46
#define TFTP_ENOTFOUND   1   /* file not found */
47
#define TFTP_EACCESS     2   /* access violation */
48
#define TFTP_ENOSPACE    3   /* disk full or allocation exceeded */
49
#define TFTP_EBADOP      4   /* illegal TFTP operation */
50
#define TFTP_EBADID      5   /* unknown transfer ID */
51
#define TFTP_EEXISTS     6   /* file already exists */
52
#define TFTP_ENOUSER     7   /* no such user */
53
// These extensions are return codes in our API, *never* passed on the net.
54
#define TFTP_TIMEOUT     8   /* operation timed out */
55
#define TFTP_NETERR      9   /* some sort of network error */
56
#define TFTP_INVALID    10   /* invalid parameter */
57
#define TFTP_PROTOCOL   11   /* protocol violation */
58
#define TFTP_TOOLARGE   12   /* file is larger than buffer */
59
 
60
/*
61
 * Server support
62
 */
63
 
64
struct tftpd_fileops {
65
    int (*open)(const char *, int);
66
    int (*close)(int);
67
    int (*write)(int, const void *, int);
68
    int (*read)(int, void *, int);
69
};
70
 
71
// Flags - passed to "open"
72
#ifndef O_RDONLY
73
#define O_RDONLY 1
74
#define O_WRONLY 2
75
#endif
76
 
77
__externC int tftpd_start(int, struct tftpd_fileops *);
78
__externC int tftpd_stop(int);
79
 
80
/*
81
 * Client support
82
 */
83
 
84
__externC int tftp_get(char *, struct sockaddr_in *, char *, int, int, int *);
85
__externC int tftp_put(char *, struct sockaddr_in *, char *, int, int, int *);
86
 
87
#define TFTP_TIMEOUT_PERIOD  5          // Seconds between retries
88
#define TFTP_TIMEOUT_MAX    50          // Max timeouts over all blocks
89
#define TFTP_RETRIES_MAX     5          // retries per block before giving up
90
 
91
#endif // _TFTP_SUPPORT_H_

powered by: WebSVN 2.1.0

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