Dumping of RTP/RTCP packets to text2pcap or pcap format (headers) More...
#include <glib.h>#include <inttypes.h>#include <string.h>#include <stdio.h>#include <stdlib.h>#include "mutex.h"

Go to the source code of this file.
Data Structures | |
| struct | janus_text2pcap |
| Instance of a text2pcap recorder. More... | |
Typedefs | |
| typedef struct janus_text2pcap | janus_text2pcap |
| Instance of a text2pcap recorder. More... | |
| typedef enum janus_text2pcap_packet | janus_text2pcap_packet |
| Packet types we can dump. More... | |
Enumerations | |
| enum | janus_text2pcap_packet { JANUS_TEXT2PCAP_RTP, JANUS_TEXT2PCAP_RTCP, JANUS_TEXT2PCAP_DATA } |
| Packet types we can dump. More... | |
Functions | |
| const char * | janus_text2pcap_packet_string (janus_text2pcap_packet type) |
| janus_text2pcap * | janus_text2pcap_create (const char *dir, const char *filename, int truncate, gboolean text) |
| Create a text2pcap recorder. More... | |
| int | janus_text2pcap_dump (janus_text2pcap *instance, janus_text2pcap_packet type, gboolean incoming, char *buf, int len, const char *format,...) G_GNUC_PRINTF(6 |
| Dump an RTP or RTCP packet. More... | |
| int int | janus_text2pcap_close (janus_text2pcap *instance) |
| Close a text2pcap recorder. More... | |
| void | janus_text2pcap_free (janus_text2pcap *instance) |
| Free a text2pcap instance. More... | |
Dumping of RTP/RTCP packets to text2pcap or pcap format (headers)
Implementation of a simple helper utility that can be used to dump incoming and outgoing RTP/RTCP packets to pcap or text2pcap format. Saving to pcap natively can be more efficient but will lack some features, as the target will be a legacy (v2.4) .pcap file and not a .pcapng one. When saving to a text file, instead, the resulting file can be passed to the text2pcap application in order to get a .pcap or .pcapng file that can be analyzed via Wireshark or similar applications, e.g.:
/usr/sbin/text2pcap -D -n -l 1 -i 17 -u 1000,2000 -t '%H:%M:%S.' dump.txt dump.pcapng /usr/sbin/wireshark dump.pcapng
While plugins are free to take advantage of this functionality, it's been specifically added to make debugging from the core easier. Enabling and disabling the dump of RTP/RTCP packets for the media traffic of a specific handle is done via the Admin/Monitor API so check the documentation of that section for more details. Notice that starting a new dump on an existing filename will result in the new packets to be appended.
| typedef struct janus_text2pcap janus_text2pcap |
Instance of a text2pcap recorder.
| typedef enum janus_text2pcap_packet janus_text2pcap_packet |
Packet types we can dump.
| int int janus_text2pcap_close | ( | janus_text2pcap * | instance | ) |
Close a text2pcap recorder.
| [in] | instance | Instance of the janus_text2pcap recorder to close |
| janus_text2pcap* janus_text2pcap_create | ( | const char * | dir, |
| const char * | filename, | ||
| int | truncate, | ||
| gboolean | text | ||
| ) |
Create a text2pcap recorder.
| [in] | dir | Path of the directory to save the recording into (will try to create it if it doesn't exist) |
| [in] | filename | Filename to use for the recording |
| [in] | truncate | Number of bytes to truncate each packet at (0 to not truncate at all) |
| [in] | text | Whether we'll save as text, or directly to pcap |
| int janus_text2pcap_dump | ( | janus_text2pcap * | instance, |
| janus_text2pcap_packet | type, | ||
| gboolean | incoming, | ||
| char * | buf, | ||
| int | len, | ||
| const char * | format, | ||
| ... | |||
| ) |
Dump an RTP or RTCP packet.
| [in] | instance | Instance of the janus_text2pcap recorder to dump the packet to |
| [in] | type | Type of the packet we're going to dump |
| [in] | incoming | Whether this is an incoming or outgoing packet |
| [in] | buf | Packet data to dump |
| [in] | len | Size of the packet data to dump |
| [in] | format | Format for the optional string to append to the line, if any |
| void janus_text2pcap_free | ( | janus_text2pcap * | instance | ) |
Free a text2pcap instance.
| [in] | instance | Instance of the janus_text2pcap recorder to free |
| const char* janus_text2pcap_packet_string | ( | janus_text2pcap_packet | type | ) |