• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/uqmi/uqmi/commands.h

  1 /*
  2  * uqmi -- tiny QMI support implementation
  3  *
  4  * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the
 18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 19  * Boston, MA 02110-1301 USA.
 20  */
 21 
 22 #ifndef __UQMI_COMMANDS_H
 23 #define __UQMI_COMMANDS_H
 24 
 25 #include <stdbool.h>
 26 #include <libubox/blob.h>
 27 
 28 #include "commands-wds.h"
 29 #include "commands-dms.h"
 30 #include "commands-nas.h"
 31 #include "commands-wms.h"
 32 #include "commands-wda.h"
 33 #include "commands-uim.h"
 34 
 35 enum qmi_cmd_result {
 36         QMI_CMD_DONE,
 37         QMI_CMD_REQUEST,
 38         QMI_CMD_EXIT,
 39 };
 40 
 41 enum {
 42         CMD_TYPE_OPTION = -1,
 43 };
 44 
 45 struct uqmi_cmd_handler {
 46         const char *name;
 47         int type;
 48 
 49         enum qmi_cmd_result (*prepare)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg);
 50         void (*cb)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg);
 51 };
 52 
 53 struct uqmi_cmd {
 54         const struct uqmi_cmd_handler *handler;
 55         char *arg;
 56 };
 57 
 58 #define __uqmi_commands \
 59         __uqmi_command(version, get-versions, no, QMI_SERVICE_CTL), \
 60         __uqmi_command(sync, sync, no, QMI_SERVICE_CTL), \
 61         __uqmi_command(set_client_id, set-client-id, required, CMD_TYPE_OPTION), \
 62         __uqmi_command(get_client_id, get-client-id, required, QMI_SERVICE_CTL), \
 63         __uqmi_command(ctl_set_data_format, set-data-format, required, QMI_SERVICE_CTL), \
 64         __uqmi_wds_commands, \
 65         __uqmi_dms_commands, \
 66         __uqmi_nas_commands, \
 67         __uqmi_wms_commands, \
 68         __uqmi_wda_commands, \
 69         __uqmi_uim_commands
 70 
 71 #define __uqmi_command(_name, _optname, _arg, _option) __UQMI_COMMAND_##_name
 72 enum uqmi_command {
 73         __uqmi_commands,
 74         __UQMI_COMMAND_LAST
 75 };
 76 #undef __uqmi_command
 77 
 78 extern bool single_line;
 79 extern const struct uqmi_cmd_handler uqmi_cmd_handler[];
 80 extern struct blob_buf status;
 81 void uqmi_add_command(char *arg, int longidx);
 82 bool uqmi_run_commands(struct qmi_dev *qmi);
 83 int uqmi_add_error(const char *msg);
 84 
 85 #endif
 86 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt