Merged revisions 83432 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83432 | russell | 2007-09-21 09:37:20 -0500 (Fri, 21 Sep 2007) | 4 lines

gcc 4.2 has a new set of warnings dealing with cosnt pointers.  This set of
changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2.
(closes issue #10774, patch from qwell)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Russell Bryant 18 years ago
parent 78a94595f6
commit 9f64905d4e

@ -311,9 +311,9 @@ static void oh323_destroy_peer(struct oh323_peer *peer)
ast_free(peer); ast_free(peer);
} }
static int oh323_simulate_dtmf_end(void *data) static int oh323_simulate_dtmf_end(const void *data)
{ {
struct oh323_pvt *pvt = data; struct oh323_pvt *pvt = (struct oh323_pvt *)data;
if (pvt) { if (pvt) {
ast_mutex_lock(&pvt->lock); ast_mutex_lock(&pvt->lock);

@ -738,8 +738,8 @@ struct iax2_thread {
enum iax2_thread_type type; enum iax2_thread_type type;
enum iax2_thread_iostate iostate; enum iax2_thread_iostate iostate;
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
void (*schedfunc)(void *); void (*schedfunc)(const void *);
void *scheddata; const void *scheddata;
#endif #endif
#ifdef DEBUG_SCHED_MULTITHREAD #ifdef DEBUG_SCHED_MULTITHREAD
char curfunc[80]; char curfunc[80];
@ -873,7 +873,7 @@ static ast_mutex_t iaxsl[IAX_MAX_CALLS];
static struct timeval lastused[IAX_MAX_CALLS]; static struct timeval lastused[IAX_MAX_CALLS];
static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms); static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
static int expire_registry(void *data); static int expire_registry(const void *data);
static int iax2_answer(struct ast_channel *c); static int iax2_answer(struct ast_channel *c);
static int iax2_call(struct ast_channel *c, char *dest, int timeout); static int iax2_call(struct ast_channel *c, char *dest, int timeout);
static int iax2_devicestate(void *data); static int iax2_devicestate(void *data);
@ -1075,7 +1075,7 @@ static struct iax2_thread *find_idle_thread(void)
} }
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
static int __schedule_action(void (*func)(void *data), void *data, const char *funcname) static int __schedule_action(void (*func)(const void *data), const void *data, const char *funcname)
{ {
struct iax2_thread *thread = NULL; struct iax2_thread *thread = NULL;
static time_t lasterror; static time_t lasterror;
@ -1103,7 +1103,7 @@ static int __schedule_action(void (*func)(void *data), void *data, const char *f
#define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__) #define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
#endif #endif
static int iax2_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data) static int iax2_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{ {
int res; int res;
@ -1113,7 +1113,7 @@ static int iax2_sched_replace(int old_id, struct sched_context *con, int when, a
return res; return res;
} }
static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data) static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{ {
int res; int res;
@ -1123,9 +1123,9 @@ static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb call
return res; return res;
} }
static int send_ping(void *data); static int send_ping(const void *data);
static void __send_ping(void *data) static void __send_ping(const void *data)
{ {
int callno = (long)data; int callno = (long)data;
ast_mutex_lock(&iaxsl[callno]); ast_mutex_lock(&iaxsl[callno]);
@ -1136,7 +1136,7 @@ static void __send_ping(void *data)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int send_ping(void *data) static int send_ping(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__send_ping, data)) if (schedule_action(__send_ping, data))
@ -1157,9 +1157,9 @@ static int get_encrypt_methods(const char *s)
return e; return e;
} }
static int send_lagrq(void *data); static int send_lagrq(const void *data);
static void __send_lagrq(void *data) static void __send_lagrq(const void *data)
{ {
int callno = (long)data; int callno = (long)data;
/* Ping only if it's real not if it's bridged */ /* Ping only if it's real not if it's bridged */
@ -1171,7 +1171,7 @@ static void __send_lagrq(void *data)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int send_lagrq(void *data) static int send_lagrq(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__send_lagrq, data)) if (schedule_action(__send_lagrq, data))
@ -2178,12 +2178,12 @@ static int update_packet(struct iax_frame *f)
return 0; return 0;
} }
static int attempt_transmit(void *data); static int attempt_transmit(const void *data);
static void __attempt_transmit(void *data) static void __attempt_transmit(const void *data)
{ {
/* Attempt to transmit the frame to the remote peer... /* Attempt to transmit the frame to the remote peer...
Called without iaxsl held. */ Called without iaxsl held. */
struct iax_frame *f = data; struct iax_frame *f = (struct iax_frame *)data;
int freeme = 0; int freeme = 0;
int callno = f->callno; int callno = f->callno;
/* Make sure this call is still active */ /* Make sure this call is still active */
@ -2259,7 +2259,7 @@ static void __attempt_transmit(void *data)
} }
} }
static int attempt_transmit(void *data) static int attempt_transmit(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__attempt_transmit, data)) if (schedule_action(__attempt_transmit, data))
@ -2280,7 +2280,7 @@ static int iax2_prune_realtime(int fd, int argc, char *argv[])
} else if ((peer = find_peer(argv[3], 0))) { } else if ((peer = find_peer(argv[3], 0))) {
if(ast_test_flag(peer, IAX_RTCACHEFRIENDS)) { if(ast_test_flag(peer, IAX_RTCACHEFRIENDS)) {
ast_set_flag(peer, IAX_RTAUTOCLEAR); ast_set_flag(peer, IAX_RTAUTOCLEAR);
expire_registry((void *)peer->name); expire_registry((const void *)peer->name);
ast_cli(fd, "OK peer %s was removed from the cache.\n", argv[3]); ast_cli(fd, "OK peer %s was removed from the cache.\n", argv[3]);
} else { } else {
ast_cli(fd, "SORRY peer %s is not eligible for this operation.\n", argv[3]); ast_cli(fd, "SORRY peer %s is not eligible for this operation.\n", argv[3]);
@ -2589,7 +2589,7 @@ static void unwrap_timestamp(struct iax_frame *fr)
} }
} }
static int get_from_jb(void *p); static int get_from_jb(const void *p);
static void update_jbsched(struct chan_iax2_pvt *pvt) static void update_jbsched(struct chan_iax2_pvt *pvt)
{ {
@ -2608,7 +2608,7 @@ static void update_jbsched(struct chan_iax2_pvt *pvt)
CALLNO_TO_PTR(pvt->callno)); CALLNO_TO_PTR(pvt->callno));
} }
static void __get_from_jb(void *p) static void __get_from_jb(const void *p)
{ {
int callno = PTR_TO_CALLNO(p); int callno = PTR_TO_CALLNO(p);
struct chan_iax2_pvt *pvt = NULL; struct chan_iax2_pvt *pvt = NULL;
@ -2684,7 +2684,7 @@ static void __get_from_jb(void *p)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int get_from_jb(void *data) static int get_from_jb(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__get_from_jb, data)) if (schedule_action(__get_from_jb, data))
@ -2906,7 +2906,7 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
ast_copy_flags(peer, &globalflags, IAX_RTAUTOCLEAR|IAX_RTCACHEFRIENDS); ast_copy_flags(peer, &globalflags, IAX_RTAUTOCLEAR|IAX_RTCACHEFRIENDS);
if (ast_test_flag(peer, IAX_RTAUTOCLEAR)) { if (ast_test_flag(peer, IAX_RTAUTOCLEAR)) {
peer->expire = iax2_sched_replace(peer->expire, sched, peer->expire = iax2_sched_replace(peer->expire, sched,
(global_rtautoclear) * 1000, expire_registry, (void *) peer->name); (global_rtautoclear) * 1000, expire_registry, (const void *)peer->name);
} }
ao2_link(peers, peer_ref(peer)); ao2_link(peers, peer_ref(peer));
if (ast_test_flag(peer, IAX_DYNAMIC)) if (ast_test_flag(peer, IAX_DYNAMIC))
@ -3080,7 +3080,7 @@ return_unref:
return res; return res;
} }
static void __auto_congest(void *nothing) static void __auto_congest(const void *nothing)
{ {
int callno = PTR_TO_CALLNO(nothing); int callno = PTR_TO_CALLNO(nothing);
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_CONGESTION }; struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_CONGESTION };
@ -3093,7 +3093,7 @@ static void __auto_congest(void *nothing)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int auto_congest(void *data) static int auto_congest(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__auto_congest, data)) if (schedule_action(__auto_congest, data))
@ -5780,14 +5780,14 @@ static int authenticate_reply(struct chan_iax2_pvt *p, struct sockaddr_in *sin,
static int iax2_do_register(struct iax2_registry *reg); static int iax2_do_register(struct iax2_registry *reg);
static void __iax2_do_register_s(void *data) static void __iax2_do_register_s(const void *data)
{ {
struct iax2_registry *reg = data; struct iax2_registry *reg = (struct iax2_registry *)data;
reg->expire = -1; reg->expire = -1;
iax2_do_register(reg); iax2_do_register(reg);
} }
static int iax2_do_register_s(void *data) static int iax2_do_register_s(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_do_register_s, data)) if (schedule_action(__iax2_do_register_s, data))
@ -6065,9 +6065,9 @@ static void register_peer_exten(struct iax2_peer *peer, int onoff)
} }
static void prune_peers(void); static void prune_peers(void);
static void __expire_registry(void *data) static void __expire_registry(const void *data)
{ {
char *name = data; const char *name = data;
struct iax2_peer *peer = NULL; struct iax2_peer *peer = NULL;
struct iax2_peer tmp_peer = { struct iax2_peer tmp_peer = {
.name = name, .name = name,
@ -6100,7 +6100,7 @@ static void __expire_registry(void *data)
peer_unref(peer); peer_unref(peer);
} }
static int expire_registry(void *data) static int expire_registry(const void *data)
{ {
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__expire_registry, data)) if (schedule_action(__expire_registry, data))
@ -6136,7 +6136,7 @@ static void reg_source_db(struct iax2_peer *p)
p->addr.sin_port = htons(atoi(c)); p->addr.sin_port = htons(atoi(c));
ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */ ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */
p->expire = iax2_sched_replace(p->expire, sched, p->expire = iax2_sched_replace(p->expire, sched,
(p->expiry + 10) * 1000, expire_registry, (void *) p->name); (p->expiry + 10) * 1000, expire_registry, (const void *)p->name);
if (iax2_regfunk) if (iax2_regfunk)
iax2_regfunk(p->name, 1); iax2_regfunk(p->name, 1);
register_peer_exten(p, 1); register_peer_exten(p, 1);
@ -6240,7 +6240,7 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
p->expiry = refresh; p->expiry = refresh;
} }
if (p->expiry && sin->sin_addr.s_addr) if (p->expiry && sin->sin_addr.s_addr)
p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, (void *)p->name); p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, (const void *)p->name);
iax_ie_append_str(&ied, IAX_IE_USERNAME, p->name); iax_ie_append_str(&ied, IAX_IE_USERNAME, p->name);
iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime(p->zonetag)); iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime(p->zonetag));
if (sin->sin_addr.s_addr) { if (sin->sin_addr.s_addr) {
@ -6385,7 +6385,7 @@ static void stop_stuff(int callno)
iax2_destroy_helper(iaxs[callno]); iax2_destroy_helper(iaxs[callno]);
} }
static void __auth_reject(void *nothing) static void __auth_reject(const void *nothing)
{ {
/* Called from IAX thread only, without iaxs lock */ /* Called from IAX thread only, without iaxs lock */
int callno = (int)(long)(nothing); int callno = (int)(long)(nothing);
@ -6405,7 +6405,7 @@ static void __auth_reject(void *nothing)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int auth_reject(void *data) static int auth_reject(const void *data)
{ {
int callno = (int)(long)(data); int callno = (int)(long)(data);
ast_mutex_lock(&iaxsl[callno]); ast_mutex_lock(&iaxsl[callno]);
@ -6434,7 +6434,7 @@ static int auth_fail(int callno, int failcode)
return 0; return 0;
} }
static void __auto_hangup(void *nothing) static void __auto_hangup(const void *nothing)
{ {
/* Called from IAX thread only, without iaxs lock */ /* Called from IAX thread only, without iaxs lock */
int callno = (int)(long)(nothing); int callno = (int)(long)(nothing);
@ -6449,7 +6449,7 @@ static void __auto_hangup(void *nothing)
ast_mutex_unlock(&iaxsl[callno]); ast_mutex_unlock(&iaxsl[callno]);
} }
static int auto_hangup(void *data) static int auto_hangup(const void *data)
{ {
int callno = (int)(long)(data); int callno = (int)(long)(data);
ast_mutex_lock(&iaxsl[callno]); ast_mutex_lock(&iaxsl[callno]);
@ -6497,15 +6497,15 @@ static void vnak_retransmit(int callno, int last)
AST_LIST_UNLOCK(&frame_queue); AST_LIST_UNLOCK(&frame_queue);
} }
static void __iax2_poke_peer_s(void *data) static void __iax2_poke_peer_s(const void *data)
{ {
struct iax2_peer *peer = data; struct iax2_peer *peer = (struct iax2_peer *)data;
iax2_poke_peer(peer, 0); iax2_poke_peer(peer, 0);
} }
static int iax2_poke_peer_s(void *data) static int iax2_poke_peer_s(const void *data)
{ {
struct iax2_peer *peer = data; struct iax2_peer *peer = (struct iax2_peer *)data;
peer->pokeexpire = -1; peer->pokeexpire = -1;
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_poke_peer_s, data)) if (schedule_action(__iax2_poke_peer_s, data))
@ -8961,9 +8961,9 @@ static int iax2_prov_cmd(int fd, int argc, char *argv[])
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static void __iax2_poke_noanswer(void *data) static void __iax2_poke_noanswer(const void *data)
{ {
struct iax2_peer *peer = data; struct iax2_peer *peer = (struct iax2_peer *)data;
if (peer->lastms > -1) { if (peer->lastms > -1) {
ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE! Time: %d\n", peer->name, peer->lastms); ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE! Time: %d\n", peer->name, peer->lastms);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms); manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms);
@ -8980,9 +8980,9 @@ static void __iax2_poke_noanswer(void *data)
peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer); peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer);
} }
static int iax2_poke_noanswer(void *data) static int iax2_poke_noanswer(const void *data)
{ {
struct iax2_peer *peer = data; struct iax2_peer *peer = (struct iax2_peer *)data;
peer->pokeexpire = -1; peer->pokeexpire = -1;
#ifdef SCHED_MULTITHREADED #ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_poke_noanswer, data)) if (schedule_action(__iax2_poke_noanswer, data))

@ -638,7 +638,7 @@ static void mgcp_queue_control(struct mgcp_subchannel *sub, int control)
return mgcp_queue_frame(sub, &f); return mgcp_queue_frame(sub, &f);
} }
static int retrans_pkt(void *data) static int retrans_pkt(const void *data)
{ {
struct mgcp_gateway *gw = (struct mgcp_gateway *)data; struct mgcp_gateway *gw = (struct mgcp_gateway *)data;
struct mgcp_message *cur, *exq = NULL, *w, *prev; struct mgcp_message *cur, *exq = NULL, *w, *prev;

@ -621,7 +621,7 @@ static inline void misdn_tasks_wakeup (void)
pthread_kill(misdn_tasks_thread, SIGUSR1); pthread_kill(misdn_tasks_thread, SIGUSR1);
} }
static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback, void *data, int variable) static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback, const void *data, int variable)
{ {
int task_id; int task_id;
@ -634,12 +634,12 @@ static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback,
return task_id; return task_id;
} }
static int misdn_tasks_add (int timeout, ast_sched_cb callback, void *data) static int misdn_tasks_add (int timeout, ast_sched_cb callback, const void *data)
{ {
return _misdn_tasks_add_variable(timeout, callback, data, 0); return _misdn_tasks_add_variable(timeout, callback, data, 0);
} }
static int misdn_tasks_add_variable (int timeout, ast_sched_cb callback, void *data) static int misdn_tasks_add_variable (int timeout, ast_sched_cb callback, const void *data)
{ {
return _misdn_tasks_add_variable(timeout, callback, data, 1); return _misdn_tasks_add_variable(timeout, callback, data, 1);
} }
@ -649,14 +649,14 @@ static void misdn_tasks_remove (int task_id)
ast_sched_del(misdn_tasks, task_id); ast_sched_del(misdn_tasks, task_id);
} }
static int misdn_l1_task (void *data) static int misdn_l1_task (const void *data)
{ {
misdn_lib_isdn_l1watcher(*(int *)data); misdn_lib_isdn_l1watcher(*(int *)data);
chan_misdn_log(5, *(int *)data, "L1watcher timeout\n"); chan_misdn_log(5, *(int *)data, "L1watcher timeout\n");
return 1; return 1;
} }
static int misdn_overlap_dial_task (void *data) static int misdn_overlap_dial_task (const void *data)
{ {
struct timeval tv_end, tv_now; struct timeval tv_end, tv_now;
int diff; int diff;

@ -1483,7 +1483,7 @@ static int sipsock_read(int *id, int fd, short events, void *ignore);
static int __sip_xmit(struct sip_pvt *p, char *data, int len); static int __sip_xmit(struct sip_pvt *p, char *data, int len);
static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod); static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod);
static int __transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable); static int __transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable);
static int retrans_pkt(void *data); static int retrans_pkt(const void *data);
static int transmit_sip_request(struct sip_pvt *p, struct sip_request *req); static int transmit_sip_request(struct sip_pvt *p, struct sip_request *req);
static int transmit_response_using_temp(ast_string_field callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, const struct sip_request *req, const char *msg); static int transmit_response_using_temp(ast_string_field callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, const struct sip_request *req, const char *msg);
static int transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req); static int transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req);
@ -1515,7 +1515,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
/*--- Dialog management */ /*--- Dialog management */
static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin, static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
int useglobal_nat, const int intended_method); int useglobal_nat, const int intended_method);
static int __sip_autodestruct(void *data); static int __sip_autodestruct(const void *data);
static void sip_scheddestroy(struct sip_pvt *p, int ms); static void sip_scheddestroy(struct sip_pvt *p, int ms);
static void sip_cancel_destroy(struct sip_pvt *p); static void sip_cancel_destroy(struct sip_pvt *p);
static struct sip_pvt *sip_destroy(struct sip_pvt *p); static struct sip_pvt *sip_destroy(struct sip_pvt *p);
@ -1523,7 +1523,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
static void __sip_pretend_ack(struct sip_pvt *p); static void __sip_pretend_ack(struct sip_pvt *p);
static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
static int auto_congest(void *arg); static int auto_congest(const void *arg);
static int update_call_counter(struct sip_pvt *fup, int event); static int update_call_counter(struct sip_pvt *fup, int event);
static int hangup_sip2cause(int cause); static int hangup_sip2cause(int cause);
static const char *hangup_cause2sip(int cause); static const char *hangup_cause2sip(int cause);
@ -1579,7 +1579,7 @@ static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, con
/*--- Misc functions */ /*--- Misc functions */
static int sip_do_reload(enum channelreloadreason reason); static int sip_do_reload(enum channelreloadreason reason);
static int reload_config(enum channelreloadreason reason); static int reload_config(enum channelreloadreason reason);
static int expire_register(void *data); static int expire_register(const void *data);
static void *do_monitor(void *data); static void *do_monitor(void *data);
static int restart_monitor(void); static int restart_monitor(void);
static int sip_addrcmp(char *name, struct sockaddr_in *sin); /* Support for peer matching */ static int sip_addrcmp(char *name, struct sockaddr_in *sin); /* Support for peer matching */
@ -1590,7 +1590,7 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target
/*--- Device monitoring and Device/extension state/event handling */ /*--- Device monitoring and Device/extension state/event handling */
static int cb_extensionstate(char *context, char* exten, int state, void *data); static int cb_extensionstate(char *context, char* exten, int state, void *data);
static int sip_devicestate(void *data); static int sip_devicestate(void *data);
static int sip_poke_noanswer(void *data); static int sip_poke_noanswer(const void *data);
static int sip_poke_peer(struct sip_peer *peer); static int sip_poke_peer(struct sip_peer *peer);
static void sip_poke_all_peers(void); static void sip_poke_all_peers(void);
static void sip_peer_hold(struct sip_pvt *p, int hold); static void sip_peer_hold(struct sip_pvt *p, int hold);
@ -1667,7 +1667,7 @@ static struct sip_peer *temp_peer(const char *name);
static void register_peer_exten(struct sip_peer *peer, int onoff); static void register_peer_exten(struct sip_peer *peer, int onoff);
static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime); static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime);
static struct sip_user *find_user(const char *name, int realtime); static struct sip_user *find_user(const char *name, int realtime);
static int sip_poke_peer_s(void *data); static int sip_poke_peer_s(const void *data);
static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_request *req); static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_request *req);
static void reg_source_db(struct sip_peer *peer); static void reg_source_db(struct sip_peer *peer);
static void destroy_association(struct sip_peer *peer); static void destroy_association(struct sip_peer *peer);
@ -1688,9 +1688,9 @@ static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us);
static void sip_registry_destroy(struct sip_registry *reg); static void sip_registry_destroy(struct sip_registry *reg);
static int sip_register(char *value, int lineno); static int sip_register(char *value, int lineno);
static const char *regstate2str(enum sipregistrystate regstate) attribute_const; static const char *regstate2str(enum sipregistrystate regstate) attribute_const;
static int sip_reregister(void *data); static int sip_reregister(const void *data);
static int __sip_do_register(struct sip_registry *r); static int __sip_do_register(struct sip_registry *r);
static int sip_reg_timeout(void *data); static int sip_reg_timeout(const void *data);
static void sip_send_all_registers(void); static void sip_send_all_registers(void);
/*--- Parsing SIP requests and responses */ /*--- Parsing SIP requests and responses */
@ -2243,9 +2243,9 @@ static void append_history_full(struct sip_pvt *p, const char *fmt, ...)
} }
/*! \brief Retransmit SIP message if no answer (Called from scheduler) */ /*! \brief Retransmit SIP message if no answer (Called from scheduler) */
static int retrans_pkt(void *data) static int retrans_pkt(const void *data)
{ {
struct sip_pkt *pkt = data, *prev, *cur = NULL; struct sip_pkt *pkt = (struct sip_pkt *)data, *prev, *cur = NULL;
int reschedule = DEFAULT_RETRANS; int reschedule = DEFAULT_RETRANS;
int xmitres = 0; int xmitres = 0;
@ -2414,9 +2414,9 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
* and we are called using that reference. So if the event is not * and we are called using that reference. So if the event is not
* rescheduled, we need to call dialog_unref(). * rescheduled, we need to call dialog_unref().
*/ */
static int __sip_autodestruct(void *data) static int __sip_autodestruct(const void *data)
{ {
struct sip_pvt *p = data; struct sip_pvt *p = (struct sip_pvt *)data;
/* If this is a subscription, tell the phone that we got a timeout */ /* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) { if (p->subscribed) {
@ -3473,9 +3473,9 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
/*! \brief Scheduled congestion on a call. /*! \brief Scheduled congestion on a call.
* Only called by the scheduler, must return the reference when done. * Only called by the scheduler, must return the reference when done.
*/ */
static int auto_congest(void *arg) static int auto_congest(const void *arg)
{ {
struct sip_pvt *p = arg; struct sip_pvt *p = (struct sip_pvt *)arg;
sip_pvt_lock(p); sip_pvt_lock(p);
p->initid = -1; /* event gone, will not be rescheduled */ p->initid = -1; /* event gone, will not be rescheduled */
@ -8063,7 +8063,7 @@ static const char *regstate2str(enum sipregistrystate regstate)
* We assume the reference so the sip_registry is valid, since it * We assume the reference so the sip_registry is valid, since it
* is stored in the scheduled event anyways. * is stored in the scheduled event anyways.
*/ */
static int sip_reregister(void *data) static int sip_reregister(const void *data)
{ {
/* if we are here, we know that we need to reregister. */ /* if we are here, we know that we need to reregister. */
struct sip_registry *r= registry_addref((struct sip_registry *) data); struct sip_registry *r= registry_addref((struct sip_registry *) data);
@ -8100,7 +8100,7 @@ static int __sip_do_register(struct sip_registry *r)
* This is called by the scheduler so the event is not pending anymore when * This is called by the scheduler so the event is not pending anymore when
* we are called. * we are called.
*/ */
static int sip_reg_timeout(void *data) static int sip_reg_timeout(const void *data)
{ {
/* if we are here, our registration timed out, so we'll just do it over */ /* if we are here, our registration timed out, so we'll just do it over */
@ -8537,9 +8537,9 @@ static void destroy_association(struct sip_peer *peer)
} }
/*! \brief Expire registration of SIP peer */ /*! \brief Expire registration of SIP peer */
static int expire_register(void *data) static int expire_register(const void *data)
{ {
struct sip_peer *peer = data; struct sip_peer *peer = (struct sip_peer *)data;
if (!peer) /* Hmmm. We have no peer. Weird. */ if (!peer) /* Hmmm. We have no peer. Weird. */
return 0; return 0;
@ -8569,9 +8569,9 @@ static int expire_register(void *data)
} }
/*! \brief Poke peer (send qualify to check if peer is alive and well) */ /*! \brief Poke peer (send qualify to check if peer is alive and well) */
static int sip_poke_peer_s(void *data) static int sip_poke_peer_s(const void *data)
{ {
struct sip_peer *peer = data; struct sip_peer *peer = (struct sip_peer *)data;
peer->pokeexpire = -1; peer->pokeexpire = -1;
sip_poke_peer(peer); sip_poke_peer(peer);
@ -16668,9 +16668,9 @@ static int restart_monitor(void)
} }
/*! \brief React to lack of answer to Qualify poke */ /*! \brief React to lack of answer to Qualify poke */
static int sip_poke_noanswer(void *data) static int sip_poke_noanswer(const void *data)
{ {
struct sip_peer *peer = data; struct sip_peer *peer = (struct sip_peer *)data;
peer->pokeexpire = -1; peer->pokeexpire = -1;
if (peer->lastms > -1) { if (peer->lastms > -1) {

@ -1007,7 +1007,7 @@ void misdn_cfg_update_ptp (void)
misdn_cfg_get(0, MISDN_GEN_MISDN_INIT, &misdn_init, sizeof(misdn_init)); misdn_cfg_get(0, MISDN_GEN_MISDN_INIT, &misdn_init, sizeof(misdn_init));
if (misdn_init) { if (!ast_strlen_zero(misdn_init)) {
fp = fopen(misdn_init, "r"); fp = fopen(misdn_init, "r");
if (fp) { if (fp) {
while(fgets(line, sizeof(line), fp)) { while(fgets(line, sizeof(line), fp)) {

@ -428,7 +428,7 @@ struct ast_channel {
int oldwriteformat; /*!< Original writer format */ int oldwriteformat; /*!< Original writer format */
int timingfd; /*!< Timing fd */ int timingfd; /*!< Timing fd */
int (*timingfunc)(void *data); int (*timingfunc)(const void *data);
void *timingdata; void *timingdata;
enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */ enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */
@ -1234,7 +1234,7 @@ int ast_autoservice_stop(struct ast_channel *chan);
/* If built with zaptel optimizations, force a scheduled expiration on the /* If built with zaptel optimizations, force a scheduled expiration on the
timer fd, at which point we call the callback function / data */ timer fd, at which point we call the callback function / data */
int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data), void *data); int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data);
/*! \brief Transfer a channel (if supported). Returns -1 on error, 0 if not supported /*! \brief Transfer a channel (if supported). Returns -1 on error, 0 if not supported
and 1 if supported and requested and 1 if supported and requested

@ -55,7 +55,7 @@ void sched_context_destroy(struct sched_context *c);
* \return returns a 0 if it should not be run again, or non-zero if it should be * \return returns a 0 if it should not be run again, or non-zero if it should be
* rescheduled to run again * rescheduled to run again
*/ */
typedef int (*ast_sched_cb)(void *data); typedef int (*ast_sched_cb)(const void *data);
#define AST_SCHED_CB(a) ((ast_sched_cb)(a)) #define AST_SCHED_CB(a) ((ast_sched_cb)(a))
/*! \brief Adds a scheduled event /*! \brief Adds a scheduled event
@ -69,7 +69,7 @@ typedef int (*ast_sched_cb)(void *data);
* \param data data to pass to the callback * \param data data to pass to the callback
* \return Returns a schedule item ID on success, -1 on failure * \return Returns a schedule item ID on success, -1 on failure
*/ */
int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data); int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data);
/*! /*!
* \brief replace a scheduler entry * \brief replace a scheduler entry
@ -81,7 +81,7 @@ int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, vo
* \retval -1 failure * \retval -1 failure
* \retval otherwise, returns scheduled item ID * \retval otherwise, returns scheduled item ID
*/ */
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data); int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data);
/*!Adds a scheduled event with rescheduling support /*!Adds a scheduled event with rescheduling support
* \param con Scheduler context to add * \param con Scheduler context to add
@ -96,7 +96,7 @@ int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched
* If callback returns 0, no further events will be re-scheduled * If callback returns 0, no further events will be re-scheduled
* \return Returns a schedule item ID on success, -1 on failure * \return Returns a schedule item ID on success, -1 on failure
*/ */
int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable); int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable);
/*! /*!
* \brief replace a scheduler entry * \brief replace a scheduler entry
@ -108,7 +108,7 @@ int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb cal
* \retval -1 failure * \retval -1 failure
* \retval otherwise, returns scheduled item ID * \retval otherwise, returns scheduled item ID
*/ */
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable); int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable);
/*! \brief Deletes a scheduled event /*! \brief Deletes a scheduled event
* Remove this event from being run. A procedure should not remove its * Remove this event from being run. A procedure should not remove its

@ -110,7 +110,7 @@ struct parse_io
void ast_yyset_column(int column_no, yyscan_t yyscanner); void ast_yyset_column(int column_no, yyscan_t yyscanner);
int ast_yyget_column(yyscan_t yyscanner); int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0; static int curlycount = 0;
static char *expr2_token_subst(char *mess); static char *expr2_token_subst(const char *mess);
%} %}
%option prefix="ast_yy" %option prefix="ast_yy"
@ -348,11 +348,11 @@ static char *expr2_token_equivs2[] =
}; };
static char *expr2_token_subst(char *mess) static char *expr2_token_subst(const char *mess)
{ {
/* calc a length, malloc, fill, and return; yyerror had better free it! */ /* calc a length, malloc, fill, and return; yyerror had better free it! */
int len=0,i; int len=0,i;
char *p; const char *p;
char *res, *s,*t; char *res, *s,*t;
int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*); int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
@ -397,7 +397,7 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
char spacebuf[8000]; /* best safe than sorry */ char spacebuf[8000]; /* best safe than sorry */
char spacebuf2[8000]; /* best safe than sorry */ char spacebuf2[8000]; /* best safe than sorry */
int i=0; int i=0;
char *s2 = expr2_token_subst((char *)s); char *s2 = expr2_token_subst(s);
spacebuf[0] = 0; spacebuf[0] = 0;
for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro,

@ -1482,7 +1482,7 @@ struct parse_io
void ast_yyset_column(int column_no, yyscan_t yyscanner); void ast_yyset_column(int column_no, yyscan_t yyscanner);
int ast_yyget_column(yyscan_t yyscanner); int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0; static int curlycount = 0;
static char *expr2_token_subst(char *mess); static char *expr2_token_subst(const char *mess);
#line 1488 "ast_expr2f.c" #line 1488 "ast_expr2f.c"
@ -3310,11 +3310,11 @@ static char *expr2_token_equivs2[] =
}; };
static char *expr2_token_subst(char *mess) static char *expr2_token_subst(const char *mess)
{ {
/* calc a length, malloc, fill, and return; yyerror had better free it! */ /* calc a length, malloc, fill, and return; yyerror had better free it! */
int len=0,i; int len=0,i;
char *p; const char *p;
char *res, *s,*t; char *res, *s,*t;
int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*); int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
@ -3359,7 +3359,7 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
char spacebuf[8000]; /* best safe than sorry */ char spacebuf[8000]; /* best safe than sorry */
char spacebuf2[8000]; /* best safe than sorry */ char spacebuf2[8000]; /* best safe than sorry */
int i=0; int i=0;
char *s2 = expr2_token_subst((char *)s); char *s2 = expr2_token_subst(s);
spacebuf[0] = 0; spacebuf[0] = 0;
for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro,

@ -1123,7 +1123,7 @@ void ast_cdr_submit_batch(int shutdown)
} }
} }
static int submit_scheduled_batch(void *data) static int submit_scheduled_batch(const void *data)
{ {
ast_cdr_submit_batch(0); ast_cdr_submit_batch(0);
/* manually reschedule from this point in time */ /* manually reschedule from this point in time */

@ -1545,13 +1545,13 @@ void ast_deactivate_generator(struct ast_channel *chan)
ast_channel_unlock(chan); ast_channel_unlock(chan);
} }
static int generator_force(void *data) static int generator_force(const void *data)
{ {
/* Called if generator doesn't have data */ /* Called if generator doesn't have data */
void *tmp; void *tmp;
int res; int res;
int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples); int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
struct ast_channel *chan = data; struct ast_channel *chan = (struct ast_channel *)data;
tmp = chan->generatordata; tmp = chan->generatordata;
chan->generatordata = NULL; chan->generatordata = NULL;
generate = chan->generator->generate; generate = chan->generator->generate;
@ -1971,7 +1971,7 @@ int ast_waitfordigit(struct ast_channel *c, int ms)
return ast_waitfordigit_full(c, ms, -1, -1); return ast_waitfordigit_full(c, ms, -1, -1);
} }
int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data), void *data) int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data)
{ {
int res = -1; int res = -1;
#ifdef HAVE_ZAPTEL #ifdef HAVE_ZAPTEL
@ -2182,7 +2182,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ioctl(chan->timingfd, ZT_TIMERACK, &blah); ioctl(chan->timingfd, ZT_TIMERACK, &blah);
if (chan->timingfunc) { if (chan->timingfunc) {
/* save a copy of func/data before unlocking the channel */ /* save a copy of func/data before unlocking the channel */
int (*func)(void *) = chan->timingfunc; int (*func)(const void *) = chan->timingfunc;
void *data = chan->timingdata; void *data = chan->timingdata;
ast_channel_unlock(chan); ast_channel_unlock(chan);
func(data); func(data);

@ -68,7 +68,7 @@ static void *hash_realloc __P((SEGMENT **, int, int));
static int hash_seq __P((const DB *, DBT *, DBT *, u_int32_t)); static int hash_seq __P((const DB *, DBT *, DBT *, u_int32_t));
static int hash_sync __P((const DB *, u_int32_t)); static int hash_sync __P((const DB *, u_int32_t));
static int hdestroy __P((HTAB *)); static int hdestroy __P((HTAB *));
static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *)); static HTAB *init_hash __P((HTAB *, const char *, const HASHINFO *));
static int init_htab __P((HTAB *, int)); static int init_htab __P((HTAB *, int));
#if BYTE_ORDER == LITTLE_ENDIAN #if BYTE_ORDER == LITTLE_ENDIAN
static void swap_header __P((HTAB *)); static void swap_header __P((HTAB *));
@ -133,7 +133,7 @@ __hash_open(file, flags, mode, info, dflags)
(void)fcntl(hashp->fp, F_SETFD, 1); (void)fcntl(hashp->fp, F_SETFD, 1);
} }
if (new_table) { if (new_table) {
if (!(hashp = init_hash(hashp, file, (HASHINFO *)info))) if (!(hashp = init_hash(hashp, file, info)))
RETURN_ERROR(errno, error1); RETURN_ERROR(errno, error1);
} else { } else {
/* Table already exists */ /* Table already exists */
@ -280,7 +280,7 @@ static HTAB *
init_hash(hashp, file, info) init_hash(hashp, file, info)
HTAB *hashp; HTAB *hashp;
const char *file; const char *file;
HASHINFO *info; const HASHINFO *info;
{ {
#ifdef _STATBUF_ST_BLKSIZE #ifdef _STATBUF_ST_BLKSIZE
struct stat statbuf; struct stat statbuf;

@ -217,9 +217,9 @@ static void *do_refresh(void *data)
return NULL; return NULL;
} }
static int refresh_list(void *data) static int refresh_list(const void *data)
{ {
struct refresh_info *info = data; struct refresh_info *info = (struct refresh_info *)data;
struct ast_dnsmgr_entry *entry; struct ast_dnsmgr_entry *entry;
/* if a refresh or reload is already in progress, exit now */ /* if a refresh or reload is already in progress, exit now */

@ -609,7 +609,7 @@ enum fsread_res {
FSREAD_SUCCESS_NOSCHED, FSREAD_SUCCESS_NOSCHED,
}; };
static int ast_fsread_audio(void *data); static int ast_fsread_audio(const void *data);
static enum fsread_res ast_readaudio_callback(struct ast_filestream *s) static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
{ {
@ -648,9 +648,9 @@ return_failure:
return FSREAD_FAILURE; return FSREAD_FAILURE;
} }
static int ast_fsread_audio(void *data) static int ast_fsread_audio(const void *data)
{ {
struct ast_filestream *fs = data; struct ast_filestream *fs = (struct ast_filestream *)data;
enum fsread_res res; enum fsread_res res;
res = ast_readaudio_callback(fs); res = ast_readaudio_callback(fs);
@ -661,7 +661,7 @@ static int ast_fsread_audio(void *data)
return 0; return 0;
} }
static int ast_fsread_video(void *data); static int ast_fsread_video(const void *data);
static enum fsread_res ast_readvideo_callback(struct ast_filestream *s) static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
{ {
@ -687,9 +687,9 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
return FSREAD_SUCCESS_SCHED; return FSREAD_SUCCESS_SCHED;
} }
static int ast_fsread_video(void *data) static int ast_fsread_video(const void *data)
{ {
struct ast_filestream *fs = data; struct ast_filestream *fs = (struct ast_filestream *)data;
enum fsread_res res; enum fsread_res res;
res = ast_readvideo_callback(fs); res = ast_readvideo_callback(fs);

@ -181,10 +181,10 @@ struct ast_rtp {
}; };
/* Forward declarations */ /* Forward declarations */
static int ast_rtcp_write(void *data); static int ast_rtcp_write(const void *data);
static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw); static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw);
static int ast_rtcp_write_sr(void *data); static int ast_rtcp_write_sr(const void *data);
static int ast_rtcp_write_rr(void *data); static int ast_rtcp_write_rr(const void *data);
static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp); static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp);
static int ast_rtp_senddigit_continuation(struct ast_rtp *rtp); static int ast_rtp_senddigit_continuation(struct ast_rtp *rtp);
int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit); int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit);
@ -2654,9 +2654,9 @@ int ast_rtcp_send_h261fur(void *data)
} }
/*! \brief Send RTCP sender's report */ /*! \brief Send RTCP sender's report */
static int ast_rtcp_write_sr(void *data) static int ast_rtcp_write_sr(const void *data)
{ {
struct ast_rtp *rtp = data; struct ast_rtp *rtp = (struct ast_rtp *)data;
int res; int res;
int len = 0; int len = 0;
struct timeval now; struct timeval now;
@ -2791,9 +2791,9 @@ static int ast_rtcp_write_sr(void *data)
} }
/*! \brief Send RTCP recipient's report */ /*! \brief Send RTCP recipient's report */
static int ast_rtcp_write_rr(void *data) static int ast_rtcp_write_rr(const void *data)
{ {
struct ast_rtp *rtp = data; struct ast_rtp *rtp = (struct ast_rtp *)data;
int res; int res;
int len = 32; int len = 32;
unsigned int lost; unsigned int lost;
@ -2890,9 +2890,9 @@ static int ast_rtcp_write_rr(void *data)
/*! \brief Write and RTCP packet to the far end /*! \brief Write and RTCP packet to the far end
* \note Decide if we are going to send an SR (with Reception Block) or RR * \note Decide if we are going to send an SR (with Reception Block) or RR
* RR is sent if we have not sent any rtp packets in the previous interval */ * RR is sent if we have not sent any rtp packets in the previous interval */
static int ast_rtcp_write(void *data) static int ast_rtcp_write(const void *data)
{ {
struct ast_rtp *rtp = data; struct ast_rtp *rtp = (struct ast_rtp *)data;
int res; int res;
if (!rtp || !rtp->rtcp) if (!rtp || !rtp->rtcp)

@ -56,7 +56,7 @@ struct sched {
struct timeval when; /*!< Absolute time event should take place */ struct timeval when; /*!< Absolute time event should take place */
int resched; /*!< When to reschedule */ int resched; /*!< When to reschedule */
int variable; /*!< Use return value from callback to reschedule */ int variable; /*!< Use return value from callback to reschedule */
void *data; /*!< Data */ const void *data; /*!< Data */
ast_sched_cb callback; /*!< Callback */ ast_sched_cb callback; /*!< Callback */
}; };
@ -207,7 +207,7 @@ static int sched_settime(struct timeval *tv, int when)
return 0; return 0;
} }
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable) int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable)
{ {
/* 0 means the schedule item is new; do not delete */ /* 0 means the schedule item is new; do not delete */
if (old_id > 0) if (old_id > 0)
@ -218,7 +218,7 @@ int ast_sched_replace_variable(int old_id, struct sched_context *con, int when,
/*! \brief /*! \brief
* Schedule callback(data) to happen when ms into the future * Schedule callback(data) to happen when ms into the future
*/ */
int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable) int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable)
{ {
struct sched *tmp; struct sched *tmp;
int res = -1; int res = -1;
@ -251,14 +251,14 @@ int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb cal
return res; return res;
} }
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data) int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{ {
if (old_id > -1) if (old_id > -1)
ast_sched_del(con, old_id); ast_sched_del(con, old_id);
return ast_sched_add(con, when, callback, data); return ast_sched_add(con, when, callback, data);
} }
int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data) int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{ {
return ast_sched_add_variable(con, when, callback, data, 0); return ast_sched_add_variable(con, when, callback, data, 0);
} }

