cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

ping.h (969B)


      1#ifndef _PING_H
      2#define _PING_H
      3
      4#include <stdint.h>
      5#ifdef WIN32
      6	typedef int socklen_t;
      7	struct sockaddr;
      8#else
      9	#include <sys/socket.h>
     10#endif
     11
     12unsigned short checksum(const unsigned char *b, uint16_t len);
     13
     14//Callback (when received)
     15void display(uint8_t *buf, int bytes);
     16
     17//Callback (before sending)
     18//return value = # of bytes to send in ping message.
     19int load_ping_packet( uint8_t  * buffer, int buffersize );
     20
     21void listener();
     22void ping(struct sockaddr *addr, socklen_t addr_len );
     23void do_pinger( );
     24
     25void singleping(struct sockaddr *addr, socklen_t addr_len ); // If using this, must call ping_setup( 0, 0); to begin.
     26
     27//If pingperiodseconds = -1, run ping/do_pinger once and exit.
     28extern float pingperiodseconds;
     29extern int precise_ping; //if 0, use minimal CPU, but ping send-outs are only approximate, if 1, spinlock until precise time for ping is hit.
     30extern int ping_failed_to_send;
     31void ping_setup(const char * strhost, const char * device);
     32
     33
     34#endif
     35