Merge remote-tracking branch 'upstream/master'

pull/225/head
Stefan Mititelu 10 years ago
commit 4fd69132a2

@ -311,60 +311,60 @@ INLINE int __cond_timedwait_tv(cond_t *c, mutex_t *m, const struct timeval *tv)
INLINE int __debug_mutex_init(mutex_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "mutex_init(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "mutex_init(%p) at %s:%u", m, file, line);
return pthread_mutex_init(m, NULL);
}
INLINE int __debug_mutex_destroy(mutex_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "mutex_destroy(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "mutex_destroy(%p) at %s:%u", m, file, line);
return pthread_mutex_destroy(m);
}
INLINE int __debug_mutex_lock(mutex_t *m, const char *file, unsigned int line) {
int ret;
mylog(LOG_DEBUG, "mutex_lock(%p) at %s:%u ...", m, file, line);
write_log(LOG_DEBUG, "mutex_lock(%p) at %s:%u ...", m, file, line);
ret = pthread_mutex_lock(m);
mylog(LOG_DEBUG, "mutex_lock(%p) at %s:%u returning %i", m, file, line, ret);
write_log(LOG_DEBUG, "mutex_lock(%p) at %s:%u returning %i", m, file, line, ret);
return ret;
}
INLINE int __debug_mutex_trylock(mutex_t *m, const char *file, unsigned int line) {
int ret;
mylog(LOG_DEBUG, "mutex_trylock(%p) at %s:%u ...", m, file, line);
write_log(LOG_DEBUG, "mutex_trylock(%p) at %s:%u ...", m, file, line);
ret = pthread_mutex_trylock(m);
mylog(LOG_DEBUG, "mutex_trylock(%p) at %s:%u returning %i", m, file, line, ret);
write_log(LOG_DEBUG, "mutex_trylock(%p) at %s:%u returning %i", m, file, line, ret);
return ret;
}
INLINE int __debug_mutex_unlock(mutex_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "mutex_unlock(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "mutex_unlock(%p) at %s:%u", m, file, line);
return pthread_mutex_unlock(m);
}
INLINE int __debug_rwlock_init(rwlock_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "rwlock_init(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "rwlock_init(%p) at %s:%u", m, file, line);
return pthread_rwlock_init(m, NULL);
}
INLINE int __debug_rwlock_destroy(rwlock_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "rwlock_destroy(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "rwlock_destroy(%p) at %s:%u", m, file, line);
return pthread_rwlock_destroy(m);
}
INLINE int __debug_rwlock_lock_r(rwlock_t *m, const char *file, unsigned int line) {
int ret;
mylog(LOG_DEBUG, "rwlock_lock_r(%p) at %s:%u ...", m, file, line);
write_log(LOG_DEBUG, "rwlock_lock_r(%p) at %s:%u ...", m, file, line);
ret = pthread_rwlock_rdlock(m);
mylog(LOG_DEBUG, "rwlock_lock_r(%p) at %s:%u returning %i", m, file, line, ret);
write_log(LOG_DEBUG, "rwlock_lock_r(%p) at %s:%u returning %i", m, file, line, ret);
return ret;
}
INLINE int __debug_rwlock_lock_w(rwlock_t *m, const char *file, unsigned int line) {
int ret;
mylog(LOG_DEBUG, "rwlock_lock_w(%p) at %s:%u ...", m, file, line);
write_log(LOG_DEBUG, "rwlock_lock_w(%p) at %s:%u ...", m, file, line);
ret = pthread_rwlock_wrlock(m);
mylog(LOG_DEBUG, "rwlock_lock_w(%p) at %s:%u returning %i", m, file, line, ret);
write_log(LOG_DEBUG, "rwlock_lock_w(%p) at %s:%u returning %i", m, file, line, ret);
return ret;
}
INLINE int __debug_rwlock_unlock_r(rwlock_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "rwlock_unlock_r(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "rwlock_unlock_r(%p) at %s:%u", m, file, line);
return pthread_rwlock_unlock(m);
}
INLINE int __debug_rwlock_unlock_w(rwlock_t *m, const char *file, unsigned int line) {
mylog(LOG_DEBUG, "rwlock_unlock_w(%p) at %s:%u", m, file, line);
write_log(LOG_DEBUG, "rwlock_unlock_w(%p) at %s:%u", m, file, line);
return pthread_rwlock_unlock(m);
}

