Lines Matching refs:index

619 int wifi_connect_on_socket_path(int index, const char *path)
630 ctrl_conn[index] = wpa_ctrl_open(path);
631 if (ctrl_conn[index] == NULL) {
636 monitor_conn[index] = wpa_ctrl_open(path);
637 if (monitor_conn[index] == NULL) {
638 wpa_ctrl_close(ctrl_conn[index]);
639 ctrl_conn[index] = NULL;
642 if (wpa_ctrl_attach(monitor_conn[index]) != 0) {
643 wpa_ctrl_close(monitor_conn[index]);
644 wpa_ctrl_close(ctrl_conn[index]);
645 ctrl_conn[index] = monitor_conn[index] = NULL;
649 if (socketpair(AF_UNIX, SOCK_STREAM, 0, exit_sockets[index]) == -1) {
650 wpa_ctrl_close(monitor_conn[index]);
651 wpa_ctrl_close(ctrl_conn[index]);
652 ctrl_conn[index] = monitor_conn[index] = NULL;
677 int wifi_send_command(int index, const char *cmd, char *reply, size_t *reply_len)
681 if (ctrl_conn[index] == NULL) {
685 ret = wpa_ctrl_request(ctrl_conn[index], cmd, strlen(cmd), reply, reply_len, NULL);
689 TEMP_FAILURE_RETRY(write(exit_sockets[index][0], "T", 1));
700 int wifi_ctrl_recv(int index, char *reply, size_t *reply_len)
703 int ctrlfd = wpa_ctrl_get_fd(monitor_conn[index]);
709 rfds[1].fd = exit_sockets[index][1];
717 return wpa_ctrl_recv(monitor_conn[index], reply, reply_len);
724 int wifi_wait_on_socket(int index, char *buf, size_t buflen)
733 if (monitor_conn[index] == NULL) {
740 result = wifi_ctrl_recv(index, buf, &nread);
793 void wifi_close_sockets(int index)
795 if (ctrl_conn[index] != NULL) {
796 wpa_ctrl_close(ctrl_conn[index]);
797 ctrl_conn[index] = NULL;
800 if (monitor_conn[index] != NULL) {
801 wpa_ctrl_close(monitor_conn[index]);
802 monitor_conn[index] = NULL;
805 if (exit_sockets[index][0] >= 0) {
806 close(exit_sockets[index][0]);
807 exit_sockets[index][0] = -1;
810 if (exit_sockets[index][1] >= 0) {
811 close(exit_sockets[index][1]);
812 exit_sockets[index][1] = -1;