summaryrefslogtreecommitdiff
path: root/orkaudio/audiocaptureplugins/voip/Rtp.cpp
blob: 9c0eaa6e0903218f432cc876c2d652ec6ac665e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Oreka -- A media capture and retrieval platform
 * 
 * Copyright (C) 2005, orecx LLC
 *
 * http://www.orecx.com
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License.
 * Please refer to http://www.gnu.org/copyleft/gpl.html
 *
 */

#define _WINSOCKAPI_		// prevents the inclusion of winsock.h

#include "ace/OS_NS_arpa_inet.h"
#include "Rtp.h"

RtpPacketInfo::RtpPacketInfo()
{
	memset(m_sourceMac, 0, sizeof(m_sourceMac));
	memset(m_destMac, 0, sizeof(m_destMac));
	m_sourceIp.s_addr = 0;
	m_destIp.s_addr = 0;
	m_sourcePort = 0;
	m_destPort = 0;
	m_payloadSize = 0;
	m_payloadType = 0;
	m_payload = NULL;
	m_seqNum = 0;
	m_timestamp = 0;
	m_arrivalTimestamp = 0;
}

void RtpPacketInfo::ToString(CStdString& string)
{
	char sourceIp[16];
	ACE_OS::inet_ntop(AF_INET, (void*)&m_sourceIp, sourceIp, sizeof(sourceIp));
	char destIp[16];
	ACE_OS::inet_ntop(AF_INET, (void*)&m_destIp, destIp, sizeof(destIp));
	string.Format("%s,%d %s,%d seq:%u ts:%u len:%d type:%d ats:%u", 
		sourceIp, m_sourcePort, destIp, m_destPort, m_seqNum, 
		m_timestamp, m_payloadSize, m_payloadType, m_arrivalTimestamp);
}

void RtpEventInfo::ToString(CStdString& string)
{
	string.Format("event:%d e:%d r:%d volume:%d duration:%d timestamp:%u", m_event, m_e, m_r, m_volume, m_duration, m_startTimestamp);
}

void RtcpSrcDescriptionPacketInfo::ToString(CStdString& string)
{
	char sourceIp[16];
	char destIp[16];

	ACE_OS::inet_ntop(AF_INET, (void*)&m_sourceIp, sourceIp, sizeof(sourceIp));
	ACE_OS::inet_ntop(AF_INET, (void*)&m_destIp, destIp, sizeof(destIp));

	string.Format("%s,%d %s,%d username:%s domain:%s port:%s", sourceIp, m_sourcePort, destIp, m_destPort, m_cnameUsername, m_cnameDomain, m_cnamePort);
}