[reSIProcate] app callback for close-to-the-wire message traces

John Gregg jgregg at aylus.com
Tue May 20 10:22:51 CDT 2014


Our device uses resiprocate and has a debug mode in which we want to 
dump into our log a trace of every message we send or receive, as close 
to the wire as possible. Basically, the next best thing to wireshark. 
Sometimes resiprocate itself discards received messages or generates 
messages without telling the app above it, so we found it necessary to 
give resiprocate a callback that takes a const * SipMessage and a 
direction flag:

typedef void (*msgTraceCb_t)(const SipMessage * msg, bool inNotOut);

We simply put a pointer to this callback in the Transport object as a 
public member variable so the app manipulates it directly; I suppose if 
we wanted to be nice we would have wrapped it in an accessor method. 
Anyway, every time the stack receives a SipMessage off the wire, and 
every time it is about to send one on the wire, it calls the callback 
(if not NULL), and the app can then do whatever logging or accounting it 
wants, in whatever format it likes, without actually changing the 
message at all. Five files changed, but relatively trivial changes. All 
based on 1.9.6 sources.

-John Gregg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DtlsTransport.cxx.diff
Type: text/x-patch
Size: 358 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/89513836/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Transport.cxx.diff
Type: text/x-patch
Size: 1012 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/89513836/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Transport.hxx.diff
Type: text/x-patch
Size: 672 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/89513836/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TransportSelector.cxx.diff
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/89513836/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UdpTransport.cxx.diff
Type: text/x-patch
Size: 388 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/89513836/attachment-0004.bin>


More information about the resiprocate-devel mailing list