iperf.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Iperf Example - iperf declaration
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #ifndef __IPERF_H_
  8. #define __IPERF_H_
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include "esp_types.h"
  13. #include "esp_err.h"
  14. #define IPERF_FLAG_CLIENT (1)
  15. #define IPERF_FLAG_SERVER (1 << 1)
  16. #define IPERF_FLAG_TCP (1 << 2)
  17. #define IPERF_FLAG_UDP (1 << 3)
  18. #define IPERF_DEFAULT_PORT 5001
  19. #define IPERF_DEFAULT_INTERVAL 3
  20. #define IPERF_DEFAULT_TIME 30
  21. #define IPERF_TRAFFIC_TASK_NAME "iperf_traffic"
  22. #define IPERF_TRAFFIC_TASK_PRIORITY 10
  23. #define IPERF_TRAFFIC_TASK_STACK 4096
  24. #define IPERF_REPORT_TASK_NAME "iperf_report"
  25. #define IPERF_REPORT_TASK_PRIORITY 20
  26. #define IPERF_REPORT_TASK_STACK 4096
  27. #define IPERF_REPORT_TASK_NAME "iperf_report"
  28. #define IPERF_UDP_TX_LEN (1472)
  29. #define IPERF_UDP_RX_LEN (16 << 10)
  30. #define IPERF_TCP_TX_LEN (16 << 10)
  31. #define IPERF_TCP_RX_LEN (16 << 10)
  32. #define IPERF_MAX_DELAY 64
  33. #define IPERF_SOCKET_RX_TIMEOUT 10
  34. #define IPERF_SOCKET_ACCEPT_TIMEOUT 5
  35. typedef struct {
  36. uint32_t flag;
  37. uint32_t dip;
  38. uint32_t sip;
  39. uint16_t dport;
  40. uint16_t sport;
  41. uint32_t interval;
  42. uint32_t time;
  43. } iperf_cfg_t;
  44. esp_err_t iperf_start(iperf_cfg_t *cfg);
  45. esp_err_t iperf_stop(void);
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif