From: Super User Date: Sat, 14 Jun 2008 06:34:50 +0000 (+0200) Subject: changed long to int (64 bit system's compatibilty) X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=d2b113f2c4f11acfaee1b2e0fd2f03744a89f6d4 changed long to int (64 bit system's compatibilty) --- diff --git a/Makefile b/Makefile index ce4b9fb..046d30a 100644 --- a/Makefile +++ b/Makefile @@ -309,7 +309,7 @@ endif clean: touch * rm -f $(LCR) $(LCRADMIN) $(CHAN_LCR) $(LCRWATCH) $(GEN) $(GENW) $(GENRC) $(GENEXT) - rm -f *.o + rm -f *.o *.ooo rm -f .*.c.sw* .*.cpp.sw* .*.h.sw* rm -f bla nohup.out a.out rm -f debug*.log diff --git a/alawulaw.c b/alawulaw.c index 07d5351..f8c62d3 100644 --- a/alawulaw.c +++ b/alawulaw.c @@ -9,10 +9,10 @@ ** ** \*****************************************************************************/ -signed long *audio_law_to_s32; +signed int *audio_law_to_s32; /* ulaw -> signed 16-bit */ -static signed long audio_ulaw_to_s32[] = +static signed int audio_ulaw_to_s32[] = { 0xffff8284, 0xffff8684, 0xffff8a84, 0xffff8e84, 0xffff9284, 0xffff9684, 0xffff9a84, 0xffff9e84, @@ -81,7 +81,7 @@ static signed long audio_ulaw_to_s32[] = }; /* alaw -> signed 16-bit */ -static signed long audio_alaw_to_s32[] = +static signed int audio_alaw_to_s32[] = { 0x000013fc, 0xffffec04, 0x00000144, 0xfffffebc, 0x0000517c, 0xffffae84, 0x0000051c, 0xfffffae4, diff --git a/alawulaw.h b/alawulaw.h index 96c170a..8811d0f 100644 --- a/alawulaw.h +++ b/alawulaw.h @@ -1,5 +1,5 @@ -extern signed long *audio_law_to_s32; +extern signed int *audio_law_to_s32; extern unsigned char audio_s16_to_law[65536]; extern short audio_alaw_relations[]; void generate_tables(char law); diff --git a/apppbx.cpp b/apppbx.cpp index 6304848..e491a57 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -1990,7 +1990,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type, { struct lcr_msg *message; char buffer[256]; - unsigned long port_id = portlist->port_id; + unsigned int port_id = portlist->port_id; struct port_list *tportlist; class Port *port; struct interface *interface; @@ -2200,7 +2200,7 @@ void EndpointAppPBX::port_disconnect_release(struct port_list *portlist, int mes { struct lcr_msg *message; char buffer[256]; - unsigned long port_id = portlist->port_id; + unsigned int port_id = portlist->port_id; int cause, location; @@ -2595,7 +2595,7 @@ void EndpointAppPBX::port_resume(struct port_list *portlist, int message_type, u /* port sends message to the endpoint */ -void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, union parameter *param) +void EndpointAppPBX::ea_message_port(unsigned int port_id, int message_type, union parameter *param) { struct port_list *portlist; struct lcr_msg *message; @@ -3318,7 +3318,7 @@ void EndpointAppPBX::join_notify(struct port_list *portlist, int message_type, u /* JOIN sends messages to the endpoint */ -void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, union parameter *param) +void EndpointAppPBX::ea_message_join(unsigned int join_id, int message_type, union parameter *param) { struct port_list *portlist; struct lcr_msg *message; @@ -4052,7 +4052,7 @@ int EndpointAppPBX::check_external(char **errstr, class Port **port) return(0); } -void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned long port_id, int dir) +void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned int port_id, int dir) { char *logtext = "unknown"; char buffer[64]; diff --git a/apppbx.h b/apppbx.h index 7bdf008..6eaf2dd 100644 --- a/apppbx.h +++ b/apppbx.h @@ -64,7 +64,7 @@ class EndpointAppPBX : public EndpointApp int e_hold; /* is this endpoint on hold ? */ char e_tone[256]; /* save tone for resuming ports */ - unsigned long e_adminid; + unsigned int e_adminid; /* states */ int e_state; /* state of endpoint */ @@ -103,9 +103,9 @@ class EndpointAppPBX : public EndpointApp int e_powercount; /* power count */ int e_powerlimit; /* power limit */ double e_callback; /* time when callback (when idle reached) 0=off */ - signed long e_cfnr_release; /* time stamp when to do the release for call forward on no response */ - signed long e_cfnr_call; /* time stamp when to do the call for call forward on no response */ - signed long e_password_timeout; /* time stamp when to do the release for password timeout */ + signed int e_cfnr_release; /* time stamp when to do the release for call forward on no response */ + signed int e_cfnr_call; /* time stamp when to do the call for call forward on no response */ + signed int e_password_timeout; /* time stamp when to do the release for password timeout */ /* port relation */ int e_multipoint_cause; /* cause value of disconnected multiport calls (highest priority) */ @@ -164,8 +164,8 @@ class EndpointAppPBX : public EndpointApp char e_crypt_info[33]; /* last information text */ int e_crypt_timeout_sec; /* timer */ int e_crypt_timeout_usec; /* timer */ - unsigned long e_crypt_random; /* current random number for ident */ - unsigned long e_crypt_bogomips; /* bogomips for ident */ + unsigned int e_crypt_random; /* current random number for ident */ + unsigned int e_crypt_bogomips; /* bogomips for ident */ unsigned char e_crypt_key[256]; /* the session key */ int e_crypt_key_len; unsigned char e_crypt_ckey[256]; /* the encrypted session key */ @@ -191,7 +191,7 @@ class EndpointAppPBX : public EndpointApp /* messages */ void hookflash(void); - void ea_message_port(unsigned long port_id, int message, union parameter *param); + void ea_message_port(unsigned int port_id, int message, union parameter *param); void port_setup(struct port_list *portlist, int message_type, union parameter *param); void port_information(struct port_list *portlist, int message_type, union parameter *param); void port_dtmf(struct port_list *portlist, int message_type, union parameter *param); @@ -206,7 +206,7 @@ class EndpointAppPBX : public EndpointApp void port_facility(struct port_list *portlist, int message_type, union parameter *param); void port_suspend(struct port_list *portlist, int message_type, union parameter *param); void port_resume(struct port_list *portlist, int message_type, union parameter *param); - void ea_message_join(unsigned long join_id, int message, union parameter *param); + void ea_message_join(unsigned int join_id, int message, union parameter *param); void join_crypt(struct port_list *portlist, int message_type, union parameter *param); void join_mISDNsignal(struct port_list *portlist, int message_type, union parameter *param); void join_setup(struct port_list *portlist, int message_type, union parameter *param); @@ -346,7 +346,7 @@ class EndpointAppPBX : public EndpointApp void cryptman_timeout(int secs); void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display); - void logmessage(int message_type, union parameter *param, unsigned long port_id, int dir); + void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir); void trace_header(char *name, int direction); }; diff --git a/bchannel.c b/bchannel.c index b6cb00d..288d3eb 100644 --- a/bchannel.c +++ b/bchannel.c @@ -63,11 +63,11 @@ void bchannel_deinitialize(void) /* * send control information to the channel (dsp-module) */ -static void ph_control(unsigned long handle, unsigned long c1, unsigned long c2, char *trace_name, int trace_value, int b_mode) +static void ph_control(unsigned int handle, unsigned int c1, unsigned int c2, char *trace_name, int trace_value, int b_mode) { unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)]; struct mISDNhead *ctrl = (struct mISDNhead *)buffer; - unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN); + unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN); int ret; if (b_mode != 0 && b_mode != 2) @@ -83,11 +83,11 @@ static void ph_control(unsigned long handle, unsigned long c1, unsigned long c2, CERROR(NULL, NULL, "Failed to send to socket %d\n", handle); } -static void ph_control_block(unsigned long handle, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value, int b_mode) +static void ph_control_block(unsigned int handle, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value, int b_mode) { unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len]; struct mISDNhead *ctrl = (struct mISDNhead *)buffer; - unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN); + unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN); int ret; if (b_mode != 0 && b_mode != 2) @@ -110,7 +110,7 @@ static void ph_control_block(unsigned long handle, unsigned long c1, void *c2, i int bchannel_create(struct bchannel *bchannel, int mode) { int ret; - unsigned long on = 1; + unsigned int on = 1; struct sockaddr_mISDN addr; if (bchannel->b_sock) @@ -261,7 +261,7 @@ static void bchannel_receive(struct bchannel *bchannel, unsigned char *buffer, i { struct mISDNhead *hh = (struct mISDNhead *)buffer; unsigned char *data = buffer + MISDN_HEADER_LEN; - unsigned long cont = *((unsigned long *)data); + unsigned int cont = *((unsigned int *)data); struct bchannel *remote_bchannel; int ret; @@ -549,7 +549,7 @@ int bchannel_handle(void) * bchannel channel handling */ struct bchannel *bchannel_first = NULL; -struct bchannel *find_bchannel_handle(unsigned long handle) +struct bchannel *find_bchannel_handle(unsigned int handle) { struct bchannel *bchannel = bchannel_first; @@ -563,7 +563,7 @@ struct bchannel *find_bchannel_handle(unsigned long handle) } #if 0 -struct bchannel *find_bchannel_ref(unsigned long ref) +struct bchannel *find_bchannel_ref(unsigned int ref) { struct bchannel *bchannel = bchannel_first; @@ -577,7 +577,7 @@ struct bchannel *find_bchannel_ref(unsigned long ref) } #endif -struct bchannel *alloc_bchannel(unsigned long handle) +struct bchannel *alloc_bchannel(unsigned int handle) { struct bchannel **bchannelp = &bchannel_first; diff --git a/bchannel.h b/bchannel.h index faf0602..f7b3860 100644 --- a/bchannel.h +++ b/bchannel.h @@ -13,7 +13,7 @@ struct bchannel { struct bchannel *next; struct chan_call *call; /* link to call process */ - unsigned long handle; /* handle for stack id */ + unsigned int handle; /* handle for stack id */ int b_sock; /* socket for b-channel */ int b_mode; /* dsp, raw, dsphdlc */ int b_state; @@ -22,7 +22,7 @@ struct bchannel { int b_tx_dejitter; int b_tx_gain, b_rx_gain; char b_pipeline[256]; - unsigned long b_conf; + unsigned int b_conf; int b_echo; int b_tone; int b_rxoff; @@ -48,8 +48,8 @@ void bchannel_blowfish(struct bchannel *bchannel, unsigned char *key, int len); void bchannel_pipeline(struct bchannel *bchannel, char *pipeline); void bchannel_gain(struct bchannel *bchannel, int gain, int tx); int bchannel_handle(void); -struct bchannel *find_bchannel_handle(unsigned long handle); -//struct bchannel *find_bchannel_ref(unsigned long ref); -struct bchannel *alloc_bchannel(unsigned long handle); +struct bchannel *find_bchannel_handle(unsigned int handle); +//struct bchannel *find_bchannel_ref(unsigned int ref); +struct bchannel *alloc_bchannel(unsigned int handle); void free_bchannel(struct bchannel *channel); diff --git a/chan_lcr.c b/chan_lcr.c index 2006d7a..ab9c76a 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -169,7 +169,7 @@ void chan_lcr_log(int type, const char *file, int line, const char *function, st va_end(args); if (call) - sprintf(call_text, "%ld", call->ref); + sprintf(call_text, "%d", call->ref); if (ast) strncpy(ast_text, ast->name, sizeof(ast_text)-1); ast_text[sizeof(ast_text)-1] = '\0'; @@ -184,7 +184,7 @@ void chan_lcr_log(int type, const char *file, int line, const char *function, st */ struct chan_call *call_first; -struct chan_call *find_call_ref(unsigned long ref) +struct chan_call *find_call_ref(unsigned int ref) { struct chan_call *call = call_first; @@ -211,7 +211,7 @@ struct chan_call *find_call_ast(struct ast_channel *ast) return(call); } -struct chan_call *find_call_handle(unsigned long handle) +struct chan_call *find_call_handle(unsigned int handle) { struct chan_call *call = call_first; @@ -305,7 +305,7 @@ unsigned short new_bridge_id(void) /* * enque message to LCR */ -int send_message(int message_type, unsigned long ref, union parameter *param) +int send_message(int message_type, unsigned int ref, union parameter *param) { struct admin_list *admin, **adminp; @@ -1048,7 +1048,7 @@ void lcr_in_dtmf(struct chan_call *call, int val) /* * message received from LCR */ -int receive_message(int message_type, unsigned long ref, union parameter *param) +int receive_message(int message_type, unsigned int ref, union parameter *param) { struct bchannel *bchannel; struct chan_call *call; @@ -1400,7 +1400,7 @@ int open_socket(void) char *socket_name = SOCKET_NAME; int conn; struct sockaddr_un sock_address; - unsigned long on = 1; + unsigned int on = 1; union parameter param; /* open socket */ diff --git a/chan_lcr.h b/chan_lcr.h index 0ca58d5..c24a666 100644 --- a/chan_lcr.h +++ b/chan_lcr.h @@ -14,7 +14,7 @@ struct bchannel; struct chan_call { struct chan_call *next; /* link to next call instance */ int state; /* current call state CHAN_LCR_STATE */ - unsigned long ref; /* callref for this channel */ + unsigned int ref; /* callref for this channel */ void *ast; /* current asterisk channel */ int pbx_started; /* indicates if pbx que is available */ diff --git a/crypt.cpp b/crypt.cpp index 80ece0e..b43bcba 100644 --- a/crypt.cpp +++ b/crypt.cpp @@ -206,7 +206,7 @@ unsigned char *crypt_key(unsigned char *key, int *binary_len) /* * support routine to get cpu speed */ -static unsigned long get_bogomips(void) +static unsigned int get_bogomips(void) { FILE *fp; char buffer[64], *p; @@ -244,9 +244,9 @@ static unsigned long get_bogomips(void) /* * crc 32 stuff */ -static unsigned long crc_reflect(unsigned long ref, char ch) +static unsigned int crc_reflect(unsigned int ref, char ch) { - unsigned long value = 0; + unsigned int value = 0; int i; i = 1; @@ -260,12 +260,12 @@ static unsigned long crc_reflect(unsigned long ref, char ch) return(value); } -static unsigned long crc32_table[256]; +static unsigned int crc32_table[256]; static int crc_initialized = 0; void crc_init(void) { - unsigned long ulPolynomial = 0x04c11db7; + unsigned int ulPolynomial = 0x04c11db7; int i, j; i = 0; @@ -284,9 +284,9 @@ void crc_init(void) crc_initialized = 1; } -unsigned long crc32(unsigned char *data, int len) +unsigned int crc32(unsigned char *data, int len) { - unsigned long crc = 0xffffffff; + unsigned int crc = 0xffffffff; if (!crc_initialized) FATAL("crc not initialized, exitting..."); @@ -656,7 +656,7 @@ void EndpointAppPBX::cryptman_handler(void) void EndpointAppPBX::cr_ident(int message, unsigned char *param, int len) { unsigned char buf[4], *p; - unsigned long bogomips = 0, ran; + unsigned int bogomips = 0, ran; int l; l = CM_SIZEOFINF(CM_INFO_RANDOM); @@ -1572,7 +1572,7 @@ void EndpointAppPBX::cryptman_timeout(int secs) */ int cryptman_encode_bch(unsigned char *data, int len, unsigned char *buf, int buf_len) { - unsigned long crc; + unsigned int crc; int overhead = 18; len--; /* without null-termination */ diff --git a/crypt.h b/crypt.h index 26d1c3e..1c6924c 100644 --- a/crypt.h +++ b/crypt.h @@ -168,6 +168,6 @@ int cm_msg_num = sizeof(cm_msg_name) / sizeof(char *); cryptman_getinf(param, a, b); void crc_init(void); -unsigned long crc32(unsigned char *data, int len); +unsigned int crc32(unsigned char *data, int len); int cryptman_encode_bch(unsigned char *data, int len, unsigned char *buf, int buf_len); diff --git a/dss1.cpp b/dss1.cpp index 59309b6..79f0674 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -16,7 +16,7 @@ extern "C" { } #include -extern unsigned long mt_assign_pid; +extern unsigned int mt_assign_pid; #include "ie.cpp" @@ -73,7 +73,7 @@ static struct l3_msg *create_l3msg(void) * return: <0: error, call is released, -cause is given * 0: ok, nothing to do */ -int Pdss1::received_first_reply_to_setup(unsigned long cmd, int channel, int exclusive) +int Pdss1::received_first_reply_to_setup(unsigned int cmd, int channel, int exclusive) { int ret; l3_msg *l3m; @@ -1150,6 +1150,15 @@ void Pdss1::release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) p_m_delete = 1; } +/* CC_RESTART INDICATION */ +void Pdss1::restart_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) +{ + l1l2l3_trace_header(p_m_mISDNport, this, L3_RESTART_IND, DIRECTION_IN); + end_trace(); + + // L3 process is not toucht. (not even by network stack) +} + /* CC_RELEASE_COMPLETE INDICATION (a reject) */ void Pdss1::release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) { @@ -1691,6 +1700,10 @@ void Pdss1::message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) release_complete_ind(cmd, pid, l3m); break; + case MT_RESTART: + restart_ind(cmd, pid, l3m); + break; + case MT_NOTIFY: notify_ind(cmd, pid, l3m); break; @@ -1827,7 +1840,7 @@ int Pdss1::handler(void) * handles all messages from endpoint */ /* MESSAGE_INFORMATION */ -void Pdss1::message_information(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_information(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -1846,7 +1859,7 @@ void Pdss1::message_information(unsigned long epoint_id, int message_id, union p int newteid = 0; /* MESSAGE_SETUP */ -void Pdss1::message_setup(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_setup(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int ret; @@ -2118,7 +2131,7 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet } /* MESSAGE_FACILITY */ -void Pdss1::message_facility(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_facility(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2135,7 +2148,7 @@ void Pdss1::message_facility(unsigned long epoint_id, int message_id, union para } /* MESSAGE_NOTIFY */ -void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_notify(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int notify; @@ -2228,7 +2241,7 @@ void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parame } /* MESSAGE_OVERLAP */ -void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2251,7 +2264,7 @@ void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union param } /* MESSAGE_PROCEEDING */ -void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_proceeding(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2274,7 +2287,7 @@ void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union pa } /* MESSAGE_ALERTING */ -void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_alerting(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2290,7 +2303,8 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + if (p_m_mISDNport->tones) + enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2315,7 +2329,7 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para } /* MESSAGE_CONNECT */ -void Pdss1::message_connect(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int type, plan, present, screen; @@ -2329,11 +2343,6 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param l1l2l3_trace_header(p_m_mISDNport, this, L3_PROCEEDING_REQ, DIRECTION_OUT); /* channel information */ enc_ie_channel_id(l3m, 1, p_m_b_channel); -// /* progress information */ -// if (p_capainfo.bearer_capa==INFO_BC_SPEECH -// || p_capainfo.bearer_capa==INFO_BC_AUDIO -// || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) -// enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2437,7 +2446,7 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param } /* MESSAGE_DISCONNECT */ -void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_disconnect(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; struct lcr_msg *message; @@ -2480,6 +2489,7 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) + if (p_m_mISDNport->tones) enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); @@ -2508,7 +2518,7 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) } /* MESSAGE_RELEASE */ -void Pdss1::message_release(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_release(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; class Endpoint *epoint; @@ -2541,8 +2551,6 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param */ if (p_state==PORT_STATE_IN_SETUP || p_state==PORT_STATE_OUT_SETUP) -// // NOTE: a bug in mISDNuser (see disconnect_req_out !!!) -// || p_state==PORT_STATE_OUT_DISCO) { //#warning remove me //PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial); @@ -2576,6 +2584,7 @@ wirklich erst proceeding?: if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) + if (p_m_mISDNport->tones) enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); @@ -2613,7 +2622,7 @@ wirklich erst proceeding?: /* * endpoint sends messages to the port */ -int Pdss1::message_epoint(unsigned long epoint_id, int message_id, union parameter *param) +int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union parameter *param) { struct lcr_msg *message; diff --git a/dss1.h b/dss1.h index f552547..1f27714 100644 --- a/dss1.h +++ b/dss1.h @@ -19,7 +19,7 @@ class Pdss1 : public PmISDN void message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); int p_m_d_ces; /* ntmode: tei&sapi */ int handler(void); - int message_epoint(unsigned long epoint_id, int message, union parameter *param); + int message_epoint(unsigned int epoint_id, int message, union parameter *param); int p_m_d_ntmode; /* flags the nt-mode */ struct lcr_msg *p_m_d_queue; /* queue for SETUP if link is down */ @@ -29,9 +29,9 @@ class Pdss1 : public PmISDN int p_m_d_collect_location; void new_state(int state); /* set new state */ -// void isdn_show_send_message(unsigned long prim, msg_t *msg); +// void isdn_show_send_message(unsigned int prim, msg_t *msg); int hunt_bchannel(int exclusive, int channel); - int received_first_reply_to_setup(unsigned long cmd, int channel, int exclusive); + int received_first_reply_to_setup(unsigned int cmd, int channel, int exclusive); void information_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void setup_acknowledge_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); @@ -40,6 +40,7 @@ class Pdss1 : public PmISDN void connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); + void restart_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void disconnect_ind_i(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void t312_timeout_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); @@ -49,16 +50,16 @@ class Pdss1 : public PmISDN void retrieve_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void suspend_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void resume_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); - void message_information(unsigned long epoint_id, int message_id, union parameter *param); - void message_setup(unsigned long epoint_id, int message_id, union parameter *param); - void message_notify(unsigned long epoint_id, int message_id, union parameter *param); - void message_facility(unsigned long epoint_id, int message_id, union parameter *param); - void message_overlap(unsigned long epoint_id, int message_id, union parameter *param); - void message_proceeding(unsigned long epoint_id, int message_id, union parameter *param); - void message_alerting(unsigned long epoint_id, int message_id, union parameter *param); - void message_connect(unsigned long epoint_id, int message_id, union parameter *param); - void message_disconnect(unsigned long epoint_id, int message_id, union parameter *param); - void message_release(unsigned long epoint_id, int message_id, union parameter *param); + void message_information(unsigned int epoint_id, int message_id, union parameter *param); + void message_setup(unsigned int epoint_id, int message_id, union parameter *param); + void message_notify(unsigned int epoint_id, int message_id, union parameter *param); + void message_facility(unsigned int epoint_id, int message_id, union parameter *param); + void message_overlap(unsigned int epoint_id, int message_id, union parameter *param); + void message_proceeding(unsigned int epoint_id, int message_id, union parameter *param); + void message_alerting(unsigned int epoint_id, int message_id, union parameter *param); + void message_connect(unsigned int epoint_id, int message_id, union parameter *param); + void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param); + void message_release(unsigned int epoint_id, int message_id, union parameter *param); /* IE conversion */ void enc_ie_complete(struct l3_msg *l3m, int complete); diff --git a/endpoint.cpp b/endpoint.cpp index 48e0db6..1dce9f1 100644 --- a/endpoint.cpp +++ b/endpoint.cpp @@ -11,7 +11,7 @@ #include "main.h" -unsigned long epoint_serial = 1; /* initial value must be 1, because 0== no epoint */ +unsigned int epoint_serial = 1; /* initial value must be 1, because 0== no epoint */ class Endpoint *epoint_first = NULL; @@ -19,7 +19,7 @@ class Endpoint *epoint_first = NULL; /* * find the epoint with epoint_id */ -class Endpoint *find_epoint_id(unsigned long epoint_id) +class Endpoint *find_epoint_id(unsigned int epoint_id) { class Endpoint *epoint = epoint_first; @@ -38,7 +38,7 @@ class Endpoint *find_epoint_id(unsigned long epoint_id) /* * endpoint constructor (link with either port or join id) */ -Endpoint::Endpoint(unsigned long port_id, unsigned long join_id) +Endpoint::Endpoint(unsigned int port_id, unsigned int join_id) { class Port *port; class Endpoint **epointpointer; @@ -138,7 +138,7 @@ Endpoint::~Endpoint(void) /* create new portlist relation */ -struct port_list *Endpoint::portlist_new(unsigned long port_id, int port_type, int earlyb) +struct port_list *Endpoint::portlist_new(unsigned int port_id, int port_type, int earlyb) { struct port_list *portlist, **portlistpointer; diff --git a/endpoint.h b/endpoint.h index a336beb..963b5dd 100644 --- a/endpoint.h +++ b/endpoint.h @@ -13,7 +13,7 @@ /* structure of port_list */ struct port_list { struct port_list *next; - unsigned long port_id; + unsigned int port_id; int port_type; int early_b; /* if patterns are available */ }; @@ -22,10 +22,10 @@ struct port_list { class Endpoint { public: - Endpoint(unsigned long port_id, unsigned long join_id); + Endpoint(unsigned int port_id, unsigned int join_id); ~Endpoint(); class Endpoint *next; /* next in list */ - unsigned long ep_serial; /* a unique serial to identify */ + unsigned int ep_serial; /* a unique serial to identify */ int handler(void); /* applocaton relation */ @@ -33,11 +33,11 @@ class Endpoint /* port relation */ struct port_list *ep_portlist; /* link to list of ports */ - struct port_list *portlist_new(unsigned long port_id, int port_type, int earlyb); + struct port_list *portlist_new(unsigned int port_id, int port_type, int earlyb); void free_portlist(struct port_list *portlist); /* join relation */ - unsigned long ep_join_id; /* link to join */ + unsigned int ep_join_id; /* link to join */ /* if still used by threads */ int ep_use; @@ -50,5 +50,5 @@ class Endpoint extern class Endpoint *epoint_first; -class Endpoint *find_epoint_id(unsigned long epoint_id); +class Endpoint *find_epoint_id(unsigned int epoint_id); diff --git a/endpointapp.cpp b/endpointapp.cpp index 0ebd482..a3c6f56 100644 --- a/endpointapp.cpp +++ b/endpointapp.cpp @@ -35,12 +35,12 @@ int EndpointApp::handler(void) /* mini application for test purpose only */ -void EndpointApp::ea_message_port(unsigned long port_id, int message_type, union parameter *param) +void EndpointApp::ea_message_port(unsigned int port_id, int message_type, union parameter *param) { PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__); } -void EndpointApp::ea_message_join(unsigned long join_id, int message_type, union parameter *param) +void EndpointApp::ea_message_join(unsigned int join_id, int message_type, union parameter *param) { PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__); } diff --git a/endpointapp.h b/endpointapp.h index 11001f3..a330a63 100644 --- a/endpointapp.h +++ b/endpointapp.h @@ -19,7 +19,7 @@ class EndpointApp class Endpoint *ea_endpoint; virtual int handler(void); - virtual void ea_message_port(unsigned long port_id, int message, union parameter *param); - virtual void ea_message_join(unsigned long join_id, int message, union parameter *param); + virtual void ea_message_port(unsigned int port_id, int message, union parameter *param); + virtual void ea_message_join(unsigned int join_id, int message, union parameter *param); }; diff --git a/extension.c b/extension.c index eaaff7d..b1f6120 100644 --- a/extension.c +++ b/extension.c @@ -1348,7 +1348,7 @@ int write_log(char *number, char *callerid, char *calledid, time_t start, time_t tm = localtime(&start); fprintf(fp,"%s %2d %04d %02d:%02d:%02d %s", mon[tm->tm_mon], tm->tm_mday, tm->tm_year+1900, tm->tm_hour, tm->tm_min, tm->tm_sec, number); if (stop) - fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned long)(stop-start))/60)%60, ((unsigned long)(stop-start))%60); + fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned int)(stop-start))/60)%60, ((unsigned int)(stop-start))%60); else fprintf(fp," --:--:--"); fprintf(fp," %s -> %s", callerid, calledid); diff --git a/genext.c b/genext.c index 21689e6..bd4226b 100644 --- a/genext.c +++ b/genext.c @@ -30,7 +30,7 @@ int fhuse = 0; struct isdn_cause isdn_cause[128]; struct isdn_location isdn_location[16]; -void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...) +void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...) { } @@ -63,7 +63,8 @@ int main(int argc, char *argv[]) { printf("Usage: %s \n\n", argv[0]); printf("extension: any number for the extension (e.g 200)\n"); - printf("interfaces: internal interface(s) to reach extension (seperated by commas. e.g Int1,Int2)\n"); + printf("interfaces: internal interface(s) to reach extension, NOT port numbers\n"); + printf(" -> seperate multiple interfaces with commas. e.g Int1,Int2\n"); printf("callerid: normal undefined called is (use what your telco assigned you)\n"); return(0); } diff --git a/gentones.c b/gentones.c index c7522fd..a883780 100644 --- a/gentones.c +++ b/gentones.c @@ -137,8 +137,8 @@ void write_tone(FILE *fp,double t1,double t2,int length,int fade_in,int fade_out struct fmt { unsigned short stereo; /* 1 = pcm, 2 = adpcm */ unsigned short channels; /* number of channels */ - unsigned long sample_rate; /* sample rate */ - unsigned long data_rate; /* data rate */ + unsigned int sample_rate; /* sample rate */ + unsigned int data_rate; /* data rate */ unsigned short bytes_sample; /* bytes per sample (all channels) */ unsigned short bits_sample; /* bits per sample (one channel) */ }; @@ -148,10 +148,10 @@ void write_wav(FILE *fp, char *wav, char law) unsigned char buffer[256]; struct fmt *fmt; FILE *wfp; - signed long i; + signed int i; int channels, bytes; short sample, sample2; - signed long size, chunk; + signed int size, chunk; int gotfmt = 0, gotdata = 0; if ((wfp=fopen(wav,"r"))) @@ -283,7 +283,7 @@ void write_wav(FILE *fp, char *wav, char law) } else { printf("Ignoring chunk '%c%c%c%c' (length=%ld)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk); - while(chunk > (signed long)sizeof(buffer)) + while(chunk > (signed int)sizeof(buffer)) { fread(buffer, sizeof(buffer), 1, wfp); chunk -= sizeof(buffer); diff --git a/genwave.c b/genwave.c index d0d024e..cb62262 100644 --- a/genwave.c +++ b/genwave.c @@ -86,8 +86,8 @@ static short isdn_audio_alaw_to_s16[] = struct fmt { unsigned short stereo; /* 1 = pcm, 2 = adpcm */ unsigned short channels; /* number of channels */ - unsigned long sample_rate; /* sample rate */ - unsigned long data_rate; /* data rate */ + unsigned int sample_rate; /* sample rate */ + unsigned int data_rate; /* data rate */ unsigned short bytes_sample; /* bytes per sample (all channels) */ unsigned short bits_sample; /* bits per sample (one channel) */ }; @@ -97,9 +97,9 @@ void write_law(FILE *fp, char *name, char law) unsigned char buffer[256]; struct fmt fmt; FILE *lfp; - unsigned long i; + unsigned int i; short sample; - unsigned long size, wsize; + unsigned int size, wsize; if ((lfp=fopen(name,"r"))) { diff --git a/join.cpp b/join.cpp index c41ae4b..b3f8843 100644 --- a/join.cpp +++ b/join.cpp @@ -12,9 +12,9 @@ #include "main.h" //#define __u8 unsigned char //#define __u16 unsigned short -//#define __u32 unsigned long +//#define __u32 unsigned int -unsigned long join_serial = 1; /* must be 1, because 0== no join */ +unsigned int join_serial = 1; /* must be 1, because 0== no join */ //JOIN_STATES @@ -23,7 +23,7 @@ class Join *join_first = NULL; /* * find the join with join_id */ -class Join *find_join_id(unsigned long join_id) +class Join *find_join_id(unsigned int join_id) { class Join *join = join_first; @@ -88,7 +88,7 @@ Join::~Join() /* epoint sends a message to a join * */ -void Join::message_epoint(unsigned long epoint_id, int message_type, union parameter *param) +void Join::message_epoint(unsigned int epoint_id, int message_type, union parameter *param) { } diff --git a/join.h b/join.h index 9ef2d1d..5c5f3f2 100644 --- a/join.h +++ b/join.h @@ -23,16 +23,16 @@ class Join Join(); virtual ~Join(); class Join *next; /* next node in list of joins */ - virtual void message_epoint(unsigned long epoint_id, int message, union parameter *param); + virtual void message_epoint(unsigned int epoint_id, int message, union parameter *param); virtual int handler(void); - unsigned long j_type; /* join type (pbx or asterisk) */ - unsigned long j_serial; /* serial/unique number of join */ + unsigned int j_type; /* join type (pbx or asterisk) */ + unsigned int j_serial; /* serial/unique number of join */ }; void join_free(void); extern class Join *join_first; -class Join *find_join_id(unsigned long join_id); +class Join *find_join_id(unsigned int join_id); diff --git a/joinpbx.cpp b/joinpbx.cpp index 0e15ef1..21cb91d 100644 --- a/joinpbx.cpp +++ b/joinpbx.cpp @@ -12,7 +12,7 @@ #include "main.h" //#define __u8 unsigned char //#define __u16 unsigned short -//#define __u32 unsigned long +//#define __u32 unsigned int /* notify endpoint about state change (if any) */ @@ -432,7 +432,7 @@ void JoinPBX::bridge(void) /* * bridging is only possible with two connected endpoints */ -void JoinPBX::bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param) +void JoinPBX::bridge_data(unsigned int epoint_from, struct join_relation *relation_from, union parameter *param) { struct join_relation *relation_to; @@ -549,7 +549,7 @@ int JoinPBX::release(struct join_relation *relation, int location, int cause) /* count number of relations in a join */ -int joinpbx_countrelations(unsigned long join_id) +int joinpbx_countrelations(unsigned int join_id) { struct join_relation *relation; int i; @@ -633,7 +633,7 @@ struct join_relation *JoinPBX::add_relation(void) /* epoint sends a message to a join * */ -void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union parameter *param) +void JoinPBX::message_epoint(unsigned int epoint_id, int message_type, union parameter *param) { class Join *cl; struct join_relation *relation, *reltemp; @@ -986,7 +986,7 @@ int track_notify(int oldstate, int notify) * if other outgoing endpoints already exists, they are release as well. * note: if this functions fails, it will destroy its own join object! */ -int JoinPBX::out_setup(unsigned long epoint_id, int message_type, union parameter *param, char *newnumber) +int JoinPBX::out_setup(unsigned int epoint_id, int message_type, union parameter *param, char *newnumber) { struct join_relation *relation; struct lcr_msg *message; diff --git a/joinpbx.h b/joinpbx.h index c9e79d1..9106251 100644 --- a/joinpbx.h +++ b/joinpbx.h @@ -38,7 +38,7 @@ enum { /* states that results from last notification */ struct join_relation { /* relation to an interface */ struct join_relation *next; /* next node */ int type; /* type of relation */ - unsigned long epoint_id; /* interface to link join to */ + unsigned int epoint_id; /* interface to link join to */ int channel_state; /* if audio is available */ int rx_state; /* current state of what we received from endpoint */ int tx_state; /* current state of what we sent to endpoint */ @@ -49,7 +49,7 @@ class JoinPBX : public Join public: JoinPBX(class Endpoint *epoint); ~JoinPBX(); - void message_epoint(unsigned long epoint_id, int message, union parameter *param); + void message_epoint(unsigned int epoint_id, int message, union parameter *param); int handler(void); int release(struct join_relation *relation, int location, int cause); @@ -67,14 +67,14 @@ class JoinPBX : public Join int j_partyline_jingle; /* also play jingle on join/leave */ void bridge(void); - void bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param); + void bridge_data(unsigned int epoint_from, struct join_relation *relation_from, union parameter *param); void remove_relation(struct join_relation *relation); struct join_relation *add_relation(void); - int out_setup(unsigned long epoint_id, int message, union parameter *param, char *newnumber); + int out_setup(unsigned int epoint_id, int message, union parameter *param, char *newnumber); void play_jingle(int in); }; void joinpbx_debug(class JoinPBX *joinpbx, char *function); -int joinpbx_countrelations(unsigned long join_id); +int joinpbx_countrelations(unsigned int join_id); int track_notify(int oldstate, int notify); diff --git a/joinremote.cpp b/joinremote.cpp index b30dd1c..4b92612 100644 --- a/joinremote.cpp +++ b/joinremote.cpp @@ -12,14 +12,14 @@ #include "main.h" //#define __u8 unsigned char //#define __u16 unsigned short -//#define __u32 unsigned long +//#define __u32 unsigned int /* * constructor for a new join * the join will have a relation to the calling endpoint */ -JoinRemote::JoinRemote(unsigned long serial, char *remote_name, int remote_id) : Join() +JoinRemote::JoinRemote(unsigned int serial, char *remote_name, int remote_id) : Join() { PDEBUG(DEBUG_JOIN, "Constructor(new join)"); union parameter param; @@ -60,7 +60,7 @@ int JoinRemote::handler(void) } -void JoinRemote::message_epoint(unsigned long epoint_id, int message_type, union parameter *param) +void JoinRemote::message_epoint(unsigned int epoint_id, int message_type, union parameter *param) { /* if endpoint has just been removed, but still a message in the que */ if (epoint_id != j_epoint_id) @@ -116,7 +116,7 @@ void JoinRemote::message_remote(int message_type, union parameter *param) } } -void message_bchannel_to_remote(unsigned long remote_id, unsigned long ref, int type, unsigned long handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type) +void message_bchannel_to_remote(unsigned int remote_id, unsigned int ref, int type, unsigned int handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type) { union parameter param; diff --git a/joinremote.h b/joinremote.h index c0be35a..b837da6 100644 --- a/joinremote.h +++ b/joinremote.h @@ -12,16 +12,16 @@ class JoinRemote : public Join { public: - JoinRemote(unsigned long serial, char *remote_name, int remote_id); + JoinRemote(unsigned int serial, char *remote_name, int remote_id); ~JoinRemote(); - void message_epoint(unsigned long epoint_id, int message, union parameter *param); + void message_epoint(unsigned int epoint_id, int message, union parameter *param); void message_remote(int message_type, union parameter *param); int handler(void); int j_remote_id; char j_remote_name[32]; - unsigned long j_epoint_id; + unsigned int j_epoint_id; }; -void message_bchannel_to_remote(unsigned long remote_id, unsigned long ref, int type, unsigned long handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type); +void message_bchannel_to_remote(unsigned int remote_id, unsigned int ref, int type, unsigned int handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type); diff --git a/lcradmin.c b/lcradmin.c index 188d718..fbd0015 100644 --- a/lcradmin.c +++ b/lcradmin.c @@ -76,7 +76,7 @@ char red = 1, #define LOGLINES 128 char logline[LOGLINES][512]; -unsigned long logcur = 0; +unsigned int logcur = 0; int logfh = -1; char logfile[128]; @@ -209,7 +209,7 @@ int debug_port(struct admin_message *msg, struct admin_message *m, int line, int } int debug_epoint(struct admin_message *msg, struct admin_message *m, int line, int i, int vline) { - unsigned long epoint = m[i].u.e.serial; + unsigned int epoint = m[i].u.e.serial; char buffer[256]; unsigned char c; int j, jj; @@ -392,7 +392,7 @@ int debug_epoint(struct admin_message *msg, struct admin_message *m, int line, i } int debug_join(struct admin_message *msg, struct admin_message *m, int line, int i) { - unsigned long join = m[i].u.j.serial; + unsigned int join = m[i].u.j.serial; char buffer[256]; int j, jj; @@ -457,7 +457,7 @@ char *admin_state(int sock, char *argv[]) *p; int line, offset = 0, hoffset = 0; int i, ii, j, jj, k; - unsigned long l, ll; + unsigned int l, ll; int num; int len; int off; @@ -1346,7 +1346,7 @@ char *admin_testcall(int sock, int argc, char *argv[]) int stimeout = 0, ptimeout = 0, atimeout = 0, ctimeout = 0; int l; double timer = 0, now_d; - unsigned long on = 1; + unsigned int on = 1; struct timeval now_tv; struct timezone now_tz; diff --git a/lcrsocket.h b/lcrsocket.h index 19fa835..735b610 100644 --- a/lcrsocket.h +++ b/lcrsocket.h @@ -76,7 +76,7 @@ struct admin_response_interface { int los, ais, rdi, slip_tx, slip_rx; int channels; char busy[256]; /* if port is idle(0) busy(1) */ - unsigned long port[256]; /* current port */ + unsigned int port[256]; /* current port */ }; struct admin_response_remote { @@ -84,14 +84,14 @@ struct admin_response_remote { }; struct admin_response_join { - unsigned long serial; /* join serial number */ + unsigned int serial; /* join serial number */ char remote[32]; /* remote application name */ - unsigned long partyline; + unsigned int partyline; }; struct admin_response_epoint { - unsigned long serial; - unsigned long join; /* link to join */ + unsigned int serial; + unsigned int join; /* link to join */ // int join_notify; /* if relation notified on hold */ // int join_hold; /* if relation on hold */ int rx_state; @@ -108,9 +108,9 @@ struct admin_response_epoint { }; struct admin_response_port { - unsigned long serial; /* port serial number */ + unsigned int serial; /* port serial number */ char name[64]; /* name of port */ - unsigned long epoint; /* link to epoint */ + unsigned int epoint; /* link to epoint */ int state; int isdn; /* if port is isdn */ int isdn_chan; /* bchannel number */ @@ -148,7 +148,7 @@ struct admin_trace_rsp { struct admin_msg { int type; /* type of message */ - unsigned long ref; /* reference to individual endpoints */ + unsigned int ref; /* reference to individual endpoints */ union parameter param; /* parameter union */ }; diff --git a/mISDN.cpp b/mISDN.cpp index 71389b5..8e7d712 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -38,7 +38,7 @@ struct mISDNport *mISDNport_first; unsigned char mISDN_rand[256]; int mISDN_rand_count = 0; -unsigned long mt_assign_pid = ~0; +unsigned int mt_assign_pid = ~0; int mISDNsocket = -1; @@ -210,7 +210,7 @@ void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *ms */ static struct isdn_message { char *name; - unsigned long value; + unsigned int value; } isdn_message[] = { {"PH_ACTIVATE", L1_ACTIVATE_REQ}, {"PH_DEACTIVATE", L1_DEACTIVATE_REQ}, @@ -255,7 +255,7 @@ static char *isdn_prim[4] = { " INDICATION", " RESPONSE", }; -void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned long msg, int direction) +void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg, int direction) { int i; char msgtext[64] = "<>"; @@ -309,11 +309,11 @@ void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsign /* * send control information to the channel (dsp-module) */ -void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned long sock, unsigned long c1, unsigned long c2, char *trace_name, int trace_value) +void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, char *trace_name, int trace_value) { unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)]; struct mISDNhead *ctrl = (struct mISDNhead *)buffer; - unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN); + unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN); int ret; if (sock < 0) @@ -334,11 +334,11 @@ void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned lo end_trace(); } -void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned long 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, char *trace_name, int trace_value) { unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len]; struct mISDNhead *ctrl = (struct mISDNhead *)buffer; - unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN); + unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN); int ret; if (sock < 0) @@ -364,7 +364,7 @@ void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int s static int _bchannel_create(struct mISDNport *mISDNport, int i) { int ret; - unsigned long on = 1; + unsigned int on = 1; struct sockaddr_mISDN addr; if (mISDNport->b_socket[i] > -1) @@ -601,15 +601,15 @@ void bchannel_event(struct mISDNport *mISDNport, int i, int event) class PmISDN *b_port = mISDNport->b_port[i]; int state = mISDNport->b_state[i]; double timer = mISDNport->b_timer[i]; - unsigned long p_m_remote_ref = 0; - unsigned long p_m_remote_id = 0; + unsigned int p_m_remote_ref = 0; + unsigned int p_m_remote_id = 0; int p_m_tx_gain = 0; int p_m_rx_gain = 0; char *p_m_pipeline = NULL; unsigned char *p_m_crypt_key = NULL; int p_m_crypt_key_len = 0; int p_m_crypt_key_type = 0; - unsigned long portid = (mISDNport->portnum<<8) + i+1+(i>=15); + unsigned int portid = (mISDNport->portnum<<8) + i+1+(i>=15); if (b_port) { @@ -1074,7 +1074,7 @@ void PmISDN::drop_bchannel(void) } /* process bchannel export/import message from join */ -void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned long handle) +void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle) { class Endpoint *epoint; class Port *port; @@ -1141,7 +1141,7 @@ void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsign ii = mISDNport->b_num; while(i < ii) { - if ((unsigned long)(mISDNport->portnum<<8)+i+1+(i>=15) == handle) + if ((unsigned int)(mISDNport->portnum<<8)+i+1+(i>=15) == handle) break; i++; } @@ -1353,9 +1353,9 @@ int PmISDN::handler(void) */ void PmISDN::bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len) { - unsigned long cont = *((unsigned long *)data); + unsigned int cont = *((unsigned int *)data); unsigned char *data_temp; - unsigned long length_temp; + unsigned int length_temp; struct lcr_msg *message; unsigned char *p; int l; @@ -1634,7 +1634,7 @@ void PmISDN::set_tone(char *dir, char *tone) /* MESSAGE_mISDNSIGNAL */ //extern struct lcr_msg *dddebug; -void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union parameter *param) +void PmISDN::message_mISDNsignal(unsigned int epoint_id, int message_id, union parameter *param) { switch(param->mISDNsignal.message) { @@ -1703,7 +1703,7 @@ void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union } /* MESSAGE_CRYPT */ -void PmISDN::message_crypt(unsigned long epoint_id, int message_id, union parameter *param) +void PmISDN::message_crypt(unsigned int epoint_id, int message_id, union parameter *param) { struct lcr_msg *message; @@ -1770,7 +1770,7 @@ void PmISDN::message_crypt(unsigned long epoint_id, int message_id, union parame /* * endpoint sends messages to the port */ -int PmISDN::message_epoint(unsigned long epoint_id, int message_id, union parameter *param) +int PmISDN::message_epoint(unsigned int epoint_id, int message_id, union parameter *param) { if (Port::message_epoint(epoint_id, message_id, param)) return(1); diff --git a/mISDN.h b/mISDN.h index d52ea06..13ca654 100644 --- a/mISDN.h +++ b/mISDN.h @@ -54,7 +54,7 @@ struct mISDNport { int b_state[128]; /* statemachine, 0 = IDLE */ double b_timer[128]; /* timer for state machine */ int b_remote_id[128]; /* the socket currently exported (0=none) */ - unsigned long b_remote_ref[128]; /* the ref currently exported */ + unsigned int b_remote_ref[128]; /* the ref currently exported */ int locally; /* local causes are sent as local causes not remote */ int los, ais, rdi, slip_rx, slip_tx; }; @@ -86,12 +86,12 @@ void mISDN_port_reorder(void); 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 long handle, unsigned long c1, unsigned long c2, char *trace_name, int trace_value); -void ph_control_block(struct mISDNport *mISDNport, unsigned long handle, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value); +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 l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned long prim, 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 long handle); +void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle); /* mISDN port classes */ @@ -103,9 +103,9 @@ class PmISDN : public Port void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len); int handler(void); void transmit(unsigned char *buffer, int length); - int message_epoint(unsigned long epoint_id, int message, union parameter *param); - void message_mISDNsignal(unsigned long epoint_id, int message_id, union parameter *param); - void message_crypt(unsigned long epoint_id, int message_id, union parameter *param); + int message_epoint(unsigned int epoint_id, int message, union parameter *param); + void message_mISDNsignal(unsigned int epoint_id, int message_id, union parameter *param); + void message_crypt(unsigned int epoint_id, int message_id, union parameter *param); struct mISDNport *p_m_mISDNport; /* pointer to port */ int p_m_delay; /* use delay instead of dejitter */ int p_m_tx_gain, p_m_rx_gain; /* volume shift (0 = no change) */ @@ -119,8 +119,8 @@ class PmISDN : public Port int p_m_joindata; /* the call requires data due to no briging capability */ int p_m_load; /* current data in dsp tx buffer */ - unsigned long p_m_last_tv_sec; /* time stamp of last handler call, (to sync audio data */ - unsigned long p_m_last_tv_msec; + unsigned int p_m_last_tv_sec; /* time stamp of last handler call, (to sync audio data */ + unsigned int p_m_last_tv_msec; // int p_m_fromup_buffer_readp; /* buffer for audio from remote endpoint */ // int p_m_fromup_buffer_writep; // unsigned char p_m_fromup_buffer[FROMUP_BUFFER_SIZE]; @@ -137,7 +137,7 @@ class PmISDN : public Port int p_m_crypt_listen_state; int p_m_crypt_listen_len; unsigned char p_m_crypt_listen_msg[1100]; - unsigned long p_m_crypt_listen_crc; + unsigned int p_m_crypt_listen_crc; void cryptman_listen_bch(unsigned char *p, int l); void set_tone(char *dir, char *name); @@ -152,7 +152,7 @@ class PmISDN : public Port // long long p_m_jitterdropped; /* number of bytes dropped */ int p_m_delete; /* true if obj. must del. */ int p_m_hold; /* if port is on hold */ - unsigned long p_m_timeout; /* timeout of timers */ + unsigned int p_m_timeout; /* timeout of timers */ time_t p_m_timer; /* start of timer */ unsigned char p_m_remote_ref; /* join to export bchannel to */ unsigned char p_m_remote_id; /* sock to export bchannel to */ diff --git a/macro.h b/macro.h index 07921e0..ab0716c 100644 --- a/macro.h +++ b/macro.h @@ -85,7 +85,7 @@ static inline void fatal(const char *function, int line, char *fmt, ...) /* memory allocation with setting to zero */ #define MALLOC(size) _malloc(size, __FUNCTION__, __LINE__) -static inline void *_malloc(unsigned long size, const char *function, int line) +static inline void *_malloc(unsigned int size, const char *function, int line) { void *addr; addr = malloc(size); diff --git a/main.c b/main.c index b66615f..4454180 100644 --- a/main.c +++ b/main.c @@ -100,7 +100,7 @@ void debug(const char *function, int line, char *prefix, char *buffer) } -void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...) +void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...) { char buffer[4096]; va_list args; diff --git a/main.h b/main.h index 6507694..2535ea1 100644 --- a/main.h +++ b/main.h @@ -55,7 +55,7 @@ extern FILE *debug_fp; #define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg) #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg) #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg) -void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...); +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); diff --git a/message.h b/message.h index c84ab19..7fa9be2 100644 --- a/message.h +++ b/message.h @@ -301,7 +301,7 @@ struct param_hello { struct param_bchannel { int type; /* BCHANNEL_* */ - unsigned long handle; /* bchannel stack/portid */ + unsigned int handle; /* bchannel stack/portid */ int tx_gain, rx_gain; char pipeline[256]; unsigned char crypt[128]; @@ -347,8 +347,8 @@ struct lcr_msg { struct lcr_msg *next; int type; /* type of message */ int flow; /* from where to where */ - unsigned long id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */ - unsigned long id_to; + unsigned int id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */ + unsigned int id_to; int keep; union parameter param; }; diff --git a/port.cpp b/port.cpp index 95ed3d5..0bc74a2 100644 --- a/port.cpp +++ b/port.cpp @@ -52,7 +52,7 @@ Functions: class Port *port_first = NULL; -unsigned long port_serial = 1; /* must be 1, because 0== no port */ +unsigned int port_serial = 1; /* must be 1, because 0== no port */ /* free epointlist relation @@ -86,7 +86,7 @@ void Port::free_epointlist(struct epoint_list *epointlist) } -void Port::free_epointid(unsigned long epoint_id) +void Port::free_epointid(unsigned int epoint_id) { struct epoint_list *temp, **tempp; @@ -117,7 +117,7 @@ void Port::free_epointid(unsigned long epoint_id) /* create new epointlist relation */ -struct epoint_list *Port::epointlist_new(unsigned long epoint_id) +struct epoint_list *Port::epointlist_new(unsigned int epoint_id) { struct epoint_list *epointlist, **epointlistpointer; @@ -267,7 +267,7 @@ void Port::new_state(int state) /* * find the port with port_id */ -class Port *find_port_id(unsigned long port_id) +class Port *find_port_id(unsigned int port_id) { class Port *port = port_first; @@ -450,7 +450,7 @@ void Port::set_vbox_tone(char *dir, char *name) */ void Port::set_vbox_play(char *name, int offset) { - signed long size; + signed int size; struct lcr_msg *message; /* use ser_box_tone() */ @@ -655,7 +655,7 @@ int Port::handler(void) * therefor a return=1 means: stop, no more processing */ //extern struct lcr_msg *dddebug; -int Port::message_epoint(unsigned long epoint_id, int message_id, union parameter *param) +int Port::message_epoint(unsigned int epoint_id, int message_id, union parameter *param) { /* check if we got audio data from one remote port */ switch(message_id) @@ -690,8 +690,8 @@ int Port::message_epoint(unsigned long epoint_id, int message_id, union paramete struct fmt { unsigned short stereo; /* 1 = mono, 2 = stereo */ unsigned short channels; /* number of channels */ - unsigned long sample_rate; /* sample rate */ - unsigned long data_rate; /* data rate */ + unsigned int sample_rate; /* sample rate */ + unsigned int data_rate; /* data rate */ unsigned short bytes_sample; /* bytes per sample (all channels) */ unsigned short bits_sample; /* bits per sample (one channel) */ }; @@ -794,7 +794,7 @@ int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ig void Port::close_record(int beep, int mute) { static signed short beep_mono[256]; - unsigned long size, wsize; + unsigned int size, wsize; struct fmt fmt; char filename[512], indexname[512]; FILE *fp; @@ -1015,7 +1015,7 @@ void Port::record(unsigned char *data, int length, int dir_fromup) unsigned char write_buffer[1024], *d; signed short *s; int free, i, ii; - signed long sample; + signed int sample; /* no recording */ if (!p_record || !length) diff --git a/port.h b/port.h index 48f6ffa..f2c0ffe 100644 --- a/port.h +++ b/port.h @@ -86,11 +86,11 @@ enum { /* event list from listening to tty */ /* structure of epoint_list */ struct epoint_list { struct epoint_list *next; - unsigned long epoint_id; + unsigned int epoint_id; int active; }; -inline unsigned long ACTIVE_EPOINT(struct epoint_list *epointlist) +inline unsigned int ACTIVE_EPOINT(struct epoint_list *epointlist) { while(epointlist) { @@ -101,7 +101,7 @@ inline unsigned long ACTIVE_EPOINT(struct epoint_list *epointlist) return(0); } -inline unsigned long INACTIVE_EPOINT(struct epoint_list *epointlist) +inline unsigned int INACTIVE_EPOINT(struct epoint_list *epointlist) { while(epointlist) { @@ -129,7 +129,7 @@ class Port class Port *next; /* next port in list */ int p_type; /* type of port */ virtual int handler(void); - virtual int message_epoint(unsigned long epoint_id, int message, union parameter *param); + 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 int read_audio(unsigned char *buffer, int length); @@ -142,20 +142,20 @@ class Port char p_tone_fh; /* file descriptor of current tone or -1 if not open */ void *p_tone_fetched; /* pointer to fetched data */ int p_tone_codec; /* codec that the tone is made of */ - long p_tone_size, p_tone_left; /* size of tone in bytes (not samples), bytes left */ - long p_tone_eof; /* flag that makes the use of eof message */ - long p_tone_counter; /* flag that makes the use of counter message */ - long p_tone_speed; /* speed of current tone, 1=normal, may also be negative */ + signed int p_tone_size, p_tone_left; /* size of tone in bytes (not samples), bytes left */ + signed int p_tone_eof; /* flag that makes the use of eof message */ + signed int p_tone_counter; /* flag that makes the use of counter message */ + signed int p_tone_speed; /* speed of current tone, 1=normal, may also be negative */ // char p_knock_fh; /* file descriptor of knocking tone or -1 if not open */ // void *p_knock_fetched; /* pointer to fetched data */ // int p_knock_codec; -// long p_knock_size, p_knock_left; +// 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_speed(int speed); /* speed of answ. */ /* identification */ - unsigned long p_serial; /* serial unique id of port */ + unsigned int p_serial; /* serial unique id of port */ char p_name[128]; /* name of port or token (h323) */ /* endpoint relation */ @@ -178,11 +178,11 @@ class Port FILE *p_record; /* recording fp: if not NULL, recording is enabled */ int p_record_type; /* codec to use: RECORD_MONO, RECORD_STEREO, ... */ int p_record_skip; /* skip bytes before writing the sample */ - unsigned long p_record_length; /* size of what's written so far */ + unsigned int p_record_length; /* size of what's written so far */ signed short p_record_buffer[RECORD_BUFFER_LENGTH]; - unsigned long p_record_buffer_readp; - unsigned long p_record_buffer_writep; + unsigned int p_record_buffer_readp; + unsigned int p_record_buffer_writep; int p_record_buffer_dir; /* current direction in buffer */ char p_record_filename[256]; /* record filename */ @@ -198,16 +198,16 @@ class Port int p_record_vbox_email_file; void free_epointlist(struct epoint_list *epointlist); - void free_epointid(unsigned long epoint_id); - struct epoint_list *epointlist_new(unsigned long epoint_id); + void free_epointid(unsigned int epoint_id); + struct epoint_list *epointlist_new(unsigned int epoint_id); }; extern Port *port_first; -extern unsigned long port_serial; +extern unsigned int port_serial; class Port *find_port_with_token(char *name); -class Port *find_port_id(unsigned long port_id); +class Port *find_port_id(unsigned int port_id); #endif // PORT_HEADER diff --git a/route.c b/route.c index 093ccbe..923d84f 100644 --- a/route.c +++ b/route.c @@ -1954,7 +1954,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) struct route_rule *rule = ruleset->rule_first; struct route_cond *cond; struct route_action *action = NULL; - unsigned long comp_len; + unsigned int comp_len; int j, jj; char callerid[64], redirid[64]; int integer; @@ -2137,9 +2137,9 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) case MATCH_FREE: case MATCH_NOTFREE: - if (!(comp_len = (unsigned long)strchr(cond->string_value, ':'))) + if (!(comp_len = (unsigned int)strchr(cond->string_value, ':'))) break; - comp_len = comp_len-(unsigned long)cond->string_value; + comp_len = comp_len-(unsigned int)cond->string_value; avail = 0; mISDNport = mISDNport_first; while(mISDNport) @@ -2270,7 +2270,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) match_string_prefix: comp_len = strlen(cond->string_value); /* because we must reach value's length */ /* we must have greater or equal length to values */ - if ((unsigned long)strlen(string) < comp_len) + if ((unsigned int)strlen(string) < comp_len) { /* special case for unfinished dialing */ if (cond->match == MATCH_DIALING) diff --git a/socket_server.c b/socket_server.c index bf3bfcd..81ec55b 100644 --- a/socket_server.c +++ b/socket_server.c @@ -26,7 +26,7 @@ struct admin_list *admin_first = NULL; */ int admin_init(void) { - unsigned long on = 1; + unsigned int on = 1; /* open and bind socket */ if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) @@ -484,7 +484,7 @@ int admin_block(struct admin_queue **responsep, int portnum, int block) */ int admin_release(struct admin_queue **responsep, char *message) { - unsigned long id; + unsigned int id; struct admin_queue *response; /* response pointer */ class EndpointAppPBX *apppbx; @@ -727,7 +727,7 @@ int admin_message_to_join(struct admin_msg *msg, struct admin_list *admin) /* * this function is called for every message to remote socket */ -int admin_message_from_join(int remote_id, unsigned long ref, int message_type, union parameter *param) +int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param) { struct admin_list *admin; struct admin_queue **responsep; /* response pointer */ @@ -1120,7 +1120,7 @@ int admin_handle(void) int len; int new_sock; socklen_t sock_len = sizeof(sock_address); - unsigned long on = 1; + unsigned int on = 1; int work = 0; /* if work was done */ struct Endpoint *epoint; diff --git a/socket_server.h b/socket_server.h index 305deb5..dc18165 100644 --- a/socket_server.h +++ b/socket_server.h @@ -13,8 +13,8 @@ struct admin_queue { struct admin_queue *next; - ulong offset; /* current offset writing */ - ulong num; /* number of admin messages */ + unsigned int offset; /* current offset writing */ + unsigned int num; /* number of admin messages */ struct admin_message am[0]; }; @@ -24,7 +24,7 @@ struct admin_list { int sockserial; char remote_name[32]; /* socket is connected remote application */ struct admin_trace_req trace; /* stores trace, if detail != 0 */ - unsigned long epointid; + unsigned int epointid; struct admin_queue *response; }; @@ -34,7 +34,7 @@ void admin_cleanup(void); int admin_handle(void); void admin_call_response(int adminid, int message, 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 long ref, int message_type, union parameter *param); +int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param); diff --git a/tones.c b/tones.c index 6b558dd..fd85529 100644 --- a/tones.c +++ b/tones.c @@ -29,12 +29,12 @@ the read_tone() will return law or 16bit mono. the read_tone will convert all ot struct fmt { unsigned short stereo; /* 1 = pcm, 2 = adpcm */ unsigned short channels; /* number of channels */ - unsigned long sample_rate; /* sample rate */ - unsigned long data_rate; /* data rate */ + unsigned int sample_rate; /* sample rate */ + unsigned int data_rate; /* data rate */ unsigned short bytes_sample; /* bytes per sample (all channels) */ unsigned short bits_sample; /* bits per sample (one channel) */ }; -int open_tone(char *file, int *codec, signed long *length, signed long *left) +int open_tone(char *file, int *codec, signed int *length, signed int *left) { int fh; char filename[256]; @@ -42,7 +42,7 @@ int open_tone(char *file, int *codec, signed long *length, signed long *left) unsigned char buffer[256]; struct fmt *fmt; int channels, bytes; - unsigned long size, chunk; + unsigned int size, chunk; int gotfmt = 0; struct stat _stat; int linksize; @@ -205,9 +205,9 @@ int open_tone(char *file, int *codec, signed long *length, signed long *left) if (codec) *codec = CODEC_MONO; if (length) - *length = ((signed long)chunk)>>1; + *length = ((signed int)chunk)>>1; if (left) - *left = ((signed long)chunk)>>1; + *left = ((signed int)chunk)>>1; // printf("left=%d\n",*left); } else if (bytes==2 && channels==2) @@ -215,18 +215,18 @@ int open_tone(char *file, int *codec, signed long *length, signed long *left) if (codec) *codec = CODEC_STEREO; if (length) - *length = ((signed long)chunk)>>2; + *length = ((signed int)chunk)>>2; if (left) - *left = ((signed long)chunk)>>2; + *left = ((signed int)chunk)>>2; } else if (bytes==1 && channels==1) { if (codec) *codec = CODEC_8BIT; if (length) - *length = (signed long)chunk; + *length = (signed int)chunk; if (left) - *left = (signed long)chunk; + *left = (signed int)chunk; } else { close(fh); @@ -270,14 +270,14 @@ int open_tone(char *file, int *codec, signed long *length, signed long *left) * the len must be the number of samples, NOT for the bytes to read!! * the data returned is law-code */ -int read_tone(int fh, unsigned char *buffer, int codec, int len, signed long size, signed long *left, int speed) +int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed) { int l; int offset; signed short buffer16[len], *buf16 = buffer16; signed short buffer32[len<<1], *buf32 = buffer32; unsigned char buffer8[len], *buf8 = buffer8; - signed long sample; + signed int sample; int i = 0; //printf("left=%ld\n",*left); @@ -422,8 +422,8 @@ int fetch_tones(void) char filename[256], name[256]; int fh; int tone_codec; - signed long tone_size, tone_left; - unsigned long memory = 0; + signed int tone_size, tone_left; + unsigned int memory = 0; int samples = 0; /* if disabled */ @@ -544,7 +544,7 @@ int fetch_tones(void) /* * opens the fetched tone (if available) */ -void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, signed long *left) +void *open_tone_fetched(char *dir, char *file, int *codec, signed int *length, signed int *left) { struct toneset *toneset; struct tonesettone *tonesettone; @@ -593,7 +593,7 @@ void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, * read from fetched tone, check size * the len must be the number of samples, NOT for the bytes to read!! */ -int read_tone_fetched(void **fetched, void *buffer, int len, signed long size, signed long *left, int speed) +int read_tone_fetched(void **fetched, void *buffer, int len, signed int size, signed int *left, int speed) { int l; //printf("left=%ld\n",*left); diff --git a/tones.h b/tones.h index 3cfaf77..8f0f9da 100644 --- a/tones.h +++ b/tones.h @@ -9,12 +9,12 @@ ** ** \*****************************************************************************/ -int open_tone(char *file, int *codec, signed long *length, signed long *left); -int read_tone(int fh, unsigned char *buffer, int codec, int len, signed long size, signed long *left, int speed); +int open_tone(char *file, int *codec, signed int *length, signed int *left); +int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed); int fetch_tones(void); void free_tones(void); -void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, signed long *left); -int read_tone_fetched(void **fetched, void *buffer, int len, signed long size, signed long *left, int speed); +void *open_tone_fetched(char *dir, char *file, int *codec, signed int *length, signed int *left); +int read_tone_fetched(void **fetched, void *buffer, int len, signed int size, signed int *left, int speed); /* tone sets */ struct tonesettone { diff --git a/trace.h b/trace.h index 65d50c4..c0fcab0 100644 --- a/trace.h +++ b/trace.h @@ -114,11 +114,11 @@ struct trace { char caller[64]; char dialing[64]; int direction; - unsigned long sec, usec; + unsigned int sec, usec; /* type */ int category; - unsigned long serial; + unsigned int serial; char name[64]; /* elements */ diff --git a/vbox.cpp b/vbox.cpp index 419c226..0b30c6c 100644 --- a/vbox.cpp +++ b/vbox.cpp @@ -65,7 +65,7 @@ static void vbox_trace_header(class VBoxPort *vbox, char *message, int direction int VBoxPort::handler(void) { struct lcr_msg *message; - unsigned long tosend; + unsigned int tosend; unsigned char buffer[ISDN_TRANSMIT]; time_t currenttime; class Endpoint *epoint; @@ -107,7 +107,7 @@ int VBoxPort::handler(void) } /* calculate the number of bytes */ - tosend = (unsigned long)((now_d-p_vbox_audio_start)*8000) - p_vbox_audio_transferred; + tosend = (unsigned int)((now_d-p_vbox_audio_start)*8000) - p_vbox_audio_transferred; /* wait for more */ if (tosend < sizeof(buffer)) @@ -189,7 +189,7 @@ int VBoxPort::handler(void) /* * endpoint sends messages to the vbox port */ -int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union parameter *param) +int VBoxPort::message_epoint(unsigned int epoint_id, int message_id, union parameter *param) { struct lcr_msg *message; class Endpoint *epoint; diff --git a/vbox.h b/vbox.h index 074c54b..b07ab5b 100644 --- a/vbox.h +++ b/vbox.h @@ -15,24 +15,24 @@ class VBoxPort : public Port public: VBoxPort(int type, struct port_settings *settings); ~VBoxPort(); - int message_epoint(unsigned long epoint_id, int message, union parameter *param); + int message_epoint(unsigned int epoint_id, int message, union parameter *param); int handler(void); private: struct EndpointAppPBX *p_vbox_apppbx; /* pbx application */ - unsigned long p_vbox_timeout; /* timeout for recording */ + unsigned int p_vbox_timeout; /* timeout for recording */ char p_vbox_extension[32]; /* current extension */ // int p_vbox_recording; /* if currently recording */ int p_vbox_announce_fh; /* the announcement filehandler */ int p_vbox_announce_codec; /* the announcement codec */ - signed long p_vbox_announce_left; /* the number of bytes left of announcement sample */ - signed long p_vbox_announce_size; /* size of current announcement (in bytes) */ + signed int p_vbox_announce_left; /* the number of bytes left of announcement sample */ + signed int p_vbox_announce_size; /* size of current announcement (in bytes) */ int p_vbox_mode; /* type of recording VBOX_MODE_* */ double p_vbox_audio_start; /* time stamp of starting of audio (<1 == not yet started) */ - unsigned long p_vbox_audio_transferred; /* number of samples sent to endpoint */ - signed long p_vbox_record_start; /* start for recording */ - signed long p_vbox_record_limit; /* limit for recording */ + unsigned int p_vbox_audio_transferred; /* number of samples sent to endpoint */ + signed int p_vbox_record_start; /* start for recording */ + signed int p_vbox_record_limit; /* limit for recording */ struct extension p_vbox_ext; /* save settings of extension */ };