[sr-dev] git:master: core: sdp parser - the log verbosity of sdp print helpers is now configurable

Ovidiu Sas osas at voipembedded.com
Mon Jun 28 18:12:28 CEST 2010


Module: sip-router
Branch: master
Commit: 986e8c19b4a66280f7e856174c375b12b791d3f3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=986e8c19b4a66280f7e856174c375b12b791d3f3

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date:   Mon Jun 28 12:17:07 2010 -0400

core: sdp parser - the log verbosity of sdp print helpers is now configurable

---

 parser/sdp/sdp.c |   18 +++++++++---------
 parser/sdp/sdp.h |    6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/parser/sdp/sdp.c b/parser/sdp/sdp.c
index d294d11..b4dd062 100644
--- a/parser/sdp/sdp.c
+++ b/parser/sdp/sdp.c
@@ -758,11 +758,11 @@ void free_sdp(sdp_info_t** _sdp)
 }
 
 
-void print_sdp_stream(sdp_stream_cell_t *stream)
+void print_sdp_stream(sdp_stream_cell_t *stream, int log_level)
 {
 	sdp_payload_attr_t *payload;
 
-	LM_DBG("....stream[%d]:%p=>%p {%p} '%.*s' '%.*s:%.*s:%.*s' '%.*s' [%d] '%.*s' '%.*s:%.*s' (%d)=>%p '%.*s' '%.*s' '%.*s' '%.*s' '%.*s' '%.*s'\n",
+	LOG(log_level , "....stream[%d]:%p=>%p {%p} '%.*s' '%.*s:%.*s:%.*s' '%.*s' [%d] '%.*s' '%.*s:%.*s' (%d)=>%p '%.*s' '%.*s' '%.*s' '%.*s' '%.*s' '%.*s'\n",
 		stream->stream_num, stream, stream->next,
 		stream->p_payload_attr,
 		stream->media.len, stream->media.s,
@@ -780,7 +780,7 @@ void print_sdp_stream(sdp_stream_cell_t *stream)
 		stream->accept_wrapped_types.len, stream->accept_wrapped_types.s);
 	payload = stream->payload_attr;
 	while (payload) {
-		LM_DBG("......payload[%d]:%p=>%p p_payload_attr[%d]:%p '%.*s' '%.*s' '%.*s' '%.*s'\n",
+		LOG(log_level, "......payload[%d]:%p=>%p p_payload_attr[%d]:%p '%.*s' '%.*s' '%.*s' '%.*s'\n",
 			payload->payload_num, payload, payload->next,
 			payload->payload_num, stream->p_payload_attr[payload->payload_num],
 			payload->rtp_payload.len, payload->rtp_payload.s,
@@ -791,7 +791,7 @@ void print_sdp_stream(sdp_stream_cell_t *stream)
 	}
 }
 
-void print_sdp_session(sdp_session_cell_t *session)
+void print_sdp_session(sdp_session_cell_t *session, int log_level)
 {
 	sdp_stream_cell_t *stream = session->streams;
 
@@ -800,26 +800,26 @@ void print_sdp_session(sdp_session_cell_t *session)
 		return;
 	}
 
-	LM_DBG("..session[%d]:%p=>%p '%.*s' '%.*s:%.*s' (%d)=>%p\n",
+	LOG(log_level, "..session[%d]:%p=>%p '%.*s' '%.*s:%.*s' (%d)=>%p\n",
 		session->session_num, session, session->next,
 		session->cnt_disp.len, session->cnt_disp.s,
 		session->bw_type.len, session->bw_type.s, session->bw_width.len, session->bw_width.s,
 		session->streams_num, session->streams);
 	while (stream) {
-		print_sdp_stream(stream);
+		print_sdp_stream(stream, log_level);
 		stream=stream->next;
 	}
 }
 
 
-void print_sdp(sdp_info_t* sdp)
+void print_sdp(sdp_info_t* sdp, int log_level)
 {
 	sdp_session_cell_t *session;
 
-	LM_DBG("sdp:%p=>%p (%d:%d)\n", sdp, sdp->sessions, sdp->sessions_num, sdp->streams_num);
+	LOG(log_level, "sdp:%p=>%p (%d:%d)\n", sdp, sdp->sessions, sdp->sessions_num, sdp->streams_num);
 	session = sdp->sessions;
 	while (session) {
-		print_sdp_session(session);
+		print_sdp_session(session, log_level);
 		session = session->next;
 	}
 }
diff --git a/parser/sdp/sdp.h b/parser/sdp/sdp.h
index 2ab34de..c7cc866 100644
--- a/parser/sdp/sdp.h
+++ b/parser/sdp/sdp.h
@@ -159,19 +159,19 @@ void free_sdp(sdp_info_t** _sdp);
  *
  * Note: only for debug purposes.
  */
-void print_sdp(sdp_info_t* sdp);
+void print_sdp(sdp_info_t* sdp, int log_level);
 /**
  * Print the content of the given sdp_session structure.
  *
  * Note: only for debug purposes.
  */
-void print_sdp_session(sdp_session_cell_t* sdp_session);
+void print_sdp_session(sdp_session_cell_t* sdp_session, int log_level);
 /**
  * Print the content of the given sdp_stream structure.
  *
  * Note: only for debug purposes.
  */
-void print_sdp_stream(sdp_stream_cell_t *stream);
+void print_sdp_stream(sdp_stream_cell_t *stream, int log_level);
 
 
 #endif /* SDP_H */




More information about the sr-dev mailing list