about summary refs log tree commit diff
path: root/src/libwpactrl/wpactrl_query.c
blob: b8b42df63f4cf5873cf045f0a8a102a1ef8ae5c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <string.h>
#include <skalibs/unix-timed.h>
#include <bcnm/wpactrl.h>
#include "wpactrl-internal.h"

ssize_t wpactrl_query (wpactrl_t *a, char const *q, char *ans, size_t ansmax, tain_t *stamp)
{
  tain_t deadline ;
  tain_add(&deadline, stamp, &a->tto) ;
  if (!ipc_timed_send(a->fds, q, strlen(q), &deadline, stamp)) return WPA_ERROR ;
  return wpactrl_fd_timed_recv(a->fds, ans, ansmax, &deadline, stamp) ;
}