Embedded TCP/IP stack  4.7.0
fnet_ping.h
1 /**************************************************************************
2 *
3 * Copyright 2011-2018 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 * PING API.
22 *
23 ***************************************************************************/
24 
25 #ifndef _FNET_PING_H_
26 
27 #define _FNET_PING_H_
28 
29 #if FNET_CFG_PING || defined(__DOXYGEN__)
30 
55 /**************************************************************************/
73 typedef void(*fnet_ping_callback_t)(fnet_error_t result, fnet_size_t packet_count, struct fnet_sockaddr *target_addr, void *cookie);
74 
75 /**************************************************************************/
78 typedef struct
79 {
80  struct fnet_sockaddr target_addr;
86  fnet_uint8_t ttl;
87  fnet_uint8_t pattern;
92  void *cookie;
95 
96 #if defined(__cplusplus)
97 extern "C" {
98 #endif
99 
100 /***************************************************************************/
128 
129 /***************************************************************************/
144 void fnet_ping_release(void);
145 
146 #if defined(__cplusplus)
147 }
148 #endif
149 
152 #endif /* FNET_CFG_PING */
153 
154 #endif /* _FNET_PING_H_ */
void(* fnet_ping_callback_t)(fnet_error_t result, fnet_size_t packet_count, struct fnet_sockaddr *target_addr, void *cookie)
Prototype of the PING-service callback function that is called when the PING-service has completed th...
Definition: fnet_ping.h:73
fnet_uint8_t pattern
Pattern byte to fill out the packet. This is useful for diagnosing data-dependent problems in a netwo...
Definition: fnet_ping.h:87
fnet_uint32_t fnet_time_t
Unsigned integer type representing time uinits. It can be seconds or milliseconds.
Definition: fnet_timer.h:64
fnet_return_t fnet_ping_init(fnet_ping_params_t *params)
Initializes PING service.
fnet_size_t packet_size
The size of the echo request, in bytes (without ICMP header). The maximum value is limited by FNET_C...
Definition: fnet_ping.h:81
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:89
void fnet_ping_release(void)
Releases the PING service.
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:55
fnet_time_t timeout
Timeout value in milliseconds, that service waits for reply on ping request.
Definition: fnet_ping.h:84
fnet_uint8_t ttl
IPv4 Time To Live (TTL) or IPv6 Hop Limit value. .
Definition: fnet_ping.h:86
void * cookie
Optional application-specific parameter. It's passed to the callback function as input parameter...
Definition: fnet_ping.h:92
fnet_ping_callback_t callback
Pointer to the callback function defined by fnet_ping_callback_t. It is called when the correct echo ...
Definition: fnet_ping.h:89
Initialization parameters for the fnet_ping_init() function.
Definition: fnet_ping.h:78
fnet_size_t packet_count
Number of packets to be sent.
Definition: fnet_ping.h:83
fnet_error_t
Possible socket error codes, returned by the fnet_error_get(), or used by the SO_ERROR option...
Definition: fnet_error.h:41
Socket address structure.
Definition: fnet_socket.h:268

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