1 // Copyright (C) 2002-2015 Federico Montesino Pouzols <fedemp@altern.org>.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with GNU ccRTP.  If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction.  Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License.  This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP.  If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way.  To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36 
37 #ifndef CCXX_RTP_RTPPKT_H_
38 #define CCXX_RTP_RTPPKT_H_
39 
40 #include <ccrtp/base.h>
41 #include <ccrtp/formats.h>
42 #include <ccrtp/CryptoContext.h>
43 
44 NAMESPACE_COMMONCPP
45 
46 /**
47  * @file rtppkt.h
48  *
49  * @short RTP packets handling.
50  **/
51 
52 /**
53  * @defgroup rtppacket RTP data packets manipulation.
54  * @{
55  **/
56 
57 /**
58  * @class RTPPacket
59  * @short A base class for both IncomingRTPPkt and OutgoingRTPPkt.
60  *
61  * Provides common low level header structures and related
62  * methods. This class provides an interface that allows for partial
63  * and generic manipulation of RTP data packets. Values are returned
64  * in host order, except raw structures, which are returned as they
65  * are sent through the network.
66  *
67  * @author David Sugar <dyfet@ostel.com>
68  **/
69 
70 class CryptoContext;
71 
72 class  __EXPORT RTPPacket
73 {
74 private:
75     struct RTPFixedHeader;
76     struct RTPHeaderExt;
77 
78 public:
79     /**
80      * Constructor, construct a packet object given the memory
81      * zone its content (header and payload) is stored. Commonly
82      * used to build RTPPacket objects from incoming data.
83      *
84      * @param block whole packet
85      * @param len total length (header + payload + padding) of the
86      *        packet
87      * @param duplicate whether to memcopy the packet. At present,
88      *        this feature is not used.
89      * @note used in IncomingRTPPkt.
90      **/
91     RTPPacket(const unsigned char* const block, size_t len,
92           bool duplicate = false);
93 
94     /**
95      * Construct a packet object without specifying its real
96      * content yet. Commonly used for outgoing packets. Header
97      * fields and payload must be filled in by another methods or
98      * by a derived constructor.
99      *
100      * @param hdrlen length of the header (including CSRC and extension).
101      * @param plen payload length.
102      * @param paddinglen pad packet to a multiple of paddinglen
103      * @note used in OutgoingRTPPkt.
104      */
105         RTPPacket(size_t hdrlen, size_t plen, uint8 paddinglen, CryptoContext* pcc= NULL);
106 
107     /**
108      * Get the length of the header, including contributing
109      * sources identifiers and header extension, if present.
110      *
111      * @return number of octets.
112      **/
113     inline uint32
getHeaderSize()114     getHeaderSize() const
115     { return hdrSize; }
116 
117     /**
118      * @return pointer to the payload section of the packet.
119      **/
120     inline const uint8* const
getPayload()121     getPayload() const
122     { return (uint8*)(buffer + getHeaderSize()); }
123 
124     /**
125      * @return length of the payload section, in octets.
126      **/
127     inline uint32
getPayloadSize()128     getPayloadSize() const
129     { return payloadSize; }
130 
131     /**
132      * @return value of the PT header field.
133      **/
134     inline PayloadType
getPayloadType()135     getPayloadType() const
136     { return static_cast<PayloadType>(getHeader()->payload); }
137 
138     /**
139      * @return value of the sequence number header field, in host order.
140      **/
141     inline uint16
getSeqNum()142     getSeqNum() const
143     { return cachedSeqNum; }
144 
145     /**
146      * @return packet timestamp in host order.
147      **/
148     inline uint32
getTimestamp()149     getTimestamp() const
150     { return cachedTimestamp; }
151 
152     /**
153      * @return RTP protocol version of packet.
154      **/
155     inline uint8
getProtocolVersion()156     getProtocolVersion() const
157     { return getHeader()->version; }
158 
159     /**
160      * Ask whether the packet contains padding bytes at the end
161      * @return true if the header padding bit is 1.
162      **/
163     inline bool
isPadded()164     isPadded() const
165     { return getHeader()->padding; }
166 
167     /**
168      * Get the number of octets padding the end of the payload
169      * section.
170      *
171      * @return Padding length in octets.
172      **/
173     inline uint8
getPaddingSize()174     getPaddingSize() const
175     { return buffer[total - 1]; }
176 
177     /**
178      * Ask whether the packet is marked (for isntance, is a new
179      * talk spurt in some audio profiles).
180      *
181      * @return true is the header marker bit is 1.
182      **/
183     inline bool
isMarked()184     isMarked() const
185     { return getHeader()->marker; }
186 
187     /**
188      * Ask whether the packet contains header extensions.
189      *
190      * @return true if the header extension bit is 1.
191      **/
192     inline bool
isExtended()193     isExtended() const
194     { return getHeader()->extension; }
195 
196     /**
197      * Get the number of contributing sources specified in the
198      * packet header.
199      **/
200     inline uint16
getCSRCsCount()201     getCSRCsCount() const
202     { return getHeader()->cc; }
203 
204     /**
205      * Get the 32-bit identifiers of the contributing sources for
206      * the packet as an array, of length getCSRCsCount().
207      *
208      * @return An array of CSRC identifiers as they are in the
209      * packet (in network order).
210      **/
211     inline const uint32*
getCSRCs()212     getCSRCs() const
213     { return static_cast<const uint32*>(&(getHeader()->sources[1])); }
214 
215     /**
216      * Get the first 16 bits (in network order) of the header of
217      * the RTP header extension. Its meaning is undefined at this
218      * level.
219      *
220      * @return 0 if the packet has no header extension, otherwise
221      *         the first 16 bits of the header extension, in
222      *         network order.
223      *
224      * @note 0 could be a valid value for the first 16 bits, in
225      *         that case RTPPacket::isExtended() should be use.
226      **/
227     inline uint16
getHdrExtUndefined()228     getHdrExtUndefined() const
229     { return (isExtended()? getHeaderExt()->undefined : 0); }
230 
231     /**
232      * Get the length (in octets) of the data contained in the
233      * header extension. Note that this length does not include
234      * the four octets at the beginning of the header extension.
235      *
236      * @return 0 if the packet has no header extension, otherwise
237      *         the length.
238      *
239      * @note 0 is a valid value for this field, so
240      *       RTPPacket::isExtended() should be used.
241      **/
242     inline uint32
getHdrExtSize()243     getHdrExtSize() const
244     { return (isExtended()?
245           (static_cast<uint32>(ntohs(getHeaderExt()->length)) << 2) :
246           0); }
247 
248     /**
249      * Get the content of the header extension.
250      *
251      * @return NULL if the packet has no header extension, otherwise
252      *         a pointer to the packet header extension content.
253      **/
254     inline const unsigned char*
getHdrExtContent()255     getHdrExtContent() const
256     { return (isExtended() ?
257           (reinterpret_cast<const unsigned char*>(getHeaderExt()) +
258            sizeof(RTPHeaderExt)) :
259           NULL); }
260 
261     /**
262      * Get the raw packet as it will be sent through the network.
263      *
264      * @return memory zone where the raw packet structure is
265      *         stored in.
266      **/
267     inline const unsigned char* const
getRawPacket()268     getRawPacket() const
269     { return buffer; }
270 
271     /**
272      * Get the raw packet length, including header, extension,
273      * payload and padding.
274      *
275      * @return size of the raw packet structure.
276      **/
277     inline uint32
getRawPacketSize()278     getRawPacketSize() const
279     { return total; }
280 
281         inline uint32
getRawPacketSizeSrtp()282         getRawPacketSizeSrtp() const
283         { return total + srtpLength; }
284 
285         inline size_t
getSizeOfFixedHeader()286     getSizeOfFixedHeader() const
287     { return sizeof(RTPFixedHeader); }
288 
289     /**
290      * Re-compute payload length.
291      *
292      * This recomputation may be necessary in case of SRTP. We need to decrypt
293      * the packet before we can handle padding. See @c takeInDataPacket in
294      * @c incqueue.cpp
295      *
296      * @param padding
297      *     If true then set padding flag in RTP header and re-compute
298      *     payloadSize.
299      */
300     void reComputePayLength(bool padding);
301 
302 protected:
303     /**
304      * Destructor, free the buffer provided in the constructor.
305      **/
~RTPPacket()306     inline virtual ~RTPPacket()
307     { endPacket(); }
308 
309     /**
310      * Free memory allocated for the packet.
311      **/
312     void
313     endPacket();
314 
315     /**
316      * Return low level structure for the header of the packet.
317      *
318      * @return RTPFixedHeader pointer to the header of the packet.
319      **/
320     inline RTPFixedHeader*
getHeader()321     getHeader() const
322     { return reinterpret_cast<RTPFixedHeader*>(buffer); }
323 
324     inline void
setExtension(bool e)325     setExtension(bool e)
326     { getHeader()->extension = e; }
327 
328     /**
329      * Get a pointer to RTPHeaderExt pointing after the RTP header
330      * (fixed part plus contributing sources). No check for
331      * for the X bit is done.
332      *
333      * @return header extension if present, garbage if not.
334      **/
335     inline const RTPHeaderExt*
getHeaderExt()336     getHeaderExt() const
337     {
338          uint32 fixsize = sizeof(RTPFixedHeader) + (getHeader()->cc << 2);
339      return (reinterpret_cast<RTPHeaderExt*>(buffer + fixsize));
340     }
341 
342     /**
343      * Obtain the absolute timestamp carried in the packet header.
344      *
345      * @return 32-bit timestamp in host order.
346      **/
347     inline uint32
getRawTimestamp()348     getRawTimestamp() const
349     { return ntohl(getHeader()->timestamp); }
350 
351     inline void
setbuffer(const void * src,size_t len,size_t pos)352     setbuffer(const void* src, size_t len, size_t pos)
353     { memcpy(buffer + pos,src,len); }
354 
355     /// Packet sequence number in host order.
356     uint16 cachedSeqNum;
357     /// Packet timestamp in host order (includes initial shift).
358     uint32 cachedTimestamp;
359 
360         /**
361          * Offset into packet memory pointing to area for SRTP data.
362          *
363          * This offset points to the memory where the SRTP protect will
364          * store the authentication and MKI data.
365          */
366         uint32 srtpDataOffset;
367 
368         /**
369          * Lebgth of additional SRTP data.
370          *
371          * Covers the SRTP authentication and MKI data.
372          */
373         int32 srtpLength;
374 
375         /// total length, including header, payload and padding
376         uint32 total;
377 
378         /// note: payload (not full packet) size.
379         uint32 payloadSize;
380 
381 private:
382     /// packet in memory
383     unsigned char* buffer;
384     /// size of the header, including contributing sources and extensions
385     uint32 hdrSize;
386     /// whether the object was contructed with duplicated = true
387     bool duplicated;
388 
389 #ifdef  CCXX_PACKED
390 #pragma pack(1)
391 #endif
392     /**
393      * @struct RTPFixedHeader
394      * @short RTP fixed header as it is send through the network.
395      *
396      * A low-level representation for generic RTP packet header as
397      * defined in RFC 1889. A packet consists of the fixed RTP
398      * header, a possibly empty list of contributing sources and
399      * the payload. Header contents are kept in network (big
400      * endian) order.
401      **/
402     struct RTPFixedHeader
403     {
404 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
405         /// For big endian boxes
406         unsigned char version:2;       ///< Version, currently 2
407         unsigned char padding:1;       ///< Padding bit
408         unsigned char extension:1;     ///< Extension bit
409         unsigned char cc:4;            ///< CSRC count
410         unsigned char marker:1;        ///< Marker bit
411         unsigned char payload:7;       ///< Payload type
412 #else
413         /// For little endian boxes
414         unsigned char cc:4;            ///< CSRC count
415         unsigned char extension:1;     ///< Extension bit
416         unsigned char padding:1;       ///< Padding bit
417         unsigned char version:2;       ///< Version, currently 2
418         unsigned char payload:7;       ///< Payload type
419         unsigned char marker:1;        ///< Marker bit
420 #endif
421         uint16 sequence;        ///< sequence number
422         uint32 timestamp;       ///< timestamp
423         uint32 sources[1];      ///< contributing sources
424     };
425 
426     /**
427      * @struct RFC2833Payload
428      * @short a structure defining RFC2833 Telephony events.
429      *
430      * structure to define RFC2833 telephony events in RTP.  You can
431      * use this by recasing the pointer returned by getPayload().
432      */
433 
434 public:
435     struct RFC2833Payload
436     {
437 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
438             uint8 event : 8;
439             bool ebit : 1;
440             bool rbit : 1;
441             uint8 vol : 6;
442             uint16 duration : 16;
443 #else
444             uint8 event : 8;
445             uint8 vol : 6;
446             bool rbit : 1;
447             bool ebit : 1;
448             uint16 duration : 16;
449 #endif
450     };
451 
452 private:
453     /**
454      * @struct RTPHeaderExt
455      *
456      * Fixed component of the variable-length header extension,
457      * appended to the fixed header, after the CSRC list, when X
458      * == 1.
459      **/
460     struct RTPHeaderExt
461     {
462         uint16 undefined; ///< to be defined
463         uint16 length;    ///< number of 32-bit words in the extension
464     };
465 #ifdef  CCXX_PACKED
466 #pragma pack()
467 #endif
468 
469     /* definitions for access to most common 2833 fields... */
470 
471 public:
472     /**
473      * Fetch a raw 2833 packet.
474      *
475      * @return low level 2833 data structure.
476      */
getRaw2833Payload(void)477     inline struct RFC2833Payload *getRaw2833Payload(void)
478         {return (struct RFC2833Payload *)getPayload();}
479 
480     /**
481      * Fetch 2833 duration field.
482      *
483      * @return 2833 duration in native host machine byte order.
484      */
get2833Duration(void)485     inline uint16 get2833Duration(void)
486         {return ntohs(getRaw2833Payload()->duration);}
487 
488     /**
489      * Set 2833 duration field.
490      *
491      * @param timestamp to use, native host machine byte order.
492      */
set2833Duration(uint16 timestamp)493     inline void set2833Duration(uint16 timestamp)
494         {getRaw2833Payload()->duration = htons(timestamp);}
495 };
496 
497 /**
498  * @class OutgoingRTPPkt
499  * @short RTP packets being sent.
500  *
501  * This class is intented to construct packet objects just before they
502  * are inserted into the sending queue, so that they are processed in
503  * a understandable and format independent manner inside the stack.
504  *
505  * @author Federico Montesino Pouzols <fedemp@altern.org>
506  **/
507 class __EXPORT OutgoingRTPPkt : public RTPPacket
508 {
509 public:
510     /**
511      * Construct a new packet to be sent, containing several
512      * contributing source identifiers, header extensions and
513      * payload.
514          *
515          * A new copy in memory (holding all this components
516      * along with the fixed header) is created. If the pointer
517          * to the SRTP CryptoContext is not NULL and holds a CryptoContext
518          * for the SSRC take the SSRC data into account when computing
519          * the required memory buffer.
520      *
521      * @param csrcs array of countributing source 32-bit
522      *        identifiers, in host order.
523      * @param numcsrc number of CSRC identifiers in the array.
524      * @param hdrext whole header extension.
525      * @param hdrextlen size of whole header extension, in octets.
526      * @param data payload.
527      * @param datalen payload length, in octets.
528      * @param paddinglen pad packet to a multiple of paddinglen.
529          * @param pcc Pointer to the SRTP CryptoContext, defaults to NULL
530          * if not specified.
531      *
532      * @note For efficiency purposes, since this constructor is
533      * valid for all packets but is too complex for the common
534      * case, two simpler others are provided.
535      **/
536     OutgoingRTPPkt(const uint32* const csrcs, uint16 numcsrc,
537                const unsigned char* const hdrext, uint32 hdrextlen,
538                const unsigned char* const data, size_t datalen,
539                        uint8 paddinglen= 0, CryptoContext* pcc= NULL);
540 
541     /**
542      * Construct a new packet to be sent, containing several
543      * contributing source identifiers and payload.
544          *
545          * A new copy in
546      * memory (holding all this components along with the fixed
547          * header) is created. If the pointer
548          * to the SRTP CryptoContext is not NULL and holds a CryptoContext
549          * for the SSRC take the SSRC data into account when computing
550          * the required memory buffer.
551      *
552      * @param csrcs array of countributing source 32-bit
553      * identifiers, in host order.
554      * @param numcsrc number of CSRC identifiers in the array.
555      * @param data payload.
556      * @param datalen payload length, in octets.
557      * @param paddinglen pad packet to a multiple of paddinglen.
558          * @param pcc Pointer to the SRTP CryptoContext, defaults to NULL
559          * if not specified.
560          **/
561     OutgoingRTPPkt(const uint32* const csrcs, uint16 numcsrc,
562                const unsigned char* const data, size_t datalen,
563                        uint8 paddinglen= 0, CryptoContext* pcc= NULL);
564 
565     /**
566      * Construct a new packet (fast variant, with no contributing
567      * sources and no header extension) to be sent.
568          *
569          * A new copy in
570          * memory (holding the whole packet) is created. If the pointer
571          * to the SRTP CryptoContext is not NULL and holds a CryptoContext
572          * for the SSRC take the SSRC data into account when computing
573          * the required memory buffer.
574      *
575      * @param data payload.
576      * @param datalen payload length, in octets.
577      * @param paddinglen pad packet to a multiple of paddinglen.
578          * @param pcc Pointer to the SRTP CryptoContext, defaults to NULL
579          * if not specified.
580          **/
581     OutgoingRTPPkt(const unsigned char* const data, size_t datalen,
582                        uint8 paddinglen= 0, CryptoContext* pcc= NULL);
583 
~OutgoingRTPPkt()584     ~OutgoingRTPPkt()
585     { }
586 
587     /**
588      * @param pt Packet payload type.
589      **/
590     inline void
setPayloadType(PayloadType pt)591     setPayloadType(PayloadType pt)
592     { getHeader()->payload = pt; }
593 
594     /**
595          * Sets the sequence number in the header.
596          *
597      * @param seq Packet sequence number, in host order.
598      **/
599     inline void
setSeqNum(uint16 seq)600     setSeqNum(uint16 seq)
601     {
602         cachedSeqNum = seq;
603         getHeader()->sequence = htons(seq);
604     }
605 
606     /**
607      * @param pts Packet timestamp, in host order.
608      **/
609     inline void
setTimestamp(uint32 pts)610     setTimestamp(uint32 pts)
611     {
612         cachedTimestamp = pts;
613         getHeader()->timestamp = htonl(pts);
614     }
615 
616     /**
617      * Set synchronization source numeric identifier.
618      *
619      * @param ssrc 32-bit Synchronization SouRCe numeric
620      * identifier, in host order.
621      **/
622     inline void
setSSRC(uint32 ssrc)623     setSSRC(uint32 ssrc) const
624     { getHeader()->sources[0] = htonl(ssrc); }
625 
626     /**
627      * Set synchronization source numeric identifier. Special
628      * version to save endianness conversion.
629      *
630      * @param ssrc 32-bit Synchronization SouRCe numeric
631      * identifier, in network order.
632      **/
633     inline void
setSSRCNetwork(uint32 ssrc)634     setSSRCNetwork(uint32 ssrc) const
635     { getHeader()->sources[0] = ssrc; }
636 
637     /**
638      * Specify the value of the marker bit. By default, the marker
639      * bit of outgoing packets is false/0. This method allows to
640      * explicity specify and change that value.
641      *
642      * @param mark value for the market bit.
643      */
644     inline void
setMarker(bool mark)645     setMarker(bool mark)
646     { getHeader()->marker = mark; }
647 
648         /**
649          * Called packet is setup.
650          *
651          * This private method computes the SRTP data and stores it in the
652          * packet. Then encrypt the payload data (ex padding).
653          */
654         void protect(uint32 ssrc, CryptoContext* pcc);
655 
656     /**
657      * Outgoing packets are equal if their sequence numbers match.
658      **/
659     inline bool
660     operator==(const OutgoingRTPPkt &p) const
661     { return ( this->getSeqNum() == p.getSeqNum() ); }
662 
663     /**
664      * Outgoing packets are not equal if their sequence numbers differ.
665      **/
666     inline bool
667     operator!=(const OutgoingRTPPkt &p) const
668     { return ( this->getSeqNum() != p.getSeqNum() ); }
669 
670 private:
671     /**
672      * Copy constructor from objects of its same kind, declared
673      * private to avoid its use.
674      **/
675     OutgoingRTPPkt(const OutgoingRTPPkt &o);
676 
677     /**
678      * Assignment operator from objects of its same kind, declared
679      * private to avoid its use.
680      **/
681     OutgoingRTPPkt&
682     operator=(const OutgoingRTPPkt &o);
683 
684     /**
685      * Set the list of CSRC identifiers in an RTP packet,
686      * switching host to network order.
687      */
688     void setCSRCArray(const uint32* const csrcs, uint16 numcsrc);
689 
690 };
691 
692 /**
693  * @class IncomingRTPPkt
694  *
695  * @short RTP packets received from other participants.
696  *
697  * This class is intented to construct a packet object just after
698  * every packet is received by the scheduled queue, so that they are
699  * processed in an understandable and format independent manner inside
700  * the stack.
701  *
702  * @author Federico Montesino Pouzols <fedemp@altern.org>
703  */
704 class __EXPORT IncomingRTPPkt : public RTPPacket
705 {
706 public:
707     /**
708      * Build an RTP packet object from a data buffer. This
709      * constructor first performs a generic RTP data packet header
710      * check, whose result can be checked via isHeaderValid().
711      *
712      * @param block pointer to the buffer the whole packet is stored in.
713      * @param len length of the whole packet, expressed in octets.
714      *
715      * @note If check fails, the packet object is
716      * incomplete. checking isHeaderValid() is recommended before
717      * using a new RTPPacket object.
718      **/
719     IncomingRTPPkt(const unsigned char* block, size_t len);
720 
~IncomingRTPPkt()721     ~IncomingRTPPkt()
722     { }
723 
724     /**
725      * Get validity of this packet
726      * @return whether the header check performed at construction
727      *         time ended successfully.
728      **/
729     inline bool
isHeaderValid()730     isHeaderValid()
731     { return headerValid; }
732 
733     /**
734      * Get synchronization source numeric identifier.
735      *
736      * @return 32-bits Synchronization SouRCe numeric identifier,
737      * in host order.
738      **/
739     inline uint32
getSSRC()740     getSSRC() const
741     { return cachedSSRC; }
742 
743         /**
744          * Unprotect a received packet.
745          *
746          * Perform SRTP processing on this packet.
747          *
748          * @param pcc Pointer to SRTP CryptoContext.
749          * @return
750          *     one if no errors, -1 if authentication failed, -2 if
751          *     replay check failed
752          */
753         int32
754         unprotect(CryptoContext* pcc);
755 
756     /**
757      * Two incoming packets are equal if they come from sources
758      * with the same SSRC and have the same sequence number.
759      **/
760     inline bool
761     operator==(const IncomingRTPPkt &p) const
762     { return ( (this->getSeqNum() == p.getSeqNum()) &&
763            (this->getSSRC() == p.getSSRC()) ); }
764 
765     /**
766      * Two incoming packets are not equal if they come from
767      * different sources or have different sequence numbers.
768      **/
769     inline bool
770     operator!=(const IncomingRTPPkt &p) const
771     { return !( *this == p ); }
772 
773 private:
774     /**
775      * Copy constructor from objects of its same kind, declared
776      * private to avoid its use.
777      **/
778     IncomingRTPPkt(const IncomingRTPPkt &ip);
779 
780     /**
781      * Assignment operator from objects of its same kind, declared
782      * private to avoid its use.
783      */
784     IncomingRTPPkt&
785     operator=(const IncomingRTPPkt &ip);
786 
787     /// Header validity, checked at construction time.
788     bool headerValid;
789     /// SSRC 32-bit identifier in host order.
790     uint32 cachedSSRC;
791     // Masks for RTP header validation: types matching RTCP SR or
792     // RR must be rejected to avoid accepting misaddressed RTCP
793     // packets.
794     static const uint16 RTP_INVALID_PT_MASK;
795     static const uint16 RTP_INVALID_PT_VALUE;
796 };
797 
798 /** @}*/ // rtppacket
799 
800 END_NAMESPACE
801 
802 #endif  // ndef CCXX_RTP_RTPPKT_H_
803 
804 /** EMACS **
805  * Local variables:
806  * mode: c++
807  * c-basic-offset: 8
808  * End:
809  */
810