blob: 7fc17fd479bc3707a3d63c32b674575e988219f6 [file] [log] [blame]
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001/*
2 * Sigma Control API DUT (station/AP/sniffer)
3 * Copyright (c) 2011-2013, Qualcomm Atheros, Inc.
4 * All Rights Reserved.
5 * Licensed under the Clear BSD license. See README for more details.
6 */
7
8#include "sigma_dut.h"
9
10
11static int cmd_dev_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
12 struct sigma_cmd *cmd)
13{
14 if (dut->mode == SIGMA_MODE_STATION ||
15 dut->mode == SIGMA_MODE_UNKNOWN) {
16 sigma_dut_print(dut, DUT_MSG_DEBUG, "Convert "
17 "dev_send_frame to sta_send_frame");
18 return cmd_sta_send_frame(dut, conn, cmd);
19 }
20
21 if (dut->mode == SIGMA_MODE_AP) {
22 sigma_dut_print(dut, DUT_MSG_DEBUG, "Convert "
23 "dev_send_frame to ap_send_frame");
24 return cmd_ap_send_frame(dut, conn, cmd);
25 }
26
27#ifdef CONFIG_WLANTEST
28 sigma_dut_print(dut, DUT_MSG_DEBUG, "Convert dev_send_frame to "
29 "wlantest_send_frame");
30 return cmd_wlantest_send_frame(dut, conn, cmd);
31#else /* CONFIG_WLANTEST */
32 send_resp(dut, conn, SIGMA_ERROR,
33 "errorCode,Unsupported dev_send_frame");
34 return 0;
35#endif /* CONFIG_WLANTEST */
36}
37
38
39static int cmd_dev_set_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
40 struct sigma_cmd *cmd)
41{
42 const char *device = get_param(cmd, "Device");
43
44 if (device && strcasecmp(device, "STA") == 0) {
45 sigma_dut_print(dut, DUT_MSG_DEBUG, "Convert "
46 "dev_set_parameter to sta_set_parameter");
47 return cmd_sta_set_parameter(dut, conn, cmd);
48 }
49
50 return -1;
51}
52
53
54static int req_intf_prog(struct sigma_cmd *cmd)
55{
56 if (get_param(cmd, "interface") == NULL)
57 return -1;
58 if (get_param(cmd, "program") == NULL)
59 return -1;
60 return 0;
61}
62
63
64void dev_register_cmds(void)
65{
66 sigma_dut_reg_cmd("dev_send_frame", req_intf_prog, cmd_dev_send_frame);
67 sigma_dut_reg_cmd("dev_set_parameter", req_intf_prog,
68 cmd_dev_set_parameter);
69}