diff --git a/src/bridge.c b/src/bridge.c index 80496db..35f1fc5 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -114,7 +114,7 @@ int parse_ip_data(modem_config *cfg, unsigned char *data, int len) } } else { - mdm_write(cfg, (char *) data, len); + mdm_write(cfg, data, len); } return 0; } @@ -127,7 +127,7 @@ void *ip_thread(void *arg) fd_set readfs; int max_fd; int res = 0; - char buf[256]; + unsigned char buf[256]; int rc; @@ -162,8 +162,8 @@ void *ip_thread(void *arg) else { LOG(LOG_DEBUG, "Read %d bytes from socket", res); buf[res] = 0; - log_trace(TRACE_IP_IN, buf, res); - parse_ip_data(cfg, (unsigned char *) buf, res); + log_trace(TRACE_IP_IN, (char *) buf, res); + parse_ip_data(cfg, buf, res); } } if (FD_ISSET(cfg->data.cp[1][0], &readfs)) { // pipe @@ -248,7 +248,7 @@ void *run_bridge(void *arg) int max_fd = 0; fd_set readfs; int res = 0; - char buf[256]; + unsigned char buf[256]; int rc = 0; int last_conn_type; @@ -405,7 +405,7 @@ void *run_bridge(void *arg) mdm_send_response(MDM_RESP_OK, cfg); } else { - mdm_parse_data(cfg, buf, res); + mdm_parse_data(cfg, (char *) buf, res); } } diff --git a/src/dce.c b/src/dce.c index 288d69b..46938c4 100644 --- a/src/dce.c +++ b/src/dce.c @@ -139,7 +139,7 @@ int dce_check_control_lines(modem_config *cfg) return new_status; } -int dce_write(modem_config *cfg, char data[], int len) +int dce_write(modem_config *cfg, unsigned char data[], int len) { if (cfg->dce_data.is_ip232) { return ip232_write(cfg, data, len); @@ -147,7 +147,7 @@ int dce_write(modem_config *cfg, char data[], int len) return ser_write(cfg->dce_data.fd, data, len); } -int dce_read(modem_config *cfg, char data[], int len) +int dce_read(modem_config *cfg, unsigned char data[], int len) { if (cfg->dce_data.is_ip232) { return ip232_read(cfg, data, len); diff --git a/src/dce.h b/src/dce.h index d92d25f..04726fe 100644 --- a/src/dce.h +++ b/src/dce.h @@ -8,8 +8,8 @@ int dce_set_flow_control(modem_config *cfg, int opts); int dce_set_control_lines(modem_config *cfg, int state); int dce_get_control_lines(modem_config *cfg); int dce_check_control_lines(modem_config *cfg); -int dce_read(modem_config *cfg, char *data, int len); -int dce_write(modem_config *cfg, char *data, int len); +int dce_read(modem_config *cfg, unsigned char *data, int len); +int dce_write(modem_config *cfg, unsigned char *data, int len); //int dce_check_for_break(modem_config *cfg, char ch, int chars_left); diff --git a/src/debug.h b/src/debug.h index 0bf8671..05b490f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -52,7 +52,7 @@ void log_set_file(FILE * a); void log_set_level(int a); int log_get_trace_flags(); void log_set_trace_flags(int a); -void log_trace(int type, unsigned char *line, int len); +void log_trace(int type, char *line, int len); void log_start(int level); void log_end(); diff --git a/src/ip.c b/src/ip.c index ae95477..4dc1bde 100644 --- a/src/ip.c +++ b/src/ip.c @@ -163,9 +163,9 @@ int ip_disconnect(int fd) return 0; } -int ip_write(int fd, char *data, int len) +int ip_write(int fd, unsigned char *data, int len) { - log_trace(TRACE_IP_OUT, data, len); + log_trace(TRACE_IP_OUT, (char *) data, len); return write(fd, data, len); } diff --git a/src/ip.h b/src/ip.h index 9fd9b48..cabe50a 100644 --- a/src/ip.h +++ b/src/ip.h @@ -12,6 +12,6 @@ extern int ip_connect(char addy[]); extern int ip_accept(int sSocket); extern int ip_disconnect(int fd); extern int ip_write(int fd, unsigned char *data, int len); -extern int ip_read(int fd, unsigned char *data, int len); +extern int ip_read(int fd, char *data, int len); #endif diff --git a/src/ip232.c b/src/ip232.c index 1c3e069..95e5112 100644 --- a/src/ip232.c +++ b/src/ip232.c @@ -157,7 +157,7 @@ int ip232_write(modem_config *cfg, unsigned char *data, int len) int text_len = 0; - log_trace(TRACE_MODEM_OUT, data, len); + log_trace(TRACE_MODEM_OUT, (char *) data, len); retval = len; if (cfg->dce_data.ip232_is_connected) { while (i < len) { @@ -191,7 +191,7 @@ int ip232_read(modem_config *cfg, unsigned char *data, int len) { int res; int rc; - unsigned char buf[256]; + char buf[256]; int i = 0; int ch; int text_len = 0; diff --git a/src/line.c b/src/line.c index c829426..90cbdb5 100644 --- a/src/line.c +++ b/src/line.c @@ -59,7 +59,7 @@ int line_write(modem_config *cfg, char *data, int len) return retval; } - return ip_write(cfg->line_data.fd, data, len); + return ip_write(cfg->line_data.fd, (unsigned char *) data, len); } int line_listen(modem_config *cfg) diff --git a/src/modem_core.c b/src/modem_core.c index fe7d0fe..be53d9b 100644 --- a/src/modem_core.c +++ b/src/modem_core.c @@ -173,14 +173,14 @@ int mdm_set_control_lines(modem_config *cfg) /* Write single char bypassing parity generation since this mirrors input */ void mdm_write_char(modem_config *cfg, char data) { - char str[2]; + unsigned char str[2]; str[0] = data; dce_write(cfg, str, 1); } -void mdm_write(modem_config *cfg, char *data, int len) +void mdm_write(modem_config *cfg, unsigned char *data, int len) { unsigned char *buf; int i; @@ -199,7 +199,7 @@ void mdm_write(modem_config *cfg, char *data, int len) buf[i] |= (((cfg->parity >> v)) & 1) << 7; } - dce_write(cfg, (char *) buf, len); + dce_write(cfg, buf, len); free(buf); } else @@ -214,17 +214,17 @@ void mdm_send_response(int msg, modem_config *cfg) LOG(LOG_DEBUG, "Sending %s response to modem", mdm_responses[msg]); if (cfg->send_responses == TRUE) { - mdm_write(cfg, cfg->crlf, 2); + mdm_write(cfg, (unsigned char *) cfg->crlf, 2); if (cfg->text_responses == TRUE) { LOG(LOG_ALL, "Sending text response"); - mdm_write(cfg, mdm_responses[msg], strlen(mdm_responses[msg])); + mdm_write(cfg, (unsigned char *) mdm_responses[msg], strlen(mdm_responses[msg])); } else { LOG(LOG_ALL, "Sending numeric response"); sprintf(msgID, "%d", msg); - mdm_write(cfg, msgID, strlen(msgID)); + mdm_write(cfg, (unsigned char *) msgID, strlen(msgID)); } - mdm_write(cfg, cfg->crlf, 2); + mdm_write(cfg, (unsigned char *) cfg->crlf, 2); } } @@ -389,8 +389,8 @@ int mdm_parse_cmd(modem_config *cfg) strncpy(cfg->dialno, cfg->last_dialno, strlen(cfg->last_dialno)); cfg->dial_type = cfg->dial_type; cfg->memory_dial = TRUE; - mdm_write(cfg, cfg->crlf, 2); - mdm_write(cfg, cfg->dialno, strlen(cfg->dialno)); + mdm_write(cfg, (unsigned char *) cfg->crlf, 2); + mdm_write(cfg, (unsigned char *) cfg->dialno, strlen(cfg->dialno)); } else { cfg->dialno[0] = 0; @@ -477,7 +477,7 @@ int mdm_parse_cmd(modem_config *cfg) break; case AT_CMD_FLAG_QUERY | 'S': sprintf(tmp, "%s%3.3d", cfg->crlf, cfg->s[num]); - mdm_write(cfg, tmp, strlen(tmp)); + mdm_write(cfg, (unsigned char *) tmp, strlen(tmp)); break; case 'T': // defaut to tone dialing //cfg->default_dial_type=MDM_DT_TONE; @@ -603,7 +603,7 @@ int mdm_handle_char(modem_config *cfg, char ch) if (cfg->cmd_started == TRUE) { if (ch == (char) (cfg->s[SRegisterBackspace])) { if (cfg->cur_line_idx == 0 && cfg->echo == TRUE) { - mdm_write(cfg, "T", 1); + mdm_write(cfg, (unsigned char *) "T", 1); } else { cfg->cur_line_idx--; diff --git a/src/modem_core.h b/src/modem_core.h index 8c7360a..6063424 100644 --- a/src/modem_core.h +++ b/src/modem_core.h @@ -145,7 +145,7 @@ typedef struct modem_config { int disconnect_delay; char crlf[3]; int parity; - unsigned char pchars[3]; + char pchars[3]; } modem_config; int mdm_init(void); diff --git a/src/nvt.c b/src/nvt.c index 2e7bb45..a9fbec6 100644 --- a/src/nvt.c +++ b/src/nvt.c @@ -120,7 +120,7 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, i return rc; } -void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt) +void send_nvt_command(int fd, nvt_vars *vars, int action, int opt) { unsigned char cmd[3]; diff --git a/src/nvt.h b/src/nvt.h index 2686eb2..a75526b 100644 --- a/src/nvt.h +++ b/src/nvt.h @@ -45,13 +45,13 @@ typedef enum { typedef struct nvt_vars { int binary_xmit; int binary_recv; - unsigned char term[256]; + char term[256]; } nvt_vars; extern void nvt_init_config(nvt_vars *vars); extern int get_nvt_cmd_response(int action, int type); extern int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, int speed); -extern void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt); +extern void send_nvt_command(int fd, nvt_vars *vars, int action, int opt); extern void parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity); #endif diff --git a/src/serial.c b/src/serial.c index cc1e6d0..5025d32 100644 --- a/src/serial.c +++ b/src/serial.c @@ -173,18 +173,18 @@ int ser_set_control_lines(int fd, int state) return 0; } -int ser_write(int fd, char *data, int len) +int ser_write(int fd, unsigned char *data, int len) { - log_trace(TRACE_MODEM_OUT, data, len); + log_trace(TRACE_MODEM_OUT, (char *) data, len); return write(fd, data, len); } -int ser_read(int fd, char *data, int len) +int ser_read(int fd, unsigned char *data, int len) { int res; res = read(fd, data, len); - log_trace(TRACE_MODEM_IN, data, res); + log_trace(TRACE_MODEM_IN, (char *) data, res); return res; } diff --git a/src/serial.h b/src/serial.h index 7175984..5fe588a 100644 --- a/src/serial.h +++ b/src/serial.h @@ -11,7 +11,7 @@ int ser_init_conn(char *tty, int speed); int ser_set_flow_control(int fd, int status); int ser_get_control_lines(int fd); int ser_set_control_lines(int fd, int state); -int ser_write(int fd, char *data, int len); -int ser_read(int fd, char *data, int len); +int ser_write(int fd, unsigned char *data, int len); +int ser_read(int fd, unsigned char *data, int len); #endif diff --git a/src/tcpser.c b/src/tcpser.c index 5886e8d..b6ca36e 100644 --- a/src/tcpser.c +++ b/src/tcpser.c @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) cSocket = ip_accept(sSocket); if (cSocket > -1) { if (strlen(all_busy) < 1) { - ip_write(cSocket, (char *) MDM_BUSY, strlen(MDM_BUSY)); + ip_write(cSocket, (unsigned char *) MDM_BUSY, strlen(MDM_BUSY)); } else { writeFile(all_busy, cSocket);