天嵌二次封装库使用手册  V1.0
wpa_ctrl.h
浏览该文件的文档.
1 #ifndef WPA_CTRL_H
2 #define WPA_CTRL_H
3 
18 #include <stdlib.h>
19 #include <stddef.h>
20 #include <stdio.h>
21 #include <sys/un.h>
22 #include <sys/socket.h>
23 #include <errno.h>
24 #include <unistd.h>
25 #include <string.h>
26 #include <fcntl.h>
27 #include <time.h>
28 #define CONFIG_CTRL_IFACE_CLIENT_DIR "/tmp"
29 #define CONFIG_CTRL_IFACE_CLIENT_PREFIX "wpa_ctrl_"
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
38  struct wpa_ctrl
39  {
40  int s;
41  struct sockaddr_un local;
42  struct sockaddr_un dest;
43  };
44 
54  struct wpa_ctrl *wpa_ctrl_open(const char *ctrl_path);
61  void wpa_ctrl_close(struct wpa_ctrl *ctrl);
75  int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
76  char *reply, size_t *reply_len);
85  int wpa_ctrl_attach(struct wpa_ctrl *ctrl);
93  int wpa_ctrl_detach(struct wpa_ctrl *ctrl);
105  int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
114  int wpa_ctrl_pending(struct wpa_ctrl *ctrl);
122  int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
132  int wpa_ctrl_send(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 #endif //WPA_CTRL
struct sockaddr_un dest
目标套接字地址的结构
Definition: wpa_ctrl.h:42
int wpa_ctrl_pending(struct wpa_ctrl *ctrl)
检查是否存在挂起(pending)的事件消息
struct sockaddr_un local
本地套接字地址的结构
Definition: wpa_ctrl.h:41
int wpa_ctrl_send(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len)
向wpa_supplicant/hostapd发送命令,但不会等待响应
void wpa_ctrl_close(struct wpa_ctrl *ctrl)
关闭wpa_supplicant/hostapd的控制接口
int wpa_ctrl_attach(struct wpa_ctrl *ctrl)
注册为控制接口的事件监视器
struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
打开wpa_supplicant/hostapd的控制接口
int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len)
接收挂起(pending)的控制接口消息
int s
用来存创建的套接字描述符
Definition: wpa_ctrl.h:40
int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len, char *reply, size_t *reply_len)
发送指令到wpa_supplicant/hostapd
控制接口库的内部结构
Definition: wpa_ctrl.h:38
int wpa_ctrl_detach(struct wpa_ctrl *ctrl)
从控制接口注销事件监视器
int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl)
获取控制接口使用的文件描述符