[ping] Add generic ping mechanism

Add generic pinger mechanism (analogous to the generic downloader
mechanism) which opens a ping socket, transmits ping requests, and
passes information about ping replies to a callback function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-10-21 14:17:47 +01:00
parent 46873eda44
commit c597c7a071
3 changed files with 327 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ERRFILE_xferbuf ( ERRFILE_CORE | 0x00180000 )
#define ERRFILE_pending ( ERRFILE_CORE | 0x00190000 )
#define ERRFILE_null_reboot ( ERRFILE_CORE | 0x001a0000 )
#define ERRFILE_pinger ( ERRFILE_CORE | 0x001b0000 )
#define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 )
#define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 )

23
src/include/ipxe/pinger.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef _IPXE_PINGER_H
#define _IPXE_PINGER_H
/** @file
*
* ICMP ping sender
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <ipxe/interface.h>
#include <ipxe/socket.h>
extern int create_pinger ( struct interface *job, const char *hostname,
unsigned long timeout, size_t len,
void ( * callback ) ( struct sockaddr *peer,
unsigned int sequence,
size_t len,
int rc ) );
#endif /* _IPXE_PINGER_H */