mikroSDK Reference Manual
tftp_common.h
Go to the documentation of this file.
1
31#ifndef _TFTP_COMMON_H
32#define _TFTP_COMMON_H
33
34//Dependencies
35#include "core/net.h"
36
37//TFTP port number
38#define TFTP_PORT 69
39
40//C++ guard
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
59
60
65typedef enum
66{
67 TFTP_ERROR_NOT_DEFINED = 0,
68 TFTP_ERROR_FILE_NOT_FOUND = 1,
69 TFTP_ERROR_ACCESS_VIOLATION = 2,
70 TFTP_ERROR_DISK_FULL = 3,
71 TFTP_ERROR_ILLEGAL_OPERATION = 4,
72 TFTP_ERROR_UNKNOWN_TID = 5,
73 TFTP_ERROR_FILE_ALREADY_EXISTS = 6,
74 TFTP_ERROR_NO_SUCH_USER = 7
76
77
78//CodeWarrior or Win32 compiler?
79#if defined(__CWCC__) || defined(_WIN32)
80 #pragma pack(push, 1)
81#endif
82
83
89{
90 uint16_t opcode; //0-1
91 char_t filename[]; //2
92} TftpRrqPacket;
93
94
99typedef __packed_struct
100{
101 uint16_t opcode; //0-1
102 char_t filename[]; //2
103} TftpWrqPacket;
104
105
110typedef __packed_struct
111{
112 uint16_t opcode; //0-1
113 uint16_t block; //2-3
114 uint8_t data[]; //4
115} TftpDataPacket;
116
117
122typedef __packed_struct
123{
124 uint16_t opcode; //0-1
125 uint16_t block; //2-3
126} TftpAckPacket;
127
128
133typedef __packed_struct
134{
135 uint16_t opcode; //0-1
136 uint16_t errorCode; //2-3
137 char_t errorMsg[]; //4
138} TftpErrorPacket;
139
140
141//CodeWarrior or Win32 compiler?
142#if defined(__CWCC__) || defined(_WIN32)
143 #pragma pack(pop)
144#endif
145
146//C++ guard
147#ifdef __cplusplus
148}
149#endif
150
151#endif
TCP/IP stack core.
TftpErrorCode
TFTP error codes.
Definition tftp_common.h:66
TftpOpcode
TFTP opcodes.
Definition tftp_common.h:51
@ TFTP_OPCODE_RRQ
Read request.
Definition tftp_common.h:52
@ TFTP_OPCODE_WRQ
Write request.
Definition tftp_common.h:53
@ TFTP_OPCODE_OACK
Option acknowledgment.
Definition tftp_common.h:57
@ TFTP_OPCODE_ACK
Acknowledgment.
Definition tftp_common.h:55
@ TFTP_OPCODE_DATA
Data.
Definition tftp_common.h:54
@ TFTP_OPCODE_ERROR
Error.
Definition tftp_common.h:56
typedef __packed_struct
Read request packet (RRQ)
Definition tftp_common.h:89