ping.h 883 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _PING_H_
  2. #define _PING_H_
  3. #include "w5500_conf.h"
  4. #include "w5500.h"
  5. #include "socket.h"
  6. #include "Types.h"
  7. #include "utility.h"
  8. #define BUF_LEN 128
  9. #define PING_REQUEST 8
  10. #define PING_REPLY 0
  11. #define CODE_ZERO 0
  12. #define SOCKET_ERROR 1
  13. #define TIMEOUT_ERROR 2
  14. #define SUCCESS 3
  15. #define REPLY_ERROR 4
  16. extern uint8 req;
  17. typedef struct pingmsg
  18. {
  19. uint8 Type; // 0 - Ping Reply, 8 - Ping Request
  20. uint8 Code; // Always 0
  21. uint16 CheckSum; // Check sum
  22. uint16 ID; // Identification
  23. uint16 SeqNum; // Sequence Number
  24. int8_t Data[BUF_LEN];// Ping Data : 1452 = IP RAW MTU - sizeof(Type+Code+CheckSum+ID+SeqNum)
  25. } PINGMSGR;
  26. void ping_auto(uint8 s, uint8 *addr);
  27. void ping_count(uint8 s, uint16_t pCount, uint8 *addr);
  28. uint8 ping_request(uint8 s, uint8 *addr);
  29. uint8 ping_reply(uint8 s, uint8 *addr, uint16_t rlen);
  30. void do_ping(void);
  31. #endif