@ -35,6 +35,7 @@
#include "call_interfaces.h"
#include "ice.h"
#include "rtpengine_config.h"
#include "log_funcs.h"

@ -15,10 +15,7 @@
#include <openssl/x509.h>
#include <limits.h>
#include "compat.h"
#include "control_ng.h"
#include "aux.h"
#include "socket.h"
#include "media_socket.h"
#define UNDEFINED ((unsigned int) -1)
#define TRUNCATED " ... Output truncated. Increase Output Buffer ... \n"
@ -86,15 +83,6 @@ enum call_type {
CT_FOREIGN_CALL,
};
#include "obj.h"
#include "aux.h"
#include "bencode.h"
#include "str.h"
#include "crypto.h"
#include "dtls.h"
#include "rtp.h"
#define ERROR_NO_FREE_PORTS -100
#define ERROR_NO_FREE_LOGS -101
@ -200,6 +188,12 @@ enum call_type {
#include "obj.h"
#include "bencode.h"
#include "crypto.h"
#include "dtls.h"
struct poller;
struct control_stream;
struct call;
@ -540,6 +534,12 @@ void __payload_type_free(void *p);
void __rtp_stats_update(GHashTable *dst, GHashTable *src);
#include "str.h"
#include "rtp.h"
INLINE void *call_malloc(struct call *c, size_t l) {
void *ret;
mutex_lock(&c->buffer_lock);

@ -15,6 +15,8 @@
#include "cli.h"
#include "socket.h"
#include "redis.h"
#include "control_ng.h"
#include "media_socket.h"
#include "rtpengine_config.h"

@ -12,6 +12,9 @@
#include "sdp.h"
#include "call_interfaces.h"
#include "socket.h"
#include "log_funcs.h"
static void timeval_update_request_time(struct request_time *request, const struct timeval *offer_diff) {
// lock offers

@ -17,6 +17,7 @@
#include "call.h"
#include "call_interfaces.h"
#include "socket.h"
#include "log_funcs.h"

@ -18,6 +18,7 @@
#include "udp_listener.h"
#include "call_interfaces.h"
#include "socket.h"
#include "log_funcs.h"
static void control_udp_incoming(struct obj *obj, str *buf, const endpoint_t *sin, char *addr,

@ -8,6 +8,8 @@
#include "log.h"
#include "obj.h"
#include "stun.h"
#include "poller.h"
#include "log_funcs.h"

@ -10,7 +10,6 @@
#include "str.h"
#include "obj.h"
#include "aux.h"
#include "call.h"
#include "media_socket.h"
#include "socket.h"
@ -163,6 +162,11 @@ int ice_request(struct stream_fd *, const endpoint_t *, struct stun_attrs *);
int ice_response(struct stream_fd *, const endpoint_t *src,
struct stun_attrs *attrs, u_int32_t transaction[3]);
#include "call.h"
/* returns 0 if ICE still has work to do, 1 otherwise */
INLINE int ice_has_finished(struct call_media *media) {
if (!media)

@ -9,14 +9,18 @@
struct call;
struct stream_fd;
struct ice_agent;
struct log_info {
union {
const struct call *call;
const struct stream_fd *stream_fd;
struct call *call;
struct stream_fd *stream_fd;
const str *str;
const char *cstr;
const struct ice_agent *ice_agent;
const void *ptr;
struct ice_agent *ice_agent;
void *ptr;
} u;
enum {
LOG_INFO_NONE = 0,
@ -73,68 +77,11 @@ void cdrlog(const char* cdrbuffer);
void rtcplog(const char* cdrbuffer);
#include "obj.h"
INLINE void log_info_clear() {
switch (log_info.e) {
case LOG_INFO_NONE:
return;
case LOG_INFO_CALL:
case LOG_INFO_STREAM_FD:
case LOG_INFO_ICE_AGENT:
__obj_put((void *) log_info.u.ptr);
break;
case LOG_INFO_STR:
case LOG_INFO_C_STRING:
break;
}
log_info.e = LOG_INFO_NONE;
log_info.u.ptr = NULL;
}
INLINE void log_info_call(const struct call *c) {
log_info_clear();
if (!c)
return;
log_info.e = LOG_INFO_CALL;
log_info.u.call = __obj_get((void *) c);
}
INLINE void log_info_stream_fd(const struct stream_fd *sfd) {
log_info_clear();
if (!sfd)
return;
log_info.e = LOG_INFO_STREAM_FD;
log_info.u.stream_fd = __obj_get((void *) sfd);
}
INLINE void log_info_str(const str *s) {
log_info_clear();
if (!s || !s->s)
return;
log_info.e = LOG_INFO_STR;
log_info.u.str = s;
}
INLINE void log_info_c_string(const char *s) {
log_info_clear();
if (!s)
return;
log_info.e = LOG_INFO_C_STRING;
log_info.u.cstr = s;
}
INLINE void log_info_ice_agent(const struct ice_agent *ag) {
log_info_clear();
if (!ag)
return;
log_info.e = LOG_INFO_ICE_AGENT;
log_info.u.ice_agent = __obj_get((void *) ag);
}
INLINE int get_log_level(void) {
return g_atomic_int_get(&log_level);
}
#define LOG_ERROR LOG_ERR
#define LOG_WARN LOG_WARNING

@ -0,0 +1,69 @@
#ifndef __LOG_FUNCS_H__
#define __LOG_FUNCS_H__
#include "aux.h"
#include "obj.h"
#include "call.h"
#include "media_socket.h"
#include "ice.h"
INLINE void log_info_clear() {
switch (log_info.e) {
case LOG_INFO_NONE:
return;
case LOG_INFO_CALL:
obj_put(log_info.u.call);
break;
case LOG_INFO_STREAM_FD:
obj_put(log_info.u.stream_fd);
break;
case LOG_INFO_ICE_AGENT:
obj_put(log_info.u.ice_agent);
break;
case LOG_INFO_STR:
case LOG_INFO_C_STRING:
break;
}
log_info.e = LOG_INFO_NONE;
log_info.u.ptr = NULL;
}
INLINE void log_info_call(struct call *c) {
log_info_clear();
if (!c)
return;
log_info.e = LOG_INFO_CALL;
log_info.u.call = obj_get(c);
}
INLINE void log_info_stream_fd(struct stream_fd *sfd) {
log_info_clear();
if (!sfd)
return;
log_info.e = LOG_INFO_STREAM_FD;
log_info.u.stream_fd = obj_get(sfd);
}
INLINE void log_info_str(const str *s) {
log_info_clear();
if (!s || !s->s)
return;
log_info.e = LOG_INFO_STR;
log_info.u.str = s;
}
INLINE void log_info_c_string(const char *s) {
log_info_clear();
if (!s)
return;
log_info.e = LOG_INFO_C_STRING;
log_info.u.cstr = s;
}
INLINE void log_info_ice_agent(struct ice_agent *ag) {
log_info_clear();
if (!ag)
return;
log_info.e = LOG_INFO_ICE_AGENT;
log_info.u.ice_agent = obj_get(ag);
}
#endif

@ -15,6 +15,8 @@
#include "rtcp.h"
#include "sdp.h"
#include "aux.h"
#include "log_funcs.h"
#include "poller.h"

@ -59,11 +59,11 @@ INLINE void *__obj_alloc(unsigned int size, void (*free_func)(void *),
INLINE void *__obj_alloc0(unsigned int size, void (*free_func)(void *),
const char *type, const char *file, unsigned int line);
INLINE struct obj *__obj_hold(struct obj *o,
const char *type, const char *file, unsigned int line);
const char *file, unsigned int line);
INLINE void *__obj_get(struct obj *o,
const char *type, const char *file, unsigned int line);
INLINE void __obj_put(struct obj *o,,
const char *type, const char *file, unsigned int line);
const char *file, unsigned int line);
INLINE void __obj_put(struct obj *o,
const char *file, unsigned int line);
#else
@ -99,7 +99,7 @@ INLINE void __obj_init(struct obj *o, unsigned int size, void (*free_func)(void
#if OBJ_DEBUG
o->magic = OBJ_MAGIC;
o->type = strdup(type);
mylog(LOG_DEBUG, "obj_allocX(\"%s\") -> %p [%s:%u]", type, o, file, line);
write_log(LOG_DEBUG, "obj_allocX(\"%s\") -> %p [%s:%u]", type, o, file, line);
#endif
o->ref = 1;
o->free_func = free_func;
@ -145,12 +145,12 @@ INLINE struct obj *__obj_hold(struct obj *o
) {
#if OBJ_DEBUG
assert(o->magic == OBJ_MAGIC);
mylog(LOG_DEBUG, "obj_hold(%p, \"%s\"), refcnt before %u [%s:%u]",
write_log(LOG_DEBUG, "obj_hold(%p, \"%s\"), refcnt before %u [%s:%u]",
o, o->type, g_atomic_int_get(&o->ref), file, line);
#endif
g_atomic_int_inc(&o->ref);
#if OBJ_DEBUG
mylog(LOG_DEBUG, "obj_hold(%p, \"%s\"), refcnt after %u [%s:%u]",
write_log(LOG_DEBUG, "obj_hold(%p, \"%s\"), refcnt after %u [%s:%u]",
o, o->type, g_atomic_int_get(&o->ref), file, line);
#endif
return o;
@ -175,13 +175,13 @@ INLINE void __obj_put(struct obj *o
) {
#if OBJ_DEBUG
assert(o->magic == OBJ_MAGIC);
mylog(LOG_DEBUG, "obj_put(%p, \"%s\"), refcnt before %u [%s:%u]",
write_log(LOG_DEBUG, "obj_put(%p, \"%s\"), refcnt before %u [%s:%u]",
o, o->type, g_atomic_int_get(&o->ref), file, line);
#endif
if (!g_atomic_int_dec_and_test(&o->ref))
return;
#if OBJ_DEBUG
mylog(LOG_DEBUG, "obj_put(%p, \"%s\"), refcnt after %u [%s:%u]",
write_log(LOG_DEBUG, "obj_put(%p, \"%s\"), refcnt after %u [%s:%u]",
o, o->type, g_atomic_int_get(&o->ref), file, line);
free(o->type);
#endif

@ -20,6 +20,12 @@
#include "hiredis/async.h"
#include "hiredis/adapters/libevent.h"
#include "event2/thread.h"
#include "log_funcs.h"
INLINE redisReply *redis_expect(int type, redisReply *r) {
if (!r)

@ -13,6 +13,7 @@
#include "crypto.h"
#include "rtcp_xr.h"
#include "homer.h"
#include "media_socket.h"

@ -1482,7 +1482,9 @@ static int replace_network_address(struct sdp_chopper *chop, struct network_addr
__parse_address(&flags->parsed_media_address, NULL, NULL, &flags->media_address);
if (!is_addr_unspecified(&flags->parsed_media_address))
len = sprintf(buf, "%s", sockaddr_print_buf(&flags->parsed_media_address));
len = sprintf(buf, "%s %s",
flags->parsed_media_address.family->rfc_name,
sockaddr_print_buf(&flags->parsed_media_address));
else
call_stream_address46(buf, ps, SAF_NG, &len, NULL);
chopper_append_dup(chop, buf, len);

@ -44,13 +44,14 @@ GetOptions(
'delete-delay=i' => \$options{'delete-delay'},
'reset' => \$options{'reset'},
'port-latching' => \$options{'port latching'},
'media-address=s' => \$options{'media address'},
) or die;
my $cmd = shift(@ARGV) or die;
my %packet = (command => $cmd);
for my $x (split(',', 'from-tag,to-tag,call-id,transport protocol,media address,ICE,address family,TOS,DTLS,via-branch,delete-delay')) {
for my $x (split(',', 'from-tag,to-tag,call-id,transport protocol,media address,ICE,address family,TOS,DTLS,via-branch,delete-delay,media address')) {
defined($options{$x}) and $packet{$x} = $options{$x};
}
for my $x (split(',', 'trust address,symmetric,asymmetric,force,strict source,media handover,sip source address,reset,port latching')) {

Loading…
Cancel
Save