@ -1295,9 +1295,9 @@ static void apply_peer(struct dundi_transaction *trans, struct dundi_peer *p)
} }
/*! \note Called with the peers list already locked */ /*! \note Called with the peers list already locked */
static int do_register_expire(void *data) static int do_register_expire(const void *data)
{ {
struct dundi_peer *peer = data; struct dundi_peer *peer = (struct dundi_peer *)data;
char eid_str[20]; char eid_str[20];
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Register expired for '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid)); ast_log(LOG_DEBUG, "Register expired for '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid));
@ -2984,12 +2984,11 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
free(trans); free(trans);
} }
static int dundi_rexmit(void *data) static int dundi_rexmit(const void *data)
{ {
struct dundi_packet *pack; struct dundi_packet *pack = (struct dundi_packet *)data;
int res; int res;
AST_LIST_LOCK(&peers); AST_LIST_LOCK(&peers);
pack = data;
if (pack->retrans < 1) { if (pack->retrans < 1) {
pack->retransid = -1; pack->retransid = -1;
if (!ast_test_flag(pack->parent, FLAG_ISQUAL)) if (!ast_test_flag(pack->parent, FLAG_ISQUAL))
@ -3079,9 +3078,9 @@ static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, i
return -1; return -1;
} }
static int do_autokill(void *data) static int do_autokill(const void *data)
{ {
struct dundi_transaction *trans = data; struct dundi_transaction *trans = (struct dundi_transaction *)data;
char eid_str[20]; char eid_str[20];
ast_log(LOG_NOTICE, "Transaction to '%s' took too long to ACK, destroying\n", ast_log(LOG_NOTICE, "Transaction to '%s' took too long to ACK, destroying\n",
dundi_eid_to_str(eid_str, sizeof(eid_str), &trans->them_eid)); dundi_eid_to_str(eid_str, sizeof(eid_str), &trans->them_eid));
@ -4267,10 +4266,10 @@ static void build_mapping(char *name, char *value)
} }
/* \note Called with the peers list already locked */ /* \note Called with the peers list already locked */
static int do_register(void *data) static int do_register(const void *data)
{ {
struct dundi_ie_data ied; struct dundi_ie_data ied;
struct dundi_peer *peer = data; struct dundi_peer *peer = (struct dundi_peer *)data;
char eid_str[20]; char eid_str[20];
char eid_str2[20]; char eid_str2[20];
if (option_debug) if (option_debug)
@ -4294,10 +4293,9 @@ static int do_register(void *data)
return 0; return 0;
} }
static int do_qualify(void *data) static int do_qualify(const void *data)
{ {
struct dundi_peer *peer; struct dundi_peer *peer = (struct dundi_peer *)data;
peer = data;
peer->qualifyid = -1; peer->qualifyid = -1;
qualify_peer(peer, 0); qualify_peer(peer, 0);
return 0; return 0;

@ -820,7 +820,7 @@ static int parse_config(int reload)
dbport = atoi(s); dbport = atoi(s);
} }
if (dbhost && !(s = ast_variable_retrieve(config, "general", "dbsock"))) { if (!ast_strlen_zero(dbhost) && !(s = ast_variable_retrieve(config, "general", "dbsock"))) {
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Postgresql RealTime: No database socket found, using '/tmp/pgsql.sock' as default.\n"); "Postgresql RealTime: No database socket found, using '/tmp/pgsql.sock' as default.\n");
strcpy(dbsock, "/tmp/pgsql.sock"); strcpy(dbsock, "/tmp/pgsql.sock");
@ -830,7 +830,7 @@ static int parse_config(int reload)
ast_config_destroy(config); ast_config_destroy(config);
if (option_debug) { if (option_debug) {
if (dbhost) { if (!ast_strlen_zero(dbhost)) {
ast_debug(1, "Postgresql RealTime Host: %s\n", dbhost); ast_debug(1, "Postgresql RealTime Host: %s\n", dbhost);
ast_debug(1, "Postgresql RealTime Port: %i\n", dbport); ast_debug(1, "Postgresql RealTime Port: %i\n", dbport);
} else { } else {
@ -868,7 +868,7 @@ static int pgsql_reconnect(const char *database)
pgsqlConn = NULL; pgsqlConn = NULL;
} }
if ((!pgsqlConn) && (dbhost || dbsock) && dbuser && dbpass && my_database) { if ((!pgsqlConn) && (!ast_strlen_zero(dbhost) || !ast_strlen_zero(dbsock)) && !ast_strlen_zero(dbuser) && !ast_strlen_zero(dbpass) && !ast_strlen_zero(my_database)) {
char *connInfo = NULL; char *connInfo = NULL;
unsigned int size = 100 + strlen(dbhost) unsigned int size = 100 + strlen(dbhost)
+ strlen(dbuser) + strlen(dbuser)
@ -909,15 +909,15 @@ static int realtime_pgsql_status(int fd, int argc, char **argv)
int ctime = time(NULL) - connect_time; int ctime = time(NULL) - connect_time;
if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) { if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
if (dbhost) { if (!ast_strlen_zero(dbhost)) {
snprintf(status, 255, "Connected to %s@%s, port %d", dbname, dbhost, dbport); snprintf(status, 255, "Connected to %s@%s, port %d", dbname, dbhost, dbport);
} else if (dbsock) { } else if (!ast_strlen_zero(dbsock)) {
snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock); snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock);
} else { } else {
snprintf(status, 255, "Connected to %s@%s", dbname, dbhost); snprintf(status, 255, "Connected to %s@%s", dbname, dbhost);
} }
if (dbuser && *dbuser) { if (!ast_strlen_zero(dbuser)) {
snprintf(status2, 99, " with username %s", dbuser); snprintf(status2, 99, " with username %s", dbuser);
} }

@ -61,8 +61,8 @@ void destroy_namelist(struct namelist *x)
} }
} }
struct namelist *create_name(char *name); struct namelist *create_name(const char *name);
struct namelist *create_name(char *name) struct namelist *create_name(const char *name)
{ {
struct namelist *x = calloc(1, sizeof(*x)); struct namelist *x = calloc(1, sizeof(*x));
if (!x) if (!x)
@ -333,12 +333,12 @@ int ast_add_extension2(struct ast_context *con,
void pbx_builtin_setvar(void *chan, void *data) void pbx_builtin_setvar(void *chan, void *data)
{ {
struct namelist *x = create_name((char*)data); struct namelist *x = create_name(data);
if(!no_comp) if(!no_comp)
printf("Executed pbx_builtin_setvar(chan, data=%s);\n", (char*)data); printf("Executed pbx_builtin_setvar(chan, data=%s);\n", (char*)data);
if( dump_extensions ) { if( dump_extensions ) {
x = create_name((char*)data); x = create_name(data);
ADD_LAST(globalvars,x); ADD_LAST(globalvars,x);
} }
} }
@ -365,7 +365,7 @@ void ast_context_add_ignorepat2(struct ast_context *con, const char *value, cons
printf("Executed ast_context_add_ignorepat2(con, value=%s, registrar=%s);\n", value, registrar); printf("Executed ast_context_add_ignorepat2(con, value=%s, registrar=%s);\n", value, registrar);
if( dump_extensions ) { if( dump_extensions ) {
struct namelist *x; struct namelist *x;
x = create_name((char*)value); x = create_name(value);
ADD_LAST(con->ignorepats,x); ADD_LAST(con->ignorepats,x);
} }
} }

Loading…
Cancel
Save