{
/* find next entry */
e_select++;
- if (e_select >= MAX_REMEMBER)
+ if (e_select >= MAX_REMEMBER) {
e_select--;
- else if (in)
+ } else if (in) {
if (e_ext.last_in[e_select][0] == '\0')
e_select--;
- else
+ } else
if (e_ext.last_out[e_select][0] == '\0')
e_select--;
{
struct route_param *rparam;
pid_t pid;
- char *command = "", isdn_port[10];
+ char *command = (char *)"";
+ char isdn_port[10];
char *argv[11]; /* check also number of args below */
int i = 0;
end_trace();
return;
}
- argv[i++] = "/bin/sh";
- argv[i++] = "-c";
+ argv[i++] = (char *)"/bin/sh";
+ argv[i++] = (char *)"-c";
argv[i++] = command;
argv[i++] = command;
if ((rparam = routeparam(e_action, PARAM_PARAM)))
argv[i++] = rparam->string_value;
}
argv[i++] = e_extdialing;
- argv[i++] = numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international);
+ argv[i++] = (char *)numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international);
argv[i++] = e_callerinfo.extension;
argv[i++] = e_callerinfo.name;
SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
void EndpointAppPBX::action_hangup_file(void)
{
struct route_param *rparam;
- char *file, *content, *mode;
+ const char *file, *content, *mode;
FILE *fp;
/* get file / content */
* set the given vbox-tone with full path (without appending)
* the tone is played and after eof, a message is received
*/
-void EndpointAppPBX::set_tone_efi(char *tone)
+void EndpointAppPBX::set_tone_efi(const char *tone)
{
struct lcr_msg *message;
VBOX_STATE_DELETE_DONE, /* tell that message is delete */
};
-char *months_english[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
-char *months_german[] = {"Jan","Feb","Maer","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"};
+const char *months_english[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
+const char *months_german[] = {"Jan","Feb","Maer","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"};
struct vbox_menu {
- char digit;
- char *english;
- char *german;
- } vbox_menu[] = {
+ const char digit;
+ const char *english;
+ const char *german;
+} vbox_menu[] = {
{'1', "<< previous", "<< zurueck"},
{'2', "-> play", "-> anhoeren"},
{'3', ">> next", ">> vor"},
{'9', "X delete", "X loeschen"},
{'0', "* call", "* anrufen"},
{'\0', NULL, NULL}
- };
+};
/*
* initialize the vbox. this is called at process_dialing(), when the VBOX_PLAY
* set the given vbox-tone with full path (without appending)
* the tone is played and after eof, a message is received
*/
-void EndpointAppPBX::set_tone_vbox(char *tone)
+void EndpointAppPBX::set_tone_vbox(const char *tone)
{
struct lcr_msg *message;
PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
}
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
- SCPY(message->param.tone.dir, (char *)((e_ext.vbox_language)?"vbox_german":"vbox_english"));
+ SCPY(message->param.tone.dir, ((e_ext.vbox_language) ? "vbox_german" : "vbox_english"));
SCPY(message->param.tone.name, tone);
message_put(message);
* the current counter value is also received by a message
* set the offset in seconds of the current recording
*/
-void EndpointAppPBX::set_play_vbox(char *file, int offset)
+void EndpointAppPBX::set_play_vbox(const char *file, int offset)
{
char filename[256];
struct lcr_msg *message;
/*
* trace header for application
*/
-void EndpointAppPBX::trace_header(char *name, int direction)
+void EndpointAppPBX::trace_header(const char *name, int direction)
{
struct trace _trace;
}
/* used display message to display callerid as available */
-char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name)
+char *EndpointAppPBX::apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name)
{
static char display[81];
display[0] = '\0';
- char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
+ const char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) id='%s' itype=%d ntype=%d present=%d screen=%d extension='%s' name='%s'\n", ea_endpoint->ep_serial, (id)?id:"NULL", itype, ntype, present, screen, (extension)?extension:"NULL", (name)?name:"NULL");
/* set tone pattern for port */
-void EndpointAppPBX::set_tone(struct port_list *portlist, char *tone)
+void EndpointAppPBX::set_tone(struct port_list *portlist, const char *tone)
{
struct lcr_msg *message;
struct lcr_msg *message;
int anycall = 0;
int cause = CAUSE_RESSOURCEUNAVAIL;
- char *p;
+ const char *p;
char cfp[64];
struct mISDNport *mISDNport;
char portname[32];
logmessage(message_type, param, portlist->port_id, DIRECTION_IN);
struct lcr_msg *message;
- char *logtext = "";
+ const char *logtext = "";
char buffer[64];
/* signal to call tool */
/* check if we have an external call
* this is used to check for encryption ability
*/
-int EndpointAppPBX::check_external(char **errstr, class Port **port)
+int EndpointAppPBX::check_external(const char **errstr, class Port **port)
{
struct join_relation *relation;
class Join *join;
void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned int port_id, int dir)
{
- char *logtext = "unknown";
+ const char *logtext = "unknown";
char buffer[64];
switch(message_type)
}
}
-void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, char *display)
+void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display)
{
struct lcr_msg *message;
};
#define EPOINT_STATE_NAMES \
-static char *state_name[] = { \
+static const char *state_name[] = { \
"EPOINT_STATE_IDLE", \
"EPOINT_STATE_IN_SETUP", \
"EPOINT_STATE_OUT_SETUP", \
void release(int release, int joinlocation, int joincause, int portlocation, int portcause);
void notify_active(void);
void keypad_function(char digit);
- void set_tone(struct port_list *portlist, char *tone);
+ void set_tone(struct port_list *portlist, const char *tone);
void out_setup(void);
struct mISDNport *hunt_port(char *ifname, int *channel);
- char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name);
+ char *apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name);
void auth(int job, int bit_num);
/* vbox playback stuff */
void vbox_handler(void);
void efi_message_eof(void);
void vbox_message_eof(void);
- void set_tone_vbox(char *tone);
- void set_play_vbox(char *file, int offset);
+ void set_tone_vbox(const char *tone);
+ void set_play_vbox(const char *file, int offset);
void set_play_speed(int speed);
/* efi */
- void set_tone_efi(char *tone);
+ void set_tone_efi(const char *tone);
/* routing */
struct route_ruleset *rulesetbyname(char *name);
void encrypt_keyex(void);
void encrypt_off(void);
void encrypt_result(int message, char *text);
- int check_external(char **errstr, class Port **port);
+ int check_external(const char **errstr, class Port **port);
/* crypt */
void cryptman_keyengine(int job);
int cryptman_sizeofinf(unsigned char *buf, int element);
unsigned char *cryptman_getinf(unsigned char *buf, int element, unsigned char *to);
void cryptman_msg2peer(unsigned char *buf);
- void cryptman_msg2user(int msg, char *text);
+ void cryptman_msg2user(int msg, const char *text);
void cryptman_msg2crengine(int msg, unsigned char *buf, int len);
void cryptman_state(int state);
void cryptman_timeout(int secs);
-
- void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display);
+ void message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display);
void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir);
- void trace_header(char *name, int direction);
+ void trace_header(const char *name, int direction);
};
/* create caller id from digits by comparing with national and international
* prefixes.
*/
-char *nationalize_callerinfo(char *string, int *ntype, char *national, char *international)
+const char *nationalize_callerinfo(const char *string, int *ntype, const char *national, const char *international)
{
if (!strncmp(international, string, strlen(international)))
{
/* create number (including access codes) from caller id
* prefixes.
*/
-char *numberrize_callerinfo(char *string, int ntype, char *national, char *international)
+const char *numberrize_callerinfo(const char *string, int ntype, const char *national, const char *international)
{
static char result[256];
** **
\*****************************************************************************/
-char *nationalize_callerinfo(char *string, int *type, char *national, char *international);
-char *numberrize_callerinfo(char *string, int type, char *national, char *international);
+const char *nationalize_callerinfo(const char *string, int *type, const char *national, const char *international);
+const char *numberrize_callerinfo(const char *string, int type, const char *national, const char *international);
CM_ST_NAMES
/* give name of state */
-static char *statename(int state)
+static const char *statename(int state)
{
if (state>=0 && state<cm_st_num)
return(cm_st_name[state]);
void EndpointAppPBX::cryptman_message(int message, unsigned char *param, int len)
{
- char *msgtext = "<<UNKNOWN MESSAGE>>";
+ const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (message>=0 && message<cm_msg_num)
msgtext = cm_msg_name[message];
if (options.deb & DEBUG_CRYPT)
{
- char *msgtext = "<<UNKNOWN MESSAGE>>";
+ const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (msg>=0 && msg<cm_msg_num)
msgtext = cm_msg_name[msg];
/* send message to user
*/
-void EndpointAppPBX::cryptman_msg2user(int msg, char *text)
+void EndpointAppPBX::cryptman_msg2user(int msg, const char *text)
{
struct lcr_msg *message;
/* send message */
if (options.deb & DEBUG_CRYPT)
{
- char *msgtext = "<<UNKNOWN MESSAGE>>";
+ const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (msg>=0 && msg<cm_msg_num)
msgtext = cm_msg_name[msg];
void EndpointAppPBX::encrypt_shared(void)
{
struct lcr_msg *message;
- char *errstr = "";
+ const char *errstr = "";
class Port *port;
int type, key_len;
unsigned char *key;
void EndpointAppPBX::encrypt_keyex(void)
{
struct lcr_msg *message;
- char *errstr = "";
+ const char *errstr = "";
class Port *port;
/* redisplay current crypt display */
};
#define CM_ST_NAMES \
-static char *cm_st_name[] = { \
+static const char *cm_st_name[] = { \
"NULL", \
"IDENT", \
"KEYGEN", \
};
#define CM_MSG_NAMES \
-static char *cm_msg_name[] = { \
+static const char *cm_msg_name[] = { \
"CP_IDENT", \
"CP_SLAVE", \
"CP_MASTER", \
/* extension */
-char *ext_rights[] = {
+const char *ext_rights[] = {
"none",
"internal",
"local",
NULL
};
-char *ext_yesno[] = {
+const char *ext_yesno[] = {
"no",
"yes",
NULL
SCPY(ext->name, param);
if (param2[0])
{
- SCAT(ext->name, " ");
+ SCAT(ext->name, (char *)" ");
SCAT(ext->name, param2);
}
*/
int write_log(char *number, char *callerid, char *calledid, time_t start, time_t stop, int aoce, int cause, int location)
{
- char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+ const char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
FILE *fp=NULL;
char filename[256];
struct tm *tm;
if (callerid[0] == '\0')
- callerid = "<unknown>";
+ callerid = (char *)"<unknown>";
SPRINT(filename, "%s/%s/%s/log", INSTALL_DATA, options.extensions_dir, number);
int lawopt=0;
struct cards {
- char *name;
- char *module;
+ const char *name;
+ const char *module;
} cards[] = {
// { "AVM Fritz PCI (PNP)", "avmfritz"},
{ "HFC PCI (Cologne Chip)", "hfcpci"},
fprintf(fp, "WAVE");
/* fmt */
- fprintf(fp, "fmt %c%c%c%c", sizeof(fmt), 0, 0, 0);
+ fprintf(fp, "fmt %c%c%c%c", (unsigned int)sizeof(fmt), 0, 0, 0);
fmt.stereo = 1;
fmt.channels = 1;
fmt.sample_rate = 8000;
return;
}
*channel = p[3] & 0x7f;
- if (*channel<1 | *channel==16)
+ if ((*channel<1) || (*channel==16))
{
add_trace("channel_id", "error", "PRI interface channel out of range (%d)", *channel);
return;
};
struct interface_param {
- char *name;
+ const char *name;
/* return value (pointer of function)(args ...) */
int (*func)(struct interface *, char *, int, char *, char*);
- char *usage;
- char *help;
+ const char *usage;
+ const char *help;
};
/* debug function for join */
-void joinpbx_debug(class JoinPBX *joinpbx, char *function)
+void joinpbx_debug(class JoinPBX *joinpbx, const char *function)
{
struct join_relation *relation;
struct port_list *portlist;
void play_jingle(int in);
};
-void joinpbx_debug(class JoinPBX *joinpbx, char *function);
+void joinpbx_debug(class JoinPBX *joinpbx, const char *function);
int joinpbx_countrelations(unsigned int join_id);
int track_notify(int oldstate, int notify);
MODE_TRACE,
};
-char *text_interfaces[] = {
+const char *text_interfaces[] = {
"off",
"brief",
"active channels",
"all channels",
};
-char *text_calls[] = {
+const char *text_calls[] = {
"off",
"brief",
"structured",
return(line);
}
-char *admin_state(int sock, char *argv[])
+
+const char *admin_state(int sock, char *argv[])
{
struct admin_message msg,
*m;
/*
* Send command and show error message.
*/
-char *admin_cmd(int sock, int mode, char *extension, char *number)
+const char *admin_cmd(int sock, int mode, char *extension, char *number)
{
static struct admin_message msg;
gettimeofday(&now_tv, &now_tz); \
now_d = ((double)(now_tv.tv_usec))/1000000 + now_tv.tv_sec; \
}
-char *admin_testcall(int sock, int argc, char *argv[])
+const char *admin_testcall(int sock, int argc, char *argv[])
{
static struct admin_message msg;
int ar = 2;
/*
* makes a trace
*/
-char *admin_trace(int sock, int argc, char *argv[])
+const char *admin_trace(int sock, int argc, char *argv[])
{
static struct admin_message msg;
int i;
int mode;
int sock, conn;
struct sockaddr_un sock_address;
- char *ret;
+ const char *ret;
/* show options */
/*
* trace
*/
-void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *msgtext, int direction)
+void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, const char *msgtext, int direction)
{
/* init trace with given values */
start_trace(mISDNport?mISDNport->portnum:0,
* layer trace header
*/
static struct isdn_message {
- char *name;
+ const char *name;
unsigned int value;
} isdn_message[] = {
{"PH_ACTIVATE", L1_ACTIVATE_REQ},
{"MT_RELEASE_L3ID", L3_RELEASE_L3ID_REQ},
{NULL, 0},
};
-static char *isdn_prim[4] = {
+static const char *isdn_prim[4] = {
" REQUEST",
" CONFIRM",
" INDICATION",
void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg, int direction)
{
int i;
- char msgtext[64] = "<<UNKNOWN MESSAGE>>";
+ char msgtext[64];
+ SCPY(msgtext, "<<UNKNOWN MESSAGE>>");
/* select message and primitive text */
i = 0;
while(isdn_message[i].name)
/*
* send control information to the channel (dsp-module)
*/
-void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, char *trace_name, int trace_value)
+void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, const char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
end_trace();
}
-void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value)
+void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, void *c2, int c2_len, const char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
PERROR("Failed to send to socket %d\n", mISDNport->b_socket[i]);
/* trace */
- chan_trace_header(mISDNport, mISDNport->b_port[i], activate?(char*)"BCHANNEL activate":(char*)"BCHANNEL deactivate", DIRECTION_OUT);
+ chan_trace_header(mISDNport, mISDNport->b_port[i], activate ? "BCHANNEL activate" : "BCHANNEL deactivate", DIRECTION_OUT);
add_trace("channel", NULL, "%d", i+1+(i>=15));
if (mISDNport->b_timer[i])
add_trace("event", NULL, "timeout recovery");
/*
* set tone
*/
-void PmISDN::set_tone(char *dir, char *tone)
+void PmISDN::set_tone(const char *dir, const char *tone)
{
int id;
int mISDN_handler(void);
void enc_ie_cause_standalone(struct l3_msg *l3m, int location, int cause);
int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
-void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned int handle, unsigned int c1, unsigned int c2, char *trace_name, int trace_value);
-void ph_control_block(struct mISDNport *mISDNport, unsigned int handle, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value);
-void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *msgtext, int direction);
+void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned int handle, unsigned int c1, unsigned int c2, const char *trace_name, int trace_value);
+void ph_control_block(struct mISDNport *mISDNport, unsigned int handle, unsigned int c1, void *c2, int c2_len, const char *trace_name, int trace_value);
+void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, const char *msgtext, int direction);
void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int prim, int direction);
void bchannel_event(struct mISDNport *mISDNport, int i, int event);
void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle);
unsigned int p_m_crypt_listen_crc;
void cryptman_listen_bch(unsigned char *p, int l);
- void set_tone(char *dir, char *name);
+ void set_tone(const char *dir, const char *name);
void set_echotest(int echotest);
int p_m_portnum; /* used port number (1...n) */
/* safe strcpy/strncpy */
#define SCPY(dst, src) scpy(dst, src, sizeof(dst))
-static inline void scpy(char *dst, char *src, unsigned int siz)
+static inline void scpy(char *dst, const char *src, unsigned int siz)
{
strncpy(dst, src, siz);
dst[siz-1] = '\0';
/* safe strcat/strncat */
#define SCAT(dst, src) scat(dst, src, sizeof(dst))
-static inline void scat(char *dst, char *src, unsigned int siz)
+static inline void scat(char *dst, const char *src, unsigned int siz)
{
strncat(dst, src, siz);
dst[siz-1] = '\0';
/* safe sprintf/snprintf */
#define SPRINT(dst, fmt, arg...) sprint(dst, sizeof(dst), fmt, ## arg)
-static inline void sprint(char *dst, unsigned int siz, char *fmt, ...)
+static inline void sprint(char *dst, unsigned int siz, const char *fmt, ...)
{
va_list args;
/* fatal error with error message and exit */
#define FATAL(fmt, arg...) fatal(__FUNCTION__, __LINE__, fmt, ##arg)
-static inline void fatal(const char *function, int line, char *fmt, ...)
+static inline void fatal(const char *function, int line, const char *fmt, ...)
{
va_list args;
char buffer[256];
fprintf(stderr, "This error is not recoverable, must exit here.\n");
#ifdef DEBUG_FUNC
debug(function, line, "FATAL ERROR", buffer);
- debug(function, line, "FATAL ERROR", "This error is not recoverable, must exit here.\n");
+ debug(function, line, "FATAL ERROR", (char *)"This error is not recoverable, must exit here.\n");
#endif
exit(EXIT_FAILURE);
}
#include "main.h"
-static char *months[] = {
+static const char *months[] = {
"January", "February", "March", "April", "Mai", "June", "July",
"August", "September", "October", "November", "December"
};
fprintf(ph, "\n * date: %s %d %d %d:%02d\n\n", months[mon], mday, year+1900, hour, min);
/* attach audio file */
- if (filename[0])
- if ((fh = open(filename, O_RDONLY)))
+ if ((filename[0]) && ((fh = open(filename, O_RDONLY))))
{
while(strchr(filename, '/'))
filename = strchr(filename, '/')+1;
int fduse = 0;
int fhuse = 0;
-char *debug_prefix = 0;
+const char *debug_prefix = NULL;
int debug_count = 0;
int last_debug = 0;
int debug_newline = 1;
int nooutput = 0;
-void debug_usleep(int msec, char *file, int line, int hour, int min, int sec)
+void debug_usleep(int msec, const char *file, int line, int hour, int min, int sec)
{
usleep(msec);
}
-void debug(const char *function, int line, char *prefix, char *buffer)
+void debug(const char *function, int line, const char *prefix, char *buffer)
{
/* if we have a new debug count, we add a mark */
if (last_debug != debug_count)
int all_idle;
char prefix_string[64];
struct sched_param schedp;
- char *debug_prefix = "alloc";
+ const char *debug_prefix = "alloc";
int created_mutexd = 0,/* created_mutext = 0,*/ created_mutexe = 0,
created_lock = 0, created_signal = 0, created_debug = 0,
created_misdn = 0;
printf("%s\n", tracetext);
start_trace(0, NULL, NULL, NULL, 0, 0, 0, tracetext);
if (quit)
- add_trace("signal", NULL, "%d", quit);
+ add_trace((char *)"signal", NULL, "%d", quit);
end_trace();
ret=0;
/* special debug function to detect buffer overflow
*/
int budetect_stop = 0;
-void budetect(const char *file, int line, char *function)
+void budetect(const char *file, int line, const char *function)
{
if (budetect_stop)
return;
void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...);
void _printerror(const char *function, int line, const char *fmt, ...);
#define DEBUG_FUNC
-void debug(const char *function, int line, char *prefix, char *buffer);
+void debug(const char *function, int line, const char *prefix, char *buffer);
#define DEBUG_CONFIG 0x0001
#define DEBUG_MSG 0x0002
#ifdef BUDETECT_DEF
#define BUDETECT budetect(__FILE__, __LINE__, __FUNCTION__);
- void budetect(const char *file, int line, char *function);
+ void budetect(const char *file, int line, const char *function);
#else
#define BUDETECT ;
#endif
/*
* port constructor
*/
-Port::Port(int type, char *portname, struct port_settings *settings)
+Port::Port(int type, const char *portname, struct port_settings *settings)
{
class Port *temp, **tempp;
/*
* set the file in the tone directory with the given name
*/
-void Port::set_tone(char *dir, char *name)
+void Port::set_tone(const char *dir, const char *name)
{
int fh;
char filename[128];
* set the file in the tone directory for vbox playback
* also set the play_eof-flag
*/
-void Port::set_vbox_tone(char *dir, char *name)
+void Port::set_vbox_tone(const char *dir, const char *name)
{
char filename[256];
* also set the eof-flag
* also set the counter-flag
*/
-void Port::set_vbox_play(char *name, int offset)
+void Port::set_vbox_play(const char *name, int offset)
{
signed int size;
struct lcr_msg *message;
* written before close, because we do not know the size yet)
* type=1 record annoucement, type=0 record audio stream, type=2 record vbox
*/
-int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ignore, char *vbox_email, int vbox_email_file)
+int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ignore, const char *vbox_email, int vbox_email_file)
{
/* RIFFxxxxWAVEfmt xxxx(fmt-size)dataxxxx... */
char dummyheader[8+4+8+sizeof(fmt)+8];
char number[256], callerid[256];
char *p;
struct caller_info callerinfo;
- char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
+ const char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
if (!p_record)
return;
fprintf(p_record, "WAVE");
/* fmt */
- fprintf(p_record, "fmt %c%c%c%c", sizeof(fmt), 0, 0, 0);
+ fprintf(p_record, "fmt %c%c%c%c", (unsigned int)sizeof(fmt), 0, 0, 0);
switch(p_record_type)
{
case CODEC_MONO:
};
#define PORT_STATE_NAMES \
-static char *state_name[] = { \
+static const char *state_name[] = { \
"PORT_STATE_IDLE", \
"PORT_STATE_IN_SETUP", \
"PORT_STATE_OUT_SETUP", \
{
public:
/* methods */
- Port(int type, char *portname, struct port_settings *settings);
+ Port(int type, const char *portname, struct port_settings *settings);
virtual ~Port();
class Port *next; /* next port in list */
int p_type; /* type of port */
virtual int handler(void);
virtual int message_epoint(unsigned int epoint_id, int message, union parameter *param);
virtual void set_echotest(int echotest);
- virtual void set_tone(char *dir, char *name);
+ virtual void set_tone(const char *dir, const char *name);
virtual int read_audio(unsigned char *buffer, int length);
struct port_settings p_settings;
// void *p_knock_fetched; /* pointer to fetched data */
// int p_knock_codec;
// signed int p_knock_size, p_knock_left;
- void set_vbox_tone(char *dir, char *name);/* tone of answering machine */
- void set_vbox_play(char *name, int offset); /* sample of answ. */
+ void set_vbox_tone(const char *dir, const char *name);/* tone of answering machine */
+ void set_vbox_play(const char *name, int offset); /* sample of answ. */
void set_vbox_speed(int speed); /* speed of answ. */
/* identification */
int p_echotest; /* set to echo audio data FROM port back to port's mixer */
/* recording */
- int open_record(int type, int mode, int skip, char *terminal, int anon_ignore, char *vbox_email, int vbox_email_file);
+ int open_record(int type, int mode, int skip, char *terminal, int anon_ignore, const char *vbox_email, int vbox_email_file);
void close_record(int beep, int mute);
void record(unsigned char *data, int length, int dir_fromup);
FILE *p_record; /* recording fp: if not NULL, recording is enabled */
/*
* parse ruleset
*/
-static char *read_string(char *p, char *key, int key_size, char *special)
+static char *read_string(char *p, char *key, int key_size, const char *special)
{
key[0] = 0;
/*
* return ruleset by name
*/
-struct route_ruleset *getrulesetbyname(char *name)
+struct route_ruleset *getrulesetbyname(const char *name)
{
struct route_ruleset *ruleset = ruleset_first;
};
struct cond_defs { /* defintion of all conditions */
- char *name; /* item's name */
+ const char *name; /* item's name */
int match; /* what to check */
int type; /* type of value (COND_TYPE) */
- char *doc; /* syntax */
- char *help; /* short help */
+ const char *doc; /* syntax */
+ const char *help; /* short help */
};
struct param_defs { /* definition of all options */
unsigned long long id; /* ID of parameter (just for checking) */
- char *name; /* name of parameter */
+ const char *name; /* name of parameter */
int type; /* type of value (PARAM_TYPE_*) */
- char *doc; /* syntax */
- char *help; /* quick help */
+ const char *doc; /* syntax */
+ const char *help; /* quick help */
};
struct action_defs { /* definition of all actions */
int id; /* ID of parameter (just for checking) */
- char *name;
+ const char *name;
void (EndpointAppPBX::*init_func)(void);
void (EndpointAppPBX::*dialing_func)(void);
void (EndpointAppPBX::*hangup_func)(void);
unsigned long long params;
- char *help;
+ const char *help;
};
void ruleset_debug(struct route_ruleset *ruleset_start);
extern char ruleset_error[256];
struct route_ruleset *ruleset_parse(void);
-struct route_ruleset *getrulesetbyname(char *name);
+struct route_ruleset *getrulesetbyname(const char *name);
int admin_interface(struct admin_queue **responsep)
{
struct admin_queue *response; /* response pointer */
- char *err_txt = "";
+ const char *err_txt = "";
int err = 0;
if (read_interfaces())
/*
* this function is called for response whenever a call state changes.
*/
-void admin_call_response(int adminid, int message, char *connected, int cause, int location, int notify)
+void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify)
{
struct admin_list *admin;
struct admin_queue *response, **responsep; /* response pointer */
int admin_init(void);
void admin_cleanup(void);
int admin_handle(void);
-void admin_call_response(int adminid, int message, char *connected, int cause, int location, int notify);
+void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify);
int admin_message_to_join(struct admin_message *msg, int remote_id);
int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param);
struct trace trace;
char trace_string[MAX_TRACE_ELEMENTS * 100 + 400];
-static char *spaces[11] = {
+static const char *spaces[11] = {
" ",
" ",
" ",
* initializes a new trace
* all values will be reset
*/
-void _start_trace(const char *__file, int __line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name)
+void _start_trace(const char *__file, int __line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name)
{
if (trace.name[0])
PERROR("trace already started (name=%s) in file %s line %d\n", trace.name, __file, __line);
* if subelement is given, element will also contain a subelement
* if multiple subelements belong to same element, name must be equal for all subelements
*/
-void _add_trace(const char *__file, int __line, char *name, char *sub, const char *fmt, ...)
+void _add_trace(const char *__file, int __line, const char *name, const char *sub, const char *fmt, ...)
{
va_list args;
#define start_trace(port, interface, caller, dialing, direction, category, serial, name) _start_trace(__FILE__, __LINE__, port, interface, caller, dialing, direction, category, serial, name)
#define add_trace(name, sub, fmt, arg...) _add_trace(__FILE__, __LINE__, name, sub, fmt, ## arg)
#define end_trace() _end_trace(__FILE__, __LINE__)
-void _start_trace(const char *__file, int line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name);
-void _add_trace(const char *__file, int line, char *name, char *sub, const char *fmt, ...);
+void _start_trace(const char *__file, int line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name);
+void _add_trace(const char *__file, int line, const char *name, const char *sub, const char *fmt, ...);
void _end_trace(const char *__file, int line);
//char *print_trace(int port, char *interface, char *caller, char *dialing, int direction, char *category, char *name);
}
-static void vbox_trace_header(class VBoxPort *vbox, char *message, int direction)
+static void vbox_trace_header(class VBoxPort *vbox, const char *message, int direction)
{
/* init trace with given values */
start_trace(0,