libqcdm,libwmc: use C99 sized types from stdint.h

This commit is contained in:
Aleksander Morgado
2016-11-23 16:19:57 +01:00
parent 944e34ecdb
commit 905c8a48e9
28 changed files with 764 additions and 783 deletions

View File

@@ -29,8 +29,8 @@
/**********************************************************************/
static u_int8_t
cdma_prev_to_qcdm (u_int8_t cdma)
static uint8_t
cdma_prev_to_qcdm (uint8_t cdma)
{
switch (cdma) {
case CDMA_PREV_IS_95:
@@ -53,8 +53,8 @@ cdma_prev_to_qcdm (u_int8_t cdma)
return QCDM_CDMA_PREV_UNKNOWN;
}
static u_int8_t
cdma_band_class_to_qcdm (u_int8_t cdma)
static uint8_t
cdma_band_class_to_qcdm (uint8_t cdma)
{
switch (cdma) {
case CDMA_BAND_CLASS_0_CELLULAR_800:
@@ -103,8 +103,8 @@ cdma_band_class_to_qcdm (u_int8_t cdma)
return QCDM_CDMA_BAND_CLASS_UNKNOWN;
}
static u_int8_t
nv_mode_pref_from_qcdm (u_int8_t qcdm)
static uint8_t
nv_mode_pref_from_qcdm (uint8_t qcdm)
{
switch (qcdm) {
case QCDM_CMD_NV_MODE_PREF_ITEM_MODE_PREF_DIGITAL:
@@ -152,7 +152,7 @@ nv_mode_pref_from_qcdm (u_int8_t qcdm)
*
*/
static char *
bin2hexstr (const u_int8_t *bytes, int len)
bin2hexstr (const uint8_t *bytes, int len)
{
static char hex_digits[] = "0123456789abcdef";
char *result;
@@ -178,7 +178,7 @@ bin2hexstr (const u_int8_t *bytes, int len)
/**********************************************************************/
static qcdmbool
check_command (const char *buf, size_t len, u_int8_t cmd, size_t min_len, int *out_error)
check_command (const char *buf, size_t len, uint8_t cmd, size_t min_len, int *out_error)
{
if (len < 1) {
qcdm_err (0, "DM command response malformed (must be at least 1 byte in length)");
@@ -241,7 +241,7 @@ check_command (const char *buf, size_t len, u_int8_t cmd, size_t min_len, int *o
}
static int
nv_status_to_qcdm_error (u_int16_t status)
nv_status_to_qcdm_error (uint16_t status)
{
switch (status) {
case DIAG_NV_STATUS_OK:
@@ -266,9 +266,9 @@ nv_status_to_qcdm_error (u_int16_t status)
}
static qcdmbool
check_nv_cmd (DMCmdNVReadWrite *cmd, u_int16_t nv_item, int *out_error)
check_nv_cmd (DMCmdNVReadWrite *cmd, uint16_t nv_item, int *out_error)
{
u_int16_t cmd_item;
uint16_t cmd_item;
qcdm_return_val_if_fail (cmd != NULL, FALSE);
qcdm_return_val_if_fail ((cmd->code == DIAG_CMD_NV_READ) || (cmd->code == DIAG_CMD_NV_WRITE), FALSE);
@@ -375,7 +375,7 @@ qcdm_cmd_esn_result (const char *buf, size_t len, int *out_error)
QcdmResult *result = NULL;
DMCmdEsnRsp *rsp = (DMCmdEsnRsp *) buf;
char *tmp;
u_int8_t swapped[4];
uint8_t swapped[4];
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -403,7 +403,7 @@ qcdm_cmd_esn_result (const char *buf, size_t len, int *out_error)
/**********************************************************************/
size_t
qcdm_cmd_control_new (char *buf, size_t len, u_int8_t mode)
qcdm_cmd_control_new (char *buf, size_t len, uint8_t mode)
{
char cmdbuf[5];
DMCmdControl *cmd = (DMCmdControl *) &cmdbuf[0];
@@ -413,7 +413,7 @@ qcdm_cmd_control_new (char *buf, size_t len, u_int8_t mode)
memset (cmd, 0, sizeof (*cmd));
cmd->code = DIAG_CMD_CONTROL;
cmd->mode = htole16 ((u_int16_t) mode);
cmd->mode = htole16 ((uint16_t) mode);
return dm_encapsulate_buffer (cmdbuf, sizeof (*cmd), sizeof (cmdbuf), buf, len);
}
@@ -452,8 +452,8 @@ qcdm_cmd_cdma_status_result (const char *buf, size_t len, int *out_error)
QcdmResult *result = NULL;
DMCmdStatusRsp *rsp = (DMCmdStatusRsp *) buf;
char *tmp;
u_int8_t swapped[4];
u_int32_t tmp_num;
uint8_t swapped[4];
uint32_t tmp_num;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -474,27 +474,27 @@ qcdm_cmd_cdma_status_result (const char *buf, size_t len, int *out_error)
qcdm_result_add_string (result, QCDM_CMD_CDMA_STATUS_ITEM_ESN, tmp);
free (tmp);
tmp_num = (u_int32_t) le16toh (rsp->rf_mode);
tmp_num = (uint32_t) le16toh (rsp->rf_mode);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_RF_MODE, tmp_num);
tmp_num = (u_int32_t) le16toh (rsp->cdma_rx_state);
tmp_num = (uint32_t) le16toh (rsp->cdma_rx_state);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_RX_STATE, tmp_num);
tmp_num = (u_int32_t) le16toh (rsp->entry_reason);
tmp_num = (uint32_t) le16toh (rsp->entry_reason);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_ENTRY_REASON, tmp_num);
tmp_num = (u_int32_t) le16toh (rsp->curr_chan);
tmp_num = (uint32_t) le16toh (rsp->curr_chan);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_CURRENT_CHANNEL, tmp_num);
qcdm_result_add_u8 (result, QCDM_CMD_CDMA_STATUS_ITEM_CODE_CHANNEL, rsp->cdma_code_chan);
tmp_num = (u_int32_t) le16toh (rsp->pilot_base);
tmp_num = (uint32_t) le16toh (rsp->pilot_base);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_PILOT_BASE, tmp_num);
tmp_num = (u_int32_t) le16toh (rsp->sid);
tmp_num = (uint32_t) le16toh (rsp->sid);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_SID, tmp_num);
tmp_num = (u_int32_t) le16toh (rsp->nid);
tmp_num = (uint32_t) le16toh (rsp->nid);
qcdm_result_add_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_NID, tmp_num);
return result;
@@ -566,15 +566,15 @@ qcdm_cmd_status_snapshot_new (char *buf, size_t len)
return dm_encapsulate_buffer (cmdbuf, sizeof (*cmd), sizeof (cmdbuf), buf, len);
}
static u_int8_t
snapshot_state_to_qcdm (u_int8_t cdma_state)
static uint8_t
snapshot_state_to_qcdm (uint8_t cdma_state)
{
/* CDMA_STATUS_SNAPSHOT_STATE_* -> QCDM_STATUS_SNAPSHOT_STATE_* */
return cdma_state + 1;
}
static inline u_int8_t
digit_fixup (u_int8_t d)
static inline uint8_t
digit_fixup (uint8_t d)
{
/* CDMA MCC/IMSI conversion adds 1 to each digit, and digits equal to
* 10 are really zero.
@@ -590,9 +590,9 @@ qcdm_cmd_status_snapshot_result (const char *buf, size_t len, int *out_error)
QcdmResult *result = NULL;
DMCmdStatusSnapshotRsp *rsp = (DMCmdStatusSnapshotRsp *) buf;
char *tmp;
u_int8_t swapped[4];
u_int8_t tmcc[3];
u_int16_t mcc, hmcc;
uint8_t swapped[4];
uint8_t tmcc[3];
uint16_t mcc, hmcc;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -653,7 +653,7 @@ qcdm_cmd_pilot_sets_new (char *buf, size_t len)
#define PILOT_SETS_CMD_NEIGHBOR_SET "neighbor-set"
static const char *
set_num_to_str (u_int32_t num)
set_num_to_str (uint32_t num)
{
if (num == QCDM_CMD_PILOT_SETS_TYPE_ACTIVE)
return PILOT_SETS_CMD_ACTIVE_SET;
@@ -682,7 +682,7 @@ qcdm_cmd_pilot_sets_result (const char *buf, size_t len, int *out_error)
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_CMD_ACTIVE_SET,
(const u_int8_t *) &rsp->sets[0],
(const uint8_t *) &rsp->sets[0],
sets_len);
}
@@ -690,7 +690,7 @@ qcdm_cmd_pilot_sets_result (const char *buf, size_t len, int *out_error)
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_CMD_CANDIDATE_SET,
(const u_int8_t *) &rsp->sets[rsp->active_count],
(const uint8_t *) &rsp->sets[rsp->active_count],
sets_len);
}
@@ -698,7 +698,7 @@ qcdm_cmd_pilot_sets_result (const char *buf, size_t len, int *out_error)
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_CMD_NEIGHBOR_SET,
(const u_int8_t *) &rsp->sets[rsp->active_count + rsp->candidate_count],
(const uint8_t *) &rsp->sets[rsp->active_count + rsp->candidate_count],
sets_len);
}
@@ -707,11 +707,11 @@ qcdm_cmd_pilot_sets_result (const char *buf, size_t len, int *out_error)
qcdmbool
qcdm_cmd_pilot_sets_result_get_num (QcdmResult *result,
u_int32_t set_type,
u_int32_t *out_num)
uint32_t set_type,
uint32_t *out_num)
{
const char *set_name;
const u_int8_t *array = NULL;
const uint8_t *array = NULL;
size_t array_len = 0;
qcdm_return_val_if_fail (result != NULL, FALSE);
@@ -728,15 +728,15 @@ qcdm_cmd_pilot_sets_result_get_num (QcdmResult *result,
qcdmbool
qcdm_cmd_pilot_sets_result_get_pilot (QcdmResult *result,
u_int32_t set_type,
u_int32_t num,
u_int32_t *out_pn_offset,
u_int32_t *out_ecio,
uint32_t set_type,
uint32_t num,
uint32_t *out_pn_offset,
uint32_t *out_ecio,
float *out_db)
{
const char *set_name;
DMCmdPilotSetsSet *set;
const u_int8_t *array = NULL;
const uint8_t *array = NULL;
size_t array_len = 0;
qcdm_return_val_if_fail (result != NULL, FALSE);
@@ -760,7 +760,7 @@ qcdm_cmd_pilot_sets_result_get_pilot (QcdmResult *result,
/**********************************************************************/
size_t
qcdm_cmd_nv_get_mdn_new (char *buf, size_t len, u_int8_t profile)
qcdm_cmd_nv_get_mdn_new (char *buf, size_t len, uint8_t profile)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -812,7 +812,7 @@ qcdm_cmd_nv_get_mdn_result (const char *buf, size_t len, int *out_error)
/**********************************************************************/
static qcdmbool
roam_pref_validate (u_int8_t dm)
roam_pref_validate (uint8_t dm)
{
if ( dm == DIAG_NV_ROAM_PREF_HOME_ONLY
|| dm == DIAG_NV_ROAM_PREF_ROAM_ONLY
@@ -822,7 +822,7 @@ roam_pref_validate (u_int8_t dm)
}
size_t
qcdm_cmd_nv_get_roam_pref_new (char *buf, size_t len, u_int8_t profile)
qcdm_cmd_nv_get_roam_pref_new (char *buf, size_t len, uint8_t profile)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -873,8 +873,8 @@ qcdm_cmd_nv_get_roam_pref_result (const char *buf, size_t len, int *out_error)
size_t
qcdm_cmd_nv_set_roam_pref_new (char *buf,
size_t len,
u_int8_t profile,
u_int8_t roam_pref)
uint8_t profile,
uint8_t roam_pref)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -916,7 +916,7 @@ qcdm_cmd_nv_set_roam_pref_result (const char *buf, size_t len, int *out_error)
/**********************************************************************/
size_t
qcdm_cmd_nv_get_mode_pref_new (char *buf, size_t len, u_int8_t profile)
qcdm_cmd_nv_get_mode_pref_new (char *buf, size_t len, uint8_t profile)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -962,8 +962,8 @@ qcdm_cmd_nv_get_mode_pref_result (const char *buf, size_t len, int *out_error)
size_t
qcdm_cmd_nv_set_mode_pref_new (char *buf,
size_t len,
u_int8_t profile,
u_int8_t mode_pref)
uint8_t profile,
uint8_t mode_pref)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -1044,7 +1044,7 @@ qcdm_cmd_nv_get_hybrid_pref_result (const char *buf, size_t len, int *out_error)
size_t
qcdm_cmd_nv_set_hybrid_pref_new (char *buf,
size_t len,
u_int8_t hybrid_pref)
uint8_t hybrid_pref)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -1132,7 +1132,7 @@ qcdm_cmd_nv_get_ipv6_enabled_result (const char *buf, size_t len, int *out_error
size_t
qcdm_cmd_nv_set_ipv6_enabled_new (char *buf,
size_t len,
u_int8_t enabled)
uint8_t enabled)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -1176,7 +1176,7 @@ qcdm_cmd_nv_set_ipv6_enabled_result (const char *buf, size_t len, int *out_error
/**********************************************************************/
static qcdmbool
hdr_rev_pref_validate (u_int8_t dm)
hdr_rev_pref_validate (uint8_t dm)
{
if ( dm == DIAG_NV_HDR_REV_PREF_0
|| dm == DIAG_NV_HDR_REV_PREF_A
@@ -1232,7 +1232,7 @@ qcdm_cmd_nv_get_hdr_rev_pref_result (const char *buf, size_t len, int *out_error
size_t
qcdm_cmd_nv_set_hdr_rev_pref_new (char *buf,
size_t len,
u_int8_t rev_pref)
uint8_t rev_pref)
{
char cmdbuf[sizeof (DMCmdNVReadWrite) + 2];
DMCmdNVReadWrite *cmd = (DMCmdNVReadWrite *) &cmdbuf[0];
@@ -1294,15 +1294,15 @@ qcdm_cmd_cm_subsys_state_info_result (const char *buf, size_t len, int *out_erro
{
QcdmResult *result = NULL;
DMCmdSubsysCMStateInfoRsp *rsp = (DMCmdSubsysCMStateInfoRsp *) buf;
u_int32_t tmp_num;
u_int32_t roam_pref;
uint32_t tmp_num;
uint32_t roam_pref;
qcdm_return_val_if_fail (buf != NULL, NULL);
if (!check_command (buf, len, DIAG_CMD_SUBSYS, sizeof (DMCmdSubsysCMStateInfoRsp), out_error))
return NULL;
roam_pref = (u_int32_t) le32toh (rsp->roam_pref);
roam_pref = (uint32_t) le32toh (rsp->roam_pref);
if (!roam_pref_validate (roam_pref)) {
qcdm_err (0, "Unknown roam preference 0x%X", roam_pref);
return NULL;
@@ -1310,33 +1310,33 @@ qcdm_cmd_cm_subsys_state_info_result (const char *buf, size_t len, int *out_erro
result = qcdm_result_new ();
tmp_num = (u_int32_t) le32toh (rsp->call_state);
tmp_num = (uint32_t) le32toh (rsp->call_state);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_CALL_STATE, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->oper_mode);
tmp_num = (uint32_t) le32toh (rsp->oper_mode);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_OPERATING_MODE, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->system_mode);
tmp_num = (uint32_t) le32toh (rsp->system_mode);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_SYSTEM_MODE, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->mode_pref);
tmp_num = (uint32_t) le32toh (rsp->mode_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_MODE_PREF, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->band_pref);
tmp_num = (uint32_t) le32toh (rsp->band_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_BAND_PREF, tmp_num);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_ROAM_PREF, roam_pref);
tmp_num = (u_int32_t) le32toh (rsp->srv_domain_pref);
tmp_num = (uint32_t) le32toh (rsp->srv_domain_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_SERVICE_DOMAIN_PREF, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->acq_order_pref);
tmp_num = (uint32_t) le32toh (rsp->acq_order_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_ACQ_ORDER_PREF, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->hybrid_pref);
tmp_num = (uint32_t) le32toh (rsp->hybrid_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_HYBRID_PREF, tmp_num);
tmp_num = (u_int32_t) le32toh (rsp->network_sel_mode_pref);
tmp_num = (uint32_t) le32toh (rsp->network_sel_mode_pref);
qcdm_result_add_u32 (result, QCDM_CMD_CM_SUBSYS_STATE_INFO_ITEM_NETWORK_SELECTION_PREF, tmp_num);
return result;
@@ -1392,14 +1392,14 @@ qcdm_cmd_hdr_subsys_state_info_result (const char *buf, size_t len, int *out_err
size_t
qcdm_cmd_ext_logmask_new (char *buf,
size_t len,
u_int32_t items[],
u_int16_t maxlog)
uint32_t items[],
uint16_t maxlog)
{
char cmdbuf[sizeof (DMCmdExtLogMask) + 2];
DMCmdExtLogMask *cmd = (DMCmdExtLogMask *) &cmdbuf[0];
u_int16_t highest = 0;
uint16_t highest = 0;
size_t total = 3;
u_int32_t i;
uint32_t i;
qcdm_return_val_if_fail (buf != NULL, 0);
qcdm_return_val_if_fail (len >= sizeof (*cmd) + DIAG_TRAILER_LEN, 0);
@@ -1432,7 +1432,7 @@ qcdm_cmd_ext_logmask_result (const char *buf, size_t len, int *out_error)
{
QcdmResult *result = NULL;
DMCmdExtLogMask *rsp = (DMCmdExtLogMask *) buf;
u_int32_t masklen = 0, maxlog = 0;
uint32_t masklen = 0, maxlog = 0;
size_t minlen = 0;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -1479,7 +1479,7 @@ qcdm_cmd_ext_logmask_result (const char *buf, size_t len, int *out_error)
qcdmbool
qcmd_cmd_ext_logmask_result_get_item (QcdmResult *result,
u_int16_t item)
uint16_t item)
{
return FALSE;
}
@@ -1555,7 +1555,7 @@ qcdm_cmd_zte_subsys_status_result (const char *buf, size_t len, int *out_error)
size_t
qcdm_cmd_nw_subsys_modem_snapshot_cdma_new (char *buf,
size_t len,
u_int8_t chipset)
uint8_t chipset)
{
char cmdbuf[sizeof (DMCmdSubsysNwSnapshotReq) + 2];
DMCmdSubsysNwSnapshotReq *cmd = (DMCmdSubsysNwSnapshotReq *) &cmdbuf[0];
@@ -1594,8 +1594,8 @@ qcdm_cmd_nw_subsys_modem_snapshot_cdma_result (const char *buf, size_t len, int
QcdmResult *result = NULL;
DMCmdSubsysNwSnapshotRsp *rsp = (DMCmdSubsysNwSnapshotRsp *) buf;
DMCmdSubsysNwSnapshotCdma *cdma = (DMCmdSubsysNwSnapshotCdma *) &rsp->data;
u_int32_t num;
u_int8_t num8;
uint32_t num;
uint8_t num8;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -1638,7 +1638,7 @@ qcdm_cmd_nw_subsys_modem_snapshot_cdma_result (const char *buf, size_t len, int
size_t
qcdm_cmd_nw_subsys_eri_new (char *buf,
size_t len,
u_int8_t chipset)
uint8_t chipset)
{
char cmdbuf[sizeof (DMCmdSubsysHeader) + 2];
DMCmdSubsysHeader *cmd = (DMCmdSubsysHeader *) &cmdbuf[0];
@@ -1708,16 +1708,16 @@ qcdm_cmd_nw_subsys_eri_result (const char *buf, size_t len, int *out_error)
static size_t
qcdm_cmd_log_config_new (char *buf,
size_t len,
u_int32_t op,
u_int32_t equip_id,
u_int16_t items[])
uint32_t op,
uint32_t equip_id,
uint16_t items[])
{
DMCmdLogConfig *cmd;
u_int16_t highest = 0;
u_int32_t items_len = 0;
uint16_t highest = 0;
uint32_t items_len = 0;
size_t cmdsize = 0, cmdbufsize;
u_int32_t i;
u_int16_t log_code;
uint32_t i;
uint16_t log_code;
qcdm_return_val_if_fail (buf != NULL, 0);
qcdm_return_val_if_fail ((equip_id & 0xFFF0) == 0, 0);
@@ -1757,7 +1757,7 @@ qcdm_cmd_log_config_new (char *buf,
size_t
qcdm_cmd_log_config_get_mask_new (char *buf,
size_t len,
u_int32_t equip_id)
uint32_t equip_id)
{
return qcdm_cmd_log_config_new (buf,
len,
@@ -1767,7 +1767,7 @@ qcdm_cmd_log_config_get_mask_new (char *buf,
}
static int
check_log_config_respose (const char *buf, size_t len, u_int32_t op)
check_log_config_respose (const char *buf, size_t len, uint32_t op)
{
DMCmdLogConfigRsp *rsp = (DMCmdLogConfigRsp *) buf;
size_t minlen = 16; /* minimum valid resposne */
@@ -1781,7 +1781,7 @@ check_log_config_respose (const char *buf, size_t len, u_int32_t op)
}
if (rsp->code == DIAG_CMD_LOG_CONFIG) {
u_int32_t rspop;
uint32_t rspop;
if (len < 16) {
/* At least enough for code + op + result + equipid */
@@ -1833,13 +1833,13 @@ check_log_config_respose (const char *buf, size_t len, u_int32_t op)
#define LOG_CODE_SET(mask, code) (mask[code / 8] & (1 << (code % 8)))
static QcdmResult *
log_config_get_set_result (const char *buf, size_t len, u_int32_t op, int *out_error)
log_config_get_set_result (const char *buf, size_t len, uint32_t op, int *out_error)
{
QcdmResult *result = NULL;
DMCmdLogConfigRsp *rsp = (DMCmdLogConfigRsp *) buf;
int err;
u_int32_t num_items;
u_int32_t equipid;
uint32_t num_items;
uint32_t equipid;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -1859,8 +1859,8 @@ log_config_get_set_result (const char *buf, size_t len, u_int32_t op, int *out_e
qcdm_result_add_u32 (result, QCDM_CMD_LOG_CONFIG_MASK_ITEM_NUM_ITEMS, num_items);
if (num_items > 0) {
u_int32_t i, num_result_items = 0, count = 0;
u_int16_t *items;
uint32_t i, num_result_items = 0, count = 0;
uint16_t *items;
/* First pass to find out how many are actually enabled */
for (i = 0; i < num_items; i++) {
@@ -1893,8 +1893,8 @@ qcdm_cmd_log_config_get_mask_result (const char *buf, size_t len, int *out_error
size_t
qcdm_cmd_log_config_set_mask_new (char *buf,
size_t len,
u_int32_t equip_id,
u_int16_t items[])
uint32_t equip_id,
uint16_t items[])
{
return qcdm_cmd_log_config_new (buf,
len,
@@ -1911,12 +1911,12 @@ qcdm_cmd_log_config_set_mask_result (const char *buf, size_t len, int *out_error
qcdmbool
qcmd_cmd_log_config_mask_result_code_set (QcdmResult *result,
u_int32_t equipid,
u_int16_t log_code)
uint32_t equipid,
uint16_t log_code)
{
const u_int16_t *items = NULL;
const uint16_t *items = NULL;
size_t len = 0;
u_int32_t i, tmp;
uint32_t i, tmp;
qcdm_return_val_if_fail (result != NULL, FALSE);
@@ -1941,10 +1941,10 @@ qcmd_cmd_log_config_mask_result_code_set (QcdmResult *result,
static char bcd_chars[] = "0123456789\0\0\0\0\0\0";
static qcdmbool
imxi_bcd_to_string (u_int8_t bytes[8], size_t len, char *buf, size_t buflen)
imxi_bcd_to_string (uint8_t bytes[8], size_t len, char *buf, size_t buflen)
{
char *p;
u_int32_t i;
uint32_t i;
if (bytes[0] == 0)
return TRUE;
@@ -2042,8 +2042,8 @@ qcdm_cmd_gsm_subsys_state_info_result (const char *buf, size_t len, int *out_err
QcdmResult *result = NULL;
DMCmdSubsysGsmStateInfoRsp *rsp = (DMCmdSubsysGsmStateInfoRsp *) buf;
char imxi[18];
u_int32_t mcc = 0, mnc = 0;
u_int8_t mnc3;
uint32_t mcc = 0, mnc = 0;
uint8_t mnc3;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -2090,4 +2090,3 @@ qcdm_cmd_gsm_subsys_state_info_result (const char *buf, size_t len, int *out_err
}
/**********************************************************************/

View File

@@ -110,7 +110,7 @@ enum {
QCDM_CMD_CONTROL_MODE_RESET = 2,
};
size_t qcdm_cmd_control_new (char *buf, size_t len, u_int8_t mode);
size_t qcdm_cmd_control_new (char *buf, size_t len, uint8_t mode);
QcdmResult *qcdm_cmd_control_result (const char *buf,
size_t len,
@@ -236,14 +236,14 @@ QcdmResult *qcdm_cmd_pilot_sets_result (const char *buf,
int *out_error);
qcdmbool qcdm_cmd_pilot_sets_result_get_num (QcdmResult *result,
u_int32_t set_type,
u_int32_t *out_num);
uint32_t set_type,
uint32_t *out_num);
qcdmbool qcdm_cmd_pilot_sets_result_get_pilot (QcdmResult *result,
u_int32_t set_type,
u_int32_t num,
u_int32_t *out_pn_offset,
u_int32_t *out_ecio,
uint32_t set_type,
uint32_t num,
uint32_t *out_pn_offset,
uint32_t *out_ecio,
float *out_db);
/**********************************************************************/
@@ -251,7 +251,7 @@ qcdmbool qcdm_cmd_pilot_sets_result_get_pilot (QcdmResult *result,
#define QCDM_CMD_NV_GET_MDN_ITEM_PROFILE "profile"
#define QCDM_CMD_NV_GET_MDN_ITEM_MDN "mdn"
size_t qcdm_cmd_nv_get_mdn_new (char *buf, size_t len, u_int8_t profile);
size_t qcdm_cmd_nv_get_mdn_new (char *buf, size_t len, uint8_t profile);
QcdmResult *qcdm_cmd_nv_get_mdn_result (const char *buf,
size_t len,
@@ -271,7 +271,7 @@ enum {
size_t qcdm_cmd_nv_get_roam_pref_new (char *buf,
size_t len,
u_int8_t profile);
uint8_t profile);
QcdmResult *qcdm_cmd_nv_get_roam_pref_result (const char *buf,
size_t len,
@@ -279,8 +279,8 @@ QcdmResult *qcdm_cmd_nv_get_roam_pref_result (const char *buf,
size_t qcdm_cmd_nv_set_roam_pref_new (char *buf,
size_t len,
u_int8_t profile,
u_int8_t roam_pref);
uint8_t profile,
uint8_t roam_pref);
QcdmResult *qcdm_cmd_nv_set_roam_pref_result (const char *buf,
size_t len,
@@ -311,7 +311,7 @@ enum {
size_t qcdm_cmd_nv_get_mode_pref_new (char *buf,
size_t len,
u_int8_t profile);
uint8_t profile);
QcdmResult *qcdm_cmd_nv_get_mode_pref_result (const char *buf,
size_t len,
@@ -319,8 +319,8 @@ QcdmResult *qcdm_cmd_nv_get_mode_pref_result (const char *buf,
size_t qcdm_cmd_nv_set_mode_pref_new (char *buf,
size_t len,
u_int8_t profile,
u_int8_t mode_pref);
uint8_t profile,
uint8_t mode_pref);
QcdmResult *qcdm_cmd_nv_set_mode_pref_result (const char *buf,
size_t len,
@@ -343,7 +343,7 @@ QcdmResult *qcdm_cmd_nv_get_hybrid_pref_result (const char *buf,
size_t qcdm_cmd_nv_set_hybrid_pref_new (char *buf,
size_t len,
u_int8_t hybrid_pref);
uint8_t hybrid_pref);
QcdmResult *qcdm_cmd_nv_set_hybrid_pref_result (const char *buf,
size_t len,
@@ -366,7 +366,7 @@ QcdmResult *qcdm_cmd_nv_get_ipv6_enabled_result (const char *buf,
size_t qcdm_cmd_nv_set_ipv6_enabled_new (char *buf,
size_t len,
u_int8_t enabled);
uint8_t enabled);
QcdmResult *qcdm_cmd_nv_set_ipv6_enabled_result (const char *buf,
size_t len,
@@ -391,7 +391,7 @@ QcdmResult *qcdm_cmd_nv_get_hdr_rev_pref_result (const char *buf,
size_t qcdm_cmd_nv_set_hdr_rev_pref_new (char *buf,
size_t len,
u_int8_t rev_pref);
uint8_t rev_pref);
QcdmResult *qcdm_cmd_nv_set_hdr_rev_pref_result (const char *buf,
size_t len,
@@ -568,8 +568,8 @@ QcdmResult *qcdm_cmd_hdr_subsys_state_info_result (const char *buf,
size_t qcdm_cmd_ext_logmask_new (char *buf,
size_t len,
u_int32_t items[], /* terminated by 0 */
u_int16_t maxlog);
uint32_t items[], /* terminated by 0 */
uint16_t maxlog);
QcdmResult *qcdm_cmd_ext_logmask_result (const char *buf,
size_t len,
@@ -577,7 +577,7 @@ QcdmResult *qcdm_cmd_ext_logmask_result (const char *buf,
/* Returns TRUE if 'item' is set in the log mask */
qcdmbool qcmd_cmd_ext_logmask_result_get_item (QcdmResult *result,
u_int16_t item);
uint16_t item);
/**********************************************************************/
@@ -593,12 +593,12 @@ QcdmResult *qcdm_cmd_event_report_result (const char *buf,
size_t qcdm_cmd_log_config_get_mask_new (char *buf,
size_t len,
u_int32_t equip_id);
uint32_t equip_id);
size_t qcdm_cmd_log_config_set_mask_new (char *buf,
size_t len,
u_int32_t equip_id,
u_int16_t items[]);
uint32_t equip_id,
uint16_t items[]);
#define QCDM_CMD_LOG_CONFIG_MASK_ITEM_EQUIP_ID "equip-id"
@@ -615,8 +615,8 @@ QcdmResult *qcdm_cmd_log_config_set_mask_result (const char *buf,
int *out_error);
qcdmbool qcmd_cmd_log_config_mask_result_code_set (QcdmResult *result,
u_int32_t equipid,
u_int16_t log_code);
uint32_t equipid,
uint16_t log_code);
/**********************************************************************/
@@ -651,7 +651,7 @@ enum {
size_t qcdm_cmd_nw_subsys_modem_snapshot_cdma_new (char *buf,
size_t len,
u_int8_t chipset);
uint8_t chipset);
QcdmResult *qcdm_cmd_nw_subsys_modem_snapshot_cdma_result (const char *buf,
size_t len,
@@ -677,7 +677,7 @@ QcdmResult *qcdm_cmd_nw_subsys_modem_snapshot_cdma_result (const char *buf,
size_t qcdm_cmd_nw_subsys_eri_new (char *buf,
size_t len,
u_int8_t chipset);
uint8_t chipset);
QcdmResult *qcdm_cmd_nw_subsys_eri_result (const char *buf,
size_t len,

View File

@@ -236,15 +236,15 @@ enum {
/* Generic DM command header */
struct DMCmdHeader {
u_int8_t code;
uint8_t code;
} __attribute__ ((packed));
typedef struct DMCmdHeader DMCmdHeader;
/* DIAG_CMD_SUBSYS */
struct DMCmdSubsysHeader {
u_int8_t code;
u_int8_t subsys_id;
u_int16_t subsys_cmd;
uint8_t code;
uint8_t subsys_id;
uint16_t subsys_cmd;
} __attribute__ ((packed));
typedef struct DMCmdSubsysHeader DMCmdSubsysHeader;
@@ -255,82 +255,82 @@ typedef enum {
/* DIAG_CMD_CONTROL */
struct DMCmdControl {
u_int8_t code;
uint8_t code;
/* DMControlMode */
u_int16_t mode;
uint16_t mode;
} __attribute__ ((packed));
typedef struct DMCmdControl DMCmdControl;
/* DIAG_CMD_NV_READ / DIAG_CMD_NV_WRITE */
struct DMCmdNVReadWrite {
u_int8_t code;
u_int16_t nv_item;
u_int8_t data[128];
u_int16_t status;
uint8_t code;
uint16_t nv_item;
uint8_t data[128];
uint16_t status;
} __attribute__ ((packed));
typedef struct DMCmdNVReadWrite DMCmdNVReadWrite;
/* DIAG_CMD_VERSION_INFO */
struct DMCmdVersionInfoRsp {
u_int8_t code;
uint8_t code;
char comp_date[11];
char comp_time[8];
char rel_date[11];
char rel_time[8];
char model[8];
u_int8_t scm;
u_int8_t mob_cai_rev;
u_int8_t mob_model;
u_int16_t mob_firmware_rev;
u_int8_t slot_cycle_index;
u_int8_t msm_ver;
u_int8_t _unknown;
uint8_t scm;
uint8_t mob_cai_rev;
uint8_t mob_model;
uint16_t mob_firmware_rev;
uint8_t slot_cycle_index;
uint8_t msm_ver;
uint8_t _unknown;
} __attribute__ ((packed));
typedef struct DMCmdVersionInfoRsp DMCmdVersionInfoRsp;
/* DIAG_CMD_ESN */
struct DMCmdEsnRsp {
u_int8_t code;
u_int8_t esn[4];
uint8_t code;
uint8_t esn[4];
} __attribute__ ((packed));
typedef struct DMCmdEsnRsp DMCmdEsnRsp;
/* DIAG_CMD_STATUS */
struct DMCmdStatusRsp {
u_int8_t code;
u_int8_t _unknown[3];
u_int8_t esn[4];
u_int16_t rf_mode;
u_int8_t min1_analog[4];
u_int8_t min1_cdma[4];
u_int8_t min2_analog[2];
u_int8_t min2_cdma[2];
u_int8_t _unknown1;
u_int16_t cdma_rx_state;
u_int8_t good_frames;
u_int16_t analog_corrected_frames;
u_int16_t analog_bad_frames;
u_int16_t analog_word_syncs;
u_int16_t entry_reason;
u_int16_t curr_chan;
u_int8_t cdma_code_chan;
u_int16_t pilot_base;
u_int16_t sid;
u_int16_t nid;
u_int16_t analog_locaid;
u_int16_t analog_rssi;
u_int8_t analog_power;
uint8_t code;
uint8_t _unknown[3];
uint8_t esn[4];
uint16_t rf_mode;
uint8_t min1_analog[4];
uint8_t min1_cdma[4];
uint8_t min2_analog[2];
uint8_t min2_cdma[2];
uint8_t _unknown1;
uint16_t cdma_rx_state;
uint8_t good_frames;
uint16_t analog_corrected_frames;
uint16_t analog_bad_frames;
uint16_t analog_word_syncs;
uint16_t entry_reason;
uint16_t curr_chan;
uint8_t cdma_code_chan;
uint16_t pilot_base;
uint16_t sid;
uint16_t nid;
uint16_t analog_locaid;
uint16_t analog_rssi;
uint8_t analog_power;
} __attribute__ ((packed));
typedef struct DMCmdStatusRsp DMCmdStatusRsp;
/* DIAG_CMD_SW_VERSION */
struct DMCmdSwVersionRsp {
u_int8_t code;
uint8_t code;
char version[31];
char comp_date[11];
u_int8_t _unknown1[2];
uint8_t _unknown1[2];
char comp_time[8];
u_int8_t _unknown2[2];
uint8_t _unknown2[2];
} __attribute__ ((packed));
typedef struct DMCmdSwVersionRsp DMCmdSwVersionRsp;
@@ -347,55 +347,55 @@ typedef enum {
/* DIAG_CMD_STATUS_SNAPSHOT */
struct DMCmdStatusSnapshotRsp {
u_int8_t code;
u_int8_t esn[4];
u_int8_t imsi_s1[4];
u_int8_t imsi_s2[2];
u_int8_t imsi_s[8];
u_int8_t imsi_11_12;
u_int16_t mcc;
u_int8_t imsi_addr_num;
u_int16_t sid;
u_int16_t nid;
u_int8_t prev;
u_int8_t prev_in_use;
u_int8_t mob_prev;
u_int8_t band_class;
u_int16_t frequency;
u_int8_t oper_mode;
u_int8_t state;
u_int8_t sub_state;
uint8_t code;
uint8_t esn[4];
uint8_t imsi_s1[4];
uint8_t imsi_s2[2];
uint8_t imsi_s[8];
uint8_t imsi_11_12;
uint16_t mcc;
uint8_t imsi_addr_num;
uint16_t sid;
uint16_t nid;
uint8_t prev;
uint8_t prev_in_use;
uint8_t mob_prev;
uint8_t band_class;
uint16_t frequency;
uint8_t oper_mode;
uint8_t state;
uint8_t sub_state;
} __attribute__ ((packed));
typedef struct DMCmdStatusSnapshotRsp DMCmdStatusSnapshotRsp;
/* DIAG_SUBSYS_CM_STATE_INFO subsys command */
struct DMCmdSubsysCMStateInfoRsp {
DMCmdSubsysHeader header;
u_int32_t call_state;
u_int32_t oper_mode;
u_int32_t system_mode;
u_int32_t mode_pref;
u_int32_t band_pref;
u_int32_t roam_pref;
u_int32_t srv_domain_pref;
u_int32_t acq_order_pref;
u_int32_t hybrid_pref;
u_int32_t network_sel_mode_pref;
uint32_t call_state;
uint32_t oper_mode;
uint32_t system_mode;
uint32_t mode_pref;
uint32_t band_pref;
uint32_t roam_pref;
uint32_t srv_domain_pref;
uint32_t acq_order_pref;
uint32_t hybrid_pref;
uint32_t network_sel_mode_pref;
} __attribute__ ((packed));
typedef struct DMCmdSubsysCMStateInfoRsp DMCmdSubsysCMStateInfoRsp;
/* DIAG_SUBSYS_HDR_STATE_INFO subsys command */
struct DMCmdSubsysHDRStateInfoRsp {
DMCmdSubsysHeader header;
u_int8_t at_state;
u_int8_t session_state;
u_int8_t almp_state;
u_int8_t init_state;
u_int8_t idle_state;
u_int8_t connected_state;
u_int8_t route_update_state;
u_int8_t overhead_msg_state;
u_int8_t hdr_hybrid_mode;
uint8_t at_state;
uint8_t session_state;
uint8_t almp_state;
uint8_t init_state;
uint8_t idle_state;
uint8_t connected_state;
uint8_t route_update_state;
uint8_t overhead_msg_state;
uint8_t hdr_hybrid_mode;
} __attribute__ ((packed));
typedef struct DMCmdSubsysHDRStateInfoRsp DMCmdSubsysHDRStateInfoRsp;
@@ -403,124 +403,124 @@ typedef struct DMCmdSubsysHDRStateInfoRsp DMCmdSubsysHDRStateInfoRsp;
/* DIAG_SUBSYS_ZTE_STATUS subsys command */
struct DMCmdSubsysZteStatusRsp {
DMCmdSubsysHeader header;
u_int8_t _unknown1[8];
u_int8_t signal_ind;
u_int8_t _unknown2;
uint8_t _unknown1[8];
uint8_t signal_ind;
uint8_t _unknown2;
} __attribute__ ((packed));
typedef struct DMCmdSubsysZteStatusRsp DMCmdSubsysZteStatusRsp;
/* DIAG_CMD_PILOT_SETS command */
struct DMCmdPilotSetsSet {
u_int16_t pn_offset;
u_int16_t ecio;
uint16_t pn_offset;
uint16_t ecio;
} __attribute__ ((packed));
typedef struct DMCmdPilotSetsSet DMCmdPilotSetsSet;
struct DMCmdPilotSetsRsp {
u_int8_t code;
u_int16_t pilot_inc;
u_int8_t active_count;
u_int8_t candidate_count;
u_int8_t neighbor_count;
uint8_t code;
uint16_t pilot_inc;
uint8_t active_count;
uint8_t candidate_count;
uint8_t neighbor_count;
DMCmdPilotSetsSet sets[52];
} __attribute__ ((packed));
typedef struct DMCmdPilotSetsRsp DMCmdPilotSetsRsp;
struct DMCmdLog {
u_int8_t code;
u_int8_t more;
u_int16_t len; /* size of packet after this member */
u_int16_t _unknown2; /* contains same value as len */
u_int16_t log_code;
u_int64_t timestamp;
u_int8_t data[0];
uint8_t code;
uint8_t more;
uint16_t len; /* size of packet after this member */
uint16_t _unknown2; /* contains same value as len */
uint16_t log_code;
uint64_t timestamp;
uint8_t data[0];
} __attribute__ ((packed));
typedef struct DMCmdLog DMCmdLog;
struct DMCmdExtLogMask {
u_int8_t code;
uint8_t code;
/* Bit number of highest '1' in 'mask'; set to 0 to get current mask. */
u_int16_t len;
uint16_t len;
/* Bitfield of log messages to receive */
u_int8_t mask[512];
uint8_t mask[512];
} __attribute__ ((packed));
typedef struct DMCmdExtLogMask DMCmdExtLogMask;
struct DMCmdEventReport {
u_int8_t code;
u_int8_t on;
uint8_t code;
uint8_t on;
} __attribute__ ((packed));
typedef struct DMCmdEventReport DMCmdEventReport;
struct DMCmdEventReportRsp {
u_int8_t code;
u_int16_t len;
u_int16_t event_id;
u_int8_t data[0];
uint8_t code;
uint16_t len;
uint16_t event_id;
uint8_t data[0];
} __attribute__ ((packed));
typedef struct DMCmdEventReportRsp DMCmdEventReportRsp;
/* DIAG_SUBSYS_NOVATEL_* subsys command */
struct DMCmdSubsysNwSnapshotReq {
DMCmdSubsysHeader hdr;
u_int8_t technology; /* DIAG_SUBSYS_NOVATEL_MODEM_SNAPSHOT_TECH_* */
u_int32_t snapshot_mask;
uint8_t technology; /* DIAG_SUBSYS_NOVATEL_MODEM_SNAPSHOT_TECH_* */
uint32_t snapshot_mask;
} __attribute__ ((packed));
typedef struct DMCmdSubsysNwSnapshotReq DMCmdSubsysNwSnapshotReq;
/* DIAG_SUBSYS_NOVATEL_MODEM_SNAPSHOT response */
struct DMCmdSubsysNwSnapshotRsp {
DMCmdSubsysHeader hdr;
u_int8_t response_code;
u_int32_t bitfield1;
u_int32_t bitfield2;
u_int8_t data[100]; /* DMCmdSubsysNwSnapshotCdma */
uint8_t response_code;
uint32_t bitfield1;
uint32_t bitfield2;
uint8_t data[100]; /* DMCmdSubsysNwSnapshotCdma */
} __attribute__ ((packed));
typedef struct DMCmdSubsysNwSnapshotRsp DMCmdSubsysNwSnapshotRsp;
struct DMCmdSubsysNwSnapshotCdma {
u_int32_t rssi;
u_int32_t battery_level;
u_int8_t call_info;
u_int8_t new_sms_ind;
u_int8_t missed_calls;
u_int32_t voicemail_ind;
u_int8_t pkt_call_ctrl_state;
u_int8_t mip_rrp_err_code;
u_int8_t cur_packet_zone_id;
u_int8_t prev;
u_int8_t band_class;
u_int8_t eri;
u_int8_t eri_alert_id;
u_int32_t cur_call_total_time;
u_int32_t cur_call_active_time;
u_int32_t cur_call_tx_ip_bytes;
u_int32_t cur_call_rx_ip_bytes;
u_int8_t connection_status;
u_int16_t dominant_pn;
u_int8_t wdisable_mask;
u_int8_t hdr_rev;
uint32_t rssi;
uint32_t battery_level;
uint8_t call_info;
uint8_t new_sms_ind;
uint8_t missed_calls;
uint32_t voicemail_ind;
uint8_t pkt_call_ctrl_state;
uint8_t mip_rrp_err_code;
uint8_t cur_packet_zone_id;
uint8_t prev;
uint8_t band_class;
uint8_t eri;
uint8_t eri_alert_id;
uint32_t cur_call_total_time;
uint32_t cur_call_active_time;
uint32_t cur_call_tx_ip_bytes;
uint32_t cur_call_rx_ip_bytes;
uint8_t connection_status;
uint16_t dominant_pn;
uint8_t wdisable_mask;
uint8_t hdr_rev;
} __attribute__ ((packed));
typedef struct DMCmdSubsysNwSnapshotCdma DMCmdSubsysNwSnapshotCdma;
/* DIAG_SUBSYS_NOVATEL_MODEM_SNAPSHOT response */
struct DMCmdSubsysNwEriRsp {
DMCmdSubsysHeader hdr;
u_int8_t status;
u_int16_t error;
u_int8_t roam;
u_int8_t eri_header[6];
u_int8_t eri_call_prompt[38];
uint8_t status;
uint16_t error;
uint8_t roam;
uint8_t eri_header[6];
uint8_t eri_call_prompt[38];
/* Roaming Indicator */
u_int8_t indicator_id;
u_int8_t icon_id;
u_int8_t icon_mode;
u_int8_t call_prompt_id; /* Call Guard? */
u_int8_t alert_id; /* Ringer? */
u_int8_t encoding_type;
u_int8_t text_len;
u_int8_t text[32];
uint8_t indicator_id;
uint8_t icon_id;
uint8_t icon_mode;
uint8_t call_prompt_id; /* Call Guard? */
uint8_t alert_id; /* Ringer? */
uint8_t encoding_type;
uint8_t text_len;
uint8_t text[32];
} __attribute__ ((packed));
typedef struct DMCmdSubsysNwEriRsp DMCmdSubsysNwEriRsp;
@@ -531,26 +531,26 @@ enum {
};
struct DMCmdLogConfig {
u_int8_t code;
u_int8_t pad[3];
u_int32_t op;
u_int32_t equipid;
u_int32_t num_items;
u_int8_t mask[0];
uint8_t code;
uint8_t pad[3];
uint32_t op;
uint32_t equipid;
uint32_t num_items;
uint8_t mask[0];
} __attribute__ ((packed));
typedef struct DMCmdLogConfig DMCmdLogConfig;
struct DMCmdLogConfigRsp {
u_int8_t code;
u_int8_t pad[3];
u_int32_t op;
u_int32_t result; /* 0 = success */
u_int32_t equipid;
uint8_t code;
uint8_t pad[3];
uint32_t op;
uint32_t result; /* 0 = success */
uint32_t equipid;
union {
u_int32_t get_range_items[16];
uint32_t get_range_items[16];
struct {
u_int32_t num_items;
u_int8_t mask[0];
uint32_t num_items;
uint8_t mask[0];
} get_set_items;
} u;
} __attribute__ ((packed));
@@ -559,51 +559,50 @@ typedef struct DMCmdLogConfigRsp DMCmdLogConfigRsp;
/* DIAG_SUBSYS_WCDMA_CALL_START command */
struct DMCmdSubsysWcdmaCallStart {
DMCmdSubsysHeader hdr;
u_int8_t number_len;
u_int8_t number_digits[32];
u_int8_t amr_rate; /* default to 7 */
uint8_t number_len;
uint8_t number_digits[32];
uint8_t amr_rate; /* default to 7 */
} __attribute__ ((packed));
typedef struct DMCmdSubsysWcdmaCallStart DMCmdSubsysWcdmaCallStart;
/* DIAG_SUBSYS_WCDMA_STATE_INFO response */
struct DMCmdSubsysWcdmaStateInfoRsp {
DMCmdSubsysHeader hdr;
u_int8_t imei_len;
u_int8_t imei[8];
u_int8_t imsi_len;
u_int8_t imsi[8];
u_int8_t l1_state;
uint8_t imei_len;
uint8_t imei[8];
uint8_t imsi_len;
uint8_t imsi[8];
uint8_t l1_state;
} __attribute__ ((packed));
typedef struct DMCmdSubsysWcdmaStateInfoRsp DMCmdSubsysWcdmaStateInfoRsp;
/* DIAG_SUBSYS_GSM_STATE_INFO response */
struct DMCmdSubsysGsmStateInfoRsp {
DMCmdSubsysHeader hdr;
u_int8_t imei_len;
u_int8_t imei[8];
u_int8_t imsi_len;
u_int8_t imsi[8];
u_int8_t lai[5];
u_int16_t cellid;
u_int8_t cm_call_state;
u_int8_t cm_opmode;
u_int8_t cm_sysmode;
uint8_t imei_len;
uint8_t imei[8];
uint8_t imsi_len;
uint8_t imsi[8];
uint8_t lai[5];
uint16_t cellid;
uint8_t cm_call_state;
uint8_t cm_opmode;
uint8_t cm_sysmode;
} __attribute__ ((packed));
typedef struct DMCmdSubsysGsmStateInfoRsp DMCmdSubsysGsmStateInfoRsp;
/* DIAG_CMD_SAMSUNG_IND response */
struct DMCmdSamsungIndRsp {
DMCmdHeader hdr;
u_int8_t _unknown1; /* always zero */
u_int8_t _unknown2; /* 0x0c */
u_int8_t _unknown3[4]; /* always zero */
u_int8_t _unknown4; /* 0x05 */
u_int8_t _unknown5; /* always zero */
u_int8_t _unknown6; /* 0x01 */
u_int8_t _unknown7; /* always zero */
u_int8_t signal; /* 0 - 5 */
uint8_t _unknown1; /* always zero */
uint8_t _unknown2; /* 0x0c */
uint8_t _unknown3[4]; /* always zero */
uint8_t _unknown4; /* 0x05 */
uint8_t _unknown5; /* always zero */
uint8_t _unknown6; /* 0x01 */
uint8_t _unknown7; /* always zero */
uint8_t signal; /* 0 - 5 */
} __attribute__ ((packed));
typedef struct DMCmdSamsungIndRsp DMCmdSamsungIndRsp;
#endif /* LIBQCDM_DM_COMMANDS_H */

View File

@@ -18,6 +18,8 @@
#ifndef LIBQCDM_LOG_ITEMS_H
#define LIBQCDM_LOG_ITEMS_H
#include <stdint.h>
enum {
/* CDMA and EVDO items */
DM_LOG_ITEM_CDMA_ACCESS_CHANNEL_MSG = 0x1004,
@@ -60,39 +62,39 @@ enum {
/* DM_LOG_ITEM_CDMA_PAGING_CHANNEL_MSG */
struct DMLogItemPagingChannelMsg {
u_int8_t msg_len; /* size of entire struct including this field */
u_int8_t msg_type; /* MSG_TYPE as in 3GPP2 C.S0004 Table 3.1.2.3.1.1.2 */
u_int8_t data[0]; /* Packed message as in 3GPP2 C.S0005 3.7.2.3.2.x */
uint8_t msg_len; /* size of entire struct including this field */
uint8_t msg_type; /* MSG_TYPE as in 3GPP2 C.S0004 Table 3.1.2.3.1.1.2 */
uint8_t data[0]; /* Packed message as in 3GPP2 C.S0005 3.7.2.3.2.x */
} __attribute ((packed));
typedef struct DMLogItemPagingChannelMsg DMLogItemPagingChannelMsg;
/* DM_LOG_ITEM_CDMA_REVERSE_POWER_CONTROL */
struct DMLogItemRPCItem {
u_int8_t channel_set_mask;
u_int16_t frame_count;
u_int8_t len_per_frame;
u_int16_t dec_history;
u_int8_t rx_agc_vals;
u_int8_t tx_power_vals;
u_int8_t tx_gain_adjust;
uint8_t channel_set_mask;
uint16_t frame_count;
uint8_t len_per_frame;
uint16_t dec_history;
uint8_t rx_agc_vals;
uint8_t tx_power_vals;
uint8_t tx_gain_adjust;
} __attribute__ ((packed));
typedef struct DMLogItemRPCItem DMLogItemRPCItem;
struct DMLogItemCdmaReversePowerControl {
u_int8_t frame_offset;
u_int8_t band_class;
u_int16_t rev_chan_rc;
u_int8_t pilot_gating_rate;
u_int8_t step_size;
u_int8_t num_records;
uint8_t frame_offset;
uint8_t band_class;
uint16_t rev_chan_rc;
uint8_t pilot_gating_rate;
uint8_t step_size;
uint8_t num_records;
DMLogItemRPCItem records[];
} __attribute__ ((packed));
typedef struct DMLogItemCdmaReversePowerControl DMLogItemCdmaReversePowerControl;
/* DM_LOG_ITEM_EVDO_PILOT_SETS_V2 */
struct DMLogItemEvdoPilotSetsV2Pilot {
u_int16_t pilot_pn;
uint16_t pilot_pn;
/* HDR pilot energy doesn't appear to be in the same units as 1x pilot
* energy (eg, -0.5 dBm increments). Instead it appears roughly correlated
* to RSSI dBm by using this formula empirically derived from simultaneous
@@ -100,25 +102,25 @@ struct DMLogItemEvdoPilotSetsV2Pilot {
*
* RSSI dBm = -110 + (MAX(pilot_energy - 50, 0) / 14)
*/
u_int16_t pilot_energy;
uint16_t pilot_energy;
union {
struct {
u_int16_t mac_index;
u_int8_t unknown1;
u_int8_t unknown2;
u_int16_t window_center;
uint16_t mac_index;
uint8_t unknown1;
uint8_t unknown2;
uint16_t window_center;
} Active;
struct {
u_int16_t channel_number;
u_int8_t unknown1;
u_int8_t unknown2;
u_int16_t window_center;
uint16_t channel_number;
uint8_t unknown1;
uint8_t unknown2;
uint16_t window_center;
} Candidate;
struct {
u_int16_t channel_number;
u_int16_t window_center;
u_int8_t unknown1; // Offset?
u_int8_t unknown2; // Age?
uint16_t channel_number;
uint16_t window_center;
uint8_t unknown1; // Offset?
uint8_t unknown2; // Age?
} Remaining;
};
} __attribute__ ((packed));
@@ -126,16 +128,16 @@ typedef struct DMLogItemEvdoPilotSetsV2Pilot DMLogItemEvdoPilotSetsV2Pilot;
/* DM_LOG_ITEM_EVDO_PILOT_SETS_V2 */
struct DMLogItemEvdoPilotSetsV2 {
u_int8_t pn_offset;
u_int8_t active_count;
u_int8_t active_window;
u_int16_t active_channel;
u_int8_t unknown1;
u_int8_t candidate_count;
u_int8_t candidate_window;
u_int8_t remaining_count;
u_int8_t remaining_window;
u_int8_t unknown2;
uint8_t pn_offset;
uint8_t active_count;
uint8_t active_window;
uint16_t active_channel;
uint8_t unknown1;
uint8_t candidate_count;
uint8_t candidate_window;
uint8_t remaining_count;
uint8_t remaining_window;
uint8_t unknown2;
DMLogItemEvdoPilotSetsV2Pilot sets[];
} __attribute__ ((packed));
@@ -145,29 +147,29 @@ typedef struct DMLogItemEvdoPilotSetsV2 DMLogItemEvdoPilotSetsV2;
struct DMLogItemWcdmaTaFingerInfo {
int32_t tx_pos;
int16_t coherent_interval_len;
u_int8_t non_coherent_interval_len;
u_int8_t num_paths;
u_int32_t path_enr;
uint8_t non_coherent_interval_len;
uint8_t num_paths;
uint32_t path_enr;
int32_t pn_pos_path;
int16_t pri_cpich_psc;
u_int8_t unknown1;
u_int8_t sec_cpich_ssc;
u_int8_t finger_channel_code_index;
u_int8_t finger_index;
uint8_t unknown1;
uint8_t sec_cpich_ssc;
uint8_t finger_channel_code_index;
uint8_t finger_index;
} __attribute__ ((packed));
typedef struct DMLogItemWcdmaTaFingerInfo DMLogItemWcdmaTaFingerInfo;
/* DM_LOG_ITEM_WCDMA_AGC_INFO */
struct DMLogItemWcdmaAgcInfo {
u_int8_t num_samples;
u_int16_t rx_agc;
u_int16_t tx_agc;
u_int16_t rx_agc_adj_pdm;
u_int16_t tx_agc_adj_pdm;
u_int16_t max_tx;
uint8_t num_samples;
uint16_t rx_agc;
uint16_t tx_agc;
uint16_t rx_agc_adj_pdm;
uint16_t tx_agc_adj_pdm;
uint16_t max_tx;
/* Bit 4 means tx_agc is valid */
u_int8_t agc_info;
uint8_t agc_info;
} __attribute__ ((packed));
typedef struct DMLogItemWcdmaAgcInfo DMLogItemWcdmaAgcInfo;
@@ -183,37 +185,37 @@ enum {
};
struct DMLogItemWcdmaRrcState {
u_int8_t rrc_state;
uint8_t rrc_state;
} __attribute__ ((packed));
typedef struct DMLogItemWcdmaRrcState DMLogItemWcdmaRrcState;
/* DM_LOG_ITEM_WCDMA_CELL_ID */
struct DMLogItemWcdmaCellId {
u_int8_t unknown1[8];
u_int32_t cellid;
u_int8_t unknown2[4];
uint8_t unknown1[8];
uint32_t cellid;
uint8_t unknown2[4];
} __attribute__ ((packed));
typedef struct DMLogItemWcdmaCellId DMLogItemWcdmaCellId;
/* DM_LOG_ITEM_GSM_BURST_METRICS */
struct DMLogItemGsmBurstMetric {
u_int32_t fn;
u_int16_t arfcn;
u_int32_t rssi;
u_int16_t power;
u_int16_t dc_offset_i;
u_int16_t dc_offset_q;
u_int16_t freq_offset;
u_int16_t timing_offset;
u_int16_t snr;
u_int8_t gain_state;
uint32_t fn;
uint16_t arfcn;
uint32_t rssi;
uint16_t power;
uint16_t dc_offset_i;
uint16_t dc_offset_q;
uint16_t freq_offset;
uint16_t timing_offset;
uint16_t snr;
uint8_t gain_state;
} __attribute__ ((packed));
typedef struct DMLogItemGsmBurstMetric DMLogItemGsmBurstMetric;
struct DMLogItemGsmBurstMetrics {
u_int8_t channel;
uint8_t channel;
DMLogItemGsmBurstMetric metrics[4];
} __attribute__ ((packed));
typedef struct DMLogItemGsmBurstMetrics DMLogItemGsmBurstMetrics;
@@ -231,12 +233,12 @@ enum {
struct DMLogItemGsmBcchMessage {
/* Band is top 4 bits; lower 12 is ARFCN */
u_int16_t bcch_arfcn;
u_int16_t bsic;
u_int16_t cell_id;
u_int8_t lai[5];
u_int8_t cell_selection_prio;
u_int8_t ncc_permitted;
uint16_t bcch_arfcn;
uint16_t bsic;
uint16_t cell_id;
uint8_t lai[5];
uint8_t cell_selection_prio;
uint8_t ncc_permitted;
} __attribute__ ((packed));
typedef struct DMLogItemGsmBcchMessage DMLogItemGsmBcchMessage;

View File

@@ -30,7 +30,7 @@
/**********************************************************************/
static qcdmbool
check_log_item (const char *buf, size_t len, u_int16_t log_code, size_t min_len, int *out_error)
check_log_item (const char *buf, size_t len, uint16_t log_code, size_t min_len, int *out_error)
{
DMCmdLog *log_cmd = (DMCmdLog *) buf;
@@ -71,7 +71,7 @@ check_log_item (const char *buf, size_t len, u_int16_t log_code, size_t min_len,
#define PILOT_SETS_LOG_REMAINING_SET "remaining-set"
static const char *
set_num_to_str (u_int32_t num)
set_num_to_str (uint32_t num)
{
if (num == QCDM_LOG_ITEM_EVDO_PILOT_SETS_V2_TYPE_ACTIVE)
return PILOT_SETS_LOG_ACTIVE_SET;
@@ -103,7 +103,7 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_LOG_ACTIVE_SET,
(const u_int8_t *) &pilot_sets->sets[0],
(const uint8_t *) &pilot_sets->sets[0],
sets_len);
}
@@ -111,7 +111,7 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_LOG_CANDIDATE_SET,
(const u_int8_t *) &pilot_sets->sets[pilot_sets->active_count],
(const uint8_t *) &pilot_sets->sets[pilot_sets->active_count],
sets_len);
}
@@ -119,7 +119,7 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
if (sets_len > 0) {
qcdm_result_add_u8_array (result,
PILOT_SETS_LOG_REMAINING_SET,
(const u_int8_t *) &pilot_sets->sets[pilot_sets->active_count + pilot_sets->candidate_count],
(const uint8_t *) &pilot_sets->sets[pilot_sets->active_count + pilot_sets->candidate_count],
sets_len);
}
@@ -129,11 +129,11 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
qcdmbool
qcdm_log_item_evdo_pilot_sets_v2_get_num (QcdmResult *result,
u_int32_t set_type,
u_int32_t *out_num)
uint32_t set_type,
uint32_t *out_num)
{
const char *set_name;
const u_int8_t *array = NULL;
const uint8_t *array = NULL;
size_t array_len = 0;
qcdm_return_val_if_fail (result != NULL, FALSE);
@@ -152,15 +152,15 @@ qcdm_log_item_evdo_pilot_sets_v2_get_num (QcdmResult *result,
qcdmbool
qcdm_log_item_evdo_pilot_sets_v2_get_pilot (QcdmResult *result,
u_int32_t set_type,
u_int32_t num,
u_int32_t *out_pilot_pn,
u_int32_t *out_pilot_energy,
uint32_t set_type,
uint32_t num,
uint32_t *out_pilot_pn,
uint32_t *out_pilot_energy,
int32_t *out_rssi_dbm)
{
const char *set_name;
DMLogItemEvdoPilotSetsV2Pilot *pilot;
const u_int8_t *array = NULL;
const uint8_t *array = NULL;
size_t array_len = 0;
qcdm_return_val_if_fail (result != NULL, FALSE);
@@ -181,4 +181,3 @@ qcdm_log_item_evdo_pilot_sets_v2_get_pilot (QcdmResult *result,
}
/**********************************************************************/

View File

@@ -35,14 +35,14 @@ QcdmResult *qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf,
int *out_error);
qcdmbool qcdm_log_item_evdo_pilot_sets_v2_get_num (QcdmResult *result,
u_int32_t set_type,
u_int32_t *out_num);
uint32_t set_type,
uint32_t *out_num);
qcdmbool qcdm_log_item_evdo_pilot_sets_v2_get_pilot (QcdmResult *result,
u_int32_t set_type,
u_int32_t num,
u_int32_t *out_pilot_pn,
u_int32_t *out_pilot_energy,
uint32_t set_type,
uint32_t num,
uint32_t *out_pilot_pn,
uint32_t *out_pilot_energy,
int32_t *out_rssi_dbm);
/**********************************************************************/

View File

@@ -64,15 +64,15 @@ enum {
/* DIAG_NV_MODE_PREF */
struct DMNVItemModePref {
u_int8_t profile;
u_int8_t mode_pref;
uint8_t profile;
uint8_t mode_pref;
} __attribute__ ((packed));
typedef struct DMNVItemModePref DMNVItemModePref;
/* DIAG_NV_DIR_NUMBER */
struct DMNVItemMdn {
u_int8_t profile;
u_int8_t mdn[10];
uint8_t profile;
uint8_t mdn[10];
} __attribute__ ((packed));
typedef struct DMNVItemMdn DMNVItemMdn;
@@ -85,8 +85,8 @@ enum {
/* DIAG_NV_ROAM_PREF */
struct DMNVItemRoamPref {
u_int8_t profile;
u_int8_t roam_pref;
uint8_t profile;
uint8_t roam_pref;
} __attribute__ ((packed));
typedef struct DMNVItemRoamPref DMNVItemRoamPref;
@@ -99,7 +99,7 @@ enum {
/* DIAG_NV_HDR_REV_PREF */
struct DMNVItemHdrRevPref {
u_int8_t rev_pref;
uint8_t rev_pref;
} __attribute__ ((packed));
typedef struct DMNVItemHdrRevPref DMNVItemHdrRevPref;
@@ -111,7 +111,7 @@ enum {
/* DIAG_NV_HYBRID_PREF */
struct DMNVItemHybridPref {
u_int8_t hybrid_pref;
uint8_t hybrid_pref;
} __attribute__ ((packed));
typedef struct DMNVItemHybridPref DMNVItemHybridPref;
@@ -123,9 +123,8 @@ enum {
/* DIAG_NV_IPV6_ENABLED */
struct DMNVItemIPv6Enabled {
u_int8_t enabled;
uint8_t enabled;
} __attribute__ ((packed));
typedef struct DMNVItemIPv6Enabled DMNVItemIPv6Enabled;
#endif /* LIBQCDM_NV_ITEMS_H */

View File

@@ -28,26 +28,25 @@ void qcdm_result_add_string (QcdmResult *result,
void qcdm_result_add_u8 (QcdmResult *result,
const char *key,
u_int8_t num);
uint8_t num);
void qcdm_result_add_u8_array (QcdmResult *result,
const char *key,
const u_int8_t *array,
const uint8_t *array,
size_t array_len);
int qcdm_result_get_u8_array (QcdmResult *result,
const char *key,
const u_int8_t **out_val,
const uint8_t **out_val,
size_t *out_len);
void qcdm_result_add_u16_array (QcdmResult *result,
const char *key,
const u_int16_t *array,
const uint16_t *array,
size_t array_len);
void qcdm_result_add_u32 (QcdmResult *result,
const char *key,
u_int32_t num);
uint32_t num);
#endif /* LIBQCDM_RESULT_PRIVATE_H */

View File

@@ -37,15 +37,15 @@ typedef enum {
struct Val {
char *key;
u_int8_t type;
uint8_t type;
union {
char *s;
u_int8_t u8;
u_int32_t u32;
u_int8_t *u8_array;
u_int16_t *u16_array;
uint8_t u8;
uint32_t u32;
uint8_t *u8_array;
uint16_t *u16_array;
} u;
u_int32_t array_len;
uint32_t array_len;
Val *next;
};
@@ -84,7 +84,7 @@ val_new_string (const char *key, const char *value)
}
static Val *
val_new_u8 (const char *key, u_int8_t u)
val_new_u8 (const char *key, uint8_t u)
{
Val *v;
@@ -102,7 +102,7 @@ val_new_u8 (const char *key, u_int8_t u)
}
static Val *
val_new_u8_array (const char *key, const u_int8_t *array, size_t array_len)
val_new_u8_array (const char *key, const uint8_t *array, size_t array_len)
{
Val *v;
@@ -129,7 +129,7 @@ val_new_u8_array (const char *key, const u_int8_t *array, size_t array_len)
}
static Val *
val_new_u32 (const char *key, u_int32_t u)
val_new_u32 (const char *key, uint32_t u)
{
Val *v;
@@ -147,7 +147,7 @@ val_new_u32 (const char *key, u_int32_t u)
}
static Val *
val_new_u16_array (const char *key, const u_int16_t *array, size_t array_len)
val_new_u16_array (const char *key, const uint16_t *array, size_t array_len)
{
Val *v;
size_t sz;
@@ -163,7 +163,7 @@ val_new_u16_array (const char *key, const u_int16_t *array, size_t array_len)
v->key = strdup (key);
v->type = VAL_TYPE_U16_ARRAY;
sz = sizeof (u_int16_t) * array_len;
sz = sizeof (uint16_t) * array_len;
v->u.u16_array = malloc (sz);
if (v->u.u16_array == NULL) {
val_free (v);
@@ -178,7 +178,7 @@ val_new_u16_array (const char *key, const u_int16_t *array, size_t array_len)
/*********************************************************/
struct QcdmResult {
u_int32_t refcount;
uint32_t refcount;
Val *first;
};
@@ -289,7 +289,7 @@ qcdm_result_get_string (QcdmResult *r,
void
qcdm_result_add_u8 (QcdmResult *r,
const char *key,
u_int8_t num)
uint8_t num)
{
Val *v;
@@ -306,7 +306,7 @@ qcdm_result_add_u8 (QcdmResult *r,
int
qcdm_result_get_u8 (QcdmResult *r,
const char *key,
u_int8_t *out_val)
uint8_t *out_val)
{
Val *v;
@@ -326,7 +326,7 @@ qcdm_result_get_u8 (QcdmResult *r,
void
qcdm_result_add_u8_array (QcdmResult *r,
const char *key,
const u_int8_t *array,
const uint8_t *array,
size_t array_len)
{
Val *v;
@@ -346,7 +346,7 @@ qcdm_result_add_u8_array (QcdmResult *r,
int
qcdm_result_get_u8_array (QcdmResult *r,
const char *key,
const u_int8_t **out_val,
const uint8_t **out_val,
size_t *out_len)
{
Val *v;
@@ -369,7 +369,7 @@ qcdm_result_get_u8_array (QcdmResult *r,
void
qcdm_result_add_u32 (QcdmResult *r,
const char *key,
u_int32_t num)
uint32_t num)
{
Val *v;
@@ -386,7 +386,7 @@ qcdm_result_add_u32 (QcdmResult *r,
int
qcdm_result_get_u32 (QcdmResult *r,
const char *key,
u_int32_t *out_val)
uint32_t *out_val)
{
Val *v;
@@ -406,7 +406,7 @@ qcdm_result_get_u32 (QcdmResult *r,
void
qcdm_result_add_u16_array (QcdmResult *r,
const char *key,
const u_int16_t *array,
const uint16_t *array,
size_t array_len)
{
Val *v;
@@ -426,7 +426,7 @@ qcdm_result_add_u16_array (QcdmResult *r,
int
qcdm_result_get_u16_array (QcdmResult *r,
const char *key,
const u_int16_t **out_val,
const uint16_t **out_val,
size_t *out_len)
{
Val *v;
@@ -445,4 +445,3 @@ qcdm_result_get_u16_array (QcdmResult *r,
*out_len = v->array_len;
return 0;
}

View File

@@ -18,7 +18,7 @@
#ifndef LIBQCDM_RESULT_H
#define LIBQCDM_RESULT_H
#include <sys/types.h>
#include <stdint.h>
typedef struct QcdmResult QcdmResult;
@@ -28,15 +28,15 @@ int qcdm_result_get_string (QcdmResult *r,
int qcdm_result_get_u8 (QcdmResult *r,
const char *key,
u_int8_t *out_val);
uint8_t *out_val);
int qcdm_result_get_u32 (QcdmResult *r,
const char *key,
u_int32_t *out_val);
uint32_t *out_val);
int qcdm_result_get_u16_array (QcdmResult *result,
const char *key,
const u_int16_t **out_val,
const uint16_t **out_val,
size_t *out_len);
QcdmResult *qcdm_result_ref (QcdmResult *r);
@@ -44,4 +44,3 @@ QcdmResult *qcdm_result_ref (QcdmResult *r);
void qcdm_result_unref (QcdmResult *r);
#endif /* LIBQCDM_RESULT_H */

View File

@@ -33,7 +33,7 @@
*/
/* Table of CRCs for each possible byte, with a generator polynomial of 0x8408 */
static const u_int16_t crc_table[256] = {
static const uint16_t crc_table[256] = {
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
@@ -69,10 +69,10 @@ static const u_int16_t crc_table[256] = {
};
/* Calculate the CRC for a buffer using a seed of 0xffff */
u_int16_t
uint16_t
dm_crc16 (const char *buffer, size_t len)
{
u_int16_t crc = 0xffff;
uint16_t crc = 0xffff;
while (len--)
crc = crc_table[(crc ^ *buffer++) & 0xff] ^ (crc >> 8);
@@ -187,7 +187,7 @@ dm_encapsulate_buffer (char *inbuf,
char *outbuf,
size_t outbuf_len)
{
u_int16_t crc;
uint16_t crc;
size_t escaped_len;
qcdm_return_val_if_fail (inbuf != NULL, 0);
@@ -242,7 +242,7 @@ dm_decapsulate_buffer (const char *inbuf,
{
qcdmbool escaping = FALSE;
size_t i, pkt_len = 0, unesc_len;
u_int16_t crc, pkt_crc;
uint16_t crc, pkt_crc;
qcdm_return_val_if_fail (inbuf != NULL, FALSE);
qcdm_return_val_if_fail (outbuf != NULL, FALSE);
@@ -309,4 +309,3 @@ dm_decapsulate_buffer (const char *inbuf,
*out_decap_len = unesc_len - 2; /* decap_len should not include the CRC */
return TRUE;
}

View File

@@ -19,20 +19,20 @@
#define LIBQCDM_UTILS_H
#include <config.h>
#include <sys/types.h>
#include <stdint.h>
typedef u_int8_t qcdmbool;
typedef uint8_t qcdmbool;
#ifndef TRUE
#define TRUE ((u_int8_t) 1)
#define TRUE ((uint8_t) 1)
#endif
#ifndef FALSE
#define FALSE ((u_int8_t) 0)
#define FALSE ((uint8_t) 0)
#endif
#define DIAG_CONTROL_CHAR 0x7E
#define DIAG_TRAILER_LEN 3
u_int16_t dm_crc16 (const char *buffer, size_t len);
uint16_t dm_crc16 (const char *buffer, size_t len);
size_t dm_escape (const char *inbuf,
size_t inbuf_len,
@@ -60,4 +60,3 @@ qcdmbool dm_decapsulate_buffer (const char *inbuf,
qcdmbool *out_need_more);
#endif /* LIBQCDM_UTILS_H */

View File

@@ -39,7 +39,7 @@ print_buf (const char *detail, const char *buf, size_t len)
int i = 0, z;
qcdmbool newline = FALSE;
char tmp[500];
u_int32_t flen;
uint32_t flen;
flen = snprintf (tmp, sizeof (tmp) - 1, "%s (%zu) ", detail, len);
fprintf (stdout, "%s", tmp);
@@ -173,7 +173,7 @@ qcdm_wait_reply (int fd, char *buf, size_t len)
}
static int
qcdm_set_ipv6_enabled (int fd, u_int8_t ipv6pref)
qcdm_set_ipv6_enabled (int fd, uint8_t ipv6pref)
{
int err;
char buf[512];
@@ -216,7 +216,7 @@ qcdm_get_ipv6_enabled (int fd)
size_t len;
QcdmResult *result;
size_t reply_len;
u_int8_t mode;
uint8_t mode;
len = qcdm_cmd_nv_get_ipv6_enabled_new (buf, sizeof (buf));
assert (len);
@@ -313,4 +313,3 @@ main (int argc, char *argv[])
return 0;
}

View File

@@ -39,7 +39,7 @@ print_buf (const char *detail, const char *buf, size_t len)
int i = 0, z;
qcdmbool newline = FALSE;
char tmp[500];
u_int32_t flen;
uint32_t flen;
flen = snprintf (tmp, sizeof (tmp) - 1, "%s (%zu) ", detail, len);
fprintf (stdout, "%s", tmp);
@@ -173,7 +173,7 @@ qcdm_wait_reply (int fd, char *buf, size_t len)
}
static int
qcdm_set_mode_pref (int fd, u_int8_t modepref)
qcdm_set_mode_pref (int fd, uint8_t modepref)
{
int err;
char buf[512];
@@ -217,7 +217,7 @@ qcdm_get_mode_pref (int fd)
QcdmResult *result;
size_t reply_len;
const char *smode = NULL;
u_int8_t mode = 0;
uint8_t mode = 0;
len = qcdm_cmd_nv_get_mode_pref_new (buf, sizeof (buf), 0);
assert (len);
@@ -291,7 +291,7 @@ qcdm_get_mode_pref (int fd)
}
static int
qcdm_set_hdr_pref (int fd, u_int8_t hdrpref)
qcdm_set_hdr_pref (int fd, uint8_t hdrpref)
{
int err;
char buf[512];
@@ -334,7 +334,7 @@ qcdm_get_hdr_pref (int fd)
size_t len;
QcdmResult *result = NULL;
size_t reply_len;
u_int8_t pref;
uint8_t pref;
const char *spref = NULL;
len = qcdm_cmd_nv_get_hdr_rev_pref_new (buf, sizeof (buf));
@@ -385,7 +385,7 @@ error:
}
static int
qcdm_set_mode (int fd, u_int8_t mode)
qcdm_set_mode (int fd, uint8_t mode)
{
int err;
char buf[512];
@@ -435,8 +435,8 @@ usage (const char *prog)
static qcdmbool
parse_mode (const char *s,
u_int8_t *out_mode,
u_int8_t *out_hdrpref,
uint8_t *out_mode,
uint8_t *out_hdrpref,
qcdmbool *out_set_evdo)
{
if (strcasecmp (s, "lte") == 0) {
@@ -506,8 +506,8 @@ parse_mode (const char *s,
int
main (int argc, char *argv[])
{
u_int8_t mode = QCDM_CMD_NV_MODE_PREF_ITEM_MODE_PREF_AUTO;
u_int8_t hdrpref = QCDM_CMD_NV_HDR_REV_PREF_ITEM_REV_PREF_EHRPD;
uint8_t mode = QCDM_CMD_NV_MODE_PREF_ITEM_MODE_PREF_AUTO;
uint8_t hdrpref = QCDM_CMD_NV_HDR_REV_PREF_ITEM_REV_PREF_EHRPD;
const char *dmport = argv[1];
const char *smode = argv[2];
const char *msg;
@@ -570,4 +570,3 @@ main (int argc, char *argv[])
return 0;
}

View File

@@ -40,7 +40,7 @@ print_buf (const char *detail, const char *buf, size_t len)
int i = 0, z;
qcdmbool newline = FALSE;
char tmp[500];
u_int32_t flen;
uint32_t flen;
flen = snprintf (tmp, sizeof (tmp) - 1, "%s (%zu) ", detail, len);
fprintf (stdout, "%s", tmp);
@@ -174,7 +174,7 @@ qcdm_wait_reply (int fd, char *buf, size_t len)
}
static int
qcdm_set_mode (int fd, u_int8_t mode)
qcdm_set_mode (int fd, uint8_t mode)
{
int err;
char buf[512];

View File

@@ -156,7 +156,7 @@ status_snapshot_state_to_string (guint8 state)
}
static const char *
cm_call_state_to_string (u_int32_t state)
cm_call_state_to_string (uint32_t state)
{
switch (state) {
case QCDM_CMD_CM_SUBSYS_STATE_INFO_CALL_STATE_IDLE:
@@ -176,7 +176,7 @@ cm_call_state_to_string (u_int32_t state)
}
static const char *
cm_system_mode_to_string (u_int32_t mode)
cm_system_mode_to_string (uint32_t mode)
{
switch (mode) {
case QCDM_CMD_CM_SUBSYS_STATE_INFO_SYSTEM_MODE_NO_SERVICE:
@@ -1480,7 +1480,7 @@ test_com_ext_logmask (void *f, void *data)
gint len;
QcdmResult *result;
gsize reply_len;
u_int32_t items[] = { 0x002C, 0x002E, 0 };
uint32_t items[] = { 0x002C, 0x002E, 0 };
guint32 maxlog = 0;
/* First get # of items the device supports */
@@ -1505,7 +1505,7 @@ test_com_ext_logmask (void *f, void *data)
qcdm_result_unref (result);
/* Now enable some log items */
len = qcdm_cmd_ext_logmask_new (buf, sizeof (buf), items, (u_int16_t) maxlog);
len = qcdm_cmd_ext_logmask_new (buf, sizeof (buf), items, (uint16_t) maxlog);
/* Send the command */
success = send_command (d, buf, len);
@@ -1581,11 +1581,11 @@ test_com_log_config (void *f, void *data)
gint len;
QcdmResult *result;
gsize reply_len;
u_int32_t num_items = 0;
const u_int16_t *items = NULL, *reread_items;
uint32_t num_items = 0;
const uint16_t *items = NULL, *reread_items;
size_t items_len = 0, reread_len;
u_int32_t i;
u_int16_t test_items[] = { 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x102C, 0x102E, 0 };
uint32_t i;
uint16_t test_items[] = { 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x102C, 0x102E, 0 };
/* Get existing mask for CDMA/EVDO equip ID */
len = qcdm_cmd_log_config_get_mask_new (buf, sizeof (buf), 0x01);
@@ -1916,8 +1916,8 @@ test_com_gsm_subsys_state_info (void *f, void *data)
QcdmResult *result;
gsize reply_len;
const char *str;
u_int32_t num;
u_int8_t u8;
uint32_t num;
uint8_t u8;
len = qcdm_cmd_gsm_subsys_state_info_new (buf, sizeof (buf));
g_assert (len == 7);
@@ -1978,4 +1978,3 @@ test_com_gsm_subsys_state_info (void *f, void *data)
qcdm_result_unref (result);
}

View File

@@ -76,8 +76,8 @@ test_result_uint8 (void *f, void *data)
void
test_result_uint8_array (void *f, void *data)
{
u_int8_t array[] = { 0, 1, 255, 32, 128, 127 };
const u_int8_t *tmp = NULL;
uint8_t array[] = { 0, 1, 255, 32, 128, 127 };
const uint8_t *tmp = NULL;
size_t tmp_len = 0;
QcdmResult *result;
@@ -90,4 +90,3 @@ test_result_uint8_array (void *f, void *data)
qcdm_result_unref (result);
}

View File

@@ -28,22 +28,22 @@
/**********************************************************************/
static int
check_command (const char *buf, size_t len, u_int8_t cmd, size_t min_len)
check_command (const char *buf, size_t len, uint8_t cmd, size_t min_len)
{
if (len < 1) {
wmc_err (0, "Zero-length response");
return -WMC_ERROR_RESPONSE_BAD_LENGTH;
}
if ((u_int8_t) buf[0] != WMC_CMD_MARKER) {
if ((uint8_t) buf[0] != WMC_CMD_MARKER) {
wmc_err (0, "Missing WMC command marker (expected 0x%02X, got 0x%02X)",
WMC_CMD_MARKER, (u_int8_t) buf[0]);
WMC_CMD_MARKER, (uint8_t) buf[0]);
return -WMC_ERROR_RESPONSE_UNEXPECTED;
}
if ((u_int8_t) buf[1] != cmd) {
if ((uint8_t) buf[1] != cmd) {
wmc_err (0, "Unexpected WMC command response (expected 0x%02X, got 0x%02X)",
(u_int8_t) cmd, (u_int8_t) buf[1]);
(uint8_t) cmd, (uint8_t) buf[1]);
return -WMC_ERROR_RESPONSE_UNEXPECTED;
}
@@ -245,40 +245,40 @@ wmc_cmd_network_info_new (char *buf, size_t buflen)
}
static wmcbool
is_gsm_service (u_int8_t service)
is_gsm_service (uint8_t service)
{
return (service == WMC_SERVICE_GSM || service == WMC_SERVICE_GPRS || service == WMC_SERVICE_EDGE);
}
static wmcbool
is_umts_service (u_int8_t service)
is_umts_service (uint8_t service)
{
return (service == WMC_SERVICE_UMTS || service == WMC_SERVICE_HSDPA
|| service == WMC_SERVICE_HSUPA || service == WMC_SERVICE_HSPA);
}
static wmcbool
is_cdma_service (u_int8_t service)
is_cdma_service (uint8_t service)
{
return (service == WMC_SERVICE_IS95A || service == WMC_SERVICE_IS95B || service == WMC_SERVICE_1XRTT);
}
static wmcbool
is_evdo_service (u_int8_t service)
is_evdo_service (uint8_t service)
{
return (service == WMC_SERVICE_EVDO_0 || service == WMC_SERVICE_EVDO_A || service == WMC_SERVICE_EVDO_A_EHRPD);
}
static wmcbool
is_lte_service (u_int8_t service)
is_lte_service (uint8_t service)
{
return (service == WMC_SERVICE_LTE);
}
static u_int8_t
sanitize_dbm (u_int8_t in_dbm, u_int8_t service)
static uint8_t
sanitize_dbm (uint8_t in_dbm, uint8_t service)
{
u_int8_t cutoff;
uint8_t cutoff;
/* 0x6A (-106 dBm) = no signal for GSM/GPRS/EDGE */
/* 0x7D (-125 dBm) = no signal for everything else */
@@ -297,7 +297,7 @@ wmc_cmd_network_info_result (const char *buf, size_t buflen)
WmcCmdNetworkInfo3Rsp *rsp3 = (WmcCmdNetworkInfo3Rsp *) buf;
char tmp[65];
int err;
u_int32_t mccmnc = 0, mcc, mnc;
uint32_t mccmnc = 0, mcc, mnc;
wmc_return_val_if_fail (buf != NULL, NULL);
@@ -415,7 +415,7 @@ wmc_cmd_get_global_mode_result (const char *buf, size_t buflen)
/**********************************************************************/
static wmcbool
validate_mode (u_int8_t mode)
validate_mode (uint8_t mode)
{
switch (mode) {
case WMC_NETWORK_MODE_AUTO_CDMA:
@@ -434,7 +434,7 @@ validate_mode (u_int8_t mode)
}
size_t
wmc_cmd_set_global_mode_new (char *buf, size_t buflen, u_int8_t mode)
wmc_cmd_set_global_mode_new (char *buf, size_t buflen, uint8_t mode)
{
WmcCmdSetGlobalMode *cmd = (WmcCmdSetGlobalMode *) buf;
@@ -464,4 +464,3 @@ wmc_cmd_set_global_mode_result (const char *buf, size_t buflen)
}
/**********************************************************************/

View File

@@ -107,7 +107,7 @@ WmcResult * wmc_cmd_get_global_mode_result (const char *buf, size_t len);
/**********************************************************************/
size_t wmc_cmd_set_global_mode_new (char *buf, size_t buflen, u_int8_t mode);
size_t wmc_cmd_set_global_mode_new (char *buf, size_t buflen, uint8_t mode);
WmcResult * wmc_cmd_set_global_mode_result (const char *buf, size_t len);

View File

@@ -18,7 +18,7 @@
#ifndef LIBWMC_PROTOCOL_H
#define LIBWMC_PROTOCOL_H
#define WMC_CMD_MARKER ((u_int8_t) 0xC8)
#define WMC_CMD_MARKER ((uint8_t) 0xC8)
enum {
WMC_CMD_GET_GLOBAL_MODE = 0x03,
@@ -51,108 +51,108 @@ enum {
/* Generic WMC command header */
struct WmcCmdHeader {
u_int8_t marker; /* Always 0xC8 */
u_int8_t cmd;
uint8_t marker; /* Always 0xC8 */
uint8_t cmd;
} __attribute__ ((packed));
typedef struct WmcCmdHeader WmcCmdHeader;
/* Used on newer devices like the UML190 and later */
struct WmcCmdInit2 {
WmcCmdHeader hdr;
u_int16_t year;
u_int8_t month;
u_int16_t day; /* big endian */
u_int16_t hours; /* big endian */
u_int16_t minutes; /* big endian */
u_int16_t seconds; /* big endian */
u_int8_t _unknown1[3];
uint16_t year;
uint8_t month;
uint16_t day; /* big endian */
uint16_t hours; /* big endian */
uint16_t minutes; /* big endian */
uint16_t seconds; /* big endian */
uint8_t _unknown1[3];
} __attribute__ ((packed));
typedef struct WmcCmdInit2 WmcCmdInit2;
struct WmcCmdInit2Rsp {
WmcCmdHeader hdr;
u_int8_t _unknown1[4];
uint8_t _unknown1[4];
} __attribute__ ((packed));
typedef struct WmcCmdInit2Rsp WmcCmdInit2Rsp;
struct WmcCmdDeviceInfoRsp {
WmcCmdHeader hdr;
u_int8_t _unknown1[27];
uint8_t _unknown1[27];
char manf[64];
char model[64];
char fwrev[64];
char hwrev[64];
u_int8_t _unknown2[64];
u_int8_t _unknown3[64];
uint8_t _unknown2[64];
uint8_t _unknown3[64];
char min[10]; /* CDMA2000/IS-95 MIN */
u_int8_t _unknown4[12];
u_int16_t home_sid;
u_int8_t _unknown5[2];
u_int16_t prlver;
u_int8_t _unknown6[2];
u_int16_t eriver;
u_int8_t _unknown7[4];
uint8_t _unknown4[12];
uint16_t home_sid;
uint8_t _unknown5[2];
uint16_t prlver;
uint8_t _unknown6[2];
uint16_t eriver;
uint8_t _unknown7[4];
} __attribute__ ((packed));
typedef struct WmcCmdDeviceInfoRsp WmcCmdDeviceInfoRsp;
struct WmcCmdDeviceInfo2Rsp {
WmcCmdHeader hdr;
u_int8_t _unknown1[27];
uint8_t _unknown1[27];
char manf[64];
char model[64];
char fwrev[64];
char hwrev[64];
u_int8_t _unknown2[64];
u_int8_t _unknown3[64];
u_int8_t min[10]; /* CDMA2000/IS-95 MIN */
u_int8_t _unknown4[12];
u_int16_t home_sid;
u_int8_t _unknown5[2];
u_int16_t prlver;
u_int8_t _unknown6[2];
u_int16_t eriver;
u_int8_t _unknown7[4];
u_int8_t _unknown8[64];
u_int8_t meid[14];
u_int8_t _unknown10[6]; /* always zero */
u_int8_t imei[16];
u_int8_t _unknown11[6]; /* always zero */
u_int8_t _unknown12[16];
u_int8_t iccid[20];
u_int8_t _unknown13[6];
uint8_t _unknown2[64];
uint8_t _unknown3[64];
uint8_t min[10]; /* CDMA2000/IS-95 MIN */
uint8_t _unknown4[12];
uint16_t home_sid;
uint8_t _unknown5[2];
uint16_t prlver;
uint8_t _unknown6[2];
uint16_t eriver;
uint8_t _unknown7[4];
uint8_t _unknown8[64];
uint8_t meid[14];
uint8_t _unknown10[6]; /* always zero */
uint8_t imei[16];
uint8_t _unknown11[6]; /* always zero */
uint8_t _unknown12[16];
uint8_t iccid[20];
uint8_t _unknown13[6];
} __attribute__ ((packed));
typedef struct WmcCmdDeviceInfo2Rsp WmcCmdDeviceInfo2Rsp;
struct WmcCmdDeviceInfo3Rsp {
WmcCmdHeader hdr;
u_int8_t _unknown1[27];
uint8_t _unknown1[27];
char manf[64];
char model[64];
char fwrev[64];
char hwrev[64];
u_int8_t _unknown2[64];
u_int8_t _unknown3[64];
u_int8_t min[10]; /* CDMA2000/IS-95 MIN */
u_int8_t _unknown4[12];
u_int16_t home_sid;
u_int8_t _unknown5[2];
u_int16_t prlver;
u_int8_t _unknown6[2];
u_int16_t eri_ver;
u_int8_t _unknown7[4];
u_int8_t _unknown8[64];
u_int8_t meid[14];
u_int8_t _unknown10[6]; /* always zero */
u_int8_t imei[16];
u_int8_t _unknown11[6]; /* always zero */
u_int8_t _unknown12[16];
u_int8_t iccid[20];
u_int8_t _unknown13[6];
u_int8_t mcc[16];
u_int8_t mnc[16];
u_int8_t _unknown14[4];
u_int8_t _unknown15[4];
u_int8_t _unknown16[4];
uint8_t _unknown2[64];
uint8_t _unknown3[64];
uint8_t min[10]; /* CDMA2000/IS-95 MIN */
uint8_t _unknown4[12];
uint16_t home_sid;
uint8_t _unknown5[2];
uint16_t prlver;
uint8_t _unknown6[2];
uint16_t eri_ver;
uint8_t _unknown7[4];
uint8_t _unknown8[64];
uint8_t meid[14];
uint8_t _unknown10[6]; /* always zero */
uint8_t imei[16];
uint8_t _unknown11[6]; /* always zero */
uint8_t _unknown12[16];
uint8_t iccid[20];
uint8_t _unknown13[6];
uint8_t mcc[16];
uint8_t mnc[16];
uint8_t _unknown14[4];
uint8_t _unknown15[4];
uint8_t _unknown16[4];
} __attribute__ ((packed));
typedef struct WmcCmdDeviceInfo3Rsp WmcCmdDeviceInfo3Rsp;
@@ -180,94 +180,94 @@ enum {
/* PC5740 response */
struct WmcCmdNetworkInfoRsp {
WmcCmdHeader hdr;
u_int8_t _unknown1;
u_int8_t _unknown2[3]; /* Always zero */
u_int8_t service; /* One of WMC_SERVICE_* */
u_int8_t _unknown3; /* Either 0x00 or 0x01 */
u_int16_t ts_year;
u_int8_t ts_month;
u_int16_t ts_day; /* BE */
u_int16_t ts_hours; /* BE */
u_int16_t ts_minutes; /* BE */
u_int16_t ts_seconds; /* BE */
u_int16_t counter1; /* A timestamp/counter? */
u_int16_t _unknown4;
u_int8_t _unknown5[3]; /* Always 0xFE 0xFF 0xFF */
u_int8_t two_g_dbm; /* 0x7D = no signal */
u_int8_t _unknown6[37]; /* Always zero */
uint8_t _unknown1;
uint8_t _unknown2[3]; /* Always zero */
uint8_t service; /* One of WMC_SERVICE_* */
uint8_t _unknown3; /* Either 0x00 or 0x01 */
uint16_t ts_year;
uint8_t ts_month;
uint16_t ts_day; /* BE */
uint16_t ts_hours; /* BE */
uint16_t ts_minutes; /* BE */
uint16_t ts_seconds; /* BE */
uint16_t counter1; /* A timestamp/counter? */
uint16_t _unknown4;
uint8_t _unknown5[3]; /* Always 0xFE 0xFF 0xFF */
uint8_t two_g_dbm; /* 0x7D = no signal */
uint8_t _unknown6[37]; /* Always zero */
} __attribute__ ((packed));
typedef struct WmcCmdNetworkInfoRsp WmcCmdNetworkInfoRsp;
/* UML190 response */
struct WmcCmdNetworkInfo2Rsp {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* 0x00 on LTE, 0x07 or 0x1F on CDMA */
u_int8_t _unknown2[3]; /* Always zero */
u_int8_t service; /* One of WMC_SERVICE_* */
u_int8_t _unknown3;
u_int16_t ts_year;
u_int8_t ts_month;
u_int16_t ts_day; /* BE */
u_int16_t ts_hours; /* BE */
u_int16_t ts_minutes; /* BE */
u_int16_t ts_seconds; /* BE */
u_int8_t _unknown4; /* always zero */
u_int16_t uptime_secs;
u_int8_t _unknown5;
u_int8_t _unknown6[3]; /* always zero on LTE, 0xFE 0xFF 0xFF on CDMA */
u_int8_t two_g_dbm; /* 0x7D = no CDMA signal, 0x6a = no GSM signal */
u_int8_t _unknown7[3]; /* Always zero */
u_int8_t cdma_opname[16]; /* Zero terminated? */
u_int8_t _unknown8[18]; /* Always zero */
u_int8_t three_g_dbm; /* 0x7D = no signal */
u_int8_t _unknown9[3]; /* Always zero */
u_int8_t _unknown10; /* 0x01 on LTE, 0x40 on CDMA */
u_int8_t _unknown11[3]; /* Always zero */
u_int8_t _unknown12; /* Always 0x01 */
u_int8_t tgpp_opname[8]; /* 3GPP operator name (Zero terminated? Sometimes "MCC MNC" too */
u_int8_t _unknown13[4]; /* Always zero */
u_int32_t _unknown14; /* 43 75 3a 00 on GSM/WCDMA mode, zero on others */
u_int32_t _unknown15; /* 49 7d 3a 00 on GSM/WCDMA mode, zero on others */
u_int8_t _unknown16[44]; /* Always zero */
u_int32_t mcc_mnc; /* GSM/WCDMA only, see MCC/MNC format note */
uint8_t _unknown1; /* 0x00 on LTE, 0x07 or 0x1F on CDMA */
uint8_t _unknown2[3]; /* Always zero */
uint8_t service; /* One of WMC_SERVICE_* */
uint8_t _unknown3;
uint16_t ts_year;
uint8_t ts_month;
uint16_t ts_day; /* BE */
uint16_t ts_hours; /* BE */
uint16_t ts_minutes; /* BE */
uint16_t ts_seconds; /* BE */
uint8_t _unknown4; /* always zero */
uint16_t uptime_secs;
uint8_t _unknown5;
uint8_t _unknown6[3]; /* always zero on LTE, 0xFE 0xFF 0xFF on CDMA */
uint8_t two_g_dbm; /* 0x7D = no CDMA signal, 0x6a = no GSM signal */
uint8_t _unknown7[3]; /* Always zero */
uint8_t cdma_opname[16]; /* Zero terminated? */
uint8_t _unknown8[18]; /* Always zero */
uint8_t three_g_dbm; /* 0x7D = no signal */
uint8_t _unknown9[3]; /* Always zero */
uint8_t _unknown10; /* 0x01 on LTE, 0x40 on CDMA */
uint8_t _unknown11[3]; /* Always zero */
uint8_t _unknown12; /* Always 0x01 */
uint8_t tgpp_opname[8]; /* 3GPP operator name (Zero terminated? Sometimes "MCC MNC" too */
uint8_t _unknown13[4]; /* Always zero */
uint32_t _unknown14; /* 43 75 3a 00 on GSM/WCDMA mode, zero on others */
uint32_t _unknown15; /* 49 7d 3a 00 on GSM/WCDMA mode, zero on others */
uint8_t _unknown16[44]; /* Always zero */
uint32_t mcc_mnc; /* GSM/WCDMA only, see MCC/MNC format note */
} __attribute__ ((packed));
typedef struct WmcCmdNetworkInfo2Rsp WmcCmdNetworkInfo2Rsp;
/* UML290 response */
struct WmcCmdNetworkInfo3Rsp {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* 0x00 on LTE, 0x07 or 0x1F on CDMA */
u_int8_t _unknown2[3]; /* Always zero */
u_int8_t service; /* One of WMC_SERVICE_* */
u_int8_t _unknown3;
u_int16_t ts_year;
u_int8_t ts_month;
u_int16_t ts_day; /* BE */
u_int16_t ts_hours; /* BE */
u_int16_t ts_minutes; /* BE */
u_int16_t ts_seconds; /* BE */
u_int8_t _unknown4; /* always zero */
u_int16_t uptime_secs;
u_int8_t _unknown5;
u_int8_t _unknown6[3]; /* always zero on LTE, 0xFE 0xFF 0xFF on CDMA */
u_int8_t two_g_dbm; /* 0x7D = no CDMA signal, 0x6a = no GSM signal */
u_int8_t _unknown7[3]; /* Always zero */
u_int8_t cdma_opname[16]; /* Zero terminated? */
u_int8_t _unknown8[18]; /* Always zero */
u_int8_t three_g_dbm; /* 0x7D = no signal */
u_int8_t _unknown9[3]; /* Always zero */
u_int8_t _unknown10; /* 0x01 on LTE, 0x40 on CDMA */
u_int8_t _unknown11[3]; /* Always zero */
u_int8_t _unknown12; /* Always 0x01 */
u_int8_t tgpp_opname[8]; /* Zero terminated? Sometimes "MCC MNC" too */
u_int8_t _unknown13[4]; /* Always zero */
u_int32_t _unknown14; /* 43 75 3a 00 on GSM/WCDMA mode, zero on others */
u_int32_t _unknown15; /* 49 7d 3a 00 on GSM/WCDMA mode, zero on others */
u_int8_t _unknown16[44]; /* Always zero */
u_int32_t mcc_mnc; /* GSM/WCDMA only, see MCC/MNC format note */
u_int8_t lte_dbm; /* 0x00 if not in LTE mode */
u_int8_t _unknown17[3]; /* Always zero */
u_int8_t _unknown18[4];
uint8_t _unknown1; /* 0x00 on LTE, 0x07 or 0x1F on CDMA */
uint8_t _unknown2[3]; /* Always zero */
uint8_t service; /* One of WMC_SERVICE_* */
uint8_t _unknown3;
uint16_t ts_year;
uint8_t ts_month;
uint16_t ts_day; /* BE */
uint16_t ts_hours; /* BE */
uint16_t ts_minutes; /* BE */
uint16_t ts_seconds; /* BE */
uint8_t _unknown4; /* always zero */
uint16_t uptime_secs;
uint8_t _unknown5;
uint8_t _unknown6[3]; /* always zero on LTE, 0xFE 0xFF 0xFF on CDMA */
uint8_t two_g_dbm; /* 0x7D = no CDMA signal, 0x6a = no GSM signal */
uint8_t _unknown7[3]; /* Always zero */
uint8_t cdma_opname[16]; /* Zero terminated? */
uint8_t _unknown8[18]; /* Always zero */
uint8_t three_g_dbm; /* 0x7D = no signal */
uint8_t _unknown9[3]; /* Always zero */
uint8_t _unknown10; /* 0x01 on LTE, 0x40 on CDMA */
uint8_t _unknown11[3]; /* Always zero */
uint8_t _unknown12; /* Always 0x01 */
uint8_t tgpp_opname[8]; /* Zero terminated? Sometimes "MCC MNC" too */
uint8_t _unknown13[4]; /* Always zero */
uint32_t _unknown14; /* 43 75 3a 00 on GSM/WCDMA mode, zero on others */
uint32_t _unknown15; /* 49 7d 3a 00 on GSM/WCDMA mode, zero on others */
uint8_t _unknown16[44]; /* Always zero */
uint32_t mcc_mnc; /* GSM/WCDMA only, see MCC/MNC format note */
uint8_t lte_dbm; /* 0x00 if not in LTE mode */
uint8_t _unknown17[3]; /* Always zero */
uint8_t _unknown18[4];
} __attribute__ ((packed));
typedef struct WmcCmdNetworkInfo3Rsp WmcCmdNetworkInfo3Rsp;
@@ -291,26 +291,26 @@ enum {
/* Used on UML190 */
struct WmcCmdConnectionInfoRsp {
WmcCmdHeader hdr;
u_int32_t rx_bytes;
u_int32_t tx_bytes;
u_int8_t _unknown1[8];
u_int8_t state; /* One of WMC_CONNECTION_STATE_* */
u_int8_t _unknown2[3]; /* Always 0xc0 0x0b 0x00 */
uint32_t rx_bytes;
uint32_t tx_bytes;
uint8_t _unknown1[8];
uint8_t state; /* One of WMC_CONNECTION_STATE_* */
uint8_t _unknown2[3]; /* Always 0xc0 0x0b 0x00 */
} __attribute__ ((packed));
typedef struct WmcCmdConnectionInfoRsp WmcCmdConnectionInfoRsp;
/* Used on UML290 */
struct WmcCmdConnectionInfo2Rsp {
WmcCmdHeader hdr;
u_int32_t rx_bytes;
u_int32_t tx_bytes;
u_int8_t _unknown1[8];
u_int8_t state; /* One of WMC_CONNECTION_STATE_* */
u_int8_t _unknown2[3]; /* Always 0xc0 0x0b 0x00 */
u_int8_t _unknown3[4]; /* Always 0x01 0x00 0x00 0x00 */
u_int8_t ip4_address[16]; /* String format, ie "10.156.45.3" */
u_int8_t _unknown4[8]; /* Netmask? */
u_int8_t ip6_address[40]; /* String format */
uint32_t rx_bytes;
uint32_t tx_bytes;
uint8_t _unknown1[8];
uint8_t state; /* One of WMC_CONNECTION_STATE_* */
uint8_t _unknown2[3]; /* Always 0xc0 0x0b 0x00 */
uint8_t _unknown3[4]; /* Always 0x01 0x00 0x00 0x00 */
uint8_t ip4_address[16]; /* String format, ie "10.156.45.3" */
uint8_t _unknown4[8]; /* Netmask? */
uint8_t ip6_address[40]; /* String format */
} __attribute__ ((packed));
typedef struct WmcCmdConnection2InfoRsp WmcCmdConnection2InfoRsp;
@@ -329,16 +329,16 @@ enum {
struct WmcCmdGetGlobalMode {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* always 0 */
uint8_t _unknown1; /* always 0 */
} __attribute__ ((packed));
typedef struct WmcCmdGetGlobalMode WmcCmdGetGlobalMode;
struct WmcCmdGetGlobalModeRsp {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* always 0x01 */
u_int8_t mode; /* one of WMC_GLOBAL_MODE_* */
u_int8_t _unknown2; /* always 0x05 */
u_int8_t _unknown3; /* always 0x00 */
uint8_t _unknown1; /* always 0x01 */
uint8_t mode; /* one of WMC_GLOBAL_MODE_* */
uint8_t _unknown2; /* always 0x05 */
uint8_t _unknown3; /* always 0x00 */
} __attribute__ ((packed));
typedef struct WmcCmdGetGlobalModeRsp WmcCmdGetGlobalModeRsp;
@@ -346,17 +346,17 @@ typedef struct WmcCmdGetGlobalModeRsp WmcCmdGetGlobalModeRsp;
struct WmcCmdSetGlobalMode {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* always 0x01 */
u_int8_t mode; /* one of WMC_GLOBAL_MODE_* */
u_int8_t _unknown2; /* always 0x05 */
u_int8_t _unknown3; /* always 0x00 */
uint8_t _unknown1; /* always 0x01 */
uint8_t mode; /* one of WMC_GLOBAL_MODE_* */
uint8_t _unknown2; /* always 0x05 */
uint8_t _unknown3; /* always 0x00 */
} __attribute__ ((packed));
typedef struct WmcCmdSetGlobalMode WmcCmdSetGlobalMode;
struct WmcCmdSetGlobalModeRsp {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* always 0x01 */
u_int32_t _unknown2; /* always zero */
uint8_t _unknown1; /* always 0x01 */
uint32_t _unknown2; /* always zero */
} __attribute__ ((packed));
typedef struct WmcCmdSetGlobalModeRsp WmcCmdSetGlobalModeRsp;
@@ -364,11 +364,11 @@ typedef struct WmcCmdSetGlobalModeRsp WmcCmdSetGlobalModeRsp;
struct WmcCmdSetOperator {
WmcCmdHeader hdr;
u_int8_t automatic; /* 0x00 = manual, 0x01 = auto */
u_int8_t _unknown1; /* always 0x50 */
u_int8_t _unknown2[3]; /* always zero */
u_int32_t mcc_mnc; /* MCC/MNC for manual reg (see format note), zero for auto */
u_int8_t _unknown3[56]; /* always zero */
uint8_t automatic; /* 0x00 = manual, 0x01 = auto */
uint8_t _unknown1; /* always 0x50 */
uint8_t _unknown2[3]; /* always zero */
uint32_t mcc_mnc; /* MCC/MNC for manual reg (see format note), zero for auto */
uint8_t _unknown3[56]; /* always zero */
} __attribute__ ((packed));
typedef struct WmcCmdSetOperator WmcCmdSetOperator;
@@ -380,8 +380,8 @@ enum {
struct WmcCmdSetOperatorRsp {
WmcCmdHeader hdr;
u_int8_t status; /* one of WMC_SET_OPERATOR_STATUS_* */
u_int8_t _unknown1[3]; /* always zero */
uint8_t status; /* one of WMC_SET_OPERATOR_STATUS_* */
uint8_t _unknown1[3]; /* always zero */
} __attribute__ ((packed));
typedef struct WmcCmdSetOperatorRsp WmcCmdSetOperatorRsp;
@@ -396,18 +396,18 @@ enum {
/* Response for both GET_FIRST_OPERATOR and GET_NEXT_OPERATOR */
struct WmcCmdGetOperatorRsp {
WmcCmdHeader hdr;
u_int8_t _unknown1; /* Usually 0x50, sometimes 0x00 */
u_int8_t _unknown2[3]; /* always zero */
u_int32_t mcc_mnc; /* see format note */
u_int8_t opname[8];
u_int8_t _unknown3[56]; /* always zero */
u_int8_t stat; /* follows 3GPP TS27.007 +COPS <stat> ? */
u_int8_t _unknown4[3]; /* always zero */
u_int8_t service; /* one of WMC_OPERATOR_SERVICE_* */
u_int8_t _unknown5[3]; /* always zero */
u_int8_t _unknown6; /* 0x63 (GET_FIRST_OP) might mean "wait" */
u_int8_t _unknown7; /* 0x00 or 0x01 */
u_int8_t _unknown8[2]; /* always zero */
uint8_t _unknown1; /* Usually 0x50, sometimes 0x00 */
uint8_t _unknown2[3]; /* always zero */
uint32_t mcc_mnc; /* see format note */
uint8_t opname[8];
uint8_t _unknown3[56]; /* always zero */
uint8_t stat; /* follows 3GPP TS27.007 +COPS <stat> ? */
uint8_t _unknown4[3]; /* always zero */
uint8_t service; /* one of WMC_OPERATOR_SERVICE_* */
uint8_t _unknown5[3]; /* always zero */
uint8_t _unknown6; /* 0x63 (GET_FIRST_OP) might mean "wait" */
uint8_t _unknown7; /* 0x00 or 0x01 */
uint8_t _unknown8[2]; /* always zero */
} __attribute__ ((packed));
typedef struct WmcCmdGetOperatorRsp WmcCmdGetOperatorRsp;
@@ -422,38 +422,38 @@ enum {
/* Later devices return all zeros for this command */
struct WmcCmdFieldTestRsp {
WmcCmdHeader hdr;
u_int8_t prl_requirements;
u_int8_t eri_support;
uint8_t prl_requirements;
uint8_t eri_support;
char nam_name[7];
u_int8_t _unknown1; /* always zero */
u_int8_t _unknown2[3]; /* always 0x0A 0x0A 0x0A */
u_int8_t _unknown3[5]; /* always zero */
u_int8_t _unknown4[10]; /* all 0x0F */
u_int16_t home_sid;
u_int16_t home_nid;
uint8_t _unknown1; /* always zero */
uint8_t _unknown2[3]; /* always 0x0A 0x0A 0x0A */
uint8_t _unknown3[5]; /* always zero */
uint8_t _unknown4[10]; /* all 0x0F */
uint16_t home_sid;
uint16_t home_nid;
char min1[7];
char min2[3];
char mcc[3];
char imsi_s[10];
char mnc[2];
u_int16_t primary_cdma_chan_a;
u_int16_t secondary_cdma_chan_a;
u_int16_t primary_cdma_chan_b;
u_int16_t secondary_cdma_chan_b;
u_int8_t accolc;
uint16_t primary_cdma_chan_a;
uint16_t secondary_cdma_chan_a;
uint16_t primary_cdma_chan_b;
uint16_t secondary_cdma_chan_b;
uint8_t accolc;
char sw_version[64];
char hw_version[64];
u_int16_t prlver;
u_int16_t eriver;
u_int16_t nid;
u_int8_t last_call_end_reason; /* ? */
u_int8_t rssi;
u_int16_t channel;
u_int8_t prev;
u_int16_t pn_offset;
u_int8_t sys_select_pref;
u_int8_t mip_pref;
u_int8_t hybrid_pref;
uint16_t prlver;
uint16_t eriver;
uint16_t nid;
uint8_t last_call_end_reason; /* ? */
uint8_t rssi;
uint16_t channel;
uint8_t prev;
uint16_t pn_offset;
uint8_t sys_select_pref;
uint8_t mip_pref;
uint8_t hybrid_pref;
} __attribute__ ((packed));
typedef struct WmcCmdFieldTestRsp WmcCmdFieldTestRsp;

View File

@@ -28,11 +28,10 @@ void wmc_result_add_string (WmcResult *result,
void wmc_result_add_u8 (WmcResult *result,
const char *key,
u_int8_t num);
uint8_t num);
void wmc_result_add_u32 (WmcResult *result,
const char *key,
u_int32_t num);
uint32_t num);
#endif /* LIBWMC_RESULT_PRIVATE_H */

View File

@@ -38,8 +38,8 @@ struct Val {
ValType type;
union {
char *s;
u_int8_t u8;
u_int32_t u32;
uint8_t u8;
uint32_t u32;
} u;
Val *next;
};
@@ -76,7 +76,7 @@ val_new_string (const char *key, const char *value)
}
static Val *
val_new_u8 (const char *key, u_int8_t u)
val_new_u8 (const char *key, uint8_t u)
{
Val *v;
@@ -94,7 +94,7 @@ val_new_u8 (const char *key, u_int8_t u)
}
static Val *
val_new_u32 (const char *key, u_int32_t u)
val_new_u32 (const char *key, uint32_t u)
{
Val *v;
@@ -114,7 +114,7 @@ val_new_u32 (const char *key, u_int32_t u)
/*********************************************************/
struct WmcResult {
u_int32_t refcount;
uint32_t refcount;
Val *first;
};
@@ -225,7 +225,7 @@ wmc_result_get_string (WmcResult *r,
void
wmc_result_add_u8 (WmcResult *r,
const char *key,
u_int8_t num)
uint8_t num)
{
Val *v;
@@ -242,7 +242,7 @@ wmc_result_add_u8 (WmcResult *r,
int
wmc_result_get_u8 (WmcResult *r,
const char *key,
u_int8_t *out_val)
uint8_t *out_val)
{
Val *v;
@@ -262,7 +262,7 @@ wmc_result_get_u8 (WmcResult *r,
void
wmc_result_add_u32 (WmcResult *r,
const char *key,
u_int32_t num)
uint32_t num)
{
Val *v;
@@ -279,7 +279,7 @@ wmc_result_add_u32 (WmcResult *r,
int
wmc_result_get_u32 (WmcResult *r,
const char *key,
u_int32_t *out_val)
uint32_t *out_val)
{
Val *v;
@@ -295,4 +295,3 @@ wmc_result_get_u32 (WmcResult *r,
*out_val = v->u.u32;
return 0;
}

View File

@@ -18,7 +18,7 @@
#ifndef LIBWMC_RESULT_H
#define LIBWMC_RESULT_H
#include <sys/types.h>
#include <stdint.h>
typedef struct WmcResult WmcResult;
@@ -28,15 +28,14 @@ int wmc_result_get_string (WmcResult *r,
int wmc_result_get_u8 (WmcResult *r,
const char *key,
u_int8_t *out_val);
uint8_t *out_val);
int wmc_result_get_u32 (WmcResult *r,
const char *key,
u_int32_t *out_val);
uint32_t *out_val);
WmcResult *wmc_result_ref (WmcResult *r);
void wmc_result_unref (WmcResult *r);
#endif /* LIBWMC_RESULT_H */

View File

@@ -33,7 +33,7 @@
*/
/* Table of CRCs for each possible byte, with a generator polynomial of 0x8408 */
static const u_int16_t crc_table[256] = {
static const uint16_t crc_table[256] = {
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
@@ -69,10 +69,10 @@ static const u_int16_t crc_table[256] = {
};
/* Calculate the CRC for a buffer using a seed of 0xffff */
u_int16_t
wmc_crc16 (const char *buffer, size_t len, u_int16_t seed)
uint16_t
wmc_crc16 (const char *buffer, size_t len, uint16_t seed)
{
u_int16_t crc = seed ? seed : 0xFFFF;
uint16_t crc = seed ? seed : 0xFFFF;
while (len--)
crc = crc_table[(crc ^ *buffer++) & 0xff] ^ (crc >> 8);
@@ -129,7 +129,7 @@ hdlc_escape (const char *inbuf,
src = inbuf;
i = inbuf_len;
while (i--) {
u_int8_t byte = (u_int8_t) *src++;
uint8_t byte = (uint8_t) *src++;
if ( byte == DIAG_CONTROL_CHAR
|| byte == DIAG_ESC_CHAR
@@ -194,13 +194,13 @@ size_t
hdlc_encapsulate_buffer (char *inbuf,
size_t cmd_len,
size_t inbuf_len,
u_int16_t crc_seed,
uint16_t crc_seed,
wmcbool add_trailer,
wmcbool escape_all_ctrl,
char *outbuf,
size_t outbuf_len)
{
u_int16_t crc;
uint16_t crc;
size_t escaped_len;
wmc_return_val_if_fail (inbuf != NULL, 0);
@@ -338,7 +338,7 @@ wmcbool
hdlc_decapsulate_buffer (const char *inbuf,
size_t inbuf_len,
wmcbool check_known_crc,
u_int16_t known_crc,
uint16_t known_crc,
char *outbuf,
size_t outbuf_len,
size_t *out_decap_len,
@@ -347,7 +347,7 @@ hdlc_decapsulate_buffer (const char *inbuf,
{
wmcbool escaping = FALSE;
size_t i, pkt_len = 0, unesc_len;
u_int16_t crc, pkt_crc;
uint16_t crc, pkt_crc;
wmc_return_val_if_fail (inbuf != NULL, FALSE);
wmc_return_val_if_fail (outbuf != NULL, FALSE);
@@ -457,4 +457,3 @@ wmc_decapsulate (const char *inbuf,
outbuf, outbuf_len,
out_decap_len, out_used, out_need_more);
}

View File

@@ -18,14 +18,14 @@
#ifndef LIBWMC_UTILS_H
#define LIBWMC_UTILS_H
#include <sys/types.h>
#include <stdint.h>
typedef u_int8_t wmcbool;
typedef uint8_t wmcbool;
#ifndef TRUE
#define TRUE ((u_int8_t) 1)
#define TRUE ((uint8_t) 1)
#endif
#ifndef FALSE
#define FALSE ((u_int8_t) 0)
#define FALSE ((uint8_t) 0)
#endif
#define DIAG_CONTROL_CHAR 0x7E
@@ -33,7 +33,7 @@ typedef u_int8_t wmcbool;
/* Utility and testcase functions */
u_int16_t wmc_crc16 (const char *buffer, size_t len, u_int16_t seed);
uint16_t wmc_crc16 (const char *buffer, size_t len, uint16_t seed);
size_t hdlc_escape (const char *inbuf,
size_t inbuf_len,
@@ -50,7 +50,7 @@ size_t hdlc_unescape (const char *inbuf,
size_t hdlc_encapsulate_buffer (char *inbuf,
size_t cmd_len,
size_t inbuf_len,
u_int16_t crc_seed,
uint16_t crc_seed,
wmcbool add_trailer,
wmcbool escape_all_ctrl,
char *outbuf,
@@ -59,7 +59,7 @@ size_t hdlc_encapsulate_buffer (char *inbuf,
wmcbool hdlc_decapsulate_buffer (const char *inbuf,
size_t inbuf_len,
wmcbool check_known_crc,
u_int16_t known_crc,
uint16_t known_crc,
char *outbuf,
size_t outbuf_len,
size_t *out_decap_len,
@@ -85,4 +85,3 @@ wmcbool wmc_decapsulate (const char *inbuf,
wmcbool uml290);
#endif /* LIBWMC_UTILS_H */

View File

@@ -347,7 +347,7 @@ test_com_device_info (void *f, void *data)
}
static const char *
service_to_string (u_int8_t service)
service_to_string (uint8_t service)
{
switch (service) {
case WMC_NETWORK_SERVICE_NONE:
@@ -392,7 +392,7 @@ test_com_network_info (void *f, void *data)
wmcbool success;
char buf[1024];
const char *str;
u_int8_t dbm, service;
uint8_t dbm, service;
gint len;
WmcResult *result;
size_t reply_len;
@@ -445,7 +445,7 @@ test_com_network_info (void *f, void *data)
}
static const char *
mode_to_string (u_int8_t service)
mode_to_string (uint8_t service)
{
switch (service) {
case WMC_NETWORK_MODE_AUTO_CDMA:
@@ -475,7 +475,7 @@ test_com_get_global_mode (void *f, void *data)
TestComData *d = data;
wmcbool success;
char buf[1024];
u_int8_t mode;
uint8_t mode;
gint len;
WmcResult *result;
size_t reply_len;
@@ -502,4 +502,3 @@ test_com_get_global_mode (void *f, void *data)
wmc_result_unref (result);
}

View File

@@ -603,7 +603,7 @@ mode_pref_qcdm_ready (MMPortSerialQcdm *port,
{
QcdmResult *result;
gint err = QCDM_SUCCESS;
u_int8_t pref = 0;
uint8_t pref = 0;
GError *error = NULL;
GByteArray *response;
@@ -1726,9 +1726,9 @@ qcdm_evdo_pilot_sets_log_handle (MMPortSerialQcdm *port,
{
MMBroadbandModem *self = MM_BROADBAND_MODEM (user_data);
QcdmResult *result;
u_int32_t num_active = 0;
u_int32_t pilot_pn = 0;
u_int32_t pilot_energy = 0;
uint32_t num_active = 0;
uint32_t pilot_pn = 0;
uint32_t pilot_energy = 0;
int32_t rssi_dbm = 0;
result = qcdm_log_item_evdo_pilot_sets_v2_new ((const char *) log_buffer->data,
@@ -6854,7 +6854,7 @@ modem_cdma_setup_cleanup_unsolicited_events (MMBroadbandModem *self,
{
CdmaUnsolicitedEventsContext *ctx;
GByteArray *logcmd;
u_int16_t log_items[] = { DM_LOG_ITEM_EVDO_PILOT_SETS_V2, 0 };
uint16_t log_items[] = { DM_LOG_ITEM_EVDO_PILOT_SETS_V2, 0 };
GError *error = NULL;
ctx = g_new0 (CdmaUnsolicitedEventsContext, 1);

View File

@@ -44,7 +44,7 @@ print_buf (const char *detail, const char *buf, size_t len)
int i = 0, z;
wmcbool newline = FALSE;
char tmp[500];
u_int32_t flen;
uint32_t flen;
flen = snprintf (tmp, sizeof (tmp) - 1, "%s (%zu) ", detail, len);
fprintf (stdout, "%s", tmp);
@@ -191,7 +191,7 @@ wmc_wait_reply (int fd, char *buf, size_t len)
}
static int
wmc_set_global_mode (const char *port, u_int8_t mode)
wmc_set_global_mode (const char *port, uint8_t mode)
{
int fd, err;
char buf[1024];
@@ -248,7 +248,7 @@ wmc_get_global_mode (const char *port)
size_t len;
WmcResult *result;
size_t reply_len;
u_int8_t mode = 0;
uint8_t mode = 0;
const char *smode = NULL;
fd = com_setup (port);
@@ -414,7 +414,7 @@ qcdm_wait_reply (int fd, char *buf, size_t len)
}
static int
qcdm_set_hdr_pref (const char *port, u_int8_t hdrpref)
qcdm_set_hdr_pref (const char *port, uint8_t hdrpref)
{
int fd, err;
char buf[512];
@@ -472,7 +472,7 @@ qcdm_get_hdr_pref (const char *port)
size_t len;
QcdmResult *result = NULL;
size_t reply_len;
u_int8_t pref;
uint8_t pref;
const char *spref = NULL;
fd = com_setup (port);
@@ -538,7 +538,7 @@ error:
}
static int
qcdm_set_mode (const char *port, u_int8_t mode)
qcdm_set_mode (const char *port, uint8_t mode)
{
int fd, err;
char buf[512];
@@ -600,8 +600,8 @@ usage (const char *prog)
static wmcbool
parse_mode (const char *s,
u_int8_t *out_mode,
u_int8_t *out_hdrpref,
uint8_t *out_mode,
uint8_t *out_hdrpref,
wmcbool *out_set_evdo)
{
if (strcasecmp (s, "lte") == 0) {
@@ -664,8 +664,8 @@ parse_mode (const char *s,
int
main (int argc, char *argv[])
{
u_int8_t mode = WMC_NETWORK_MODE_AUTO;
u_int8_t hdrpref = QCDM_CMD_NV_HDR_REV_PREF_ITEM_REV_PREF_EHRPD;
uint8_t mode = WMC_NETWORK_MODE_AUTO;
uint8_t hdrpref = QCDM_CMD_NV_HDR_REV_PREF_ITEM_REV_PREF_EHRPD;
const char *wmcport = argv[1];
const char *dmport = argv[2];
const char *msg = NULL;
@@ -719,4 +719,3 @@ main (int argc, char *argv[])
return 0;
}