Embedded TCP/IP stack  4.7.0
fnet_tftp_srv.h
1 /**************************************************************************
2 *
3 * Copyright 2008-2016 by Andrey Butok. FNET Community.
4 *
5 ***************************************************************************
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ***************************************************************************
20 *
21 * TFTP Server API.
22 *
23 ***************************************************************************/
24 
25 #ifndef _FNET_TFTP_SRV_H_
26 
27 #define _FNET_TFTP_SRV_H_
28 
29 #if FNET_CFG_TFTP_SRV || defined(__DOXYGEN__)
30 
31 #include "fnet_tftp.h"
32 
53 /**************************************************************************/
87  const struct fnet_sockaddr *address,
88  fnet_char_t *filename, /* null-terminated.*/
89  fnet_char_t *mode, /* null-terminated.*/
90  fnet_tftp_error_t *error_code, /* error code [0-7] RFC783, if result==FNET_ERR*/
91  fnet_char_t * *error_message, /* optinal, if result==FNET_ERR*/
92  void *handler_param);
93 
94 /**************************************************************************/
145 typedef fnet_int32_t(*fnet_tftp_srv_data_handler_t)(fnet_tftp_request_t request,
146  fnet_uint8_t *data,
147  fnet_size_t data_size,
148  fnet_tftp_error_t *error_code,
149  fnet_char_t * *error_message,
150  void *handler_param);
151 
152 /**************************************************************************/
167  fnet_return_t status,
168  void *handler_param);
169 
170 /**************************************************************************/
173 typedef struct
174 {
175  struct fnet_sockaddr address;
210 
211 /**************************************************************************/
215 typedef long fnet_tftp_srv_desc_t;
216 
217 /**************************************************************************/
221 typedef enum
222 {
235 
236 #if defined(__cplusplus)
237 extern "C" {
238 #endif
239 
240 /***************************************************************************/
261 
262 /***************************************************************************/
279 
280 /***************************************************************************/
296 
297 #if defined(__cplusplus)
298 }
299 #endif
300 
303 #endif /* FNET_CFG_TFTP_SRV */
304 
305 #endif /* _FNET_TFTP_SRV_H_ */
fnet_bool_t fnet_tftp_srv_is_enabled(fnet_tftp_srv_desc_t desc)
Detects if the TFTP Server service is enabled or disabled.
TFTP server is waiting for a request from a TFTP client.
fnet_uint32_t fnet_time_t
Unsigned integer type representing time uinits. It can be seconds or milliseconds.
Definition: fnet_timer.h:64
fnet_tftp_srv_complete_handler_t complete_handler
Pointer to the optional callback function defined by fnet_tftp_srv_complete_handler_t(). This parameter is optional and can be set to zero.
fnet_return_t(* fnet_tftp_srv_request_handler_t)(fnet_tftp_request_t request_type, const struct fnet_sockaddr *address, fnet_char_t *filename, fnet_char_t *mode, fnet_tftp_error_t *error_code, fnet_char_t **error_message, void *handler_param)
Prototype of the TFTP-server callback function that is called when the TFTP server has received a new...
Definition: fnet_tftp_srv.h:86
fnet_tftp_srv_data_handler_t data_handler
Pointer to the callback function defined by fnet_tftp_srv_data_handler_t().
fnet_tftp_srv_desc_t fnet_tftp_srv_init(fnet_tftp_srv_params_t *params)
Initializes the TFTP-server service.
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:89
fnet_tftp_srv_request_handler_t request_handler
Pointer to the callback function defined by fnet_tftp_srv_request_handler_t().
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:55
void fnet_tftp_srv_release(fnet_tftp_srv_desc_t desc)
Releases the TFTP-server service.
The TFTP server is not initialized or released.
fnet_index_t retransmit_max
Maximum number of retransmissions. If no response from a TFTP client is received till maximum retran...
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:80
void * handler_param
Optional application-specific parameter. It is passed to the request_handler, data_handler and compl...
fnet_tftp_srv_state_t
TFTP server states. Used mainly for debugging purposes.
The DATA transfer is completed, or received error, or terminated by the application.
void(* fnet_tftp_srv_complete_handler_t)(fnet_tftp_request_t request, fnet_return_t status, void *handler_param)
Prototype of the TFTP-server callback function that is called when the TFTP server has completed file...
unsigned int fnet_index_t
Unsigned integer type representing the index.
Definition: fnet_stdlib.h:70
fnet_int32_t(* fnet_tftp_srv_data_handler_t)(fnet_tftp_request_t request, fnet_uint8_t *data, fnet_size_t data_size, fnet_tftp_error_t *error_code, fnet_char_t **error_message, void *handler_param)
Prototype of the TFTP-server callback function prototype that is called when the TFTP server has rece...
char fnet_char_t
Type representing the charecter.
Definition: fnet_stdlib.h:75
fnet_tftp_request_t
The TFTP request type. It defines a TFTP service behavior, if it will read or write a file from/to a ...
Definition: fnet_tftp.h:51
long fnet_tftp_srv_desc_t
TFTP server descriptor.
Input parameters for the fnet_tftp_srv_init() function.
Sends or receives DATA packets to the remote TFTP client.
Socket address structure.
Definition: fnet_socket.h:268
fnet_tftp_error_t
TFTP error codes indicating the nature of the error according to RFC 1350.
Definition: fnet_tftp.h:66
fnet_time_t timeout
Timeout for the TFTP client response in seconds. If no response from a TFTP client is received durin...

© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net