r2610 - trunk/libminisip/include/libminisip/rtp
werner at minisip.org
werner at minisip.org
Sun Jun 4 10:07:09 CEST 2006
Author: werner
Date: 2006-06-04 10:07:08 +0200 (Sun, 04 Jun 2006)
New Revision: 2610
Modified:
trunk/libminisip/include/libminisip/rtp/CryptoContext.h
trunk/libminisip/include/libminisip/rtp/RtpHeader.h
trunk/libminisip/include/libminisip/rtp/RtpPacket.h
trunk/libminisip/include/libminisip/rtp/SRtpPacket.h
Log:
Add ZRTP support, protected with #ifdef ZRTP_SUPPORT
Modified: trunk/libminisip/include/libminisip/rtp/CryptoContext.h
===================================================================
--- trunk/libminisip/include/libminisip/rtp/CryptoContext.h 2006-06-04 08:04:58 UTC (rev 2609)
+++ trunk/libminisip/include/libminisip/rtp/CryptoContext.h 2006-06-04 08:07:08 UTC (rev 2610)
@@ -43,7 +43,7 @@
CryptoContext( uint32_t ssrc );
CryptoContext( uint32_t ssrc, int roc, uint16_t seq_no,
- int key_deriv_rate,
+ int64_t key_deriv_rate,
//enum encr_method encryption,
uint8_t ealg,
//enum auth_method authentication,
@@ -88,7 +88,7 @@
unsigned int roc;
unsigned int guessed_roc;
unsigned short s_l;
- unsigned int key_deriv_rate;
+ int64_t key_deriv_rate;
/* bitmask for replay check */
uint64_t replay_window;
Modified: trunk/libminisip/include/libminisip/rtp/RtpHeader.h
===================================================================
--- trunk/libminisip/include/libminisip/rtp/RtpHeader.h 2006-06-04 08:04:58 UTC (rev 2609)
+++ trunk/libminisip/include/libminisip/rtp/RtpHeader.h 2006-06-04 08:07:08 UTC (rev 2610)
@@ -1,88 +1,89 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef RTPHEADER_H
-#define RTPHEADER_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<vector>
-
-class LIBMINISIP_API RtpHeader{
-
- public:
- RtpHeader();
- void setVersion(int v);
- void setExtension(int x);
- void setCSRCCount(int cc);
- void setMarker(int m);
- bool getMarker();
- void setPayloadType(int pt);
- int getPayloadType();
- void setSeqNo(uint16_t seq_no);
- uint16_t getSeqNo();
- void setTimestamp(uint32_t timestamp);
- uint32_t getTimestamp();
- void setSSRC(uint32_t ssrc);
- uint32_t getSSRC();
- void addCSRC(int csrc);
-
-#ifdef TCP_FRIENDLY
- void setRttEstimate(uint32_t rtt){tcpFriendlyMode=true; rttestimate=rtt;}
- uint32_t getRttEstimate(){return rttestimate;}
-
- void setSendingTimestamp(uint32_t ts){tcpFriendlyMode=true; sending_timestamp=ts;}
- uint32_t getSendingTimestamp(){return sending_timestamp;}
-#endif
-
-#ifdef DEBUG_OUTPUT
- void printDebug();
-#endif
-
- int size();
- char *getBytes();
-
- int CSRC_count;
- int version;
- int extension;
- int marker;
- int payload_type;
- uint16_t sequence_number;
- uint32_t timestamp;
- uint32_t SSRC;
- std::vector<int> CSRC;
-
- private:
-#ifdef TCP_FRIENDLY
- //code to support the variable bandwidth experiments in the
- //thesis by David Tlahuetl
- bool tcpFriendlyMode;
- uint32_t sending_timestamp;
- uint32_t rttestimate;
-#endif
-
-};
-
-#endif
-
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef RTPHEADER_H
+#define RTPHEADER_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<vector>
+
+class LIBMINISIP_API RtpHeader{
+
+ public:
+ RtpHeader();
+ void setVersion(int v);
+ void setExtension(int x);
+ int getExtension();
+ void setCSRCCount(int cc);
+ void setMarker(int m);
+ bool getMarker();
+ void setPayloadType(int pt);
+ int getPayloadType();
+ void setSeqNo(uint16_t seq_no);
+ uint16_t getSeqNo();
+ void setTimestamp(uint32_t timestamp);
+ uint32_t getTimestamp();
+ void setSSRC(uint32_t ssrc);
+ uint32_t getSSRC();
+ void addCSRC(int csrc);
+
+#ifdef TCP_FRIENDLY
+ void setRttEstimate(uint32_t rtt){tcpFriendlyMode=true; rttestimate=rtt;}
+ uint32_t getRttEstimate(){return rttestimate;}
+
+ void setSendingTimestamp(uint32_t ts){tcpFriendlyMode=true; sending_timestamp=ts;}
+ uint32_t getSendingTimestamp(){return sending_timestamp;}
+#endif
+
+#ifdef DEBUG_OUTPUT
+ void printDebug();
+#endif
+
+ int size();
+ char *getBytes();
+
+ int CSRC_count;
+ int version;
+ int extension;
+ int marker;
+ int payload_type;
+ uint16_t sequence_number;
+ uint32_t timestamp;
+ uint32_t SSRC;
+ std::vector<int> CSRC;
+
+ private:
+#ifdef TCP_FRIENDLY
+ //code to support the variable bandwidth experiments in the
+ //thesis by David Tlahuetl
+ bool tcpFriendlyMode;
+ uint32_t sending_timestamp;
+ uint32_t rttestimate;
+#endif
+
+};
+
+#endif
+
Modified: trunk/libminisip/include/libminisip/rtp/RtpPacket.h
===================================================================
--- trunk/libminisip/include/libminisip/rtp/RtpPacket.h 2006-06-04 08:04:58 UTC (rev 2609)
+++ trunk/libminisip/include/libminisip/rtp/RtpPacket.h 2006-06-04 08:07:08 UTC (rev 2610)
@@ -1,67 +1,114 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef RTPPACKET_H
-#define RTPPACKET_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/MemObject.h>
-
-#include<libmnetutil/UDPSocket.h>
-#include<libmnetutil/IPAddress.h>
-
-#include<libminisip/rtp/RtpHeader.h>
-
-class LIBMINISIP_API RtpPacket: public MObject {
- public:
- RtpPacket();
- RtpPacket(unsigned char *content, int content_length, int seq_no, unsigned timestamp, unsigned ssrc);
- RtpPacket(RtpHeader hdr, unsigned char *content, int content_length);
- virtual ~RtpPacket();
-
- static RtpPacket *readPacket(UDPSocket &udp_sock, int timeout=-1);
-
- void sendTo(UDPSocket &udp_sock, IPAddress &to_addr, int port);
-
- RtpHeader &getHeader();
-
- unsigned char *getContent();
- int getContentLength();
-
-#ifdef DEBUG_OUTPUT
- void printDebug();
-#endif
-
- virtual char *getBytes();
- virtual int size();
-
- protected:
-
- RtpHeader header;
- int content_length;
- unsigned char *content;
-};
-
-#endif
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef RTPPACKET_H
+#define RTPPACKET_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/MemObject.h>
+
+#include<libmnetutil/UDPSocket.h>
+#include<libmnetutil/IPAddress.h>
+
+#include<libminisip/rtp/RtpHeader.h>
+
+/**
+ * This class implements the RTP header.
+ *
+ * As a specific feature the RTP packet class handles the extension
+ * header feature of RTP. This is because the extension header is not
+ * standard RTP header but contains more application related data.
+ *
+ */
+
+class LIBMINISIP_API RtpPacket: public MObject {
+ public:
+ RtpPacket();
+ RtpPacket(unsigned char *content, int content_length, int seq_no, unsigned timestamp, unsigned ssrc);
+ RtpPacket(RtpHeader hdr, unsigned char *content, int content_length);
+ virtual ~RtpPacket();
+
+ static RtpPacket *readPacket(UDPSocket &udp_sock, int timeout=-1);
+
+ void sendTo(UDPSocket &udp_sock, IPAddress &to_addr, int port);
+
+ RtpHeader &getHeader();
+
+ unsigned char *getContent();
+ int getContentLength();
+#ifdef ZRTP_SUPPORT
+ /**
+ * Get length of extension header in bytes (not in words).
+ *
+ * @return
+ * Length in bytes of extension header
+ */
+ int getExtensionLength() { return extensionLength; };
+
+ /*
+ * Get pointer to extension header data.
+ *
+ * The pointer is returned as unsigned char because the extension
+ * header data structure is application dependend.
+ *
+ * @return
+ * Returns the pointer to the extension header
+ */
+ unsigned char* getExtensionHeader() { return extensionHeader; };
+
+ /*
+ * Set extension header for this RTP packet.
+ *
+ * This method prepends the extension header to data thay may already
+ * exist in this packet. The method updates the overall data content
+ * as well as the lentgh. Als the extension header flag is set.
+ *
+ * @param data
+ * Pointer to extensione header data.
+ * @param length
+ * Length of extension header data in bytes.
+ */
+ void setExtHeader(unsigned char* data, int length);
+#endif // ZRTP_SUPPORT
+
+#ifdef DEBUG_OUTPUT
+ void printDebug();
+#endif
+
+ virtual char *getBytes();
+ virtual int size();
+
+ protected:
+
+ RtpHeader header;
+ int content_length;
+ unsigned char *content;
+#ifdef ZRTP_SUPPORT
+ int extensionLength;
+ unsigned char* extensionHeader;
+#endif
+};
+
+#endif
Modified: trunk/libminisip/include/libminisip/rtp/SRtpPacket.h
===================================================================
--- trunk/libminisip/include/libminisip/rtp/SRtpPacket.h 2006-06-04 08:04:58 UTC (rev 2609)
+++ trunk/libminisip/include/libminisip/rtp/SRtpPacket.h 2006-06-04 08:07:08 UTC (rev 2610)
@@ -1,77 +1,78 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004
- *
- * Authors: Israel Abad <i_abad at terra.es>
- * Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-#ifndef SRTPPACKET_H
-#define SRTPPACKET_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmnetutil/UDPSocket.h>
-#include<libmnetutil/IPAddress.h>
-
-#include<libminisip/rtp/CryptoContext.h>
-#include<libminisip/rtp/RtpPacket.h>
-
-RtpPacket * readRtpPacket( MRef<CryptoContext *>, UDPSocket * socket );
-
-class LIBMINISIP_API SRtpPacket : public RtpPacket{
- public:
- SRtpPacket();
- SRtpPacket(CryptoContext *scontext, RtpPacket *rtppacket);
- SRtpPacket(RtpHeader hdr,
- unsigned char *content,
- int content_length,
- unsigned char *tag,
- int tag_length,
- unsigned char *mki,
- int mki_length);
- SRtpPacket( unsigned char *content, int content_length,
- int seq_no, unsigned timestamp,
- unsigned ssrc);
- virtual ~SRtpPacket();
-
- static SRtpPacket *readPacket( UDPSocket &udp_sock, int timeout=-1 ); // static????
-
- void protect( MRef<CryptoContext *> scontext );
- int unprotect( MRef<CryptoContext *> scontext );
-
- unsigned char *get_tag();
- unsigned int get_tag_length();
- void remove_tag();
- void set_tag(unsigned char *tag);
-
- virtual char * getBytes();
- virtual int size();
-
-
- private:
- bool encrypted;
- unsigned char *tag;
- unsigned int tag_length;
- unsigned char * mki;
- unsigned int mki_length;
-};
-
-
-#endif
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Israel Abad <i_abad at terra.es>
+ * Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+#ifndef SRTPPACKET_H
+#define SRTPPACKET_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmnetutil/UDPSocket.h>
+#include<libmnetutil/IPAddress.h>
+
+#include<libminisip/rtp/CryptoContext.h>
+#include<libminisip/rtp/RtpPacket.h>
+
+RtpPacket * readRtpPacket( MRef<CryptoContext *>, UDPSocket * socket );
+
+class LIBMINISIP_API SRtpPacket : public RtpPacket{
+ public:
+ SRtpPacket();
+ SRtpPacket(CryptoContext *scontext, RtpPacket *rtppacket);
+ SRtpPacket(RtpHeader hdr,
+ unsigned char *content,
+ int content_length,
+ unsigned char *tag,
+ int tag_length,
+ unsigned char *mki,
+ int mki_length);
+ SRtpPacket( unsigned char *content, int content_length,
+ int seq_no, unsigned timestamp,
+ unsigned ssrc);
+ virtual ~SRtpPacket();
+
+ static SRtpPacket *readPacket( UDPSocket &udp_sock, MRef<IPAddress *>&from, int timeout=-1);
+ // static????
+
+ void protect( MRef<CryptoContext *> scontext );
+ int unprotect( MRef<CryptoContext *> scontext );
+
+ unsigned char *get_tag();
+ unsigned int get_tag_length();
+ void remove_tag();
+ void set_tag(unsigned char *tag);
+
+ virtual char * getBytes();
+ virtual int size();
+
+
+ private:
+ bool encrypted;
+ unsigned char *tag;
+ unsigned int tag_length;
+ unsigned char * mki;
+ unsigned int mki_length;
+};
+
+
+#endif
More information about the Minisip-devel
mailing list