Embedded TCP/IP stack: fnet_ping.h Source File

FNET

fnet_ping.h
1 /**************************************************************************
2 *
3 * Copyright 2011-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 * 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 /**************************************************************************/
59 typedef enum
60 {
71 
72 /**************************************************************************/
90 typedef void(*fnet_ping_callback_t)(fnet_error_t result, fnet_size_t packet_count, struct fnet_sockaddr *target_addr, void* cookie);
91 
92 /**************************************************************************/
96 {
97  struct fnet_sockaddr target_addr;
103  fnet_uint8_t ttl;
104  fnet_uint8_t pattern;
109  void *cookie;
111 };
112 
113 #if defined(__cplusplus)
114 extern "C" {
115 #endif
116 
117 /***************************************************************************/
145 
146 /***************************************************************************/
161 void fnet_ping_release(void);
162 
163 /***************************************************************************/
179 
180 #if defined(__cplusplus)
181 }
182 #endif
183 
186 #endif /* FNET_CFG_PING */
187 
188 #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:90
The PING service is waiting for echo reply.
Definition: fnet_ping.h:65
The PING service is waying a timeout till next request.
Definition: fnet_ping.h:67
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_size_t packet_count
Number of packets to be sent.
Definition: fnet_ping.h:100
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:90
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:56
fnet_uint8_t ttl
IPv4 Time To Live (TTL) or IPv6 Hop Limit value. .
Definition: fnet_ping.h:103
The PING service is going to send echo request.
Definition: fnet_ping.h:63
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:104
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:106
fnet_ping_state_t fnet_ping_state(void)
Retrieves the current state of the PING service (for debugging purposes).
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:98
Initialization parameters for the fnet_ping_request() function.
Definition: fnet_ping.h:95
fnet_return_t fnet_ping_request(struct fnet_ping_params *params)
Initializes PING service.
fnet_ping_state_t
PING service states. Used mainly for debugging purposes.
Definition: fnet_ping.h:59
fnet_time_t timeout
Timeout value in milliseconds, that service waits for reply on ping request.
Definition: fnet_ping.h:101
fnet_error_t
Possible socket error codes, returned by the fnet_error_get(), or used by the SO_ERROR option...
Definition: fnet_error.h:42
The PING service is not initialized or is released.
Definition: fnet_ping.h:61
Socket address structure.
Definition: fnet_socket.h:270
void * cookie
Optional application-specific parameter. It's passed to the callback function as input parameter...
Definition: fnet_ping.h:109

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