From 0b3a6b4838e4ba55c79387bf7314e6dffb33bf42 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 6 Feb 2014 20:26:30 +0100 Subject: Follow consistent coding style in headers Signed-off-by: Paul Kocialkowski --- samsung-ipc/call.c | 22 +++++++++++----------- samsung-ipc/gen.c | 2 +- samsung-ipc/gprs.c | 20 ++++++++++---------- samsung-ipc/net.c | 13 ++++++------- samsung-ipc/rfs.c | 22 +++++++++++----------- samsung-ipc/sec.c | 40 ++++++++++++++++++++-------------------- samsung-ipc/sms.c | 8 ++++---- 7 files changed, 63 insertions(+), 64 deletions(-) (limited to 'samsung-ipc') diff --git a/samsung-ipc/call.c b/samsung-ipc/call.c index 2c29d3d..c5c0c21 100644 --- a/samsung-ipc/call.c +++ b/samsung-ipc/call.c @@ -25,7 +25,7 @@ #define OUTGOING_NUMBER_MAX_LENGTH 86 -void ipc_call_outgoing_setup(struct ipc_call_outgoing *message, unsigned char type, +void ipc_call_outgoing_setup(struct ipc_call_outgoing_data *message, unsigned char type, unsigned char identity, unsigned char prefix, char *number) { int length; @@ -37,12 +37,12 @@ void ipc_call_outgoing_setup(struct ipc_call_outgoing *message, unsigned char ty if (length > OUTGOING_NUMBER_MAX_LENGTH) length = OUTGOING_NUMBER_MAX_LENGTH; - memset(message, 0, sizeof(struct ipc_call_outgoing)); + memset(message, 0, sizeof(struct ipc_call_outgoing_data)); message->type = type; message->identity = identity; message->prefix = prefix; - message->length = length; + message->number_length = length; strncpy((char *) message->number, number, length); } @@ -71,7 +71,7 @@ struct ipc_call_list_entry* ipc_call_list_response_get_entry(struct ipc_message_ for (n = 0; n < num + 1; n++) { entry = (struct ipc_call_list_entry *) (response->data + pos); - pos += (unsigned int) (sizeof(struct ipc_call_list_entry) + entry->number_len); + pos += (unsigned int) (sizeof(struct ipc_call_list_entry) + entry->number_length); } return entry; @@ -93,7 +93,7 @@ char *ipc_call_list_response_get_entry_number(struct ipc_message_info *response, for (n = 0; n < num + 1; n++) { if (entry != NULL) - pos += entry->number_len; + pos += entry->number_length; entry = (struct ipc_call_list_entry *) (response->data + pos); pos += (unsigned int) sizeof(struct ipc_call_list_entry); @@ -102,17 +102,17 @@ char *ipc_call_list_response_get_entry_number(struct ipc_message_info *response, if (entry == NULL || (unsigned char *) (response->data + pos) == NULL) return NULL; - number = (char *) malloc(sizeof(char) * entry->number_len); - strncpy(number, (char *) (response->data + pos), entry->number_len); + number = (char *) malloc(sizeof(char) * entry->number_length); + strncpy(number, (char *) (response->data + pos), entry->number_length); return number; } -unsigned char *ipc_call_cont_dtmf_burst_pack(struct ipc_call_cont_dtmf *message, +unsigned char *ipc_call_cont_dtmf_burst_pack(struct ipc_call_cont_dtmf_data *message, unsigned char *burst, int burst_len) { unsigned char *data = NULL; - int data_len = sizeof(struct ipc_call_cont_dtmf) + burst_len; + int data_len = sizeof(struct ipc_call_cont_dtmf_data) + burst_len; if (message == NULL || burst == NULL || burst_len <= 0) return NULL; @@ -120,8 +120,8 @@ unsigned char *ipc_call_cont_dtmf_burst_pack(struct ipc_call_cont_dtmf *message, data = (unsigned char *) malloc(sizeof(unsigned char) * data_len); memset(data, 0, data_len); - memcpy(data, message, sizeof(struct ipc_call_cont_dtmf)); - memcpy(data + sizeof(struct ipc_call_cont_dtmf), burst, burst_len); + memcpy(data, message, sizeof(struct ipc_call_cont_dtmf_data)); + memcpy(data + sizeof(struct ipc_call_cont_dtmf_data), burst, burst_len); return data; } diff --git a/samsung-ipc/gen.c b/samsung-ipc/gen.c index e2bc300..6db041b 100644 --- a/samsung-ipc/gen.c +++ b/samsung-ipc/gen.c @@ -21,7 +21,7 @@ #include -int ipc_gen_phone_res_check(struct ipc_gen_phone_res *res) +int ipc_gen_phone_res_check(struct ipc_gen_phone_res_data *res) { if (res == NULL) return -1; diff --git a/samsung-ipc/gprs.c b/samsung-ipc/gprs.c index b73c8f7..7c14df9 100644 --- a/samsung-ipc/gprs.c +++ b/samsung-ipc/gprs.c @@ -22,7 +22,7 @@ #include -void ipc_gprs_port_list_setup(struct ipc_gprs_port_list *message) +void ipc_gprs_port_list_setup(struct ipc_gprs_port_list_data *message) { // FIXME: These are only known-to-work values used on most devices unsigned char bytes[] = { @@ -32,41 +32,41 @@ void ipc_gprs_port_list_setup(struct ipc_gprs_port_list *message) if (message == NULL) return; - memset(message, 0, sizeof(struct ipc_gprs_port_list)); + memset(message, 0, sizeof(struct ipc_gprs_port_list_data)); - memcpy(message->unk, bytes, sizeof(bytes)); + memcpy(message->magic, bytes, sizeof(bytes)); } -void ipc_gprs_define_pdp_context_setup(struct ipc_gprs_define_pdp_context *message, +void ipc_gprs_define_pdp_context_setup(struct ipc_gprs_define_pdp_context_data *message, unsigned char cid, int enable, char *apn) { if (message == NULL) return; - memset(message, 0, sizeof(struct ipc_gprs_define_pdp_context)); + memset(message, 0, sizeof(struct ipc_gprs_define_pdp_context_data)); message->enable = enable ? 1 : 0; message->cid = cid; - message->unk = 0x2; + message->magic = 0x2; strncpy((char *) message->apn, apn, 124); } -void ipc_gprs_pdp_context_setup(struct ipc_gprs_pdp_context_set *message, +void ipc_gprs_pdp_context_request_set_setup(struct ipc_gprs_pdp_context_request_set_data *message, unsigned char cid, int enable, char *username, char *password) { if (message == NULL) return; - memset(message, 0, sizeof(struct ipc_gprs_pdp_context_set)); + memset(message, 0, sizeof(struct ipc_gprs_pdp_context_request_set_data)); message->enable = enable ? 1 : 0; message->cid = cid; if (enable && username != NULL && password != NULL) { - message->unk0[2] = 0x13; - message->unk2 = 0x1; + message->magic[2] = 0x13; + message->unknown2 = 0x1; strncpy((char *) message->username, username, 32); strncpy((char *) message->password, password, 32); } diff --git a/samsung-ipc/net.c b/samsung-ipc/net.c index 2a340a0..e67f909 100644 --- a/samsung-ipc/net.c +++ b/samsung-ipc/net.c @@ -22,15 +22,14 @@ #include -void ipc_net_regist_get_setup(struct ipc_net_regist_get *message, +void ipc_net_regist_setup(struct ipc_net_regist_request_data *message, unsigned char domain) { - /* FIXME: could that be IPC_NET_ACCESS_TECHNOLOGY_... (act) ? */ - message->net = 0xff; + message->act = IPC_NET_ACCESS_TECHNOLOGY_UNKNOWN; message->domain = domain; } -void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_set *message, +void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_request_data *message, unsigned char mode, char *plmn, unsigned char act) { int message_plmn_len; @@ -42,11 +41,11 @@ void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_set *message, message_plmn_len = sizeof(message->plmn); - memset(message, 0, sizeof(struct ipc_net_plmn_sel_set)); + memset(message, 0, sizeof(struct ipc_net_plmn_sel_request_data)); if (mode == IPC_NET_PLMN_SEL_AUTO) { - message->mode = IPC_NET_PLMN_SEL_AUTO; + message->mode_sel = IPC_NET_PLMN_SEL_AUTO; message->act = IPC_NET_ACCESS_TECHNOLOGY_UNKNOWN; } else if (mode == IPC_NET_PLMN_SEL_MANUAL) @@ -63,7 +62,7 @@ void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_set *message, if (plmn_len < message_plmn_len) memset((void *) (message->plmn + plmn_len), '#', message_plmn_len - plmn_len); - message->mode = IPC_NET_PLMN_SEL_MANUAL; + message->mode_sel = IPC_NET_PLMN_SEL_MANUAL; message->act = act; } } diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c index 38eea11..0607abe 100644 --- a/samsung-ipc/rfs.c +++ b/samsung-ipc/rfs.c @@ -834,8 +834,8 @@ int nv_data_write(struct ipc_client *client, int offset, int length, char *buf) void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, struct ipc_message_info *info) { - struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data; - struct ipc_rfs_io_confirm *rfs_io_conf; + struct ipc_rfs_nv_read_item_data *rfs_io = (struct ipc_rfs_nv_read_item_data *) info->data; + struct ipc_rfs_nv_read_item_confirm_header *rfs_io_conf; void *rfs_data; int rc; @@ -845,9 +845,9 @@ void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, return; } - rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_io_confirm)); - memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_io_confirm)); - rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_io_confirm); + rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_nv_read_item_confirm_header)); + memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_nv_read_item_confirm_header)); + rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_nv_read_item_confirm_header); ipc_client_log(client, "Asked to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset); rc = nv_data_read(client, rfs_io->offset, rfs_io->length, rfs_data); @@ -863,15 +863,15 @@ void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, rfs_io_conf->length = rfs_io->length; ipc_client_send(client, IPC_RFS_NV_READ_ITEM, 0, (unsigned char *) rfs_io_conf, - rfs_io->length + sizeof(struct ipc_rfs_io_confirm), info->aseq); + rfs_io->length + sizeof(struct ipc_rfs_nv_read_item_confirm_header), info->aseq); free(rfs_io_conf); } void ipc_rfs_send_io_confirm_for_nv_write_item(struct ipc_client *client, struct ipc_message_info *info) { - struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data; - struct ipc_rfs_io_confirm *rfs_io_conf; + struct ipc_rfs_nv_read_item_confirm_header *rfs_io = (struct ipc_rfs_nv_read_item_confirm_header *) info->data; + struct ipc_rfs_nv_write_item_confirm_data *rfs_io_conf; void *rfs_data; int rc; @@ -881,7 +881,7 @@ void ipc_rfs_send_io_confirm_for_nv_write_item(struct ipc_client *client, return; } - rfs_data = info->data + sizeof(struct ipc_rfs_io); + rfs_data = info->data + sizeof(struct ipc_rfs_nv_read_item_confirm_header); #ifdef DEBUG ipc_client_log(client, "Write rfs_data dump:"); @@ -892,13 +892,13 @@ void ipc_rfs_send_io_confirm_for_nv_write_item(struct ipc_client *client, rc = nv_data_write(client, rfs_io->offset, rfs_io->length, rfs_data); ipc_client_log(client, "Sending RFS IO Confirm message (rc is %d)", rc); - rfs_io_conf = (struct ipc_rfs_io_confirm*) malloc(sizeof(struct ipc_rfs_io_confirm)); + rfs_io_conf = (struct ipc_rfs_nv_write_item_confirm_data *) malloc(sizeof(struct ipc_rfs_nv_write_item_confirm_data)); rfs_io_conf->confirm = rc < 0 ? 0 : 1; rfs_io_conf->offset = rfs_io->offset; rfs_io_conf->length = rfs_io->length; ipc_client_send(client, IPC_RFS_NV_WRITE_ITEM, 0, (unsigned char *) rfs_io_conf, - sizeof(struct ipc_rfs_io_confirm), info->aseq); + sizeof(struct ipc_rfs_nv_write_item_confirm_data), info->aseq); free(rfs_io_conf); } diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c index 7fa9a42..76584e8 100644 --- a/samsung-ipc/sec.c +++ b/samsung-ipc/sec.c @@ -23,52 +23,52 @@ #include -void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, +void ipc_sec_sim_status_setup(struct ipc_sec_sim_status_request_data *message, unsigned char pin_type, char *pin1, char *pin2) { if (message == NULL) return; - memset(message, 0, sizeof(struct ipc_sec_pin_status_set)); + memset(message, 0, sizeof(struct ipc_sec_sim_status_request_data)); message->type = pin_type; if (pin1 != NULL) { strncpy((char *) message->pin1, pin1, 8); - message->length1 = strlen(pin1); + message->pin1_length = strlen(pin1); } if (pin2 != NULL) { strncpy((char *) message->pin2, pin2, 8); - message->length2 = strlen(pin2); + message->pin2_length = strlen(pin2); } } -void ipc_sec_lock_info_get_setup(struct ipc_sec_lock_info_get *message, +void ipc_sec_lock_info_setup(struct ipc_sec_lock_info_request_data *message, unsigned char pin_type) { if (message == NULL) return; - message->unk0 = 1; - message->pin_type = pin_type; + message->magic = 1; + message->type = pin_type; } char *ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response) { int n = 0; - int offset = (int) sizeof(struct ipc_sec_rsim_access_response); + int offset = (int) sizeof(struct ipc_sec_rsim_access_response_header); int size = 0; if (response == NULL) return NULL; - struct ipc_sec_rsim_access_response *rsimresp = (struct ipc_sec_rsim_access_response*) response->data; - char *file_data = (char *) malloc(sizeof(char) * rsimresp->len); + struct ipc_sec_rsim_access_response_header *rsimresp = (struct ipc_sec_rsim_access_response_header*) response->data; + char *file_data = (char *) malloc(sizeof(char) * rsimresp->length); - for (n = 0; n < rsimresp->len; n++) + for (n = 0; n < rsimresp->length; n++) { if (response->data[offset + n] == 0x0) continue; @@ -80,40 +80,40 @@ char *ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *respon } } - if (size < rsimresp->len) + if (size < rsimresp->length) file_data = (char *) realloc(file_data, sizeof(char) * size); return file_data; } -void ipc_sec_phone_lock_set_setup(struct ipc_sec_phone_lock_set *message, +void ipc_sec_phone_lock_request_set_setup(struct ipc_sec_phone_lock_request_set_data *message, int pin_type, int enable, char *passwd) { - message->type = pin_type; - message->lock = enable ? 1 : 0; + message->facility_type = pin_type; + message->active = enable ? 1 : 0; if (passwd != NULL) { strncpy((char *) message->password, passwd, 39); - message->length = strlen(passwd); + message->password_length = strlen(passwd); } } -void ipc_sec_change_locking_pw_set_setup(struct ipc_sec_change_locking_pw_set *message, +void ipc_sec_change_locking_pw_setup(struct ipc_sec_change_locking_pw_data *message, int type, char *passwd_old, char *passwd_new) { - message->facility = type; + message->facility_type = type; if (passwd_old != NULL) { strncpy((char *) message->password_old, passwd_old, 39); - message->length_old = strlen(passwd_old); + message->password_old_length = strlen(passwd_old); } if (passwd_new != NULL) { strncpy((char *) message->password_new, passwd_new, 39); - message->length_new = strlen(passwd_new); + message->password_new_length = strlen(passwd_new); } } diff --git a/samsung-ipc/sms.c b/samsung-ipc/sms.c index d837881..047754e 100644 --- a/samsung-ipc/sms.c +++ b/samsung-ipc/sms.c @@ -22,7 +22,7 @@ #include -unsigned char *ipc_sms_send_msg_pack(struct ipc_sms_send_msg_request *msg, char *smsc, +unsigned char *ipc_sms_send_msg_pack(struct ipc_sms_send_msg_request_header *msg, char *smsc, unsigned char *pdu, int pdu_length) { unsigned char *data = NULL, *p = NULL; @@ -32,13 +32,13 @@ unsigned char *ipc_sms_send_msg_pack(struct ipc_sms_send_msg_request *msg, char return NULL; smsc_len = strlen(smsc); - data_length = smsc_len + pdu_length + sizeof(struct ipc_sms_send_msg_request); + data_length = smsc_len + pdu_length + sizeof(struct ipc_sms_send_msg_request_header); data = (unsigned char *) malloc(sizeof(unsigned char) * data_length); memset(data, 0, data_length); p = data; - memcpy(p, msg, sizeof(struct ipc_sms_send_msg_request)); - p += sizeof(struct ipc_sms_send_msg_request); + memcpy(p, msg, sizeof(struct ipc_sms_send_msg_request_header)); + p += sizeof(struct ipc_sms_send_msg_request_header); memcpy(p, (char *) (smsc + 1), smsc_len); p += smsc_len; memcpy(p, pdu, pdu_length); -- cgit v1.1