about summary refs log tree commit diff
path: root/src/libwpactrl/wpactrl_setnetworkoption.c
blob: 5b2fdcada3a0d5ea4982674731963d4b84d9cb6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ISC license. */

#include <string.h>
#include <skalibs/uint32.h>
#include <bcnm/wpactrl.h>

wparesponse_t wpactrl_setnetworkoption (wpactrl_t *a, uint32_t id, char const *var, char const *val, tain_t *stamp)
{
  size_t varlen = strlen(var) ;
  size_t vallen = strlen(val) ;
  size_t idlen ;
  char buf[15 + UINT32_FMT + varlen + vallen] ;
  memcpy(buf, "SET_NETWORK ", 12) ;
  idlen = uint32_fmt(buf + 12, id) ;
  buf[12 + idlen] = ' ' ;
  memcpy(buf + 13 + idlen, var, varlen) ;
  buf[13 + idlen + varlen] = ' ' ;
  memcpy(buf + 14 + idlen + varlen, val, vallen) ;
  buf[14 + idlen + varlen + vallen] = 0 ;
  return wpactrl_command(a, buf, stamp) ;
}