Embedded TCP/IP stack: fnet_tftp_srv.h Source File

FNET

fnet_tftp_srv.h
1 /**************************************************************************
2 *
3 * Copyright 2011-2016 by Andrey Butok. FNET Community.
4 * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License"); you may
9 * not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 ***************************************************************************
21 *
22 * TFTP Server API.
23 *
24 ***************************************************************************/
25 
26 #ifndef _FNET_TFTP_SRV_H_
27 
28 #define _FNET_TFTP_SRV_H_
29 
30 #if FNET_CFG_TFTP_SRV || defined(__DOXYGEN__)
31 
32 #include "fnet_tftp.h"
33 
54 /**************************************************************************/
88  const struct fnet_sockaddr *address,
89  fnet_char_t *filename, /* null-terminated.*/
90  fnet_char_t *mode, /* null-terminated.*/
91  fnet_tftp_error_t *error_code, /* error code [0-7] RFC783, if result==FNET_ERR*/
92  fnet_char_t * *error_message, /* optinal, if result==FNET_ERR*/
93  void *handler_param);
94 
95 /**************************************************************************/
146 typedef fnet_int32_t(*fnet_tftp_srv_data_handler_t)(fnet_tftp_request_t request,
147  fnet_uint8_t *data,
148  fnet_size_t data_size,
149  fnet_tftp_error_t *error_code,
150  fnet_char_t * *error_message,
151  void *handler_param);
152 
153 /**************************************************************************/
168  fnet_return_t status,
169  void *handler_param);
170 
171 /**************************************************************************/
175 {
176  struct fnet_sockaddr address;
210 };
211 
212 /**************************************************************************/
216 typedef long fnet_tftp_srv_desc_t;
217 
218 /**************************************************************************/
222 typedef enum
223 {
236 
237 #if defined(__cplusplus)
238 extern "C" {
239 #endif
240 
241 /***************************************************************************/
262 
263 /***************************************************************************/
280 
281 /***************************************************************************/
297 
298 #if defined(__cplusplus)
299 }
300 #endif
301 
304 #endif /* FNET_CFG_TFTP_SRV */
305 
306 #endif /* _FNET_TFTP_SRV_H_ */
fnet_tftp_srv_desc_t fnet_tftp_srv_init(struct fnet_tftp_srv_params *params)
Initializes the TFTP-server service.
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_time_t timeout
Timeout for the TFTP client response in seconds. If no response from a TFTP client is received durin...
fnet_uint32_t fnet_time_t
Unsigned integer type representing time uinits. It can be ticks, seconds or milliseconds.
Definition: fnet_timer.h:66
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:87
fnet_tftp_srv_request_handler_t request_handler
Pointer to the callback function defined by fnet_tftp_srv_request_handler_t().
Input parameters for the fnet_tftp_srv_init() function.
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:90
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:56
fnet_index_t retransmit_max
Maximum number of retransmissions. If no response from a TFTP client is received till maximum retran...
void fnet_tftp_srv_release(fnet_tftp_srv_desc_t desc)
Releases the TFTP-server service.
The TFTP server is not initialized or released.
void * handler_param
Optional application-specific parameter. It is passed to the request_handler, data_handler and compl...
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:81
fnet_tftp_srv_data_handler_t data_handler
Pointer to the callback function defined by fnet_tftp_srv_data_handler_t().
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_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:71
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:76
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:52
long fnet_tftp_srv_desc_t
TFTP server descriptor.
Sends or receives DATA packets to the remote TFTP client.
Socket address structure.
Definition: fnet_socket.h:270
fnet_tftp_error_t
TFTP error codes indicating the nature of the error according to RFC 1350.
Definition: fnet_tftp.h:67

© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net