00001 // $Id: RTPPacket.hh 1772 2011-03-10 12:45:21Z tho $ 00002 // 00003 // Copyright (C) 2006 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Philipp Batroff <pug@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #ifndef HH_SENF_Packets_DefaultBundle_RTPPacket_ 00027 #define HH_SENF_Packets_DefaultBundle_RTPPacket_ 1 00028 00029 // Custom includes 00030 #include <senf/Packets/Packets.hh> 00031 00032 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00033 namespace senf { 00034 00035 struct RTPPacketParser : public PacketParserBase 00036 { 00037 # include SENF_PARSER() 00038 SENF_PARSER_BITFIELD ( version, 2, unsigned ); //Version (RFC 3550) 00039 SENF_PARSER_BITFIELD ( padding, 1, bool ); //1 if padding behind payload 00040 SENF_PARSER_BITFIELD ( extension, 1, bool ); 00041 SENF_PARSER_BITFIELD_RO ( csrcCount, 4, unsigned ); //0-15,define the number of contributing sources 00042 SENF_PARSER_BITFIELD ( marker, 1, bool ); //Marker M=1, used to signal speech silent compression; further use in combination with PT to be defined 00043 SENF_PARSER_BITFIELD ( payloadType, 7, unsigned ); //Payload Type; e.g. PCM=8 (RFC 3550) 00044 SENF_PARSER_FIELD ( seqNumber, UInt16Parser ); //random number to identify initial segment of a stream, increment by 1 used to resequence segments at receiver 00045 SENF_PARSER_FIELD ( timeStamp, UInt32Parser ); //signals sampling time of 1st byte of payload; initialized; used to calculate Jitter between segments 00046 SENF_PARSER_FIELD ( synSourceId, UInt32Parser ); //Synchronization source identifier; identifier of RFTP stream source (random number) in case of conferencing identifier of mixer 00047 SENF_PARSER_VECTOR (csrcOpt, csrcCount, UInt32Parser ); 00048 00049 SENF_PARSER_FINALIZE(RTPPacketParser); 00050 00051 bool valid() const { return version() == 2; } 00052 }; 00053 00054 struct RTPPacketType 00055 : public PacketTypeBase, 00056 public PacketTypeMixin<RTPPacketType> 00057 { 00058 typedef PacketTypeMixin<RTPPacketType> mixin; 00059 typedef ConcretePacket<RTPPacketType> packet; 00060 typedef RTPPacketParser parser; 00061 00062 using mixin::nextPacketRange; 00063 using mixin::init; 00064 using mixin::initSize; 00065 00066 static void dump(packet p, std::ostream & os); 00067 }; 00068 00069 typedef RTPPacketType::packet RTPPacket; 00070 00071 } 00072 00073 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00074 #endif