File: rtcplib.h

package info (click to toggle)
rtpengine 13.5.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,676 kB
  • sloc: ansic: 86,764; perl: 59,422; python: 3,193; sh: 1,030; makefile: 693; asm: 211
file content (49 lines) | stat: -rw-r--r-- 996 bytes parent folder | download
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
#ifndef _RTCPLIB_H_
#define _RTCPLIB_H_

#include <glib.h>
#include "str.h"
#include "compat.h"


struct rtcp_header {
#if G_BYTE_ORDER == G_BIG_ENDIAN
	unsigned	    version:2;	/**< packet type            */
	unsigned	    p:1;	/**< padding flag           */
	unsigned	    count:5;	/**< varies by payload type */
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
	unsigned	    count:5;	/**< varies by payload type */
	unsigned	    p:1;	/**< padding flag           */
	unsigned	    version:2;	/**< packet type            */
#else
#error "byte order unknown"
#endif
	unsigned char pt;
	uint16_t length;
} __attribute__ ((packed));

struct rtcp_packet {
	struct rtcp_header header;
	uint32_t ssrc;
} __attribute__ ((packed));


/* RFC 5761 section 4 */
INLINE bool rtcp_demux_is_rtcp(const str *s) {
	struct rtcp_packet *rtcp;

	if (s->len < sizeof(*rtcp))
		return false;

	rtcp = (void *) s->s;

	if (rtcp->header.pt < 194)
		return false;
	if (rtcp->header.pt > 223)
		return false;
	return true;
}



#endif