From 2975b2131d5a7f22d22da439be246cacf6b0e980 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 8 Dec 2023 12:36:00 -0500 Subject: [PATCH] MT#55283 convert struct call to typedef Change-Id: I1f01fdf74d6d3952413ebc02dfdb9770b324481c --- daemon/call.c | 90 +++++++++++++++++++-------------------- daemon/call_interfaces.c | 68 ++++++++++++++--------------- daemon/cdr.c | 2 +- daemon/cli.c | 12 +++--- daemon/codec.c | 34 +++++++-------- daemon/dtmf.c | 14 +++--- daemon/ice.c | 20 ++++----- daemon/janus.c | 28 ++++++------ daemon/jitter_buffer.c | 4 +- daemon/log.c | 2 +- daemon/log.h | 4 +- daemon/log_funcs.h | 2 +- daemon/media_player.c | 6 +-- daemon/media_socket.c | 10 ++--- daemon/mqtt.c | 8 ++-- daemon/recording.c | 60 +++++++++++++------------- daemon/redis.c | 38 ++++++++--------- daemon/rtcp.c | 18 ++++---- daemon/sdp.c | 2 +- daemon/statistics.c | 8 ++-- include/call.h | 59 +++++++++++++------------ include/call_interfaces.h | 5 +-- include/cdr.h | 4 +- include/cli.h | 4 +- include/codec.h | 5 +-- include/dtmf.h | 5 +-- include/ice.h | 5 +-- include/jitter_buffer.h | 4 +- include/media_player.h | 6 +-- include/media_socket.h | 8 ++-- include/mqtt.h | 10 ++--- include/recording.h | 23 +++++----- include/redis.h | 5 +-- include/rtcp.h | 2 +- include/ssrc.h | 1 - include/statistics.h | 9 ++-- include/types.h | 1 + t/log_funcs.h | 4 +- t/test-stats.c | 4 +- t/test-transcode.c | 4 +- 40 files changed, 295 insertions(+), 303 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 45d44f83b..23cdf76c1 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -76,13 +76,13 @@ unsigned int call_socket_cpu_affinity = 0; static struct timeval add_ongoing_calls_dur_in_interval(struct timeval *interval_start, struct timeval *interval_duration); static void __call_free(void *p); -static void __call_cleanup(struct call *c); +static void __call_cleanup(call_t *c); static void __monologue_stop(struct call_monologue *ml); static void media_stop(struct call_media *m); static void __subscribe_medias_both_ways(struct call_media * a, struct call_media * b); /* called with call->master_lock held in R */ -static int call_timer_delete_monologues(struct call *c) { +static int call_timer_delete_monologues(call_t *c) { GList *i; struct call_monologue *ml; int ret = 0; @@ -121,7 +121,7 @@ static int call_timer_delete_monologues(struct call *c) { -void call_make_own_foreign(struct call *c, bool foreign) { +void call_make_own_foreign(call_t *c, bool foreign) { statistics_update_foreignown_dec(c); bf_set_clear(&c->call_flags, CALL_FLAG_FOREIGN, foreign); statistics_update_foreignown_inc(c); @@ -130,7 +130,7 @@ void call_make_own_foreign(struct call *c, bool foreign) { /* called with hashlock held */ -static void call_timer_iterator(struct call *c, struct iterator_helper *hlp) { +static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) { unsigned int check; bool good = false; struct packet_stream *ps; @@ -375,7 +375,7 @@ fault: } void kill_calls_timer(GSList *list, const char *url) { - struct call *ca; + call_t *ca; GList *csl; struct call_monologue *cm; char *url_prefix = NULL, *url_suffix = NULL; @@ -538,9 +538,9 @@ int call_init(void) { return 0; } -static void __call_iterator_remove(struct call *c) { +static void __call_iterator_remove(call_t *c) { for (unsigned int i = 0; i < NUM_CALL_ITERATORS; i++) { - struct call *prev_call, *next_call; + call_t *prev_call, *next_call; while (1) { mutex_lock(&rtpe_call_iterators[i].lock); // lock this entry @@ -588,7 +588,7 @@ void call_free(void) { mqtt_timer_stop(&global_mqtt_timer); rtpe_calls_ht_iter iter; t_hash_table_iter_init(&iter, rtpe_callhash); - struct call *c; + call_t *c; while (t_hash_table_iter_next(&iter, NULL, &c)) { __call_iterator_remove(c); __call_cleanup(c); @@ -599,7 +599,7 @@ void call_free(void) { -struct call_media *call_media_new(struct call *call) { +struct call_media *call_media_new(call_t *call) { struct call_media *med; med = uid_slice_alloc0(med, &call->medias); med->call = call; @@ -614,7 +614,7 @@ static struct call_media *__get_media(struct call_monologue *ml, const struct st const sdp_ng_flags *flags, unsigned int index) { struct call_media *med; - struct call *call; + call_t *call; // check for trickle ICE SDP fragment if (flags && flags->fragment && sp->media_id.len) { @@ -891,7 +891,7 @@ static void __rtp_stats_free(void *p) { g_slice_free1(sizeof(struct rtp_stats), p); } -struct packet_stream *__packet_stream_new(struct call *call) { +struct packet_stream *__packet_stream_new(call_t *call) { struct packet_stream *stream; stream = uid_slice_alloc0(stream, &call->streams.q); @@ -911,7 +911,7 @@ struct packet_stream *__packet_stream_new(struct call *call) { static int __num_media_streams(struct call_media *media, unsigned int num_ports) { struct packet_stream *stream; - struct call *call = media->call; + call_t *call = media->call; int ret = 0; // we need at least two, one for RTP and one for RTCP as they hold the crypto context @@ -1079,7 +1079,7 @@ void call_media_state_machine(struct call_media *m) { int __init_stream(struct packet_stream *ps) { struct call_media *media = ps->media; - struct call *call = ps->call; + call_t *call = ps->call; int dtls_active = -1; g_autoptr(char) paramsbuf = NULL; struct dtls_connection *dtls_conn = NULL; @@ -2016,7 +2016,7 @@ static void __fingerprint_changed(struct call_media *m) { __dtls_restart(m); } -static void __set_all_tos(struct call *c) { +static void __set_all_tos(call_t *c) { for (__auto_type l = c->stream_fds.head; l; l = l->next) { struct stream_fd *sfd = l->data; if (sfd->socket.fd == -1) @@ -2025,7 +2025,7 @@ static void __set_all_tos(struct call *c) { } } -static void __tos_change(struct call *call, const sdp_ng_flags *flags) { +static void __tos_change(call_t *call, const sdp_ng_flags *flags) { unsigned char new_tos; /* Handle TOS= parameter. Negative value = no change, not present or too large = @@ -2088,7 +2088,7 @@ static void __dtls_logic(const sdp_ng_flags *flags, struct call_media *other_media, struct stream_params *sp) { unsigned int tmp; - struct call *call = other_media->call; + call_t *call = other_media->call; /* active and passive are from our POV */ tmp = other_media->media_flags; @@ -2187,7 +2187,7 @@ static void __update_media_id(struct call_media *media, struct call_media *other if (!flags) return; - struct call *call = other_media->call; + call_t *call = other_media->call; struct call_monologue *ml = media ? media->monologue : NULL; struct call_monologue *other_ml = other_media->monologue; @@ -2572,7 +2572,7 @@ void update_init_subscribers(struct call_monologue *ml, enum call_opmode opmode) } static void __call_monologue_init_from_flags(struct call_monologue *ml, sdp_ng_flags *flags) { - struct call *call = ml->call; + call_t *call = ml->call; call->last_signal = rtpe_now.tv_sec; call->deleted = 0; @@ -2607,7 +2607,7 @@ static void __update_media_label(struct call_media *media, struct call_media *ot if (!flags) return; - struct call *call = media->call; + call_t *call = media->call; if (flags->siprec && flags->opmode == OP_REQUEST) { if (!media->label.len) { @@ -2625,7 +2625,7 @@ static void __update_media_label(struct call_media *media, struct call_media *ot static void __media_init_from_flags(struct call_media *other_media, struct call_media *media, struct stream_params *sp, sdp_ng_flags *flags) { - struct call *call = other_media->call; + call_t *call = other_media->call; str_q *additional_attributes = &sp->attributes; /* attributes in str format */ if (flags && flags->opmode == OP_OFFER && flags->reset) { @@ -3550,7 +3550,7 @@ next: return res; } -static void __call_cleanup(struct call *c) { +static void __call_cleanup(call_t *c) { for (__auto_type l = c->streams.head; l; l = l->next) { struct packet_stream *ps = l->data; @@ -3596,7 +3596,7 @@ static void __call_cleanup(struct call *c) { } /* called lock-free, but must hold a reference to the call */ -void call_destroy(struct call *c) { +void call_destroy(call_t *c) { struct packet_stream *ps=0; GList *l, *ll; struct call_monologue *ml; @@ -3609,7 +3609,7 @@ void call_destroy(struct call *c) { } rwlock_lock_w(&rtpe_callhash_lock); - struct call *call_ht = NULL; + call_t *call_ht = NULL; t_hash_table_steal_extended(rtpe_callhash, &c->callid, NULL, &call_ht); if (call_ht) { if (call_ht != c) { @@ -3881,7 +3881,7 @@ void __monologue_free(struct call_monologue *m) { } static void __call_free(void *p) { - struct call *c = p; + call_t *c = p; struct call_monologue *m; struct call_media *md; struct packet_stream *ps; @@ -3933,8 +3933,8 @@ static void __call_free(void *p) { assert(c->stream_fds.head == NULL); } -static struct call *call_create(const str *callid) { - struct call *c; +static call_t *call_create(const str *callid) { + call_t *c; ilog(LOG_NOTICE, "Creating new call"); c = obj_alloc0("call", sizeof(*c), __call_free); @@ -3962,8 +3962,8 @@ static struct call *call_create(const str *callid) { } /* returns call with master_lock held in W */ -struct call *call_get_or_create(const str *callid, bool exclusive) { - struct call *c; +call_t *call_get_or_create(const str *callid, bool exclusive) { + call_t *c; restart: rwlock_lock_r(&rtpe_callhash_lock); @@ -3987,7 +3987,7 @@ restart: for (int i = 0; i < NUM_CALL_ITERATORS; i++) { c->iterator[i].link.data = obj_get(c); - struct call *first_call; + call_t *first_call; while (1) { // lock the list mutex_lock(&rtpe_call_iterators[i].lock); @@ -4039,8 +4039,8 @@ restart: * Therefore the code must use obj_put() on the call after call_get() * and after it's done operating on the object. */ -struct call *call_get(const str *callid) { - struct call *ret; +call_t *call_get(const str *callid) { + call_t *ret; rwlock_lock_r(&rtpe_callhash_lock); ret = t_hash_table_lookup(rtpe_callhash, callid); @@ -4058,7 +4058,7 @@ struct call *call_get(const str *callid) { } /* returns call with master_lock held in W, or possibly NULL iff opmode == OP_ANSWER */ -struct call *call_get_opmode(const str *callid, enum call_opmode opmode) { +call_t *call_get_opmode(const str *callid, enum call_opmode opmode) { if (opmode == OP_OFFER) return call_get_or_create(callid, false); return call_get(callid); @@ -4072,7 +4072,7 @@ struct call *call_get_opmode(const str *callid, enum call_opmode opmode) { * * Must be called with call->master_lock held in W. */ -struct call_monologue *__monologue_create(struct call *call) { +struct call_monologue *__monologue_create(call_t *call) { struct call_monologue *ret; __C_DBG("creating new monologue"); @@ -4098,7 +4098,7 @@ struct call_monologue *__monologue_create(struct call *call) { * Must be called with call->master_lock held in W. */ void __monologue_tag(struct call_monologue *ml, const str *tag) { - struct call *call = ml->call; + call_t *call = ml->call; __C_DBG("tagging monologue with '"STR_FORMAT"'", STR_FMT(tag)); if (ml->tag.s) @@ -4108,7 +4108,7 @@ void __monologue_tag(struct call_monologue *ml, const str *tag) { } void __monologue_viabranch(struct call_monologue *ml, const str *viabranch) { - struct call *call = ml->call; + call_t *call = ml->call; if (!viabranch || !viabranch->len) return; @@ -4221,7 +4221,7 @@ static void __tags_unassociate_all(struct call_monologue *a) { } void monologue_destroy(struct call_monologue *monologue) { - struct call *call; + call_t *call; call = monologue->call; @@ -4269,7 +4269,7 @@ static void __tags_unassociate(struct call_monologue *a, struct call_monologue * * Returns `true`, if we need to update Redis. */ static bool monologue_delete_iter(struct call_monologue *a, int delete_delay) { - struct call *call = a->call; + call_t *call = a->call; if (!call) return 0; @@ -4311,7 +4311,7 @@ static bool monologue_delete_iter(struct call_monologue *a, int delete_delay) { * * Must be called with call->master_lock held in W. */ -struct call_monologue *call_get_monologue(struct call *call, const str *fromtag) { +struct call_monologue *call_get_monologue(call_t *call, const str *fromtag) { return g_hash_table_lookup(call->tags, fromtag); } @@ -4321,7 +4321,7 @@ struct call_monologue *call_get_monologue(struct call *call, const str *fromtag) * * Must be called with call->master_lock held in W. */ -struct call_monologue *call_get_or_create_monologue(struct call *call, const str *fromtag) { +struct call_monologue *call_get_or_create_monologue(call_t *call, const str *fromtag) { struct call_monologue *ret = call_get_monologue(call, fromtag); if (!ret) { ret = __monologue_create(call); @@ -4348,7 +4348,7 @@ static void __tags_associate(struct call_monologue *a, struct call_monologue *b) /** * Check whether the call object contains some other monologues, which can have own associations. */ -static bool call_monologues_associations_left(struct call * c) { +static bool call_monologues_associations_left(call_t * c) { for (GList * l = c->monologues.head; l; l = l->next) { struct call_monologue * ml = l->data; @@ -4464,7 +4464,7 @@ static bool call_viabranch_intact_monologue(const str * viabranch, struct call_m * * `dialogue` must be initialised to zero. */ -static int call_get_monologue_new(struct call_monologue *monologues[2], struct call *call, +static int call_get_monologue_new(struct call_monologue *monologues[2], call_t *call, const str *fromtag, const str *totag, const str *viabranch) @@ -4568,7 +4568,7 @@ monologues_intact_finalize: * * `dialogue` must be initialised to zero. */ -static int call_get_dialogue(struct call_monologue *monologues[2], struct call *call, +static int call_get_dialogue(struct call_monologue *monologues[2], call_t *call, const str *fromtag, const str *totag, const str *viabranch) @@ -4657,7 +4657,7 @@ done: /* fromtag and totag strictly correspond to the directionality of the message, not to the actual * SIP headers. IOW, the fromtag corresponds to the monologue sending this message, even if the * tag is actually from the TO header of the SIP message (as it would be in a 200 OK) */ -int call_get_mono_dialogue(struct call_monologue *monologues[2], struct call *call, +int call_get_mono_dialogue(struct call_monologue *monologues[2], call_t *call, const str *fromtag, const str *totag, const str *viabranch) @@ -4719,7 +4719,7 @@ static void monologue_stop(struct call_monologue *ml, bool stop_media_subsribers // call must be locked in W. // unlocks the call and releases the reference prior to returning, even on error. -int call_delete_branch(struct call *c, const str *branch, +int call_delete_branch(call_t *c, const str *branch, const str *fromtag, const str *totag, bencode_item_t *output, int delete_delay) { struct call_monologue *ml; @@ -4851,7 +4851,7 @@ out: int call_delete_branch_by_id(const str *callid, const str *branch, const str *fromtag, const str *totag, bencode_item_t *output, int delete_delay) { - struct call *c = call_get(callid); + call_t *c = call_get(callid); if (!c) { ilog(LOG_INFO, "Call-ID to delete not found"); return -1; diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 53a522103..f73399c68 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -162,7 +162,7 @@ fail: return -1; } -static void updated_created_from(struct call *c, const char *addr, const endpoint_t *sin) { +static void updated_created_from(call_t *c, const char *addr, const endpoint_t *sin) { if (!c->created_from && addr) { c->created_from = call_strdup(c, addr); if (sin) @@ -173,7 +173,7 @@ static void updated_created_from(struct call *c, const char *addr, const endpoin static str *call_update_lookup_udp(char **out, enum call_opmode opmode, const char* addr, const endpoint_t *sin) { - struct call *c; + call_t *c; struct call_monologue *monologues[2]; /* subscriber lists of both monologues */ sdp_streams_q q = TYPED_GQUEUE_INIT; struct stream_params sp; @@ -310,13 +310,13 @@ static void streams_parse(const char *s, sdp_streams_q *q) { i = 0; pcre2_multi_match(streams_re, s, 4, streams_parse_func, &i, &q->q); } -void call_unlock_release(struct call **c) { +void call_unlock_release(call_t **c) { if (!*c) return; rwlock_unlock_w(&(*c)->master_lock); obj_put(*c); } -INLINE void call_unlock_release_update(struct call **c) { +INLINE void call_unlock_release_update(call_t **c) { if (!*c) return; rwlock_unlock_w(&(*c)->master_lock); @@ -328,7 +328,7 @@ INLINE void call_unlock_release_update(struct call **c) { static str *call_request_lookup_tcp(char **out, enum call_opmode opmode) { - struct call *c; + call_t *c; struct call_monologue *monologues[2]; g_auto(sdp_streams_q) s = TYPED_GQUEUE_INIT; str *ret = NULL; @@ -398,7 +398,7 @@ str *call_delete_udp(char **out) { return str_sprintf("%s 0\n", out[RE_UDP_COOKIE]); } str *call_query_udp(char **out) { - AUTO_CLEANUP_NULL(struct call *c, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *c, call_unlock_release); str *ret; struct call_stats stats; @@ -437,7 +437,7 @@ void call_delete_tcp(char **out) { call_delete_branch_by_id(&callid, NULL, NULL, NULL, NULL, -1); } -static void call_status_iterator(struct call *c, struct streambuf_stream *s) { +static void call_status_iterator(call_t *c, struct streambuf_stream *s) { // GList *l; // struct callstream *cs; // struct peer *p; @@ -476,10 +476,10 @@ void calls_status_tcp(struct streambuf_stream *s) { static void call_release_ref(void *p) { - struct call *c = p; + call_t *c = p; obj_put(c); } -INLINE void call_bencode_hold_ref(struct call *c, bencode_item_t *bi) { +INLINE void call_bencode_hold_ref(call_t *c, bencode_item_t *bi) { /* We cannot guarantee that the "call" structures are still around at the time * when the bencode reply is finally read and sent out. Since we use scatter/gather * to avoid duplication of strings and stuff, we reserve a reference to the call @@ -1959,7 +1959,7 @@ static const char *call_offer_answer_ng(ng_buffer *ngbuf, bencode_item_t *input, g_auto(str) sdp = STR_NULL; g_auto(sdp_sessions_q) parsed = TYPED_GQUEUE_INIT; g_auto(sdp_streams_q) streams = TYPED_GQUEUE_INIT; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue * monologues[2]; int ret; g_auto(sdp_ng_flags) flags; @@ -2162,7 +2162,7 @@ const char *call_delete_ng(bencode_item_t *input, bencode_item_t *output) { } } - struct call *c = call_get(&callid); + call_t *c = call_get(&callid); if (!c) goto err; @@ -2458,7 +2458,7 @@ static void ng_stats_ssrc(bencode_item_t *dict, struct ssrc_hash *ht) { } /* call must be locked */ -void ng_call_stats(struct call *call, const str *fromtag, const str *totag, bencode_item_t *output, +void ng_call_stats(call_t *call, const str *fromtag, const str *totag, bencode_item_t *output, struct call_stats *totals) { bencode_item_t *tags = NULL, *dict; @@ -2544,7 +2544,7 @@ static void ng_list_calls(bencode_item_t *output, long long int limit) { const char *call_query_ng(bencode_item_t *input, bencode_item_t *output) { str callid, fromtag, totag; - struct call *call; + call_t *call; if (!bencode_dictionary_get_str(input, "call-id", &callid)) return "No call-id in message"; @@ -2580,10 +2580,10 @@ const char *call_list_ng(bencode_item_t *input, bencode_item_t *output) { static const char *call_recording_common_ng(bencode_item_t *input, bencode_item_t *output, - void (*fn)(bencode_item_t *input, struct call *call)) + void (*fn)(bencode_item_t *input, call_t *call)) { str callid, fromtag; - struct call *call; + call_t *call; str metadata; if (!bencode_dictionary_get_str(input, "call-id", &callid)) @@ -2617,7 +2617,7 @@ static const char *call_recording_common_ng(bencode_item_t *input, bencode_item_ } -static void start_recording_fn(bencode_item_t *input, struct call *call) { +static void start_recording_fn(bencode_item_t *input, call_t *call) { str output_dest; bencode_dictionary_get_str(input, "output-destination", &output_dest); CALL_SET(call, RECORDING_ON); @@ -2628,7 +2628,7 @@ const char *call_start_recording_ng(bencode_item_t *input, bencode_item_t *outpu } -static void pause_recording_fn(bencode_item_t *input, struct call *call) { +static void pause_recording_fn(bencode_item_t *input, call_t *call) { CALL_CLEAR(call, RECORDING_ON); recording_pause(call); } @@ -2637,7 +2637,7 @@ const char *call_pause_recording_ng(bencode_item_t *input, bencode_item_t *outpu } -static void stop_recording_fn(bencode_item_t *input, struct call *call) { +static void stop_recording_fn(bencode_item_t *input, call_t *call) { // support alternative usage for "pause" call: either `pause=yes` ... str pause; if (bencode_dictionary_get_str(input, "pause", &pause)) { @@ -2669,7 +2669,7 @@ const char *call_stop_recording_ng(bencode_item_t *input, bencode_item_t *output } -static const char *media_block_match1(struct call *call, struct call_monologue **monologue, +static const char *media_block_match1(call_t *call, struct call_monologue **monologue, sdp_ng_flags *flags) { if (flags->label.s) { @@ -2711,7 +2711,7 @@ found: __monologue_unconfirm(*monologue, "media blocking signalling event"); return NULL; } -static const char *media_block_match(struct call **call, struct call_monologue **monologue, +static const char *media_block_match(call_t **call, struct call_monologue **monologue, sdp_ng_flags *flags, bencode_item_t *input, enum call_opmode opmode) { *call = NULL; @@ -2747,7 +2747,7 @@ void add_media_to_sub_list(GQueue *q, struct call_media *media, struct call_mono ms->monologue = ml; g_queue_push_tail(q, ms); } -static const char *media_block_match_mult(struct call **call, GQueue *medias, +static const char *media_block_match_mult(call_t **call, GQueue *medias, sdp_ng_flags *flags, bencode_item_t *input, enum call_opmode opmode) { call_ng_process_flags(flags, input, opmode); @@ -2813,7 +2813,7 @@ static const char *media_block_match_mult(struct call **call, GQueue *medias, // XXX these are all identical - unify and use a flags int and/or callback const char *call_start_forwarding_ng(bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; g_auto(sdp_ng_flags) flags; @@ -2842,7 +2842,7 @@ const char *call_start_forwarding_ng(bencode_item_t *input, bencode_item_t *outp } const char *call_stop_forwarding_ng(bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; g_auto(sdp_ng_flags) flags; @@ -2921,7 +2921,7 @@ static void call_monologue_set_block_mode(struct call_monologue *ml, sdp_ng_flag codec_update_all_handlers(ml); } const char *call_block_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; g_auto(sdp_ng_flags) flags; @@ -2962,7 +2962,7 @@ const char *call_block_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { } const char *call_unblock_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; g_auto(sdp_ng_flags) flags; @@ -3024,7 +3024,7 @@ static const char *call_block_silence_media(bencode_item_t *input, bool on_off, const char *lcase_verb, unsigned int call_flag, unsigned int ml_flag, size_t attr_offset) { - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; g_auto(sdp_ng_flags) flags; @@ -3176,7 +3176,7 @@ const char *call_unsilence_media_ng(bencode_item_t *input, bencode_item_t *outpu #ifdef WITH_TRANSCODING -static const char *play_media_select_party(struct call **call, GQueue *monologues, +static const char *play_media_select_party(call_t **call, GQueue *monologues, bencode_item_t *input, sdp_ng_flags *flags) { struct call_monologue *monologue; @@ -3199,7 +3199,7 @@ static const char *play_media_select_party(struct call **call, GQueue *monologue const char *call_play_media_ng(bencode_item_t *input, bencode_item_t *output) { #ifdef WITH_TRANSCODING - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); g_auto(GQueue) monologues; const char *err = NULL; g_auto(sdp_ng_flags) flags; @@ -3254,7 +3254,7 @@ const char *call_play_media_ng(bencode_item_t *input, bencode_item_t *output) { const char *call_stop_media_ng(bencode_item_t *input, bencode_item_t *output) { #ifdef WITH_TRANSCODING - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); g_auto(GQueue) monologues; const char *err = NULL; long long last_frame_pos = 0; @@ -3287,7 +3287,7 @@ const char *call_stop_media_ng(bencode_item_t *input, bencode_item_t *output) { const char *call_play_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { #ifdef WITH_TRANSCODING - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); g_auto(GQueue) monologues; const char *err = NULL; g_auto(sdp_ng_flags) flags; @@ -3396,7 +3396,7 @@ const char *call_publish_ng(ng_buffer *ngbuf, bencode_item_t *input, bencode_ite g_auto(sdp_streams_q) streams = TYPED_GQUEUE_INIT; g_auto(str) sdp_in = STR_NULL; g_auto(str) sdp_out = STR_NULL; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); call_ng_process_flags(&flags, input, OP_PUBLISH); @@ -3449,7 +3449,7 @@ const char *call_subscribe_request_ng(bencode_item_t *input, bencode_item_t *out const char *err = NULL; g_auto(sdp_ng_flags) flags; char rand_buf[65]; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); AUTO_CLEANUP(GQueue srms, media_subscriptions_clear) = G_QUEUE_INIT; g_auto(str) sdp_out = STR_NULL; @@ -3583,7 +3583,7 @@ const char *call_subscribe_answer_ng(ng_buffer *ngbuf, bencode_item_t *input, be g_auto(sdp_ng_flags) flags; g_auto(sdp_sessions_q) parsed = TYPED_GQUEUE_INIT; g_auto(sdp_streams_q) streams = TYPED_GQUEUE_INIT; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); call_ng_process_flags(&flags, input, OP_REQ_ANSWER); @@ -3623,7 +3623,7 @@ const char *call_subscribe_answer_ng(ng_buffer *ngbuf, bencode_item_t *input, be const char *call_unsubscribe_ng(bencode_item_t *input, bencode_item_t *output) { g_auto(sdp_ng_flags) flags; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); call_ng_process_flags(&flags, input, OP_REQ_ANSWER); diff --git a/daemon/cdr.c b/daemon/cdr.c index 564dd4ce0..a67cb8e77 100644 --- a/daemon/cdr.c +++ b/daemon/cdr.c @@ -35,7 +35,7 @@ static const char * get_term_reason_text(enum termination_reason t) { return get_enum_array_text(__term_reason_texts, t, "UNKNOWN"); } -void cdr_update_entry(struct call* c) { +void cdr_update_entry(call_t * c) { GList *l; struct call_monologue *ml; struct timeval tim_result_duration; diff --git a/daemon/cli.c b/daemon/cli.c index 42c3157a2..3b2cbb09a 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -197,7 +197,7 @@ static const cli_handler_t cli_params_handlers[] = { }; -static void cli_list_call_info(struct cli_writer *cw, struct call *c); +static void cli_list_call_info(struct cli_writer *cw, call_t *c); static void cli_list_tag_info(struct cli_writer *cw, struct call_monologue *ml); @@ -249,7 +249,7 @@ next:; ITERATE_CALL_LIST_NEXT_END(c); // destroy calls - struct call *c = NULL; + call_t *c = NULL; while ((c = g_queue_pop_head(&call_list))) { if (!c->ml_deleted) { for (i = c->monologues.head; i; i = i->next) { @@ -583,7 +583,7 @@ static void cli_incoming_list_offertimeout(str *instr, struct cli_writer *cw) { } static void cli_incoming_list_callid(str *instr, struct cli_writer *cw) { - struct call *c = 0; + call_t *c = 0; if (instr->len == 0) { cw->cw_printf(cw, "%s\n", "More parameters required."); @@ -604,7 +604,7 @@ static void cli_incoming_list_callid(str *instr, struct cli_writer *cw) { } -static void cli_list_call_info(struct cli_writer *cw, struct call *c) { +static void cli_list_call_info(struct cli_writer *cw, call_t *c) { struct call_monologue *ml; GList *l; @@ -994,7 +994,7 @@ static void cli_incoming_params(str *instr, struct cli_writer *cw) { } static void cli_incoming_terminate(str *instr, struct cli_writer *cw) { - struct call* c=0; + call_t * c=0; struct call_monologue *ml; GList *i; @@ -1195,7 +1195,7 @@ static void cli_incoming_debug(str *instr, struct cli_writer *cw) { } } - struct call *c = call_get(&callid); + call_t *c = call_get(&callid); if (!c) { cw->cw_printf(cw, "Call ID '" STR_FORMAT "' not found\n", STR_FMT(&callid)); diff --git a/daemon/codec.c b/daemon/codec.c index 1b0a23b9e..4253013da 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -33,13 +33,13 @@ struct codec_timer { struct mqtt_timer { struct codec_timer ct; struct mqtt_timer **self; - struct call *call; + call_t *call; struct call_media *media; }; struct timer_callback { struct codec_timer ct; - void (*timer_callback_func)(struct call *, void *); - struct call *call; + void (*timer_callback_func)(call_t *, void *); + call_t *call; void *ptr; }; @@ -118,7 +118,7 @@ struct dtx_buffer { int ptime; // ms per packet int tspp; // timestamp increment per packet unsigned int clockrate; - struct call *call; + call_t *call; dtx_packet_q packets; struct media_packet last_mp; unsigned long head_ts; @@ -148,7 +148,7 @@ TYPED_GQUEUE(delay_frame, struct delay_frame) struct delay_buffer { struct codec_timer ct; - struct call *call; + call_t *call; struct codec_handler *handler; mutex_t lock; unsigned int delay; @@ -233,7 +233,7 @@ struct codec_tracker { struct rtcp_timer { struct codec_timer ct; - struct call *call; + call_t *call; struct call_media *media; }; @@ -275,7 +275,7 @@ static struct codec_handler *__input_handler(struct codec_handler *h, struct med static void __delay_frame_process(struct delay_buffer *, struct delay_frame *dframe); static void __dtx_restart(struct codec_handler *h); static void __delay_buffer_setup(struct delay_buffer **dbufp, - struct codec_handler *h, struct call *call, unsigned int delay); + struct codec_handler *h, call_t *call, unsigned int delay); static void __delay_buffer_shutdown(struct delay_buffer *dbuf, bool); static void delay_buffer_stop(struct delay_buffer **pcmbp); static int __buffer_delay_packet(struct delay_buffer *dbuf, @@ -1542,7 +1542,7 @@ static void __mqtt_timer_free(void *p) { } static void __codec_mqtt_timer_schedule(struct mqtt_timer *mqt); INLINE bool __mqtt_timer_common_call(struct mqtt_timer *mqt) { - struct call *call = mqt->call; + call_t *call = mqt->call; rwlock_lock_w(&call->master_lock); @@ -1592,7 +1592,7 @@ static void __codec_mqtt_timer_schedule(struct mqtt_timer *mqt) { timerthread_obj_schedule_abs(&mqt->ct.tt_obj, &mqt->ct.next); } // master lock held in W -void mqtt_timer_start(struct mqtt_timer **mqtp, struct call *call, struct call_media *media) { +void mqtt_timer_start(struct mqtt_timer **mqtp, call_t *call, struct call_media *media) { if (*mqtp) // already scheduled return; @@ -3134,7 +3134,7 @@ static void __delay_frame_process(struct delay_buffer *dbuf, struct delay_frame static void __delay_send_later(struct codec_timer *ct) { struct delay_buffer *dbuf = (void *) ct; - struct call *call = NULL; + call_t *call = NULL; struct delay_frame *dframe = NULL; { @@ -3289,7 +3289,7 @@ static void __dtx_send_later(struct codec_timer *ct) { // vars assigned in the loop struct dtx_packet *dtxp; - struct call *call; + call_t *call; struct codec_ssrc_handler *ch; struct packet_stream *ps; struct codec_ssrc_handler *input_ch; @@ -3612,7 +3612,7 @@ static void __dtx_restart(struct codec_handler *h) { ssrc_hash_foreach(h->ssrc_hash, __dtx_buffer_restart, NULL); } static void __delay_buffer_setup(struct delay_buffer **dbufp, - struct codec_handler *h, struct call *call, unsigned int delay) + struct codec_handler *h, call_t *call, unsigned int delay) { if (!dbufp) return; @@ -4584,7 +4584,7 @@ static void __insert_codec_tracker(GHashTable *all_clockrates, GHashTable *all_s } } #endif -static int __codec_options_set1(struct call *call, struct rtp_payload_type *pt, const str *enc, +static int __codec_options_set1(call_t *call, struct rtp_payload_type *pt, const str *enc, str_case_value_ht codec_set) { str *pt_str = t_hash_table_lookup(codec_set, enc); @@ -4609,7 +4609,7 @@ static int __codec_options_set1(struct call *call, struct rtp_payload_type *pt, payload_type_free(pt_parsed); return 1; } -static void __codec_options_set(struct call *call, struct rtp_payload_type *pt, str_case_value_ht codec_set) { +static void __codec_options_set(call_t *call, struct rtp_payload_type *pt, str_case_value_ht codec_set) { if (!call) return; if (!t_hash_table_is_set(codec_set)) @@ -4978,7 +4978,7 @@ static struct rtp_payload_type *codec_store_find_compatible(struct codec_store * void __codec_store_populate_reuse(struct codec_store *dst, struct codec_store *src, struct codec_store_args a) { // start fresh struct call_media *media = dst->media; - struct call *call = media ? media->call : NULL; + call_t *call = media ? media->call : NULL; for (__auto_type l = src->codec_prefs.head; l; l = l->next) { struct rtp_payload_type *pt = l->data; @@ -5059,7 +5059,7 @@ void __codec_store_populate(struct codec_store *dst, struct codec_store *src, st codec_store_move(&orig_dst, dst); struct call_media *media = dst->media; - struct call *call = media ? media->call : NULL; + call_t *call = media ? media->call : NULL; for (__auto_type l = src->codec_prefs.head; l; l = l->next) { struct rtp_payload_type *pt = l->data; @@ -5649,7 +5649,7 @@ static void __codec_timer_callback_fire(struct codec_timer *ct) { codec_timer_stop(&ct); log_info_pop(); } -void codec_timer_callback(struct call *c, void (*func)(struct call *, void *), void *p, uint64_t delay) { +void codec_timer_callback(call_t *c, void (*func)(call_t *, void *), void *p, uint64_t delay) { struct timer_callback *cb = obj_alloc0("codec_timer_callback", sizeof(*cb), __codec_timer_callback_free); cb->ct.tt_obj.tt = &codec_timers_thread; cb->call = obj_get(c); diff --git a/daemon/dtmf.c b/daemon/dtmf.c index 3a2643624..a9fd24e16 100644 --- a/daemon/dtmf.c +++ b/daemon/dtmf.c @@ -39,7 +39,7 @@ char dtmf_code_to_char(int code) { static void dtmf_bencode_and_notify(struct call_media *media, unsigned int event, unsigned int volume, unsigned int duration, const endpoint_t *fsin, int clockrate) { - struct call *call = media->call; + call_t *call = media->call; struct call_monologue *ml = media->monologue; bencode_buffer_t bencbuf; @@ -82,7 +82,7 @@ static GString *dtmf_json_print(struct call_media *media, unsigned int event, un unsigned int duration, const endpoint_t *fsin, int clockrate) { - struct call *call = media->call; + call_t *call = media->call; struct call_monologue *ml = media->monologue; GString *buf = g_string_new(""); @@ -123,7 +123,7 @@ static GString *dtmf_json_print(struct call_media *media, unsigned int event, un return buf; } -bool dtmf_do_logging(const struct call *c, bool injected) { +bool dtmf_do_logging(const call_t *c, bool injected) { if (injected && rtpe_config.dtmf_no_log_injects) return false; if (_log_facility_dtmf) @@ -178,7 +178,7 @@ static void dtmf_end_event(struct call_media *media, unsigned int event, unsigne g_string_free(buf, TRUE); } -static void dtmf_trigger_set(struct call *c, void *mlp) { +static void dtmf_trigger_set(call_t *c, void *mlp) { struct call_monologue *ml = mlp; rwlock_lock_w(&c->master_lock); @@ -198,7 +198,7 @@ static void dtmf_trigger_set(struct call *c, void *mlp) { rwlock_unlock_w(&c->master_lock); } -static void dtmf_trigger_unset(struct call *c, void *mlp) { +static void dtmf_trigger_unset(call_t *c, void *mlp) { struct call_monologue *ml = mlp; ilog(LOG_INFO, "Setting DTMF block mode to %i", ml->block_dtmf_trigger_end); @@ -508,7 +508,7 @@ static const char *dtmf_inject_pcm(struct call_media *media, struct call_media * struct codec_ssrc_handler *csh, int code, int volume, int duration, int pause) { - struct call *call = monologue->call; + call_t *call = monologue->call; for (__auto_type l = ps->rtp_sinks.head; l; l = l->next) { struct sink_handler *sh = l->data; @@ -671,7 +671,7 @@ const char *dtmf_inject(struct call_media *media, int code, int volume, int dura #endif -enum block_dtmf_mode dtmf_get_block_mode(struct call *call, struct call_monologue *ml) { +enum block_dtmf_mode dtmf_get_block_mode(call_t *call, struct call_monologue *ml) { if (!call) { if (!ml) return BLOCK_DTMF_OFF; diff --git a/daemon/ice.c b/daemon/ice.c index 6f28f36a8..2d1fbde3c 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -53,7 +53,7 @@ struct sdp_fragment { static void __ice_agent_free(void *p); -static void create_random_ice_string(struct call *call, str *s, int len); +static void create_random_ice_string(call_t *call, str *s, int len); static void __do_ice_checks(struct ice_agent *ag); static struct ice_candidate_pair *__pair_lookup(struct ice_agent *, struct ice_candidate *cand, const struct local_intf *ifa); @@ -182,7 +182,7 @@ static void queue_sdp_fragment(ng_buffer *ngbuf, sdp_streams_q *streams, sdp_ng_ t_queue_push_tail(frags, frag); mutex_unlock(&sdp_fragments_lock); } -bool trickle_ice_update(ng_buffer *ngbuf, struct call *call, sdp_ng_flags *flags, +bool trickle_ice_update(ng_buffer *ngbuf, call_t *call, sdp_ng_flags *flags, sdp_streams_q *streams) { if (!flags->fragment) @@ -416,7 +416,7 @@ TYPED_GHASHTABLE_IMPL(transaction_ht, __trans_hash, __trans_equal, NULL, NULL) static void __ice_agent_initialize(struct ice_agent *ag) { struct call_media *media = ag->media; - struct call *call = ag->call; + call_t *call = ag->call; ag->candidate_hash = candidate_ht_new(); ag->cand_prio_hash = priority_ht_new(); @@ -441,7 +441,7 @@ static void __ice_agent_initialize(struct ice_agent *ag) { static struct ice_agent *__ice_agent_new(struct call_media *media) { struct ice_agent *ag; - struct call *call = media->call; + call_t *call = media->call; ag = obj_alloc0("ice_agent", sizeof(*ag), __ice_agent_free); ag->tt_obj.tt = &ice_agents_timer_thread; @@ -464,7 +464,7 @@ void ice_agent_init(struct ice_agent **agp, struct call_media *media) { *agp = ag = __ice_agent_new(media); } -static int __copy_cand(struct call *call, struct ice_candidate *dst, const struct ice_candidate *src) { +static int __copy_cand(call_t *call, struct ice_candidate *dst, const struct ice_candidate *src) { int eq = (dst->priority == src->priority); *dst = *src; call_str_cpy(call, &dst->foundation, &src->foundation); @@ -505,7 +505,7 @@ void ice_restart(struct ice_agent *ag) { void ice_update(struct ice_agent *ag, struct stream_params *sp, bool allow_reset) { struct ice_candidate *cand, *dup; struct call_media *media; - struct call *call; + call_t *call; int recalc = 0; unsigned int comps; struct packet_stream *components[MAX_COMPONENTS], *ps; @@ -1034,7 +1034,7 @@ static struct ice_candidate_pair *__pair_lookup(struct ice_agent *ag, struct ice return t_hash_table_lookup(ag->pair_hash, &p); } -static void __cand_ice_foundation(struct call *call, struct ice_candidate *cand) { +static void __cand_ice_foundation(call_t *call, struct ice_candidate *cand) { char buf[64]; int len; @@ -1049,7 +1049,7 @@ static struct ice_candidate_pair *__learned_candidate(struct ice_agent *ag, stru { struct ice_candidate *cand, *old_cand; struct ice_candidate_pair *pair; - struct call *call = ag->call; + call_t *call = ag->call; struct packet_stream *ps = sfd->stream; cand = g_slice_alloc0(sizeof(*cand)); @@ -1540,7 +1540,7 @@ void ice_thread_run(void *p) { } static void ice_agents_timer_run(void *ptr) { struct ice_agent *ag = ptr; - struct call *call; + call_t *call; call = ag->call; log_info_ice_agent(ag); @@ -1559,7 +1559,7 @@ static void random_ice_string(char *buf, int len) { *buf++ = ice_chars[ssl_random() % strlen(ice_chars)]; } -static void create_random_ice_string(struct call *call, str *s, int len) { +static void create_random_ice_string(call_t *call, str *s, int len) { char buf[30]; assert(len < sizeof(buf)); diff --git a/daemon/janus.c b/daemon/janus.c index 0a874282b..480a3d12e 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -113,8 +113,8 @@ static uint64_t jr_str_int(JsonReader *r) { } -static struct call_monologue *janus_get_monologue(uint64_t handle_id, struct call *call, - struct call_monologue *(*fn)(struct call *, const str *)) +static struct call_monologue *janus_get_monologue(uint64_t handle_id, call_t *call, + struct call_monologue *(*fn)(call_t *, const str *)) { g_autoptr(char) handle_buf = NULL; handle_buf = g_strdup_printf("%" PRIu64, handle_id); @@ -226,7 +226,7 @@ static const char *janus_videoroom_create(struct janus_session *session, struct continue; room->call_id.s = janus_call_id(room_id); room->call_id.len = strlen(room->call_id.s); - struct call *call = call_get_or_create(&room->call_id, true); + call_t *call = call_get_or_create(&room->call_id, true); if (!call) { ilog(LOG_WARN, "Call with reserved Janus ID '" STR_FORMAT "' already exists", STR_FMT(&room->call_id)); @@ -267,7 +267,7 @@ static const char *janus_videoroom_exists(struct janus_session *session, if (room_id) room = t_hash_table_lookup(janus_rooms, &room_id); if (room) { - struct call *call = call_get(&room->call_id); + call_t *call = call_get(&room->call_id); if (call) { exists = true; rwlock_unlock_w(&call->master_lock); @@ -300,7 +300,7 @@ static const char *janus_videoroom_destroy(struct janus_session *session, ilog(LOG_INFO, "Destroying videoroom with ID %" PRIu64, room_id); - struct call *call = call_get(&room->call_id); + call_t *call = call_get(&room->call_id); // XXX if call is destroyed separately, room persist -> room should be destroyed too if (call) { rwlock_unlock_w(&call->master_lock); @@ -393,7 +393,7 @@ static void janus_add_publisher_details(JsonBuilder *builder, struct call_monolo } -static void janus_publishers_list(JsonBuilder *builder, struct call *call, struct janus_room *room, +static void janus_publishers_list(JsonBuilder *builder, call_t *call, struct janus_room *room, uint64_t feed_id) { json_builder_begin_array(builder); // [ @@ -426,7 +426,7 @@ static void janus_publishers_list(JsonBuilder *builder, struct call *call, struc // global janus_lock is held static const char *janus_videoroom_join_sub(struct janus_handle *handle, struct janus_room *room, int *retcode, - uint64_t feed_id, struct call *call, GQueue *medias) + uint64_t feed_id, call_t *call, GQueue *medias) { // does the feed actually exist? get the feed handle *retcode = 512; @@ -514,7 +514,7 @@ static const char *janus_videoroom_join(struct websocket_message *wm, struct jan if (!room) return "No such room"; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); *retcode = 426; call = call_get(&room->call_id); if (!call) @@ -837,7 +837,7 @@ static const char *janus_videoroom_configure(struct websocket_message *wm, struc if (handle->room != room_id) return "Not in the room"; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct janus_room *room = t_hash_table_lookup(janus_rooms, &room_id); *retcode = 426; @@ -973,7 +973,7 @@ static const char *janus_videoroom_start(struct websocket_message *wm, struct ja if (sdp_streams(&parsed, &streams, &flags)) return "Incomplete SDP specification"; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); struct janus_room *room = t_hash_table_lookup(janus_rooms, &room_id); *retcode = 426; @@ -1039,7 +1039,7 @@ static const char *janus_videoroom_unpublish(struct websocket_message *wm, struc if (!room) return "No such room"; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); call = call_get(&room->call_id); if (!call) return "No such room"; @@ -1368,7 +1368,7 @@ static void janus_destroy_handle(struct janus_handle *handle) { janus_notify_publishers(room_id, handle_id, NULL, *feed, janus_notify_publishers_unpublished); janus_notify_publishers(room_id, handle_id, NULL, *feed, janus_notify_publishers_leaving); - struct call *call = call_get(&room->call_id); + call_t *call = call_get(&room->call_id); if (call) { // remove publisher monologue struct call_monologue *ml = janus_get_monologue(handle_id, call, call_get_monologue); @@ -1385,7 +1385,7 @@ static void janus_destroy_handle(struct janus_handle *handle) { if (t_hash_table_remove(room->subscribers, &handle_id)) { // was a subscriber - struct call *call = call_get(&room->call_id); + call_t *call = call_get(&room->call_id); if (call) { // remove subscriber monologue struct call_monologue *ml = janus_get_monologue(handle_id, call, call_get_monologue); @@ -1606,7 +1606,7 @@ static const char *janus_trickle(JsonReader *reader, struct janus_session *sessi // fetch call g_autoptr(char) call_id = NULL; - AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); + AUTO_CLEANUP_NULL(call_t *call, call_unlock_release); { LOCK(&janus_lock); diff --git a/daemon/jitter_buffer.c b/daemon/jitter_buffer.c index 0ebf082a2..c025789c0 100644 --- a/daemon/jitter_buffer.c +++ b/daemon/jitter_buffer.c @@ -225,7 +225,7 @@ int buffer_packet(struct media_packet *mp, const str *s) { int ret = 1; // must call stream_packet mp->call = mp->sfd->call; - struct call *call = mp->call; + call_t *call = mp->call; rwlock_lock_r(&call->master_lock); @@ -415,7 +415,7 @@ void jitter_buffer_loop(void *p) { timerthread_run(&jitter_buffer_thread); } -struct jitter_buffer *jitter_buffer_new(struct call *c) { +struct jitter_buffer *jitter_buffer_new(call_t *c) { ilog(LOG_DEBUG, "creating jitter_buffer"); struct jitter_buffer *jb = timerthread_queue_new("jitter_buffer", sizeof(*jb), diff --git a/daemon/log.c b/daemon/log.c index d6dd458e0..c896220a4 100644 --- a/daemon/log.c +++ b/daemon/log.c @@ -166,7 +166,7 @@ void rtcplog(const char* cdrbuffer) { } int get_local_log_level(unsigned int subsystem_idx) { - struct call *call = NULL; + call_t *call = NULL; switch (log_info.e) { case LOG_INFO_CALL: diff --git a/daemon/log.h b/daemon/log.h index b0e0fa849..0ab830f48 100644 --- a/daemon/log.h +++ b/daemon/log.h @@ -4,17 +4,17 @@ #include "str.h" #include "loglib.h" +#include "types.h" -struct call; struct stream_fd; struct ice_agent; enum log_format; struct log_info { union { - struct call *call; + call_t *call; struct stream_fd *stream_fd; const str *str; const char *cstr; diff --git a/daemon/log_funcs.h b/daemon/log_funcs.h index 1b858b817..20874fccd 100644 --- a/daemon/log_funcs.h +++ b/daemon/log_funcs.h @@ -71,7 +71,7 @@ INLINE void log_info_reset(void) { } } -INLINE void log_info_call(struct call *c) { +INLINE void log_info_call(call_t *c) { if (!c) return; __log_info_push(); diff --git a/daemon/media_player.c b/daemon/media_player.c index 206941571..e2cd781a4 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -309,7 +309,7 @@ out: } static void send_timer_send_lock(struct send_timer *st, struct codec_packet *cp) { - struct call *call = st->call; + call_t *call = st->call; if (!call) return; @@ -326,7 +326,7 @@ static void send_timer_send_lock(struct send_timer *st, struct codec_packet *cp) } // st->stream->out_lock (or call->master_lock/W) must be held already static void send_timer_send_nolock(struct send_timer *st, struct codec_packet *cp) { - struct call *call = st->call; + call_t *call = st->call; if (!call) return; @@ -1197,7 +1197,7 @@ err: static void media_player_run(void *ptr) { struct media_player *mp = ptr; - struct call *call = mp->call; + call_t *call = mp->call; log_info_media(mp->media); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 312bbc43c..dd7945c7d 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1282,7 +1282,7 @@ void free_release_sfd_intf_list(struct sfd_intf_list *il) { /* called lock-free */ static void stream_fd_closed(int fd, void *p, uintptr_t u) { struct stream_fd *sfd = p; - struct call *c; + call_t *c; int i; socklen_t j; @@ -1412,7 +1412,7 @@ static const char *kernelize_one(struct rtpengine_target_info *reti, GQueue *out GList **payload_types) { struct rtpengine_destination_info *redi = NULL; - struct call *call = stream->call; + call_t *call = stream->call; struct call_media *media = stream->media; struct packet_stream *sink = sink_handler ? sink_handler->sink : NULL; bool non_forwarding = false; @@ -1643,7 +1643,7 @@ static void kernelize_one_sink_handler(struct rtpengine_target_info *reti, GQueu } /* called with in_lock held */ void kernelize(struct packet_stream *stream) { - struct call *call = stream->call; + call_t *call = stream->call; const char *nk_warn_msg; struct call_media *media = stream->media; @@ -3109,7 +3109,7 @@ static void stream_fd_readable(int fd, void *p, uintptr_t u) { char buf[RTP_BUFFER_SIZE]; int ret, iters; bool update = false; - struct call *ca; + call_t *ca; if (sfd->socket.fd != fd) return; @@ -3230,7 +3230,7 @@ static void stream_fd_free(void *p) { obj_put(f->call); } -struct stream_fd *stream_fd_new(socket_t *fd, struct call *call, struct local_intf *lif) { +struct stream_fd *stream_fd_new(socket_t *fd, call_t *call, struct local_intf *lif) { struct stream_fd *sfd; struct poller_item pi; struct poller *p = rtpe_poller; diff --git a/daemon/mqtt.c b/daemon/mqtt.c index f8d158afa..3f2a43178 100644 --- a/daemon/mqtt.c +++ b/daemon/mqtt.c @@ -152,7 +152,7 @@ void mqtt_publish(char *s) { } -static void mqtt_call_stats(struct call *call, JsonBuilder *json) { +static void mqtt_call_stats(call_t *call, JsonBuilder *json) { json_builder_set_member_name(json, "call_id"); json_builder_add_string_value(json, call->callid.s); } @@ -426,7 +426,7 @@ static void mqtt_media_stats(struct call_media *media, JsonBuilder *json) { } -static void mqtt_full_call(struct call *call, JsonBuilder *json) { +static void mqtt_full_call(call_t *call, JsonBuilder *json) { rwlock_lock_r(&call->master_lock); log_info_call(call); @@ -525,7 +525,7 @@ INLINE void __mqtt_timer_outro(JsonBuilder *json) { json_builder_end_object(json); mqtt_publish(glib_json_print(json)); } -void mqtt_timer_run_media(struct call *call, struct call_media *media) { +void mqtt_timer_run_media(call_t *call, struct call_media *media) { JsonBuilder *json = __mqtt_timer_intro(); rwlock_lock_r(&call->master_lock); @@ -540,7 +540,7 @@ void mqtt_timer_run_media(struct call *call, struct call_media *media) { __mqtt_timer_outro(json); } -void mqtt_timer_run_call(struct call *call) { +void mqtt_timer_run_call(call_t *call) { JsonBuilder *json = __mqtt_timer_intro(); mqtt_full_call(call, json); diff --git a/daemon/recording.c b/daemon/recording.c index 473f5659f..dbb18c8fe 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -42,27 +42,27 @@ static int append_meta_chunk(struct recording *recording, const char *buf, unsig // all methods static int create_spool_dir_all(const char *spoolpath); -static void init_all(struct call *call); +static void init_all(call_t *call); static void sdp_after_all(struct recording *recording, GString *str, struct call_monologue *ml, enum call_opmode opmode); static void dump_packet_all(struct media_packet *mp, const str *s); -static void finish_all(struct call *call, bool discard); +static void finish_all(call_t *call, bool discard); // pcap methods static int rec_pcap_create_spool_dir(const char *dirpath); -static void rec_pcap_init(struct call *); +static void rec_pcap_init(call_t *); static void sdp_after_pcap(struct recording *, GString *str, struct call_monologue *, enum call_opmode opmode); static void dump_packet_pcap(struct media_packet *mp, const str *s); -static void finish_pcap(struct call *, bool discard); +static void finish_pcap(call_t *, bool discard); static void response_pcap(struct recording *, bencode_item_t *); // proc methods -static void proc_init(struct call *); +static void proc_init(call_t *); static void sdp_before_proc(struct recording *, const str *, struct call_monologue *, enum call_opmode); static void sdp_after_proc(struct recording *, GString *str, struct call_monologue *, enum call_opmode opmode); static void meta_chunk_proc(struct recording *, const char *, const str *); -static void update_flags_proc(struct call *call, bool streams); -static void finish_proc(struct call *, bool discard); +static void update_flags_proc(call_t *call, bool streams); +static void finish_proc(call_t *, bool discard); static void dump_packet_proc(struct media_packet *mp, const str *s); static void init_stream_proc(struct packet_stream *); static void setup_stream_proc(struct packet_stream *); @@ -268,7 +268,7 @@ static int rec_pcap_create_spool_dir(const char *spoolpath) { } // lock must be held -void update_metadata_call(struct call *call, str *metadata) { +void update_metadata_call(call_t *call, str *metadata) { if (!metadata || !metadata->s || !call) return; @@ -284,7 +284,7 @@ void update_metadata_monologue(struct call_monologue *ml, str *metadata) { if (!metadata || !metadata->s || !ml) return; - struct call *call = ml->call; + call_t *call = ml->call; if (str_cmp_str(metadata, &ml->metadata)) { call_str_cpy(call, &ml->metadata, metadata); @@ -295,14 +295,14 @@ void update_metadata_monologue(struct call_monologue *ml, str *metadata) { update_metadata_call(call, metadata); } -static void update_output_dest(struct call *call, const str *output_dest) { +static void update_output_dest(call_t *call, const str *output_dest) { if (!output_dest || !output_dest->s || !call->recording) return; recording_meta_chunk(call->recording, "OUTPUT_DESTINATION", output_dest); } // lock must be held -static void update_flags_proc(struct call *call, bool streams) { +static void update_flags_proc(call_t *call, bool streams) { append_meta_chunk_null(call->recording, "RECORDING %u", CALL_ISSET(call, RECORDING_ON)); append_meta_chunk_null(call->recording, "FORWARDING %u", CALL_ISSET(call, REC_FORWARDING)); if (!streams) @@ -313,12 +313,12 @@ static void update_flags_proc(struct call *call, bool streams) { ps->unique_id, ML_ISSET(ps->media->monologue, REC_FORWARDING) ? 1 : 0); } } -static void recording_update_flags(struct call *call, bool streams) { +static void recording_update_flags(call_t *call, bool streams) { _rm(update_flags, call, streams); } // lock must be held -void recording_start(struct call *call, const char *prefix, const str *output_dest) { +void recording_start(call_t *call, const char *prefix, const str *output_dest) { if (call->recording) { // already active update_output_dest(call, output_dest); @@ -373,7 +373,7 @@ void recording_start(struct call *call, const char *prefix, const str *output_de recording_update_flags(call, true); } -void recording_stop(struct call *call) { +void recording_stop(call_t *call) { if (!call->recording) return; @@ -394,11 +394,11 @@ void recording_stop(struct call *call) { ilog(LOG_NOTICE, "Turning off call recording."); recording_finish(call, false); } -void recording_pause(struct call *call) { +void recording_pause(call_t *call) { ilog(LOG_NOTICE, "Pausing call recording."); recording_update_flags(call, true); } -void recording_discard(struct call *call) { +void recording_discard(call_t *call) { CALL_CLEAR(call, RECORDING_ON); if (!call->recording) return; @@ -409,7 +409,7 @@ void recording_discard(struct call *call) { /** * - * Controls the setting of recording variables on a `struct call *`. + * Controls the setting of recording variables on a `call_t *`. * Sets the `record_call` value on the `struct call`, initializing the * recording struct if necessary. * If we do not yet have a PCAP file associated with the call, create it @@ -417,7 +417,7 @@ void recording_discard(struct call *call) { * * Returns a boolean for whether or not the call is being recorded. */ -void detect_setup_recording(struct call *call, const sdp_ng_flags *flags) { +void detect_setup_recording(call_t *call, const sdp_ng_flags *flags) { if (!flags) return; @@ -439,7 +439,7 @@ void detect_setup_recording(struct call *call, const sdp_ng_flags *flags) { ilog(LOG_INFO, "\"record-call\" flag "STR_FORMAT" is invalid flag.", STR_FMT(recordcall)); } -static void rec_pcap_init(struct call *call) { +static void rec_pcap_init(call_t *call) { struct recording *recording = call->recording; // Wireshark starts at packet index 1, so we start there, too @@ -515,7 +515,7 @@ static void sdp_after_pcap(struct recording *recording, GString *s, struct call_ /** * Writes metadata to metafile, closes file, and renames it to finished location. */ -static void rec_pcap_meta_finish_file(struct call *call) { +static void rec_pcap_meta_finish_file(call_t *call) { // This should usually be called from a place that has the call->master_lock struct recording *recording = call->recording; @@ -588,7 +588,7 @@ static void rec_pcap_meta_finish_file(struct call *call) { /** * Closes and discards all output files. */ -static void rec_pcap_meta_discard_file(struct call *call) { +static void rec_pcap_meta_discard_file(call_t *call) { struct recording *recording = call->recording; if (recording == NULL || recording->pcap.meta_fp == NULL) @@ -702,7 +702,7 @@ static void dump_packet_pcap(struct media_packet *mp, const str *s) { mutex_unlock(&recording->pcap.recording_lock); } -static void finish_pcap(struct call *call, bool discard) { +static void finish_pcap(call_t *call, bool discard) { rec_pcap_recording_finish_file(call->recording); if (!discard) rec_pcap_meta_finish_file(call); @@ -724,7 +724,7 @@ static void response_pcap(struct recording *recording, bencode_item_t *output) { -void recording_finish(struct call *call, bool discard) { +void recording_finish(call_t *call, bool discard) { if (!call || !call->recording) return; @@ -804,7 +804,7 @@ static int append_meta_chunk(struct recording *recording, const char *buf, unsig return ret; } -static void proc_init(struct call *call) { +static void proc_init(call_t *call) { struct recording *recording = call->recording; recording->proc.call_idx = UNINIT_IDX; @@ -842,7 +842,7 @@ static void sdp_after_proc(struct recording *recording, GString *s, struct call_ "SDP from %u after %s", ml->unique_id, get_opmode_text(opmode)); } -static void finish_proc(struct call *call, bool discard) { +static void finish_proc(call_t *call, bool discard) { struct recording *recording = call->recording; if (!kernel.is_open) return; @@ -883,7 +883,7 @@ static void init_stream_proc(struct packet_stream *stream) { static void setup_stream_proc(struct packet_stream *stream) { struct call_media *media = stream->media; struct call_monologue *ml = media->monologue; - struct call *call = stream->call; + call_t *call = stream->call; struct recording *recording = call->recording; char buf[128]; int len; @@ -916,7 +916,7 @@ static void setup_stream_proc(struct packet_stream *stream) { } static void setup_monologue_proc(struct call_monologue *ml) { - struct call *call = ml->call; + call_t *call = ml->call; struct recording *recording = call->recording; if (!recording) @@ -932,7 +932,7 @@ static void setup_monologue_proc(struct call_monologue *ml) { } static void setup_media_proc(struct call_media *media) { - struct call *call = media->call; + call_t *call = media->call; struct recording *recording = call->recording; if (!recording) @@ -1004,7 +1004,7 @@ static int create_spool_dir_all(const char *spoolpath) { return TRUE; } -static void init_all(struct call *call) { +static void init_all(call_t *call) { rec_pcap_init(call); proc_init(call); } @@ -1021,7 +1021,7 @@ static void dump_packet_all(struct media_packet *mp, const str *s) { dump_packet_proc(mp, s); } -static void finish_all(struct call *call, bool discard) { +static void finish_all(call_t *call, bool discard) { finish_pcap(call, discard); finish_proc(call, discard); } diff --git a/daemon/redis.c b/daemon/redis.c index b78331acb..48fbe3784 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -361,7 +361,7 @@ err: void on_redis_notification(redisAsyncContext *actx, void *reply, void *privdata) { struct redis *r = 0; - struct call *c = NULL; + call_t *c = NULL; str callid; str keyspace_id; @@ -989,12 +989,12 @@ static int redis_check_conn(struct redis *r) { } /* called with r->lock held and c->master_lock held */ -static void redis_delete_call_json(struct call *c, struct redis *r) { +static void redis_delete_call_json(call_t *c, struct redis *r) { redis_pipe(r, "DEL "PB"", STR(&c->callid)); redis_consume(r); } -static void redis_delete_async_call_json(struct call *c, struct redis *r) { +static void redis_delete_async_call_json(call_t *c, struct redis *r) { gchar *redis_command; redis_command = g_strdup_printf("SELECT %i", c->redis_hosted_db); @@ -1208,7 +1208,7 @@ static void *redis_list_get_ptr(struct redis_list *list, struct redis_hash *rh, return redis_list_get_idx_ptr(list, idx); } -static int json_build_list_cb(callback_arg_t q, struct call *c, const char *key, +static int json_build_list_cb(callback_arg_t q, call_t *c, const char *key, unsigned int idx, struct redis_list *list, int (*cb)(str *, callback_arg_t, struct redis_list *, void *), void *ptr, JsonReader *root_reader) { @@ -1259,13 +1259,13 @@ static int rbpa_cb_simple(str *s, callback_arg_t pap, struct redis_list *list, v return 0; } -static int json_build_list(callback_arg_t q, struct call *c, const char *key, +static int json_build_list(callback_arg_t q, call_t *c, const char *key, unsigned int idx, struct redis_list *list, JsonReader *root_reader) { return json_build_list_cb(q, c, key, idx, list, rbl_cb_simple, NULL, root_reader); } -static int json_build_ptra(medias_arr *q, struct call *c, const char *key, +static int json_build_ptra(medias_arr *q, call_t *c, const char *key, unsigned int idx, struct redis_list *list, JsonReader *root_reader) { return json_build_list_cb(q, c, key, idx, list, rbpa_cb_simple, NULL, root_reader); @@ -1373,7 +1373,7 @@ static int redis_hash_get_sdes_params(sdes_q *out, const struct redis_hash *h, c return 0; } -static int redis_sfds(struct call *c, struct redis_list *sfds) { +static int redis_sfds(call_t *c, struct redis_list *sfds) { unsigned int i; str family, intf_name; struct redis_hash *rh; @@ -1446,7 +1446,7 @@ err: return -1; } -static int redis_streams(struct call *c, struct redis_list *streams) { +static int redis_streams(call_t *c, struct redis_list *streams) { unsigned int i; struct redis_hash *rh; struct packet_stream *ps; @@ -1479,7 +1479,7 @@ static int redis_streams(struct call *c, struct redis_list *streams) { return 0; } -static int redis_tags(struct call *c, struct redis_list *tags, JsonReader *root_reader) { +static int redis_tags(call_t *c, struct redis_list *tags, JsonReader *root_reader) { unsigned int i; int ii; struct redis_hash *rh; @@ -1549,7 +1549,7 @@ static int rbl_cb_plts_r(str *s, callback_arg_t dummy, struct redis_list *list, codec_store_add_raw(&med->codecs, rbl_cb_plts_g(s, list, ptr)); return 0; } -static int json_medias(struct call *c, struct redis_list *medias, struct redis_list *tags, +static int json_medias(call_t *c, struct redis_list *medias, struct redis_list *tags, JsonReader *root_reader) { unsigned int i; @@ -1610,7 +1610,7 @@ static int json_medias(struct call *c, struct redis_list *medias, struct redis_l return 0; } -static int redis_maps(struct call *c, struct redis_list *maps) { +static int redis_maps(call_t *c, struct redis_list *maps) { unsigned int i; struct redis_hash *rh; struct endpoint_map *em; @@ -1705,7 +1705,7 @@ static int rbl_subs_cb(str *s, callback_arg_t dummy, struct redis_list *list, vo return 0; } -static int json_link_tags(struct call *c, struct redis_list *tags, struct redis_list *medias, JsonReader *root_reader) +static int json_link_tags(call_t *c, struct redis_list *tags, struct redis_list *medias, JsonReader *root_reader) { unsigned int i; struct call_monologue *ml, *other_ml; @@ -1771,7 +1771,7 @@ static struct media_subscription *__find_media_subscriber(struct call_media *med return NULL; } -static int json_link_streams(struct call *c, struct redis_list *streams, +static int json_link_streams(call_t *c, struct redis_list *streams, struct redis_list *sfds, struct redis_list *medias, JsonReader *root_reader) { unsigned int i; @@ -1837,7 +1837,7 @@ static int json_link_streams(struct call *c, struct redis_list *streams, return 0; } -static int json_link_medias(struct call *c, struct redis_list *medias, +static int json_link_medias(call_t *c, struct redis_list *medias, struct redis_list *streams, struct redis_list *maps, JsonReader *root_reader) { for (unsigned int i = 0; i < medias->len; i++) @@ -1893,7 +1893,7 @@ static int rbl_cb_intf_sfds(str *s, callback_arg_t qp, struct redis_list *list, return 0; } -static int json_link_maps(struct call *c, struct redis_list *maps, +static int json_link_maps(call_t *c, struct redis_list *maps, struct redis_list *sfds, JsonReader *root_reader) { unsigned int i; @@ -1945,7 +1945,7 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign) redisReply* rr_jsonStr; struct redis_hash call; struct redis_list tags, sfds, streams, medias, maps; - struct call *c = NULL; + call_t *c = NULL; str s, id, meta; time_t last_signal; @@ -2332,7 +2332,7 @@ static void json_update_dtls_fingerprint(JsonBuilder *builder, const char *pref, * encodes the few (k,v) pairs for one call under one json structure */ -char* redis_encode_json(struct call *c) { +char* redis_encode_json(call_t *c) { JsonBuilder *builder = json_builder_new (); struct recording *rec = 0; @@ -2681,7 +2681,7 @@ char* redis_encode_json(struct call *c) { } -void redis_update_onekey(struct call *c, struct redis *r) { +void redis_update_onekey(call_t *c, struct redis *r) { unsigned int redis_expires_s; if (!r) @@ -2728,7 +2728,7 @@ err: } /* must be called lock-free */ -void redis_delete(struct call *c, struct redis *r) { +void redis_delete(call_t *c, struct redis *r) { int delete_async = rtpe_config.redis_delete_async; rlog(LOG_DEBUG, "Redis delete_async=%d", delete_async); diff --git a/daemon/rtcp.c b/daemon/rtcp.c index 4fb1bfcd3..2d30544b7 100644 --- a/daemon/rtcp.c +++ b/daemon/rtcp.c @@ -254,7 +254,7 @@ struct rtcp_process_ctx { // all available methods struct rtcp_handler { void (*init)(struct rtcp_process_ctx *); - void (*start)(struct rtcp_process_ctx *, struct call *); + void (*start)(struct rtcp_process_ctx *, call_t *); void (*common)(struct rtcp_process_ctx *, struct rtcp_packet *); void (*sr)(struct rtcp_process_ctx *, struct sender_report_packet *); void (*rr_list_start)(struct rtcp_process_ctx *, const struct rtcp_packet *); @@ -270,7 +270,7 @@ struct rtcp_handler { void (*xr_stats)(struct rtcp_process_ctx *, const struct xr_rb_stats *); void (*xr_rr_time)(struct rtcp_process_ctx *, const struct xr_rb_rr_time *); void (*xr_voip_metrics)(struct rtcp_process_ctx *, const struct xr_rb_voip_metrics *); - void (*finish)(struct rtcp_process_ctx *, struct call *, const endpoint_t *, const endpoint_t *, + void (*finish)(struct rtcp_process_ctx *, call_t *, const endpoint_t *, const endpoint_t *, const struct timeval *); void (*destroy)(struct rtcp_process_ctx *); }; @@ -324,12 +324,12 @@ static void homer_sdes_list_start(struct rtcp_process_ctx *, const struct source static void homer_sdes_item(struct rtcp_process_ctx *, const struct sdes_chunk *, const struct sdes_item *, const char *); static void homer_sdes_list_end(struct rtcp_process_ctx *); -static void homer_finish(struct rtcp_process_ctx *, struct call *, const endpoint_t *, const endpoint_t *, +static void homer_finish(struct rtcp_process_ctx *, call_t *, const endpoint_t *, const endpoint_t *, const struct timeval *); // syslog functions static void logging_init(struct rtcp_process_ctx *); -static void logging_start(struct rtcp_process_ctx *, struct call *); +static void logging_start(struct rtcp_process_ctx *, call_t *); static void logging_common(struct rtcp_process_ctx *, struct rtcp_packet *); static void logging_sdes_list_start(struct rtcp_process_ctx *, const struct source_description_packet *); static void logging_sr(struct rtcp_process_ctx *, struct sender_report_packet *); @@ -339,7 +339,7 @@ static void logging_xr_rr_time(struct rtcp_process_ctx *, const struct xr_rb_rr_ static void logging_xr_dlrr(struct rtcp_process_ctx *, const struct xr_rb_dlrr *); static void logging_xr_stats(struct rtcp_process_ctx *, const struct xr_rb_stats *); static void logging_xr_voip_metrics(struct rtcp_process_ctx *, const struct xr_rb_voip_metrics *); -static void logging_finish(struct rtcp_process_ctx *, struct call *, const endpoint_t *, const endpoint_t *, +static void logging_finish(struct rtcp_process_ctx *, call_t *, const endpoint_t *, const endpoint_t *, const struct timeval *); static void logging_destroy(struct rtcp_process_ctx *); @@ -660,7 +660,7 @@ int rtcp_parse(GQueue *q, struct media_packet *mp) { struct rtcp_chain_element *el; rtcp_handler_func func; str s = mp->raw; - struct call *c = mp->call; + call_t *c = mp->call; struct rtcp_process_ctx log_ctx_s, *log_ctx; unsigned int len; @@ -1128,7 +1128,7 @@ static void homer_sdes_list_end(struct rtcp_process_ctx *ctx) { str_sanitize(ctx->json); g_string_append_printf(ctx->json, "],"); } -static void homer_finish(struct rtcp_process_ctx *ctx, struct call *c, const endpoint_t *src, +static void homer_finish(struct rtcp_process_ctx *ctx, call_t *c, const endpoint_t *src, const endpoint_t *dst, const struct timeval *tv) { str_sanitize(ctx->json); @@ -1143,7 +1143,7 @@ static void homer_finish(struct rtcp_process_ctx *ctx, struct call *c, const end static void logging_init(struct rtcp_process_ctx *ctx) { ctx->log = g_string_new(NULL); } -static void logging_start(struct rtcp_process_ctx *ctx, struct call *c) { +static void logging_start(struct rtcp_process_ctx *ctx, call_t *c) { g_string_append_printf(ctx->log, "["STR_FORMAT"] ", STR_FMT(&c->callid)); ctx->log_init_len = ctx->log->len; } @@ -1256,7 +1256,7 @@ static void logging_xr_voip_metrics(struct rtcp_process_ctx *ctx, const struct x ctx->scratch.xr_vm.jb_max, ctx->scratch.xr_vm.jb_abs_max); } -static void logging_finish(struct rtcp_process_ctx *ctx, struct call *c, const endpoint_t *src, +static void logging_finish(struct rtcp_process_ctx *ctx, call_t *c, const endpoint_t *src, const endpoint_t *dst, const struct timeval *tv) { str_sanitize(ctx->log); diff --git a/daemon/sdp.c b/daemon/sdp.c index 291897c3d..d03e27c26 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2726,7 +2726,7 @@ static void insert_dtls(GString *s, struct call_media *media, struct dtls_connec int i; const struct dtls_hash_func *hf; str actpass_str = STR_NULL; - struct call *call = media->call; + call_t *call = media->call; GString * s_dst; if (!media->protocol || !media->protocol->srtp) diff --git a/daemon/statistics.c b/daemon/statistics.c index 17795024d..263f2f322 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -27,7 +27,7 @@ struct global_stats_counter rtpe_stats_intv; // calculated once per sec by `ca // op can be CMC_INCREMENT or CMC_DECREMENT // check not to multiple decrement or increment -void statistics_update_ip46_inc_dec(struct call* c, int op) { +void statistics_update_ip46_inc_dec(call_t * c, int op) { // already incremented if (op == CMC_INCREMENT && CALL_ISSET(c, MEDIA_COUNTED)) { return ; @@ -103,13 +103,13 @@ void statistics_update_ip46_inc_dec(struct call* c, int op) { bf_set_clear(&c->call_flags, CALL_FLAG_MEDIA_COUNTED, op == CMC_INCREMENT); } -void statistics_update_foreignown_dec(struct call* c) { +void statistics_update_foreignown_dec(call_t * c) { if (IS_FOREIGN_CALL(c)) { RTPE_GAUGE_DEC(foreign_sessions); } } -void statistics_update_foreignown_inc(struct call* c) { +void statistics_update_foreignown_inc(call_t * c) { if (IS_FOREIGN_CALL(c)) { /* foreign call*/ RTPE_GAUGE_INC(foreign_sessions); RTPE_STATS_INC(foreign_sess); @@ -117,7 +117,7 @@ void statistics_update_foreignown_inc(struct call* c) { } -void statistics_update_oneway(struct call* c) { +void statistics_update_oneway(call_t * c) { struct call_monologue *ml; struct call_media *md; GList *l; diff --git a/include/call.h b/include/call.h index 12eb34a94..7a2d9d90f 100644 --- a/include/call.h +++ b/include/call.h @@ -202,7 +202,7 @@ enum { #define ML_FLAG_BLOCK_MEDIA 0x00800000 #define ML_FLAG_SILENCE_MEDIA 0x01000000 -/* struct call */ +/* call_t */ #define CALL_FLAG_IPV4_OFFER 0x00010000 #define CALL_FLAG_IPV6_OFFER 0x00020000 #define CALL_FLAG_IPV4_ANSWER 0x00040000 @@ -270,7 +270,6 @@ enum block_dtmf_mode { struct control_stream; -struct call; struct redis; struct crypto_suite; struct rtpengine_srtp; @@ -381,7 +380,7 @@ struct packet_stream { out_lock; struct call_media *media; /* RO */ - struct call *call; /* RO */ + call_t *call; /* RO */ unsigned int component; /* RO, starts with 1 */ unsigned int unique_id; /* RO */ struct recording_stream recording; /* LOCK: call->master_lock */ @@ -440,7 +439,7 @@ struct packet_stream { */ struct call_media { struct call_monologue *monologue; /* RO */ - struct call *call; /* RO */ + call_t *call; /* RO */ unsigned int index; /* RO */ unsigned int unique_id; /* RO */ @@ -523,7 +522,7 @@ struct media_subscription { * A regular A/B call has two call_monologue objects with each subscribed to the other. */ struct call_monologue { - struct call *call; /* RO */ + call_t *call; /* RO */ unsigned int unique_id; /* RO */ str tag; @@ -591,9 +590,9 @@ struct call_iterator_entry { \ GList *__l = rtpe_call_iterators[__which].first; \ bool __has_lock = true; \ - struct call *next_ ## varname = NULL; \ + call_t *next_ ## varname = NULL; \ while (__l) { \ - struct call *varname = NULL; \ + call_t *varname = NULL; \ if (next_ ## varname) \ varname = next_ ## varname; \ else { \ @@ -626,12 +625,12 @@ struct call_iterator_entry { TYPED_GHASHTABLE(labels_ht, str, struct call_monologue, str_hash, str_equal, NULL, NULL) /** - * struct call is the main parent structure of all call-related objects. + * call_t is the main parent structure of all call-related objects. * * The logical object hierarchy under the 'struct call': * call > call_monologue > call_media > packet_stream > stream_fd * - * struct call usually has multiple call_monologue objects. + * call_t usually has multiple call_monologue objects. * Meanwhile each sub-object of call, as a parent of own sub-objects, * can also contain multiple child objects. * @@ -724,11 +723,11 @@ extern struct call_iterator_list rtpe_call_iterators[NUM_CALL_ITERATORS]; int call_init(void); void call_free(void); -struct call_monologue *__monologue_create(struct call *call); +struct call_monologue *__monologue_create(call_t *call); void __monologue_free(struct call_monologue *m); void __monologue_tag(struct call_monologue *ml, const str *tag); void __monologue_viabranch(struct call_monologue *ml, const str *viabranch); -struct packet_stream *__packet_stream_new(struct call *call); +struct packet_stream *__packet_stream_new(call_t *call); void __add_media_subscription(struct call_media * which, struct call_media * to, const struct sink_attrs *attrs); struct media_subscription *call_get_media_subscription(GHashTable *ht, struct call_media * cm); @@ -740,16 +739,16 @@ void __add_sink_handler(sink_handler_q *, struct packet_stream *, const struct s void media_subscription_free(void *); void media_subscriptions_clear(GQueue *q); -struct call *call_get_or_create(const str *callid, bool exclusive); -struct call *call_get_opmode(const str *callid, enum call_opmode opmode); -void call_make_own_foreign(struct call *c, bool foreign); -int call_get_mono_dialogue(struct call_monologue *monologues[2], struct call *call, +call_t *call_get_or_create(const str *callid, bool exclusive); +call_t *call_get_opmode(const str *callid, enum call_opmode opmode); +void call_make_own_foreign(call_t *c, bool foreign); +int call_get_mono_dialogue(struct call_monologue *monologues[2], call_t *call, const str *fromtag, const str *totag, const str *viabranch); -struct call_monologue *call_get_monologue(struct call *call, const str *fromtag); -struct call_monologue *call_get_or_create_monologue(struct call *call, const str *fromtag); -struct call *call_get(const str *callid); +struct call_monologue *call_get_monologue(call_t *call, const str *fromtag); +struct call_monologue *call_get_or_create_monologue(call_t *call, const str *fromtag); +call_t *call_get(const str *callid); int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *streams, sdp_ng_flags *flags); __attribute__((nonnull(1, 2, 3))) void codecs_offer_answer(struct call_media *media, struct call_media *other_media, @@ -764,10 +763,10 @@ int monologue_unsubscribe(struct call_monologue *dst, sdp_ng_flags *); void monologue_destroy(struct call_monologue *ml); int call_delete_branch_by_id(const str *callid, const str *branch, const str *fromtag, const str *totag, bencode_item_t *output, int delete_delay); -int call_delete_branch(struct call *, const str *branch, +int call_delete_branch(call_t *, const str *branch, const str *fromtag, const str *totag, bencode_item_t *output, int delete_delay); -void call_destroy(struct call *); -struct call_media *call_media_new(struct call *call); +void call_destroy(call_t *); +struct call_media *call_media_new(call_t *call); void call_media_free(struct call_media **mdp); enum call_stream_state call_stream_state_machine(struct packet_stream *); void call_media_state_machine(struct call_media *m); @@ -792,7 +791,7 @@ const struct rtp_payload_type *__rtp_stats_codec(struct call_media *m); #include "str.h" #include "rtp.h" -INLINE void *call_malloc(struct call *c, size_t l) { +INLINE void *call_malloc(call_t *c, size_t l) { void *ret; mutex_lock(&c->buffer_lock); ret = call_buffer_alloc(&c->buffer, l); @@ -800,7 +799,7 @@ INLINE void *call_malloc(struct call *c, size_t l) { return ret; } -INLINE char *call_strdup_len(struct call *c, const char *s, unsigned int len) { +INLINE char *call_strdup_len(call_t *c, const char *s, unsigned int len) { char *r; if (!s) return NULL; @@ -810,12 +809,12 @@ INLINE char *call_strdup_len(struct call *c, const char *s, unsigned int len) { return r; } -INLINE char *call_strdup(struct call *c, const char *s) { +INLINE char *call_strdup(call_t *c, const char *s) { if (!s) return NULL; return call_strdup_len(c, s, strlen(s)); } -INLINE str *call_str_cpy_len(struct call *c, str *out, const char *in, int len) { +INLINE str *call_str_cpy_len(call_t *c, str *out, const char *in, int len) { if (!in) { *out = STR_NULL; return out; @@ -824,24 +823,24 @@ INLINE str *call_str_cpy_len(struct call *c, str *out, const char *in, int len) out->len = len; return out; } -INLINE str *call_str_cpy(struct call *c, str *out, const str *in) { +INLINE str *call_str_cpy(call_t *c, str *out, const str *in) { return call_str_cpy_len(c, out, in ? in->s : NULL, in ? in->len : 0); } -INLINE str *call_str_cpy_c(struct call *c, str *out, const char *in) { +INLINE str *call_str_cpy_c(call_t *c, str *out, const char *in) { return call_str_cpy_len(c, out, in, in ? strlen(in) : 0); } -INLINE str *call_str_dup(struct call *c, const str *in) { +INLINE str *call_str_dup(call_t *c, const str *in) { str *out; out = call_malloc(c, sizeof(*out)); call_str_cpy_len(c, out, in->s, in->len); return out; } -INLINE str *call_str_init_dup(struct call *c, char *s) { +INLINE str *call_str_init_dup(call_t *c, char *s) { str t; str_init(&t, s); return call_str_dup(c, &t); } -INLINE void __call_unkernelize(struct call *call, const char *reason) { +INLINE void __call_unkernelize(call_t *call, const char *reason) { for (GList *l = call->monologues.head; l; l = l->next) { struct call_monologue *ml = l->data; __monologue_unconfirm(ml, reason); diff --git a/include/call_interfaces.h b/include/call_interfaces.h index f99a18ed9..e0beaab6a 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -11,7 +11,6 @@ #include "sdp.h" #include "types.h" -struct call; struct call_stats; struct streambuf_stream; struct sockaddr_in6; @@ -240,7 +239,7 @@ const char *call_unsilence_media_ng(bencode_item_t *, bencode_item_t *); const char *call_play_media_ng(bencode_item_t *, bencode_item_t *); const char *call_stop_media_ng(bencode_item_t *, bencode_item_t *); const char *call_play_dtmf_ng(bencode_item_t *, bencode_item_t *); -void ng_call_stats(struct call *call, const str *fromtag, const str *totag, bencode_item_t *output, +void ng_call_stats(call_t *call, const str *fromtag, const str *totag, bencode_item_t *output, struct call_stats *totals); const char *call_publish_ng(ng_buffer *, bencode_item_t *, bencode_item_t *, const char *, const endpoint_t *); @@ -253,7 +252,7 @@ void add_media_to_sub_list(GQueue *q, struct call_media *media, struct call_mono void save_last_sdp(struct call_monologue *ml, str *sdp, sdp_sessions_q *parsed, sdp_streams_q *streams); void call_ng_flags_init(sdp_ng_flags *out, enum call_opmode opmode); void call_ng_free_flags(sdp_ng_flags *flags); -void call_unlock_release(struct call **c); +void call_unlock_release(call_t **c); G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(sdp_ng_flags, call_ng_free_flags) diff --git a/include/cdr.h b/include/cdr.h index deb6bc909..8af085a65 100644 --- a/include/cdr.h +++ b/include/cdr.h @@ -9,13 +9,13 @@ #define CDR_H_ #include "helpers.h" +#include "types.h" -struct call; enum tag_type; enum call_opmode; const char *get_tag_type_text(enum tag_type t); const char *get_opmode_text(enum call_opmode); -void cdr_update_entry(struct call* c); +void cdr_update_entry(call_t * c); #endif /* CDR_H_ */ diff --git a/include/cli.h b/include/cli.h index 61a0c30b9..db6b81d28 100644 --- a/include/cli.h +++ b/include/cli.h @@ -4,6 +4,7 @@ #include "socket.h" #include "obj.h" #include "tcp_listener.h" +#include "types.h" struct cli { struct obj obj; @@ -12,13 +13,12 @@ struct cli { }; struct cli_writer; -struct call; struct call_monologue; struct cli_writer { void (*cw_printf)(struct cli_writer *, const char *, ...) __attribute__ ((format (printf, 2, 3))); void *ptr; - struct call *call; + call_t *call; struct call_monologue *ml; }; diff --git a/include/codec.h b/include/codec.h index eab781be6..2164efcb6 100644 --- a/include/codec.h +++ b/include/codec.h @@ -23,7 +23,6 @@ struct stream_params; struct supp_codec_tracker; struct rtcp_timer; struct mqtt_timer; -struct call; struct codec_store; struct call_monologue; struct delay_buffer; @@ -94,10 +93,10 @@ void codecs_init(void); void codecs_cleanup(void); void codec_timers_loop(void *); void rtcp_timer_stop(struct rtcp_timer **); -void codec_timer_callback(struct call *, void (*)(struct call *, void *), void *, uint64_t delay); +void codec_timer_callback(call_t *, void (*)(call_t *, void *), void *, uint64_t delay); void mqtt_timer_stop(struct mqtt_timer **); -void mqtt_timer_start(struct mqtt_timer **mqtp, struct call *call, struct call_media *media); +void mqtt_timer_start(struct mqtt_timer **mqtp, call_t *call, struct call_media *media); struct codec_handler *codec_handler_get(struct call_media *, int payload_type, struct call_media *sink, struct sink_handler *); diff --git a/include/dtmf.h b/include/dtmf.h index d8bc566ee..27ec0b04b 100644 --- a/include/dtmf.h +++ b/include/dtmf.h @@ -12,7 +12,6 @@ struct media_packet; struct call_media; -struct call; struct call_monologue; @@ -33,10 +32,10 @@ int dtmf_code_from_char(char); char dtmf_code_to_char(int code); const char *dtmf_inject(struct call_media *media, int code, int volume, int duration, int pause, struct call_media *sink); -bool dtmf_do_logging(const struct call *, bool injected); +bool dtmf_do_logging(const call_t *, bool injected); void dtmf_dsp_event(const struct dtmf_event *new_event, struct dtmf_event *cur_event, struct call_media *media, int clockrate, uint64_t ts, bool injected); -enum block_dtmf_mode dtmf_get_block_mode(struct call *call, struct call_monologue *ml); +enum block_dtmf_mode dtmf_get_block_mode(call_t *call, struct call_monologue *ml); bool is_pcm_dtmf_block_mode(enum block_dtmf_mode mode); bool is_dtmf_replace_mode(enum block_dtmf_mode mode); struct dtmf_event *is_in_dtmf_event(dtmf_event_q *, uint32_t ts, int clockrate, unsigned int head, diff --git a/include/ice.h b/include/ice.h index 402b4f3e2..d3200866c 100644 --- a/include/ice.h +++ b/include/ice.h @@ -64,7 +64,6 @@ struct logical_intf; struct local_intf; struct packet_stream; struct call_media; -struct call; struct stream_params; struct stun_attrs; struct call_monologue; @@ -116,7 +115,7 @@ TYPED_GHASHTABLE_PROTO(transaction_ht, uint32_t, struct ice_candidate_pair) /* these are protected by the call's master_lock */ struct ice_agent { struct timerthread_obj tt_obj; - struct call *call; /* main reference */ + call_t *call; /* main reference */ struct call_media *media; const struct logical_intf *logical_intf; sockfamily_t *desired_family; @@ -176,7 +175,7 @@ int ice_response(struct stream_fd *, const endpoint_t *src, struct stun_attrs *attrs, void *transaction); void dequeue_sdp_fragments(struct call_monologue *); -bool trickle_ice_update(ng_buffer *ngbuf, struct call *call, sdp_ng_flags *flags, +bool trickle_ice_update(ng_buffer *ngbuf, call_t *call, sdp_ng_flags *flags, sdp_streams_q *streams); enum thread_looper_action ice_slow_timer(void); diff --git a/include/jitter_buffer.h b/include/jitter_buffer.h index 80a11e986..44f61ba95 100644 --- a/include/jitter_buffer.h +++ b/include/jitter_buffer.h @@ -37,14 +37,14 @@ struct jitter_buffer { unsigned int dtmf_mult_factor; int buffer_len; int clock_drift_val; - struct call *call; + call_t *call; int disabled; }; void jitter_buffer_init(void); void jitter_buffer_init_free(void); -struct jitter_buffer *jitter_buffer_new(struct call *); +struct jitter_buffer *jitter_buffer_new(call_t *); void jitter_buffer_free(struct jitter_buffer **); int buffer_packet(struct media_packet *mp, const str *s); diff --git a/include/media_player.h b/include/media_player.h index 9224de3af..8e74e4a7c 100644 --- a/include/media_player.h +++ b/include/media_player.h @@ -5,11 +5,11 @@ #include "auxlib.h" #include "timerthread.h" #include "str.h" +#include "types.h" #include -struct call; struct call_media; struct call_monologue; struct codec_handler; @@ -54,7 +54,7 @@ struct media_player { struct timerthread_obj tt_obj; mutex_t lock; media_player_run_func run_func; - struct call *call; + call_t *call; struct call_monologue *ml; struct call_media *media; struct packet_stream *sink; @@ -101,7 +101,7 @@ INLINE struct media_player *media_player_get(struct media_player *mp) { struct send_timer { struct timerthread_queue ttq; - struct call *call; // main reference that keeps this alive + call_t *call; // main reference that keeps this alive struct packet_stream *sink; }; diff --git a/include/media_socket.h b/include/media_socket.h index 673d8a915..9431f0b12 100644 --- a/include/media_socket.h +++ b/include/media_socket.h @@ -235,7 +235,7 @@ struct stream_fd { * The call is only released when it has been dissociated from all stream_fd objects, * which happens during call teardown. */ - struct call *call; /* RO */ + call_t *call; /* RO */ struct packet_stream *stream; /* LOCK: call->master_lock */ struct crypto_context crypto; /* IN direction, LOCK: stream->in_lock */ struct dtls_connection dtls; /* LOCK: stream->in_lock */ @@ -270,7 +270,7 @@ struct media_packet { endpoint_t fsin; // source address of received packet struct timeval tv; // timestamp when packet was received struct stream_fd *sfd; // fd which received the packet - struct call *call; // sfd->call + call_t *call; // sfd->call struct packet_stream *stream; // sfd->stream struct call_media *media; // stream->media struct call_media *media_out; // output media @@ -301,13 +301,13 @@ struct local_intf *get_any_interface_address(const struct logical_intf *lif, soc void interfaces_exclude_port(unsigned int port); int is_local_endpoint(const struct intf_address *addr, unsigned int port); -//int get_port(socket_t *r, unsigned int port, const struct local_intf *lif, const struct call *c); +//int get_port(socket_t *r, unsigned int port, const struct local_intf *lif, const call_t *c); //void release_port(socket_t *r, const struct local_intf *); int __get_consecutive_ports(socket_q *out, unsigned int num_ports, unsigned int wanted_start_port, struct intf_spec *spec, const str *); int get_consecutive_ports(socket_intf_list_q *out, unsigned int num_ports, unsigned int num_intfs, struct call_media *media); -struct stream_fd *stream_fd_new(socket_t *fd, struct call *call, struct local_intf *lif); +struct stream_fd *stream_fd_new(socket_t *fd, call_t *call, struct local_intf *lif); struct stream_fd *stream_fd_lookup(const endpoint_t *); void stream_fd_release(struct stream_fd *); enum thread_looper_action release_closed_sockets(void); diff --git a/include/mqtt.h b/include/mqtt.h index 5b246634d..c366cf0e7 100644 --- a/include/mqtt.h +++ b/include/mqtt.h @@ -3,8 +3,8 @@ #include #include "main.h" +#include "types.h" -struct call; struct call_media; @@ -15,8 +15,8 @@ int mqtt_init(void); void mqtt_loop(void *); int mqtt_publish_scope(void); void mqtt_publish(char *); -void mqtt_timer_run_media(struct call *, struct call_media *); -void mqtt_timer_run_call(struct call *); +void mqtt_timer_run_media(call_t *, struct call_media *); +void mqtt_timer_run_call(call_t *); void mqtt_timer_run_global(void); void mqtt_timer_run_summary(void); @@ -28,8 +28,8 @@ void mqtt_timer_run_summary(void); INLINE int mqtt_init(void) { return 0; } INLINE void mqtt_publish(char *s) { } INLINE int mqtt_publish_scope(void) { return MPS_NONE; }; -INLINE void mqtt_timer_run_media(struct call *c, struct call_media *m) { } -INLINE void mqtt_timer_run_call(struct call *c) { } +INLINE void mqtt_timer_run_media(call_t *c, struct call_media *m) { } +INLINE void mqtt_timer_run_call(call_t *c) { } INLINE void mqtt_timer_run_global(void) { } INLINE void mqtt_timer_run_summary(void) { } diff --git a/include/recording.h b/include/recording.h index 5015797e0..6d6d40fdc 100644 --- a/include/recording.h +++ b/include/recording.h @@ -20,7 +20,6 @@ struct packet_stream; struct media_packet; -struct call; enum call_opmode; struct rtpengine_target_info; struct call_monologue; @@ -67,16 +66,16 @@ struct recording_method { int kernel_support; int (*create_spool_dir)(const char *); - void (*init_struct)(struct call *); + void (*init_struct)(call_t *); void (*sdp_before)(struct recording *, const str *, struct call_monologue *, enum call_opmode); void (*sdp_after)(struct recording *, GString *, struct call_monologue *, enum call_opmode); void (*meta_chunk)(struct recording *, const char *, const str *); - void (*update_flags)(struct call *call, bool streams); + void (*update_flags)(call_t *call, bool streams); void (*dump_packet)(struct media_packet *, const str *s); - void (*finish)(struct call *, bool discard); + void (*finish)(call_t *, bool discard); void (*response)(struct recording *, bencode_item_t *); void (*init_stream_struct)(struct packet_stream *); @@ -106,7 +105,7 @@ void recording_fs_free(void); /** * - * Controls the setting of recording variables on a `struct call *`. + * Controls the setting of recording variables on a `call_t *`. * Sets the `record_call` value on the `struct call`, initializing the * recording struct if necessary. * If we do not yet have a PCAP file associated with the call, create it @@ -114,20 +113,20 @@ void recording_fs_free(void); * * Returns a boolean for whether or not the call is being recorded. */ -void detect_setup_recording(struct call *call, const sdp_ng_flags *flags); -void update_metadata_call(struct call *call, str *metadata); +void detect_setup_recording(call_t *call, const sdp_ng_flags *flags); +void update_metadata_call(call_t *call, str *metadata); void update_metadata_monologue(struct call_monologue *ml, str *metadata); -void recording_start(struct call *call, const char *prefix, const str *output_dest); -void recording_pause(struct call *call); -void recording_stop(struct call *call); -void recording_discard(struct call *call); +void recording_start(call_t *call, const char *prefix, const str *output_dest); +void recording_pause(call_t *call); +void recording_stop(call_t *call); +void recording_discard(call_t *call); #define meta_write_sdp_before(args...) _rm(sdp_before, args) #define meta_write_sdp_after(args...) _rm(sdp_after, args) -void recording_finish(struct call *, bool discard); +void recording_finish(call_t *, bool discard); diff --git a/include/redis.h b/include/redis.h index 74d05dc8f..737e6fbb3 100644 --- a/include/redis.h +++ b/include/redis.h @@ -42,7 +42,6 @@ enum subscribe_action { UNSUBSCRIBE_ALL, }; -struct call; @@ -98,8 +97,8 @@ struct redis *redis_new(const endpoint_t *, int, const char *, enum redis_role, struct redis *redis_dup(const struct redis *r, int db); void redis_close(struct redis *r); int redis_restore(struct redis *, bool foreign, int db); -void redis_update_onekey(struct call *c, struct redis *r); -void redis_delete(struct call *, struct redis *); +void redis_update_onekey(call_t *c, struct redis *r); +void redis_delete(call_t *, struct redis *); void redis_wipe(struct redis *); int redis_async_event_base_action(struct redis *r, enum event_base_action); int redis_notify_subscribe_action(struct redis *r, enum subscribe_action action, int keyspace); diff --git a/include/rtcp.h b/include/rtcp.h index ef4622621..1074511ac 100644 --- a/include/rtcp.h +++ b/include/rtcp.h @@ -15,7 +15,7 @@ struct call_monologue; struct rtcp_parse_ctx { - struct call *call; + call_t *call; struct call_media *media; const struct timeval *received; }; diff --git a/include/ssrc.h b/include/ssrc.h index 35ebe8f63..c8385cdc8 100644 --- a/include/ssrc.h +++ b/include/ssrc.h @@ -12,7 +12,6 @@ -struct call; struct call_media; struct timeval; struct rtp_payload_type; diff --git a/include/statistics.h b/include/statistics.h index 9561e0680..d450cdd89 100644 --- a/include/statistics.h +++ b/include/statistics.h @@ -5,7 +5,6 @@ #include "bencode.h" #include "rtpengine_config.h" -struct call; struct packet_stream; struct stream_stats { @@ -192,10 +191,10 @@ extern struct global_stats_counter rtpe_stats_intv; // per-second, calculated o -void statistics_update_oneway(struct call *); -void statistics_update_ip46_inc_dec(struct call *, int op); -void statistics_update_foreignown_dec(struct call *); -void statistics_update_foreignown_inc(struct call* c); +void statistics_update_oneway(call_t *); +void statistics_update_ip46_inc_dec(call_t *, int op); +void statistics_update_foreignown_dec(call_t *); +void statistics_update_foreignown_inc(call_t * c); stats_metric_q *statistics_gather_metrics(struct interface_sampled_rate_stats *); void statistics_free_metrics(stats_metric_q *); diff --git a/include/types.h b/include/types.h index b111912a1..21f4fa942 100644 --- a/include/types.h +++ b/include/types.h @@ -6,6 +6,7 @@ typedef struct sdp_ng_flags sdp_ng_flags; typedef struct stats_metric stats_metric; typedef struct ng_buffer ng_buffer; +typedef struct call call_t; #include "containers.h" diff --git a/t/log_funcs.h b/t/log_funcs.h index f2aa31eb5..1525384e4 100644 --- a/t/log_funcs.h +++ b/t/log_funcs.h @@ -3,8 +3,8 @@ #include "helpers.h" #include "str.h" +#include "types.h" -struct call; struct stream_fd; struct ice_agent; struct call_media; @@ -15,7 +15,7 @@ INLINE void log_info_pop(void) { } INLINE void log_info_pop_until(void *p) { } -INLINE void log_info_call(struct call *c) { +INLINE void log_info_call(call_t *c) { } INLINE void log_info_stream_fd(struct stream_fd *sfd) { } diff --git a/t/test-stats.c b/t/test-stats.c index b46793332..682e8d6fc 100644 --- a/t/test-stats.c +++ b/t/test-stats.c @@ -4304,9 +4304,9 @@ int main(void) { const str callid1 = STR_CONST_INIT("test1"); const str callid2 = STR_CONST_INIT("test2"); - struct call *call1 = call_get_or_create(&callid1, true); + call_t *call1 = call_get_or_create(&callid1, true); struct call_monologue *ml1 = call_get_or_create_monologue(call1, &callid1); - struct call *call2 = call_get_or_create(&callid2, true); + call_t *call2 = call_get_or_create(&callid2, true); struct call_monologue *ml2 = call_get_or_create_monologue(call2, &callid2); call1->created = ml1->started = (struct timeval) {157,0}; call2->created = ml2->started = (struct timeval) {57,0}; diff --git a/t/test-transcode.c b/t/test-transcode.c index 4d8a16bcb..4ec2c37aa 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -36,7 +36,7 @@ static GHashTable *rtp_ts_ht; static GHashTable *rtp_seq_ht; static uint32_t ssrc_A; static uint32_t ssrc_B; -static struct call call; +static call_t call; static sdp_ng_flags flags; static struct call_media *media_A; static struct call_media *media_B; @@ -68,7 +68,7 @@ static void __init(void) { flags.codec_except = str_case_ht_new(); flags.codec_set = str_case_value_ht_new(); } -static struct packet_stream *ps_new(struct call *c) { +static struct packet_stream *ps_new(call_t *c) { struct packet_stream *ps = malloc(sizeof(*ps)); assert(ps != NULL); memset(ps, 0, sizeof(*ps));