XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_ping.c 文件参考
#include <stdlib.h>
#include <stdbool.h>
#include "lwip/opt.h"
#include "lwip/init.h"
#include "lwip/mem.h"
#include "lwip/icmp.h"
#include "lwip/netif.h"
#include "lwip/sys.h"
#include "lwip/timeouts.h"
#include "lwip/inet.h"
#include "lwip/inet_chksum.h"
#include "lwip/ip.h"
#include "lwip/netdb.h"
#include "lwip/sockets.h"
#include "xf_sys.h"
#include "xf_ping.h"
xf_ping.c 的引用(Include)关系图:

浏览源代码.

宏定义

#define PING_TIME_DIFF_MS(_end, _start)    ((uint32_t)((_end - _start) / 1000))
 
#define PING_CHECK_START_TIMEOUT_MS   (100)
 
#define PING_FLAGS_INIT   (1 << 0)
 
#define PING_FLAGS_RUN   (1 << 1)
 
#define THREAD_NOTIFY_BIT   0x01
 
#define XF_GOTO_ON_FALSE(a, err_code, goto_tag, log_tag, format, ...)
 
#define WAIT_CNT_MAX   1000
 

函数

static xf_err_t xf_ping_send (xf_ping_ctx_t *ctx)
 
static int xf_ping_receive (xf_ping_ctx_t *ctx)
 
static void xf_ping_thread (void *args)
 
xf_err_t xf_ping_new_session (const xf_ping_cfg_t *p_cfg, xf_ping_cb_t cb_func, void *user_args, xf_ping_t *hdl_out)
 创建 ping 会话。
 
xf_err_t xf_ping_delete_session (xf_ping_t hdl)
 删除 ping 会话。
 
xf_err_t xf_ping_start (xf_ping_t hdl)
 启动 ping 会话。
 
xf_err_t xf_ping_restart (xf_ping_t hdl, const xf_ping_cfg_t *p_cfg, xf_ping_cfg_update_flags_t *p_flags)
 重新启动 ping 会话。
 
bool xf_ping_is_running (xf_ping_t hdl)
 检查 ping 是否正在运行。
 
xf_err_t xf_ping_stop (xf_ping_t hdl)
 停止 ping 会话。
 

变量

static const char * TAG = "xf_ping"
 

详细描述

作者
catcatBlue (catca.nosp@m.tblu.nosp@m.e@qq..nosp@m.com)
版本
1.0
日期
2024-10-12

Copyright (c) 2024, CorAL. All rights reserved.

在文件 xf_ping.c 中定义.

宏定义说明

◆ PING_TIME_DIFF_MS

#define PING_TIME_DIFF_MS (   _end,
  _start 
)     ((uint32_t)((_end - _start) / 1000))

在文件 xf_ping.c35 行定义.

◆ PING_CHECK_START_TIMEOUT_MS

#define PING_CHECK_START_TIMEOUT_MS   (100)

在文件 xf_ping.c38 行定义.

◆ PING_FLAGS_INIT

#define PING_FLAGS_INIT   (1 << 0)

在文件 xf_ping.c40 行定义.

◆ PING_FLAGS_RUN

#define PING_FLAGS_RUN   (1 << 1)

在文件 xf_ping.c41 行定义.

◆ THREAD_NOTIFY_BIT

#define THREAD_NOTIFY_BIT   0x01

在文件 xf_ping.c43 行定义.

◆ XF_GOTO_ON_FALSE

#define XF_GOTO_ON_FALSE (   a,
  err_code,
  goto_tag,
  log_tag,
  format,
  ... 
)
值:
do { \
if (unlikely(!(a))) { \
XF_LOGE(log_tag, format, ##__VA_ARGS__); \
ret = err_code; \
goto goto_tag; \
} \
} while (0)
#define unlikely(x)
分支预测,优化条件为 假 的可能性更大的情况。
Definition xf_attr.h:113

在文件 xf_ping.c59 行定义.

◆ WAIT_CNT_MAX

#define WAIT_CNT_MAX   1000

函数说明

◆ xf_ping_send()

static xf_err_t xf_ping_send ( xf_ping_ctx_t ctx)
static

在文件 xf_ping.c347 行定义.

◆ xf_ping_receive()

static int xf_ping_receive ( xf_ping_ctx_t ctx)
static

< sock buffer, 64 字节足以容纳 IP 头和 ICMP 头

< ICMP 的数据部分

在文件 xf_ping.c376 行定义.

◆ xf_ping_thread()

static void xf_ping_thread ( void *  args)
static

< 在循环内更新,此处赋值有可能无法获得实际值

在文件 xf_ping.c437 行定义.

变量说明

◆ TAG

const char* TAG = "xf_ping"
static

在文件 xf_ping.c55 行定义.