--- /dev/null
+[submodule "linphone/oRTP"]
+ path = linphone/oRTP
+ url = git://git.linphone.org/ortp.git
--- /dev/null
+Subproject commit 305f3368f583102d1f8a788592dbabb92798edf1
+++ /dev/null
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.guess
-config.log
-config.status
-config.sub
-configure
-depcomp
-install-sh
-libtool
-ltmain.sh
-missing
-ortp-config.h
-ortp-config.h.in
-ortp.defs
-ortp.pc
-ortp.spec
-stamp-h1
-doc
-ortp.doxygen
-.settings
+++ /dev/null
-Simon MORLAT (simon dot morlat at linphone dot org) is the author the oRTP library.
-
-
-Lovadina Nicola < lovadina dot nicola dot 10272 at unimo dot it > worked on RTCP support.
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-2007-07-26 Francois-Xavier Kowalski <fix@hp.com>
-
- * pkg.list: 1.3
- Do not run makewhatis when installing EPM-generated package.
-
-2007-04-19 Francois-Xavier Kowalski <fix@hp.com>
-
- * ortp.spec.in (Requires): 1.4
- Adapt to new documentation generation change from gtk-doc to
- Doxygen.
-
- * Makefile.am (docdir): 1.27
- automake's docdir is not always defined & is generally not
- package specific, so we manually define docdir & pkgdocdir.
-
-2007-03-01 Francois-Xavier Kowalski <fix@hp.com>
-
- * include/ortp/payloadtype.h: 1.28
- Encompass every declaration (whether lvalue or not) under extern
- "C".
-
-2007-01-18 Francois-Xavier Kowalski <fix@hp.com>
-
- * oRTP/Makefile.am: 1.24
- Fix RPM package generattion to cope with
- <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206841>
-
-2006-10-24 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com>
-
- * include/ortp/port.h: 1.21
- * src/scheduler.h (ortp_get_scheduler): 1.13
- Disable some Intel C/C++ warnings to build with icc.
-
- * include/ortp/stun_udp.h (__STUN_UDP_H__): 1.6
- * include/ortp/stun.h: 1.6
- Use <ortp/port.h>
-
-2006-07-10 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com>
-
- * configure.ac: 1.89
- * gtk-doc.make (dist-check-gtkdoc): 1.1
- Non-fatal but incomplete "make dist" when gtk-doc is not
- installed.
-
-2006-07-07 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com>
-
- * src/avprofile.c (NORMAL_BITRATE): 1.27
- Use ISO C/99 tagged struct syntax rather than GCC's legacy one.
-
-2006-07-07 Francois-Xavier Kowalski <fix@hp.com>
-
- * src/rtpsession.c (RTP_SEQ_IS_GREATER): 1.132
- Fix comment content (using <>) that breaks gtkdoc SGML
- generation.
-
- * include/ortp/event.h: 1.3
- OrtpEventData cannot be a type a s struct at the same time.
-
- * ortp.spec.in (Requires): 1.2
- Drop glib option
-
- * gtk-doc.make:
- * docs/Makefile.am (#DOC_MAIN_SGML_FILE): 1.7
- * Makefile.am
- Use slightly modified gtkdocize.
-
- * ortp.spec.in (Requires): 1.2
- Force build of gtk-doc, as the default choice that comes with
- GTK_DOC_CHECK m4 macro is "no".
-
-2006-07-06 Francois-Xavier Kowalski <fix@hp.com>
-
- * src/payloadtype.c (rtp_profile_destroy): 1.20
- avoid double-free
-
- * configure.ac: 1.88
- ortp-0.10.1.1
-
-Friday March 10 2006 : ortp-0.9.1
- - fix package name (was 0.9.0.)
-
-Wednesday March 8 2006 : ortp-0.9.0
- - a lot of cleanups, glib dropped, win32 port reactivated
-
-Tuesday December 20 2005 : ortp-0.8.1
- - change session's clockrate dependant parameters upon payload type changed events at socket level
- - rtp_session_set_recv_buf_size() added.
- - bugfix in rtp_session_set_remote_addr()
- - memory leak fixed in rtp_profile_destroy()
-
-Wednesday December 07 2005: ortp-0.8.0
- - make package modifications
- - make rpm added
- - add support for different payload types for incoming and outgoing stream (which breaks api compatibility)
- - prefix all PayloadType with payload_type_* to avoid naming conflicts
-
-Wednesday August 24 2005: ortp-0.7.1
- - added patch for pkgconfig support from Jean-Philippe Barrette-LaPierre
-
-Monday August 8 2005: ortp-0.7.1pre5
- - adaptive jitter buffer improvements
- - timestamp compensated packets returned by rtp_session_recvm_with_ts
- - new payload definitions.
-
-Tuesday August 2 2005: ortp-0.7.1pre4
- - adaptive jitter buffer cleanups.
- - hton24 utility function added for RTCP
-
-Tuesday July 4 2005: ortp-0.7.1pre3
- - improve automatic jitter buffer: no more closed-loop; just estimation.
- - merge patch for multicast from Samuel Thibault
- - merge patch for parsing of rtcp packets from Nicola Baldo
- - add static payload definitions for g723.1 and g729.
-
-Wednesday November 17 2004: ortp-0.7.0 series starts
- - add automatic jitter buffer:
- * compensate clock slides
- * estimate the jitter and sets the minimum jitter compensation delay accordingly
- - posix timer simplified
- - less system calls: use non blocking recv() and don't use select() or poll()
- - add new functions for optimized packet sending
- - recv() and send() are always made within the rtp_session_recv..() and rtp_session_send..()
- functions. That means that scheduled non blocking mode does no more work as it worked before, ie
- that packet will be sent immediately rather than being sent on time by the scheduler as it was before.
- - HPUX kernel target removed.
- - scheduler always built.
-
-Tuesday August 12 2003 : ortp-0.6.3
- - some improvements by Aymeric Moizard for Win32 build
- - some bug fixes concerning ipv6 support.
-
-Thursday August 7 2003 : ortp-0.6.2
- - just some minor improvements for using oRTP in a C++ environment.
-
-Wednesday January 8 2003: ortp-0.6.0
- - many bug fixes by Telisma: the most important bug concerned the windows port.
- - some new functionnalities concerning the RTP profiles and payload management.
- - ported to glib-2.0 .
-
-Monday September 23 2002: ortp-0.5.0
- - ortp has been ported to the Microsoft Windows OS (version 2000 and later) by Eloquant
- (http://www.eloquant.com)
- - some bug fixes and improvements of the windows port have been made by Telisma
- (http://www.telisma.com)
-
-Wednesday June 5 2002: ortp-0.4.4
- - Some crashing bugs fixed.
-
-Wednesday May 15 2002: ortp-0.4.3
- - Install include files properly.
-
-Tuesday May 7 2002: ortp-0.4.2
- - First official and public release of oRTP.
+++ /dev/null
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
-
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
-Basic Installation
-==================
-
- These are generic installation instructions.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.)
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. Run `./configure --help'
-for details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
-
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
-
- *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on. Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
- CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
- OS KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
- If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
-produce code for.
-
- If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
- Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
-
- ./configure CC=/usr/local2/bin/gcc
-
-will cause the specified gcc to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-`configure' Invocation
-======================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--help'
-`-h'
- Print a summary of the options to `configure', and exit.
-
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`--cache-file=FILE'
- Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
- disable caching.
-
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
-
+++ /dev/null
-# linphone/oRTP/Makefile.am --
-
-EXTRA_DIST = oRTP.prj ortp-config.h.in TODO pkg.list autogen.sh ortp.pc.in ortp.spec.in ortp.spec ortp.doxygen
-
-SUBDIRS=src build include
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = ortp.pc
-
-SOURCES=$(top_srcdir)/include/ortp/*.h $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h
-
-#html doc
-if HAVE_DOXYGEN
-
-# doxdir & pkgdocdir are not always defined by automake
-docdir=$(datadir)/doc
-pkgdocdir=$(docdir)/$(PACKAGE)-$(VERSION)
-doc_htmldir=$(pkgdocdir)/html
-
-doc_html_DATA = $(top_builddir)/doc/html/html.tar
-
-$(doc_html_DATA): $(top_builddir)/doc/html/index.html
- cd $(<D) && tar cf html.tar *
-
-$(top_builddir)/doc/html/index.html: $(SOURCES) ortp.doxygen Makefile.am
- rm -rf doc
- $(DOXYGEN) ortp.doxygen
-
-install-data-hook:
- cd $(DESTDIR)$(doc_htmldir) && tar xf html.tar && rm -f html.tar
-
-uninstall-hook:
- cd $(DESTDIR)$(doc_htmldir) && rm -f *
-
-endif
-
-## oRTP packaging methods:
-
-# `make rpm'
-
-.phony: rpm
-
-rpm:
- $(MAKE) dist
-# <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206841>
- TAR_OPTIONS=--wildcards rpmbuild -ta --clean --rmsource --rmspec $(PACKAGE)-$(VERSION).tar.gz
-
-# `make package'
-
-if WITH_EPM
-
-.PHONY: package
-
-PKG_NAME = $(PACKAGE)-$(VERSION)-$(RELEASE)
-BUILDROOT = $(shell pwd)/epm-install
-
-package: $(srcdir)/pkg.list $(srcdir)/configure
- -rm -rf pkg $(BUILDROOT) $(PKG_NAME).*
- $(MAKE) install DESTDIR=$(BUILDROOT)
- $(MKEPMLIST) -u $(SYS_USER) -g $(SYS_GROUP) --prefix $(prefix) \
- $(BUILDROOT)/$(prefix) > files.list
- $(EPM) -vv -f native -g -n -a $(ARCH) --keep-files --output-dir pkg \
- srcdir=$(srcdir) \
- top_srcdir=$(top_srcdir) \
- top_builddir=$(top_builddir) \
- PACKAGE=$(PACKAGE) \
- SUMMARY="$(SUMMARY)" \
- VERSION=$(ORTP_PKGCONFIG_VERSION) \
- RELEASE=$(RELEASE) \
- LICENSE="$(LICENSE)" \
- VENDOR="$(VENDOR)" \
- PACKAGER="$(PACKAGER)" \
- $(PACKAGE) $(srcdir)/pkg.list
- mv -f pkg/$(PACKAGE)-$(ORTP_PKGCONFIG_VERSION)-$(RELEASE).$(EPM_PKG_EXT) $(PKG_NAME).$(ARCH).$(EPM_PKG_EXT)
-
-clean-local:
- rm -rf pkg $(BUILDROOT)
- rm -f files.list
- rm -rf doc
-
-endif WITH_EPM
-
-distclean-local:
- -rm -f ortp.defs
-
-all-local: ortp.spec
-
-ortp.spec: ortp.spec.in
-
+++ /dev/null
-September 17, 2009: ortp-0.16.1
- - minor compilation fixes
-
-May 4, 2009 : ortp-0.16.0
- - update stun api to support new RFC
- - fix gcc warnings
- - added new PayloadType
-
-October 13, 2008: ortp-0.15.0
- - telephone event detection bugfix
- - reduce number of memory allocation: !! attention here ABI/API change !!
- If you are using mp=rtp_session_recvm_with_ts(), the payload data is no more pointed by mp->b_cont->b_rptr.
- Instead you can use the following to skip the header:
- rtp_get_payload(mp,mp->b_rptr);
-
-March 14, 2007: ortp-0.14.3
- - new ortp_set_memory_functions() method
- - jitter buffer bugfixes, simplification and improvements
-
-July 27, 2007: ortp-0.14.0
- - a few optimisations
- - support for number of channels in PayloadType (interface changed !)
- - srtp optional support (using libsrtp from http://srtp.sf.net)
-
-April, 11 2007: ortp-0.13.1:
- - do not recv rtcp packets from rtp_session_sendm_with_ts() when session is not send-only.
- - removed gtk-doc, using doxygen instead.
- - minor patches
-
-January, 23 2007: ortp-0.13.0
- - add support for a pluggable transport layer
- - enables use of different RtpProfile for send and recv directions
- - fix RTCP memleak
- - new telephone-event types added.
-
-November, 9 2006: ortp-0.12.0
- - fix statistics
- - jitter buffer accuracy improved
- - enable 0 ms jitter buffer (implies permissive dequeuing of packets)
- - enable optional connected mode: the udp socket is connect()ed so only
- packets coming from the connected destination are received.
-
-August, 22 2006: ortp-0.11.0
- - added rtp_session_set_dscp, rtp_session_send_rtcp_APP
- - fixed statistics little bugs.
-
-May, 30 2006: ortp-0.10.0
- - new RTCP parser
- - new event api
- - stun helper routines
- - permissive algorithm for video packet enqueueing
+++ /dev/null
-What is it ?
-************
-
-oRTP is a LGPL licensed C library implementing the RTP protocol (rfc3550). It is available
-for most unix clones (primilarly Linux and HP-UX), and Microsoft Windows.
-
-What are the build prequisites ?
-********************************
-libc library and header files.
-
-How do you I test ?
-*******************
-
-There are shorts and easy to understand programs given with the library. There are good example
-to understand how to use oRTP api.
-- rtpsend : sends a stream from a file on disk.
-- rtprecv : receives a stream and writes it to disk.
-- mrtpsend: sends multiple streams from a file on disk to a range of remote port.
-- mrtprecv: receives mutiple streams on a range of local ports and writes them on disk.
-
-
-Is there some documentation ?
-*****************************
-
-See the doxygen generated API documentation in docs/html. Program examples are a very good
-starting point.
-
-
-What are the current features ?
-******************************
- - works with ipv6
- - packet scheduler
- - adaptive jitter compensation
- - automatic sending of RTCP SR or RR coumpounded with a SDES
- - RTCP parser API
-
-
-What are the planned features ?
-*******************************
- - multi-endpoint rtp sessions.
-
-
-In which application oRTP is being used ?
-*****************************************
- - linphone (http://www.linphone.org) was the first.
- - the OCMP platform (a Hewlett Packard product).
-
-How to compile my program using ortp ?
-**************************************
-gcc -o myprogram `pkg-config --cflags ortp` myprogram.c \
- `pkg-config --libs ortp`
-
-
-What about Windows port ?
-*************************
-There are instructions and Microsoft Visual C++ project files in build/win32native/oRTP.
-
-
+++ /dev/null
-* make statistics thread-safe.
-* add a rtp_stats_display() func to display rtp_stats_t properly.
+++ /dev/null
-#!/bin/sh
-AM_VERSION="1.10"
-if ! type aclocal-$AM_VERSION 1>/dev/null 2>&1; then
- # automake-1.10 (recommended) is not available on Fedora 8
- AUTOMAKE=automake
- ACLOCAL=aclocal
-else
- ACLOCAL=aclocal-${AM_VERSION}
- AUTOMAKE=automake-${AM_VERSION}
-fi
-
-if test -f /opt/local/bin/glibtoolize ; then
- # darwin
- LIBTOOLIZE=/opt/local/bin/glibtoolize
-else
- LIBTOOLIZE=libtoolize
-fi
-if test -d /opt/local/share/aclocal ; then
- ACLOCAL_ARGS="-I /opt/local/share/aclocal"
-fi
-
-
-set -x
-rm -rf config.cache autom4te.cache
-$LIBTOOLIZE --copy --force
-$ACLOCAL $ACLOCAL_ARGS
-autoheader
-$AUTOMAKE --add-missing --copy
-autoconf
-
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-SUBDIRS= win32native wince winmob
+++ /dev/null
-Makefile.in
-Makefile
+++ /dev/null
-EXTRA_DIST=oRTP.vcproj ortp.def
-
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="8,00"\r
- Name="oRTP"\r
- ProjectGUID="{4A07BB2B-F56E-4F1B-A719-D28B782AC128}"\r
- RootNamespace="oRTP"\r
- Keyword="Win32Proj"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Win32"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Win32"\r
- OutputDirectory="Debug"\r
- IntermediateDirectory="Debug"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
- CharacterSet="0"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="0"\r
- AdditionalIncludeDirectories=""..\..\..\win32-bin\include";"..\..\include";"..\..\include\ortp";"..\..\src";"..\..\build\win32native\include""\r
- PreprocessorDefinitions="HAVE_OPENSSL_HMAC_H;HAVE_OPENSSL_MD5_H;_CRT_SECURE_NO_DEPRECATE;ORTP_INET6;WIN32;_DEBUG;_WINDOWS;_USRDLL;ORTP_EXPORTS;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"\r
- MinimalRebuild="true"\r
- BasicRuntimeChecks="3"\r
- RuntimeLibrary="1"\r
- UsePrecompiledHeader="0"\r
- WarningLevel="3"\r
- DebugInformationFormat="4"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="libeay32.lib Ws2_32.lib libsrtp.lib Winmm.lib libcmtd.lib"\r
- LinkIncremental="1"\r
- AdditionalLibraryDirectories=""..\..\..\win32-bin\lib""\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- GenerateDebugInformation="true"\r
- ProgramDatabaseFile="$(OutDir)/oRTP.pdb"\r
- SubSystem="2"\r
- TargetMachine="1"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Win32"\r
- OutputDirectory="Release"\r
- IntermediateDirectory="Release"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
- CharacterSet="2"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""..\..\..\win32-bin\include";"..\..\include";"..\..\include\ortp";"..\..\src";"..\..\build\win32native\include""\r
- PreprocessorDefinitions="HAVE_OPENSSL_HMAC_H;HAVE_OPENSSL_MD5_H;_CRT_SECURE_NO_DEPRECATE;ORTP_INET6;WIN32;NDEBUG;_WINDOWS;_USRDLL;ORTP_EXPORTS;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"\r
- RuntimeLibrary="0"\r
- UsePrecompiledHeader="0"\r
- WarningLevel="3"\r
- DebugInformationFormat="0"\r
- CallingConvention="0"\r
- CompileAs="1"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="libeay32.lib Ws2_32.lib libsrtp.lib Winmm.lib libcmt.lib"\r
- LinkIncremental="1"\r
- AdditionalLibraryDirectories=""..\..\..\win32-bin\lib""\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- GenerateDebugInformation="false"\r
- SubSystem="2"\r
- OptimizeReferences="2"\r
- EnableCOMDATFolding="2"\r
- TargetMachine="1"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="Source Files"\r
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
- >\r
- <File\r
- RelativePath="..\..\src\avprofile.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\b64.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\dll_entry.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\event.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\jitterctl.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\ortp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath=".\ortp.def"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\payloadtype.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\port.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\posixtimer.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtcp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtcpparse.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpparse.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession_inet.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsignaltable.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtptimer.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\scheduler.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\sessionset.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\srtp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\str_utils.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\stun.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\stun_udp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\telephonyevents.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\utils.c"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="Header Files"\r
- Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
- >\r
- <File\r
- RelativePath="..\..\include\ortp\b64.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\event.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\jitterctl.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\ortp-config-win32.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\ortp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\payloadtype.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\port.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtcp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpmod.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtpsession.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession_priv.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtpsignaltable.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtptimer.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\scheduler.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\sessionset.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\srtp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\str_utils.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\stun.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\stun_udp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\telephonyevents.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\utils.h"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="Resource Files"\r
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
- >\r
- </Filter>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-LIBRARY ortp\r
-\r
-EXPORTS\r
-\r
- ortp_init\r
- ortp_scheduler_init\r
- ortp_exit\r
-\r
- ortp_get_scheduler\r
- ortp_set_log_file\r
- ortp_set_log_level_mask\r
- ortp_logv_out\r
- ortp_set_log_handler\r
- ortp_strdup_printf\r
- ortp_logv\r
- \r
- ortp_get_global_stats\r
- ortp_global_stats_display\r
- \r
- session_set_new\r
- session_set_select\r
- session_set_destroy\r
- \r
- rtp_stats_display\r
- rtp_session_get_stats\r
- \r
- rtp_session_init\r
- rtp_session_new\r
- \r
- rtp_session_set_scheduling_mode\r
- rtp_session_set_blocking_mode\r
- rtp_session_set_profile\r
- rtp_session_get_profile\r
- rtp_session_set_data\r
-\r
- rtp_session_signal_connect\r
- rtp_session_signal_disconnect_by_callback\r
- rtp_session_set_ssrc\r
- rtp_session_set_seq_number\r
- rtp_session_get_seq_number\r
- rtp_session_set_jitter_compensation\r
- rtp_session_set_local_addr\r
- rtp_session_set_remote_addr\r
- rtp_session_enable_adaptive_jitter_compensation\r
- rtp_session_set_recv_buf_size\r
-\r
- rtp_session_send_with_ts\r
- rtp_session_sendm_with_ts\r
-\r
- rtp_session_set_sockets\r
- rtp_session_get_rtp_socket\r
- rtp_session_get_rtcp_socket\r
-\r
- rtp_session_set_payload_type\r
- rtp_session_set_send_payload_type\r
- rtp_session_get_send_payload_type\r
- rtp_session_set_recv_payload_type\r
- rtp_session_get_recv_payload_type\r
-\r
- rtp_session_recv_with_ts\r
- rtp_session_recvm_with_ts\r
- rtp_session_create_packet\r
- \r
- rtp_session_get_current_send_ts\r
- rtp_session_get_current_recv_ts\r
- rtp_session_reset\r
- rtp_session_uninit\r
- rtp_session_destroy\r
-\r
- rtp_add_csrc\r
-\r
- rtp_session_send_dtmf\r
- rtp_session_add_telephone_event\r
- rtp_session_create_telephone_event_packet\r
- \r
- rtp_session_set_source_description\r
- rtp_session_set_symmetric_rtp\r
- \r
- rtp_profile_new\r
- rtp_profile_set_payload\r
- rtp_profile_clone_full\r
- rtp_profile_destroy\r
- rtp_profile_get_payload_from_rtpmap\r
- \r
- payload_type_set_send_fmtp\r
- payload_type_clone\r
- fmtp_get_value\r
- \r
- ortp_free\r
- ortp_malloc\r
- ortp_strdup\r
- ortp_realloc\r
- ortp_malloc0\r
- freemsg\r
- dupmsg\r
-\r
- allocb\r
- getq\r
- putq\r
- msgpullup\r
- qinit\r
- flushq\r
- msgdsize\r
- peekq\r
- freeb\r
- dupb\r
- concatb\r
- esballoc\r
- \r
- WIN_thread_create\r
- WIN_thread_join\r
- WIN_cond_init\r
- WIN_mutex_init\r
- WIN_mutex_unlock\r
- WIN_cond_wait\r
- WIN_mutex_lock\r
- WIN_cond_destroy\r
- WIN_mutex_destroy\r
- WIN_cond_signal\r
- \r
- __ortp_log_mask\r
-\r
- rtp_session_register_event_queue\r
- rtp_session_unregister_event_queue\r
- ortp_ev_queue_new\r
- ortp_ev_queue_flush\r
- ortp_ev_queue_get\r
- ortp_ev_queue_destroy\r
- ortp_event_get_type\r
- ortp_event_get_data\r
- ortp_event_destroy\r
- \r
- stunParseHostName\r
- stunParseServerName\r
- sendMessage\r
- stunEncodeMessage\r
- stunBuildReqSimple\r
- stunParseMessage\r
- stunServerProcessMsg\r
- stunNatType\r
- stunTest\r
- stunOpenSocket\r
- stunOpenSocketPair\r
- stunCalculateIntegrity_shortterm\r
- stunCalculateIntegrity_longterm\r
- stunCalculateFingerprint\r
- \r
- getWinSocketError\r
-\r
- rtp_session_set_transports\r
- srtp_transport_new\r
- \r
- ortp_srtp_init\r
- ortp_srtp_create\r
- ortp_srtp_dealloc\r
- ortp_srtp_add_stream\r
-\r
- rtp_session_set_dscp\r
- rtp_session_compute_recv_bandwidth\r
- rtp_session_compute_send_bandwidth\r
- rtcp_next_packet\r
- rtcp_is_SDES\r
- rtcp_sdes_parse\r
- rtcp_is_SR\r
- rtcp_SR_get_ssrc\r
- rtcp_SR_get_report_block\r
- rtcp_SR_get_sender_info\r
- rtcp_is_RR\r
- rtcp_RR_get_ssrc\r
- rtcp_RR_get_report_block\r
- rtcp_is_BYE\r
- rtcp_BYE_get_ssrc\r
- rtcp_BYE_get_reason\r
- rtcp_is_APP
- rtcp_APP_get_subtype
- rtcp_APP_get_ssrc
- rtcp_APP_get_name
- rtcp_APP_get_data\r
- rtp_session_flush_sockets\r
- rtp_session_resync\r
- rtp_session_set_remote_addr_and_port\r
- rtp_session_set_time_jump_limit\r
-\r
- copymsg\r
- rtp_session_enable_jitter_buffer\r
-\r
- rtp_session_set_rtp_socket_recv_buffer_size\r
- rtp_session_set_rtp_socket_send_buffer_size\r
- rtp_session_set_jitter_buffer_params\r
-\r
- rtp_get_payload\r
-\r
- rtp_session_set_remote_addr_full\r
- rtp_session_send_rtcp_APP\r
- b64_decode\r
- b64_encode\r
- \r
- payload_type_set_recv_fmtp\r
- rtp_session_get_local_port\r
- rtp_session_get_jitter_buffer_params\r
-\r
- copyb\r
- turnAllocateSocketPair\r
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-EXTRA_DIST=oRTP.vcproj ortp.def
-
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="oRTP"
- ProjectGUID="{9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}"
- RootNamespace="oRTP"
- Keyword="MFCDLLProj"
- >
- <Platforms>
- <Platform
- Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- />
- <Platform
- Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
- />
- <Platform
- Name="Windows Mobile 6 Standard SDK (ARMV4I)"
- />
- <Platform
- Name="MP100_2P21 (ARMV4I)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- OutputDirectory="$(PlatformName)\Debug"
- IntermediateDirectory="$(PlatformName)\Debug"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="false"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="2"
- FavorSizeOrSpeed="1"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- GenerateDebugInformation="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
- OutputDirectory="$(PlatformName)\Debug"
- IntermediateDirectory="$(PlatformName)\Debug"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="false"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
- IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="false"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="2"
- FavorSizeOrSpeed="1"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- GenerateDebugInformation="true"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|MP100_2P21 (ARMV4I)"
- OutputDirectory="MP100_2P21 (ARMV4I)\$(ConfigurationName)"
- IntermediateDirectory="MP100_2P21 (ARMV4I)\$(ConfigurationName)"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="false"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- FavorSizeOrSpeed="0"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:$(CESubsystem) /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- GenerateDebugInformation="true"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- OutputDirectory="$(PlatformName)\Release"
- IntermediateDirectory="$(PlatformName)\Release"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="false"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
- OutputDirectory="$(PlatformName)\Release"
- IntermediateDirectory="$(PlatformName)\Release"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="false"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
- IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="false"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|MP100_2P21 (ARMV4I)"
- OutputDirectory="MP100_2P21 (ARMV4I)\$(ConfigurationName)"
- IntermediateDirectory="MP100_2P21 (ARMV4I)\$(ConfigurationName)"
- ConfigurationType="2"
- UseOfMFC="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="false"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="3"
- FavorSizeOrSpeed="1"
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
- Culture="1033"
- AdditionalIncludeDirectories="$(IntDir)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions=" /SUBSYSTEM:$(CESubsystem) /MACHINE:THUMB"
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"
- IgnoreAllDefaultLibraries="true"
- ModuleDefinitionFile="oRTP.def"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\src\avprofile.c"
- >
- </File>
- <File
- RelativePath="..\..\src\b64.c"
- >
- </File>
- <File
- RelativePath="..\..\src\event.c"
- >
- </File>
- <File
- RelativePath="..\..\src\jitterctl.c"
- >
- </File>
- <File
- RelativePath="..\..\src\ortp.c"
- >
- </File>
- <File
- RelativePath="..\..\src\payloadtype.c"
- >
- </File>
- <File
- RelativePath="..\..\src\port.c"
- >
- </File>
- <File
- RelativePath="..\..\src\posixtimer.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtcp.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtcpparse.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtpparse.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtpsession.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtpsession_inet.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtpsignaltable.c"
- >
- </File>
- <File
- RelativePath="..\..\src\rtptimer.c"
- >
- </File>
- <File
- RelativePath="..\..\src\scheduler.c"
- >
- </File>
- <File
- RelativePath="..\..\src\sessionset.c"
- >
- </File>
- <File
- RelativePath="..\..\src\str_utils.c"
- >
- </File>
- <File
- RelativePath="..\..\src\stun.c"
- >
- </File>
- <File
- RelativePath="..\..\src\stun_udp.c"
- >
- </File>
- <File
- RelativePath="..\..\src\telephonyevents.c"
- >
- </File>
- <File
- RelativePath="..\..\src\utils.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\include\ortp\b64.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\event.h"
- >
- </File>
- <File
- RelativePath="..\..\src\jitterctl.h"
- >
- </File>
- <File
- RelativePath="..\..\src\ortp-config-win32.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\ortp.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\payloadtype.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\port.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\rtcp.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\rtp.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\rtpsession.h"
- >
- </File>
- <File
- RelativePath="..\..\src\rtpsession_priv.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\rtpsignaltable.h"
- >
- </File>
- <File
- RelativePath="..\..\src\rtptimer.h"
- >
- </File>
- <File
- RelativePath="..\..\src\scheduler.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\sessionset.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\str_utils.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\stun.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\stun_udp.h"
- >
- </File>
- <File
- RelativePath="..\..\include\ortp\telephonyevents.h"
- >
- </File>
- <File
- RelativePath="..\..\src\utils.h"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\ortp.def"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-LIBRARY ortp\r
-\r
-EXPORTS\r
-\r
- ortp_init\r
- ortp_scheduler_init\r
- ortp_exit\r
-\r
- ortp_get_scheduler\r
- ortp_set_log_file\r
- ortp_set_log_level_mask\r
- ortp_logv_out\r
- ortp_set_log_handler\r
- ortp_strdup_printf\r
- ortp_logv\r
- \r
- ortp_get_global_stats\r
- ortp_global_stats_display\r
- \r
- session_set_new\r
- session_set_select\r
- session_set_destroy\r
- \r
- rtp_stats_display\r
- rtp_session_get_stats\r
- \r
- rtp_session_init\r
- rtp_session_new\r
- \r
- rtp_session_set_scheduling_mode\r
- rtp_session_set_blocking_mode\r
- rtp_session_set_profile\r
- rtp_session_get_profile\r
- rtp_session_set_data\r
-\r
- rtp_session_signal_connect\r
- rtp_session_signal_disconnect_by_callback\r
- rtp_session_set_ssrc\r
- rtp_session_set_seq_number\r
- rtp_session_get_seq_number\r
- rtp_session_set_jitter_compensation\r
- rtp_session_set_local_addr\r
- rtp_session_set_remote_addr\r
- rtp_session_enable_adaptive_jitter_compensation\r
- rtp_session_set_recv_buf_size\r
-\r
- rtp_session_send_with_ts\r
- rtp_session_sendm_with_ts\r
-\r
- rtp_session_set_sockets\r
- rtp_session_get_rtp_socket\r
- rtp_session_get_rtcp_socket\r
-\r
- rtp_session_set_payload_type\r
- rtp_session_set_send_payload_type\r
- rtp_session_get_send_payload_type\r
- rtp_session_set_recv_payload_type\r
- rtp_session_get_recv_payload_type\r
-\r
- rtp_session_recv_with_ts\r
- rtp_session_recvm_with_ts\r
- rtp_session_create_packet\r
- \r
- rtp_session_get_current_send_ts\r
- rtp_session_get_current_recv_ts\r
- rtp_session_reset\r
- rtp_session_uninit\r
- rtp_session_destroy\r
-\r
- rtp_add_csrc\r
-\r
- rtp_session_send_dtmf\r
- rtp_session_add_telephone_event\r
- rtp_session_create_telephone_event_packet\r
- \r
- rtp_session_set_source_description\r
- rtp_session_set_symmetric_rtp\r
- \r
- rtp_profile_new\r
- rtp_profile_set_payload\r
- rtp_profile_clone_full\r
- rtp_profile_destroy\r
- rtp_profile_get_payload_from_rtpmap\r
- rtp_profile_get_payload_number_from_rtpmap\r
- rtp_profile_get_payload_number_from_mime\r
- \r
- payload_type_new\r
- payload_type_set_send_fmtp\r
- payload_type_append_send_fmtp\r
- payload_type_clone\r
- payload_type_destroy\r
- fmtp_get_value\r
- \r
- ortp_free\r
- ortp_malloc\r
- ortp_strdup\r
- ortp_realloc\r
- ortp_malloc0\r
- \r
- freemsg\r
- dupmsg\r
- allocb\r
- getq\r
- putq\r
- msgpullup\r
- qinit\r
- flushq\r
- msgdsize\r
- peekq\r
- freeb\r
- dupb\r
- concatb\r
- esballoc\r
- \r
- WIN_thread_create\r
- WIN_thread_join\r
- WIN_cond_init\r
- WIN_mutex_init\r
- WIN_mutex_unlock\r
- WIN_cond_wait\r
- WIN_mutex_lock\r
- WIN_cond_destroy\r
- WIN_mutex_destroy\r
- WIN_cond_signal\r
- \r
- __ortp_log_mask\r
- ortp_strdup_printf\r
- ortp_strdup_vprintf\r
-\r
- rtp_session_register_event_queue\r
- rtp_session_unregister_event_queue\r
- ortp_ev_queue_new\r
- ortp_ev_queue_flush\r
- ortp_ev_queue_get\r
- ortp_ev_queue_destroy\r
- ortp_event_get_type\r
- ortp_event_get_data\r
- ortp_event_destroy\r
- \r
- stunParseHostName\r
- stunParseServerName\r
- sendMessage\r
- stunEncodeMessage\r
- stunBuildReqSimple\r
- stunParseMessage\r
- stunServerProcessMsg\r
- stunNatType\r
- stunTest\r
- stunOpenSocket\r
- stunOpenSocketPair\r
- stunCalculateIntegrity_shortterm\r
- stunCalculateIntegrity_longterm\r
- stunCalculateFingerprint\r
- \r
- getWinSocketError\r
- close_socket\r
- set_non_blocking_socket\r
- ortp_strerror\r
- gettimeofday\r
- ortp_file_exist\r
- \r
-\r
-\r
- rtp_session_set_dscp\r
- rtp_session_compute_recv_bandwidth\r
- rtp_session_compute_send_bandwidth\r
- rtcp_next_packet\r
- rtcp_is_SDES\r
- rtcp_sdes_parse\r
- rtcp_is_SR\r
- rtcp_SR_get_ssrc\r
- rtcp_SR_get_report_block\r
- rtcp_SR_get_sender_info\r
- rtcp_is_RR\r
- rtcp_RR_get_ssrc\r
- rtcp_RR_get_report_block\r
- rtcp_is_BYE\r
- rtcp_BYE_get_ssrc\r
- rtcp_BYE_get_reason\r
- rtcp_is_APP\r
- rtcp_APP_get_subtype\r
- rtcp_APP_get_ssrc\r
- rtcp_APP_get_name\r
- rtcp_APP_get_data\r
- rtp_session_flush_sockets\r
- rtp_session_resync\r
- rtp_session_set_remote_addr_and_port\r
- rtp_session_set_time_jump_limit\r
-\r
- copymsg\r
- rtp_session_enable_jitter_buffer\r
-\r
- rtp_session_set_rtp_socket_recv_buffer_size\r
- rtp_session_set_rtp_socket_send_buffer_size\r
- rtp_session_set_jitter_buffer_params\r
-\r
- rtp_get_payload\r
-\r
- rtp_session_set_remote_addr_full\r
- rtp_session_send_rtcp_APP\r
- b64_decode\r
- b64_encode\r
- \r
- payload_type_set_recv_fmtp\r
- rtp_session_get_local_port\r
- rtp_session_get_jitter_buffer_params\r
-\r
- copyb\r
- turnAllocateSocketPair\r
+++ /dev/null
-EXTRA_DIST=oRTP.vcproj ortp.def oRTP.sln
-
-
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 10.00\r
-# Visual Studio 2008\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oRTP", "oRTP.vcproj", "{9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)\r
- Debug|Windows Mobile 6 Standard SDK (ARMV4I) = Debug|Windows Mobile 6 Standard SDK (ARMV4I)\r
- Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)\r
- Release|Windows Mobile 6 Standard SDK (ARMV4I) = Release|Windows Mobile 6 Standard SDK (ARMV4I)\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)\r
- {9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="9,00"\r
- Name="oRTP"\r
- ProjectGUID="{9FEA0683-C391-4C74-BCF6-2F9E4DE1B541}"\r
- RootNamespace="oRTP"\r
- Keyword="MFCDLLProj"\r
- TargetFrameworkVersion="131072"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"\r
- />\r
- <Platform\r
- Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"\r
- />\r
- <Platform\r
- Name="Windows Mobile 6 Standard SDK (ARMV4I)"\r
- />\r
- <Platform\r
- Name="Windows Mobile 6 Professional SDK (ARMV4I)"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"\r
- OutputDirectory="$(PlatformName)\Debug"\r
- IntermediateDirectory="$(PlatformName)\Debug"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- MkTypLibCompatible="false"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="2"\r
- FavorSizeOrSpeed="1"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"\r
- RuntimeLibrary="3"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- GenerateDebugInformation="true"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\vbamsipua"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"\r
- OutputDirectory="$(PlatformName)\Debug"\r
- IntermediateDirectory="$(PlatformName)\Debug"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- MkTypLibCompatible="false"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL"\r
- RuntimeLibrary="3"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\vbamsipua"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"\r
- OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"\r
- IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- MkTypLibCompatible="false"\r
- TargetEnvironment="1"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="2"\r
- FavorSizeOrSpeed="1"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"\r
- RuntimeLibrary="3"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- GenerateDebugInformation="true"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- TargetMachine="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"\r
- OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"\r
- IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- MkTypLibCompatible="false"\r
- TargetEnvironment="1"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="2"\r
- FavorSizeOrSpeed="1"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL"\r
- RuntimeLibrary="3"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmtd.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- GenerateDebugInformation="true"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- TargetMachine="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\linphone"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"\r
- OutputDirectory="$(PlatformName)\Release"\r
- IntermediateDirectory="$(PlatformName)\Release"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- MkTypLibCompatible="false"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"\r
- RuntimeLibrary="2"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="\amsip"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"\r
- OutputDirectory="$(PlatformName)\Release"\r
- IntermediateDirectory="$(PlatformName)\Release"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- MkTypLibCompatible="false"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL"\r
- RuntimeLibrary="2"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\vbamsipua"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"\r
- OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"\r
- IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- MkTypLibCompatible="false"\r
- TargetEnvironment="1"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"\r
- RuntimeLibrary="2"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- TargetMachine="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\amsipua"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"\r
- OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"\r
- IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- MkTypLibCompatible="false"\r
- TargetEnvironment="1"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="..\..\include;..\..\..\osip\include"\r
- PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;AMD_HACK;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL"\r
- RuntimeLibrary="2"\r
- TreatWChar_tAsBuiltInType="true"\r
- UsePrecompiledHeader="0"\r
- ProgramDataBaseFileName="$(IntDir)/oRTP.pdb"\r
- WarningLevel="3"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"\r
- Culture="1033"\r
- AdditionalIncludeDirectories="$(IntDir)"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"\r
- AdditionalDependencies="ws2.lib iphlpapi.lib mmtimer.lib libcmt.lib"\r
- IgnoreAllDefaultLibraries="true"\r
- ModuleDefinitionFile="oRTP.def"\r
- RandomizedBaseAddress="1"\r
- DataExecutionPrevention="0"\r
- TargetMachine="0"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory=""\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="Source Files"\r
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
- >\r
- <File\r
- RelativePath="..\..\src\avprofile.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\b64.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\event.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\jitterctl.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\ortp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\payloadtype.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\port.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\posixtimer.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtcp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtcpparse.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpparse.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession_inet.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsignaltable.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtptimer.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\scheduler.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\sessionset.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\str_utils.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\stun.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\stun_udp.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\telephonyevents.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\utils.c"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="Header Files"\r
- Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
- >\r
- <File\r
- RelativePath="..\..\include\ortp\b64.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\event.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\jitterctl.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\ortp-config-win32.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\ortp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\payloadtype.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\port.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtcp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtpsession.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtpsession_priv.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\rtpsignaltable.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\rtptimer.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\scheduler.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\sessionset.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\str_utils.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\stun.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\stun_udp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\include\ortp\telephonyevents.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\src\utils.h"\r
- >\r
- </File>\r
- </Filter>\r
- <File\r
- RelativePath=".\ortp.def"\r
- >\r
- </File>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-LIBRARY ortp\r
-\r
-EXPORTS\r
-\r
- ortp_init\r
- ortp_scheduler_init\r
- ortp_exit\r
-\r
- ortp_get_scheduler\r
- ortp_set_log_file\r
- ortp_set_log_level_mask\r
- ortp_logv_out\r
- ortp_set_log_handler\r
- ortp_strdup_printf\r
- ortp_logv\r
- \r
- ortp_get_global_stats\r
- ortp_global_stats_display\r
- \r
- session_set_new\r
- session_set_select\r
- session_set_destroy\r
- \r
- rtp_stats_display\r
- rtp_session_get_stats\r
- \r
- rtp_session_init\r
- rtp_session_new\r
- \r
- rtp_session_set_scheduling_mode\r
- rtp_session_set_blocking_mode\r
- rtp_session_set_profile\r
- rtp_session_get_profile\r
- rtp_session_set_data\r
-\r
- rtp_session_signal_connect\r
- rtp_session_signal_disconnect_by_callback\r
- rtp_session_set_ssrc\r
- rtp_session_set_seq_number\r
- rtp_session_get_seq_number\r
- rtp_session_set_jitter_compensation\r
- rtp_session_set_local_addr\r
- rtp_session_set_remote_addr\r
- rtp_session_enable_adaptive_jitter_compensation\r
- rtp_session_set_recv_buf_size\r
-\r
- rtp_session_send_with_ts\r
- rtp_session_sendm_with_ts\r
-\r
- rtp_session_set_sockets\r
- rtp_session_get_rtp_socket\r
- rtp_session_get_rtcp_socket\r
-\r
- rtp_session_set_payload_type\r
- rtp_session_set_send_payload_type\r
- rtp_session_get_send_payload_type\r
- rtp_session_set_recv_payload_type\r
- rtp_session_get_recv_payload_type\r
-\r
- rtp_session_recv_with_ts\r
- rtp_session_recvm_with_ts\r
- rtp_session_create_packet\r
- \r
- rtp_session_get_current_send_ts\r
- rtp_session_get_current_recv_ts\r
- rtp_session_reset\r
- rtp_session_uninit\r
- rtp_session_destroy\r
-\r
- rtp_add_csrc\r
-\r
- rtp_session_send_dtmf\r
- \r
- rtp_session_set_source_description\r
- rtp_session_set_symmetric_rtp\r
- \r
- rtp_profile_new\r
- rtp_profile_set_payload\r
- rtp_profile_clone_full\r
- rtp_profile_destroy\r
- rtp_profile_get_payload_from_rtpmap\r
- rtp_profile_get_payload_number_from_rtpmap\r
- rtp_profile_get_payload_number_from_mime\r
- \r
- payload_type_new\r
- payload_type_set_send_fmtp\r
- payload_type_append_send_fmtp\r
- payload_type_clone\r
- payload_type_destroy\r
- fmtp_get_value\r
- \r
- ortp_free\r
- ortp_malloc\r
- ortp_strdup\r
- ortp_realloc\r
- ortp_malloc0\r
- \r
- freemsg\r
- dupmsg\r
- allocb\r
- getq\r
- putq\r
- msgpullup\r
- qinit\r
- flushq\r
- msgdsize\r
- peekq\r
- freeb\r
- dupb\r
- concatb\r
- esballoc\r
- \r
- WIN_thread_create\r
- WIN_thread_join\r
- WIN_cond_init\r
- WIN_mutex_init\r
- WIN_mutex_unlock\r
- WIN_cond_wait\r
- WIN_mutex_lock\r
- WIN_cond_destroy\r
- WIN_mutex_destroy\r
- WIN_cond_signal\r
- \r
- __ortp_log_mask\r
- ortp_strdup_printf\r
- ortp_strdup_vprintf\r
-\r
- rtp_session_register_event_queue\r
- rtp_session_unregister_event_queue\r
- ortp_ev_queue_new\r
- ortp_ev_queue_flush\r
- ortp_ev_queue_get\r
- ortp_ev_queue_destroy\r
- ortp_event_get_type\r
- ortp_event_get_data\r
- ortp_event_destroy\r
- \r
- stunParseHostName\r
- stunParseServerName\r
- sendMessage\r
- stunEncodeMessage\r
- stunBuildReqSimple\r
- stunParseMessage\r
- stunServerProcessMsg\r
- stunNatType\r
- stunTest\r
- stunOpenSocket\r
- stunOpenSocketPair\r
- stunCalculateIntegrity_shortterm\r
- stunCalculateIntegrity_longterm\r
- stunCalculateFingerprint\r
- \r
- getWinSocketError\r
- close_socket\r
- set_non_blocking_socket\r
- ortp_strerror\r
- gettimeofday\r
- ortp_file_exist\r
- \r
-\r
-\r
- rtp_session_set_dscp\r
- rtp_session_compute_recv_bandwidth\r
- rtp_session_compute_send_bandwidth\r
- rtcp_next_packet\r
- rtcp_is_SDES\r
- rtcp_sdes_parse\r
- rtcp_is_SR\r
- rtcp_SR_get_ssrc\r
- rtcp_SR_get_report_block\r
- rtcp_SR_get_sender_info\r
- rtcp_is_RR\r
- rtcp_RR_get_ssrc\r
- rtcp_RR_get_report_block\r
- rtcp_is_BYE\r
- rtcp_BYE_get_ssrc\r
- rtcp_BYE_get_reason\r
- rtcp_is_APP\r
- rtcp_APP_get_subtype\r
- rtcp_APP_get_ssrc\r
- rtcp_APP_get_name\r
- rtcp_APP_get_data\r
- rtp_session_flush_sockets\r
- rtp_session_resync\r
- rtp_session_set_remote_addr_and_port\r
- rtp_session_set_time_jump_limit\r
-\r
- copymsg\r
- rtp_session_enable_jitter_buffer\r
-\r
- rtp_session_set_rtp_socket_recv_buffer_size\r
- rtp_session_set_rtp_socket_send_buffer_size\r
- rtp_session_set_jitter_buffer_params\r
-\r
- rtp_get_payload\r
-\r
- rtp_session_set_remote_addr_full\r
- rtp_session_send_rtcp_APP\r
- b64_decode\r
- b64_encode\r
- \r
- payload_type_set_recv_fmtp\r
- rtp_session_get_local_port\r
- rtp_session_get_jitter_buffer_params\r
-\r
- copyb\r
- turnAllocateSocketPair\r
+++ /dev/null
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT([ortp],[0.16.1])
-AC_CANONICAL_SYSTEM
-
-dnl Source packaging numbers
-ORTP_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
-ORTP_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
-ORTP_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
-ORTP_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
-
-LIBORTP_SO_CURRENT=8 dnl increment this number when you add/change/remove an interface
-LIBORTP_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
-LIBORTP_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
-
-LIBORTP_SO_VERSION=$LIBORTP_SO_CURRENT:$LIBORTP_SO_REVISION:$LIBORTP_SO_AGE
-ORTP_VERSION=${ORTP_MAJOR_VERSION}.${ORTP_MINOR_VERSION}.${ORTP_MICRO_VERSION}
-
-if test -n "$ORTP_EXTRA_VERSION" ; then
- ORTP_VERSION="${ORTP_VERSION}.${ORTP_EXTRA_VERSION}"
-fi
-
-ORTP_PKGCONFIG_VERSION=${ORTP_VERSION}
-
-AC_SUBST(LIBORTP_SO_VERSION)
-AC_SUBST(ORTP_VERSION)
-AC_SUBST(ORTP_PKGCONFIG_VERSION)
-
-
-PACKAGE=ortp
-
-AM_INIT_AUTOMAKE([tar-ustar])
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
-AC_CONFIG_HEADERS(ortp-config.h)
-AC_DEFINE_UNQUOTED(ORTP_MAJOR_VERSION,$ORTP_MAJOR_VERSION, [major version])
-AC_DEFINE_UNQUOTED(ORTP_MINOR_VERSION,$ORTP_MINOR_VERSION, [minor version])
-AC_DEFINE_UNQUOTED(ORTP_MICRO_VERSION,$ORTP_MICRO_VERSION, [micro version])
-AC_DEFINE_UNQUOTED(ORTP_VERSION,"$ORTP_VERSION",[ortp version number])
-
-AC_SUBST([mkdir_p])
-
-AC_MSG_CHECKING([warning make an error on compilation])
-AC_ARG_ENABLE(strict,
-[ --enable-strict Enable error on compilation warning [default=yes]],
-[wall_werror=$enableval],
-[wall_werror=yes]
-)
-
-AC_ARG_ENABLE(perf,
-[ --enable-perf Disable costly features to reduce cpu consumtion [default=no]],
-[perf=$enableval],
-[perf=no]
-)
-
-ORTP_DEFS=
-
-dnl enable ipv6 support
-AC_ARG_ENABLE(ipv6,
- [ --enable-ipv6 Turn on ipv6 support],
- [case "${enableval}" in
- yes) ipv6=true;;
- no) ipv6=false;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
- esac],[ipv6=true])
-if test x$ipv6 = xtrue ; then
- ORTP_DEFS="$ORTP_DEFS -DORTP_INET6"
-fi
-
-AC_ARG_ENABLE(mode64bit,
- [ --enable-mode64bit=[yes/no] produce a 64-bit library. [default=no]],
- [case "${enableval}" in
- yes) mode64bit_enabled=yes;;
- no) mode64bit_enabled=no;;
- *) AC_MSG_ERROR("Bad value for --enable-mode64bit");;
- esac],
- [mode64bit_enabled=no])
-
-AC_ARG_ENABLE(debug,
- [ --enable-debug=[yes/no] enables the display of traces showing the execution of the library. [default=yes]],
- [case "${enableval}" in
- yes) debug_enabled=yes;;
- no) debug_enabled=no;;
- *) AC_MSG_ERROR("Bad value for --enable-debug");;
- esac],
- [debug_enabled=no])
-
-
-hpux_host=no
-posixtimer_interval=10000
-PTHREAD_LDFLAGS=
-
-case "$target_os" in
- *hpux*)
- hpux_host=yes
- AC_DEFINE(NOCONNECT,1,[Defined if we should not use connect() on udp sockets])
- CFLAGS="$CFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L"
- LIBS="$LIBS -lxnet"
- ;;
- *freebsd*)
- AC_DEFINE(NOCONNECT,1,[Defined if we should not use connect() on udp sockets])
- PTHREAD_LDFLAGS="-pthread"
- ;;
- *mingw32ce)
- CFLAGS="$CFLAGS -D_WIN32_WCE -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
- LIBS="$LIBS -lws2 -liphlpapi"
- build_tests=no
- mingw_found=yes
- ;;
- *mingw*)
- CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
- LIBS="$LIBS -lws2_32 -liphlpapi -lwinmm"
- build_tests=no
- ;;
-esac
-
-AC_CONFIG_COMMANDS([libtool-hacking],[
-if test "$mingw_found" = "yes" ; then
- echo "Hacking libtool to work with mingw..."
- sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
- cp -f ./libtool.tmp ./libtool
- rm -f ./libtool.tmp
-fi
-],[mingw_found=$mingw_found])
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
-AC_ENABLE_SHARED(yes)
-AC_ENABLE_STATIC(no)
-
-if test "$GCC" != "yes" ; then
- if test "$hpux_host" = "yes" ; then
- dnl we are probably using HPUX cc compiler, so add a +O2 to CFLAGS
- CFLAGS="$CFLAGS +O2 -g "
- if test x$mode64bit_enabled = xyes ; then
- CFLAGS="$CFLAGS +DA2.0W +DS2.0"
- fi
- fi
-else
- CFLAGS="$CFLAGS -Wall"
-fi
-
-build_scheduler=yes
-
-dnl Check if we have seteuid system call
-AC_CHECK_FUNCS(seteuid)
-
-
-dnl check if we can use the pthread_library
-AC_CHECK_LIB(pthread, pthread_mutex_init, [pthread_enabled=yes], [pthread_enabled=no])
-if test $pthread_enabled = "no" ; then
- build_scheduler=no
-else
- PTHREAD_LIBS="-lpthread"
- PTHREAD_CFLAGS="-D_REENTRANT"
- AC_SUBST(PTHREAD_CFLAGS)
- AC_SUBST(PTHREAD_LIBS)
- AC_SUBST(PTHREAD_LDFLAGS)
-fi
-AC_ARG_WITH(thread-stack-size,
- AC_HELP_STRING([--with-thread-stack-size=SIZE-IN-BYTES],[Set thread stack size [[default=os-default]]]),
- [thread_stack_size=$withval], [thread_stack_size=0])
-AC_DEFINE_UNQUOTED(ORTP_DEFAULT_THREAD_STACK_SIZE, $thread_stack_size, [Default thread stack size (0 = let operating system decide)])
-
-
-dnl check for libsrtp support (secure rtp)
-AC_ARG_WITH( srtp,
- [ --with-srtp Set prefix where libsrtp can be found (ex:/usr or /usr/local)[default=/usr] ],
- [ srtp_prefix=${withval}],[ srtp_prefix=/usr ])
-
-
-if test "${srtp_prefix}" != "/usr" ; then
- SRTP_CFLAGS="-I${srtp_prefix}/include"
- SRTP_LIBS="-L${srtp_prefix}/lib"
-fi
-SRTP_LIBS="$SRTP_LIBS -lsrtp"
-
-dnl check srtp headers
-have_srtp=no
-CPPFLAGS_save=$CPPFLAGS
-CPPFLAGS=$SRTP_CFLAGS
-AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
-CPPFLAGS=$CPPFLAGS_save
-
-dnl check for srtp lib
-LDFLAGS_save=$LDFLAGS
-LDFLAGS=$SRTP_LIBS
-LIBS_save=$LIBS
-AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
-LDFLAGS=$LDFLAGS_save
-LIBS=$LIBS_save
-
-if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
- have_srtp=yes
- AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
-else
- AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
- SRTP_CFLAGS=
- SRTP_LIBS=
-fi
-
-AC_SUBST(SRTP_CFLAGS)
-AC_SUBST(SRTP_LIBS)
-
-if test $debug_enabled = "yes"; then
- ORTP_DEFS="$ORTP_DEFS -DORTP_DEBUG_MODE -g"
- CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
-fi
-
-AC_ARG_ENABLE(memcheck,
- [ --enable-memcheck=[yes/no] enables memory leak detection (HPUX only).],
- [case "${enableval}" in
- yes) memcheck_enabled=yes;;
- no) memcheck_enabled=no;;
- *) AC_MSG_ERROR("Bad value for --enable-memcheck");;
- esac],
- [memcheck_enabled=no])
-
-if test "$memcheck_enabled" = "yes" ; then
- if test "$hpux_host" = "yes" ; then
- AC_DEFINE(ENABLE_MEMCHECK,1,[Defined when memory leak checking if enabled])
- else
- echo "WARNING ************ : the memory check option is only available for HPUX."
- fi
-fi
-
-AC_ARG_ENABLE(so-reuseaddr,
- [ --enable-so-reuseaddr=[yes/no] enables SO_REUSEADDR socket option in the rtp_session_set_local_addr() function.],
- [case "${enableval}" in
- yes) so_reuseaddr_enabled=yes;;
- no) so_reuseaddr_enabled=no;;
- *) AC_MSG_ERROR("Bad value for --enable-so-reuseaddr");;
- esac],
- [so_reuseaddr_enabled=yes])
-
-if test "$so_reuseaddr_enabled" = "yes" ; then
- AC_DEFINE(SO_REUSE_ADDR,1,[Defined when SO_REUSEADDR socket option in the rtp_session_set_local_addr() function is enabled])
-fi
-
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(poll.h sys/poll.h sys/uio.h fcntl.h sys/time.h unistd.h sys/audio.h linux/soundcard.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AC_HEADER_TIME
-AC_WORDS_BIGENDIAN
-if test x$ac_cv_c_bigendian = xyes ; then
- ORTP_DEFS="$ORTP_DEFS -DORTP_BIGENDIAN"
-fi
-
-dnl Checks for library functions.
-AC_CHECK_FUNCS(select socket strerror)
-
-if test $hpux_host = "yes" ; then
-dnl it seems 10 ms is too fast on hpux and it causes trouble
- posixtimer_interval=20000
-fi
-
-AC_DEFINE_UNQUOTED(POSIXTIMER_INTERVAL,$posixtimer_interval,[Defines the periodicity of the rtp scheduler in microseconds])
-
-if test "$perf" = "yes" ; then
- CFLAGS="$CFLAGS -DPERF"
-fi
-
-if test $GCC = yes && test $wall_werror = yes; then
- CFLAGS="$CFLAGS -Werror "
-fi
-
-AC_ARG_ENABLE(ssl-hmac,
- [ --enable-ssl-hmac=[yes/no] enables use of ssl/hmac for stun],
- [case "${enableval}" in
- yes) ssl_hmac_enabled=yes;;
- no) ssl_hmac_enabled=no;;
- *) AC_MSG_ERROR("Bad value for --enable-ssl-hmac");;
- esac],
- [ssl_hmac_enabled=yes])
-
-if test "$ssl_hmac_enabled" = "yes" ; then
- AC_CHECK_HEADERS(openssl/hmac.h openssl/md5.h)
- AC_CHECK_LIB(ssl,SSL_CTX_new,[SSL_LIBS="-lssl"])
- AC_CHECK_LIB(crypto,MD5,[SSL_LIBS="$SSL_LIBS -lcrypto"])
-fi
-
-
-
-
-
-AC_SUBST(SSL_LIBS)
-
-ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $SRTP_LIBS $SSL_LIBS"
-ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS $SRTP_CFLAGS"
-CFLAGS="$CFLAGS $ORTP_DEFS"
-echo "$ORTPDEPS_CFLAGS" > ortp.defs
-
-
-dnl ##################################################
-dnl # Check for doxygen
-dnl ##################################################
-
-AC_PATH_PROG(DOXYGEN,doxygen,false)
-AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
-
-
-dnl ##################################################
-dnl # Check for ESP Packager
-dnl ##################################################
-
-AC_PATH_PROG(EPM,epm,false)
-AC_PATH_PROG(MKEPMLIST,mkepmlist,false)
-AC_PATH_PROG(EPMINSTALL,epminstall,false)
-AM_CONDITIONAL(WITH_EPM,test $EPM != false && test $MKEPMLIST != false && test $EPMINSTALL != false)
-AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)
-
-# Preferred packaging system, as per EPM terminology
-case $target in
-*-*-linux*)
- if test -f /etc/debian_version ; then
- EPM_PKG_EXT=deb
- else
- EPM_PKG_EXT=rpm
- fi
- ;;
-*-hp-hpux*)
- EPM_PKG_EXT=depot.gz;;
-*-dec-osf*)
- EPM_PKG_EXT=setld;;
-esac
-AC_SUBST(EPM_PKG_EXT)
-
-# System software User & Group names
-case $target in
-*-*-linux*)
- SYS_USER=root
- SYS_GROUP=root
- ;;
-*-*-hpux*|*-dec-osf*)
- SYS_USER=bin
- SYS_GROUP=bin
- ;;
-esac
-AC_SUBST(SYS_USER)
-AC_SUBST(SYS_GROUP)
-
-# CPU Architecture
-case $target_cpu in
-i?86) ARCH=i386;;
-*) ARCH=$target_cpu;;
-esac
-AC_SUBST(ARCH)
-
-# Various other packaging variables, that can be over-ridden ad `make
-# package' time
-SUMMARY="An LGPL implementation of RTP - RFC3550"
-AC_SUBST(SUMMARY)
-PACKAGER=anonymous
-AC_SUBST(PACKAGER)
-LICENSE=LGPL
-AC_SUBST(LICENSE)
-VENDOR=Linphone
-AC_SUBST(VENDOR)
-RELEASE=1
-AC_SUBST(RELEASE)
-
-AC_SUBST(ORTPDEPS_CFLAGS)
-AC_SUBST(ORTPDEPS_LIBS)
-AC_SUBST(ORTPDEPS_LDFLAGS)
-
-AC_OUTPUT(
-Makefile
-include/Makefile
-include/ortp/Makefile
-src/Makefile
-src/tests/Makefile
-src/tests/win_receiver/Makefile
-src/tests/win_sender/Makefile
-build/Makefile
-build/win32native/Makefile
-build/wince/Makefile
-build/winmob/Makefile
-ortp.pc
-ortp.spec
-ortp.doxygen
-)
-
-AC_MSG_WARN([ortp-0.15.0 breaks compatibility with older releases, because value returned by rtp_session_recvm_with_ts() has
- changed. See the API documentation in doc/ for further readings.])
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-SUBDIRS=ortp
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-
-
-ortp_includedir=$(includedir)/ortp
-
-ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h \
- ortp.h telephonyevents.h sessionset.h payloadtype.h rtpsignaltable.h \
- rtcp.h \
- event.h stun.h stun_udp.h srtp.h \
- b64.h
-
-EXTRA_DIST=$(ortp_include_HEADERS)
+++ /dev/null
-/* /////////////////////////////////////////////////////////////////////////////\r
- * File: b64/b64.h\r
- *\r
- * Purpose: Header file for the b64 library\r
- *\r
- * Created: 18th October 2004\r
- * Updated: 24th August 2008\r
- *\r
- * Thanks: To Adam McLaurin, for ideas regarding the b64_decode2() and\r
- * b64_encode2().\r
- *\r
- * Home: http://synesis.com.au/software/\r
- *\r
- * Copyright (c) 2004-2008, Matthew Wilson and Synesis Software\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above copyright notice, this\r
- * list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright notice,\r
- * this list of conditions and the following disclaimer in the documentation\r
- * and/or other materials provided with the distribution.\r
- * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of\r
- * any contributors may be used to endorse or promote products derived from\r
- * this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
- * POSSIBILITY OF SUCH DAMAGE.\r
- *\r
- * ////////////////////////////////////////////////////////////////////////// */\r
-\r
-\r
-/** \file b64/b64.h\r
- *\r
- * \brief [C/C++] Header file for the b64 library.\r
- */\r
-\r
-#ifndef B64_INCL_B64_H_B64\r
-#define B64_INCL_B64_H_B64\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Version information\r
- */\r
-\r
-#ifndef B64_DOCUMENTATION_SKIP_SECTION\r
-# define B64_VER_B64_H_B64_MAJOR 1\r
-# define B64_VER_B64_H_B64_MINOR 5\r
-# define B64_VER_B64_H_B64_REVISION 4\r
-# define B64_VER_B64_H_B64_EDIT 28\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-\r
-/** \def B64_VER_MAJOR\r
- * The major version number of b64\r
- */\r
-\r
-/** \def B64_VER_MINOR\r
- * The minor version number of b64\r
- */\r
-\r
-/** \def B64_VER_REVISION\r
- * The revision version number of b64\r
- */\r
-\r
-/** \def B64_VER\r
- * The current composite version number of b64\r
- */\r
-\r
-#ifndef B64_DOCUMENTATION_SKIP_SECTION\r
-# define B64_VER_1_0_1 0x01000100\r
-# define B64_VER_1_0_2 0x01000200\r
-# define B64_VER_1_0_3 0x01000300\r
-# define B64_VER_1_1_1 0x01010100\r
-# define B64_VER_1_1_2 0x01010200\r
-# define B64_VER_1_1_3 0x01010300\r
-# define B64_VER_1_2_1 0x01020100\r
-# define B64_VER_1_2_2 0x01020200\r
-# define B64_VER_1_2_3 0x01020300\r
-# define B64_VER_1_2_4 0x01020400\r
-# define B64_VER_1_2_5 0x01020500\r
-# define B64_VER_1_2_6 0x01020600\r
-# define B64_VER_1_2_7 0x01020700\r
-# define B64_VER_1_3_1 0x010301ff\r
-# define B64_VER_1_3_2 0x010302ff\r
-# define B64_VER_1_3_3 0x010303ff\r
-# define B64_VER_1_3_4 0x010304ff\r
-\r
-# define B64_VER B64_VER_1_3_4\r
-#else /* ? B64_DOCUMENTATION_SKIP_SECTION */\r
-# define B64_VER 0x010304ff\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-\r
-#define B64_VER_MAJOR 1\r
-#define B64_VER_MINOR 3\r
-#define B64_VER_REVISION 4\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Includes\r
- */\r
-\r
-#include <stddef.h>\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Namespace\r
- */\r
-\r
-#if !defined(B64_NO_NAMESPACE) && \\r
- !defined(__cplusplus)\r
-# define B64_NO_NAMESPACE\r
-#endif /* !B64_NO_NAMESPACE && !__cplusplus */\r
-\r
-#ifdef B64_NAMESPACE\r
-# undef B64_NAMESPACE\r
-#endif /* B64_NAMESPACE */\r
-\r
-#ifdef B64_NAMESPACE_QUALIFIER\r
-# undef B64_NAMESPACE_QUALIFIER\r
-#endif /* B64_NAMESPACE_QUALIFIER */\r
-\r
-\r
-#ifndef B64_NO_NAMESPACE\r
-\r
-# ifdef B64_CUSTOM_NAMESPACE\r
-# define B64_NAMESPACE B64_CUSTOM_NAMESPACE\r
-# else /* ? B64_CUSTOM_NAMESPACE */\r
-# define B64_NAMESPACE b64\r
-# endif /* B64_CUSTOM_NAMESPACE */\r
-\r
-# if defined(B64_CUSTOM_NAMESPACE) && \\r
- defined(B64_CUSTOM_NAMESPACE_QUALIFIER)\r
-# define B64_NAMESPACE_QUALIFIER B64_CUSTOM_NAMESPACE_QUALIFIER\r
-# else /* B64_CUSTOM_NAMESPACE && B64_CUSTOM_NAMESPACE_QUALIFIER */\r
-# define B64_NAMESPACE_QUALIFIER ::B64_NAMESPACE\r
-# endif /* B64_CUSTOM_NAMESPACE && B64_CUSTOM_NAMESPACE_QUALIFIER */\r
-\r
-\r
-/** \brief [C/C++] The b64 namespace, within which the core library types and functions\r
- * reside in C++ compilation. In C compilation, they all reside in the global\r
- * namespace.\r
- *\r
- * \htmlonly\r
- * <hr>\r
- * \endhtmlonly\r
- */\r
-namespace B64_NAMESPACE\r
-{\r
-#endif /* !B64_NO_NAMESPACE */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Enumerations\r
- */\r
-\r
-/** \brief Return codes (from b64_encode2() / b64_decode2())\r
- */\r
-enum B64_RC\r
-{\r
- B64_RC_OK = 0 /*!< Operation was successful. */\r
- , B64_RC_INSUFFICIENT_BUFFER = 1 /*!< The given translation buffer was not of sufficient size. */\r
- , B64_RC_TRUNCATED_INPUT = 2 /*!< The input did not represent a fully formed stream of octet couplings. */\r
- , B64_RC_DATA_ERROR = 3 /*!< Invalid data. */\r
-#ifndef B64_DOCUMENTATION_SKIP_SECTION\r
- , B64_max_RC_value\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-};\r
-\r
-#ifndef __cplusplus\r
-typedef enum B64_RC B64_RC;\r
-#endif /* !__cplusplus */\r
-\r
-/** \brief Coding behaviour modification flags (for b64_encode2() / b64_decode2())\r
- */\r
-enum B64_FLAGS\r
-{\r
- B64_F_LINE_LEN_USE_PARAM = 0x0000 /*!< Uses the lineLen parameter to b64_encode2(). Ignored by b64_decode2(). */\r
- , B64_F_LINE_LEN_INFINITE = 0x0001 /*!< Ignores the lineLen parameter to b64_encode2(). Line length is infinite. Ignored by b64_decode2(). */\r
- , B64_F_LINE_LEN_64 = 0x0002 /*!< Ignores the lineLen parameter to b64_encode2(). Line length is 64. Ignored by b64_decode2(). */\r
- , B64_F_LINE_LEN_76 = 0x0003 /*!< Ignores the lineLen parameter to b64_encode2(). Line length is 76. Ignored by b64_decode2(). */\r
- , B64_F_LINE_LEN_MASK = 0x000f /*!< Mask for testing line length flags to b64_encode2(). Ignored by b64_encode2(). */\r
- , B64_F_STOP_ON_NOTHING = 0x0000 /*!< Decoding ignores all invalid characters in the input data. Ignored by b64_encode2(). */\r
- , B64_F_STOP_ON_UNKNOWN_CHAR = 0x0100 /*!< Causes decoding to break if any non-Base-64 [a-zA-Z0-9=+/], non-whitespace character is encountered. Ignored by b64_encode2(). */\r
- , B64_F_STOP_ON_UNEXPECTED_WS = 0x0200 /*!< Causes decoding to break if any unexpected whitespace is encountered. Ignored by b64_encode2(). */\r
- , B64_F_STOP_ON_BAD_CHAR = 0x0300 /*!< Causes decoding to break if any non-Base-64 [a-zA-Z0-9=+/] character is encountered. Ignored by b64_encode2(). */\r
-};\r
-\r
-#ifndef __cplusplus\r
-typedef enum B64_FLAGS B64_FLAGS;\r
-#endif /* !__cplusplus */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Functions\r
- */\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-\r
-/** \brief Encodes a block of binary data into Base-64\r
- *\r
- * \param src Pointer to the block to be encoded. May not be NULL, except when\r
- * \c dest is NULL, in which case it is ignored.\r
- * \param srcSize Length of block to be encoded\r
- * \param dest Pointer to the buffer into which the result is to be written. May\r
- * be NULL, in which case the function returns the required length\r
- * \param destLen Length of the buffer into which the result is to be written. Must\r
- * be at least as large as that indicated by the return value from\r
- * \link b64::b64_encode b64_encode(NULL, srcSize, NULL, 0)\endlink.\r
- *\r
- * \return 0 if the size of the buffer was insufficient, or the length of the\r
- * converted buffer was longer than \c destLen\r
- *\r
- * \note The function returns the required length if \c dest is NULL\r
- *\r
- * \note The function returns the required length if \c dest is NULL. The returned size\r
- * might be larger than the actual required size, but will never be smaller.\r
- *\r
- * \note Threading: The function is fully re-entrant.\r
- *\r
- * \see b64::encode()\r
- */\r
-size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);\r
-\r
-/** \brief Encodes a block of binary data into Base-64\r
- *\r
- * \param src Pointer to the block to be encoded. May not be NULL, except when\r
- * \c dest is NULL, in which case it is ignored.\r
- * \param srcSize Length of block to be encoded\r
- * \param dest Pointer to the buffer into which the result is to be written. May\r
- * be NULL, in which case the function returns the required length\r
- * \param destLen Length of the buffer into which the result is to be written. Must\r
- * be at least as large as that indicated by the return value from\r
- * \link b64::b64_encode2 b64_encode2(NULL, srcSize, NULL, 0, flags, lineLen, rc)\endlink.\r
- * \param flags A combination of the B64_FLAGS enumeration, that moderate the\r
- * behaviour of the function\r
- * \param lineLen If the flags parameter contains B64_F_LINE_LEN_USE_PARAM, then\r
- * this parameter represents the length of the lines into which the encoded form is split,\r
- * with a hard line break ('\\r\\n'). If this value is 0, then the line is not\r
- * split. If it is <0, then the RFC-1113 recommended line length of 64 is used\r
- * \param rc The return code representing the status of the operation. May be NULL.\r
- *\r
- * \return 0 if the size of the buffer was insufficient, or the length of the\r
- * converted buffer was longer than \c destLen\r
- *\r
- * \note The function returns the required length if \c dest is NULL. The returned size\r
- * might be larger than the actual required size, but will never be smaller.\r
- *\r
- * \note Threading: The function is fully re-entrant.\r
- *\r
- * \see b64::encode()\r
- */\r
-size_t b64_encode2( void const *src\r
- , size_t srcSize\r
- , char *dest\r
- , size_t destLen\r
- , unsigned flags\r
- , int lineLen /* = 0 */\r
- , B64_RC *rc /* = NULL */);\r
-\r
-/** \brief Decodes a sequence of Base-64 into a block of binary data\r
- *\r
- * \param src Pointer to the Base-64 block to be decoded. May not be NULL, except when\r
- * \c dest is NULL, in which case it is ignored. If \c dest is NULL, and \c src is\r
- * <b>not</b> NULL, then the returned value is calculated exactly, otherwise a value\r
- * is returned that is guaranteed to be large enough to hold the decoded block.\r
- *\r
- * \param srcLen Length of block to be encoded. Must be an integral of 4, the Base-64\r
- * encoding quantum, otherwise the Base-64 block is assumed to be invalid\r
- * \param dest Pointer to the buffer into which the result is to be written. May\r
- * be NULL, in which case the function returns the required length\r
- * \param destSize Length of the buffer into which the result is to be written. Must\r
- * be at least as large as that indicated by the return value from\r
- * \c b64_decode(src, srcSize, NULL, 0), even in the case where the encoded form\r
- * contains a number of characters that will be ignored, resulting in a lower total\r
- * length of converted form.\r
- *\r
- * \return 0 if the size of the buffer was insufficient, or the length of the\r
- * converted buffer was longer than \c destSize\r
- *\r
- * \note The function returns the required length if \c dest is NULL. The returned size\r
- * might be larger than the actual required size, but will never be smaller.\r
- *\r
- * \note \anchor anchor__4_characters The behaviour of both\r
- * \link b64::b64_encode2 b64_encode2()\endlink\r
- * and\r
- * \link b64::b64_decode2 b64_decode2()\endlink\r
- * are undefined if the line length is not a multiple of 4.\r
- *\r
- * \note Threading: The function is fully re-entrant.\r
- *\r
- * \see b64::decode()\r
- */\r
-size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);\r
-\r
-/** \brief Decodes a sequence of Base-64 into a block of binary data\r
- *\r
- * \param src Pointer to the Base-64 block to be decoded. May not be NULL, except when\r
- * \c dest is NULL, in which case it is ignored. If \c dest is NULL, and \c src is\r
- * <b>not</b> NULL, then the returned value is calculated exactly, otherwise a value\r
- * is returned that is guaranteed to be large enough to hold the decoded block.\r
- *\r
- * \param srcLen Length of block to be encoded. Must be an integral of 4, the Base-64\r
- * encoding quantum, otherwise the Base-64 block is assumed to be invalid\r
- * \param dest Pointer to the buffer into which the result is to be written. May\r
- * be NULL, in which case the function returns the required length\r
- * \param destSize Length of the buffer into which the result is to be written. Must\r
- * be at least as large as that indicated by the return value from\r
- * \c b64_decode(src, srcSize, NULL, 0), even in the case where the encoded form\r
- * contains a number of characters that will be ignored, resulting in a lower total\r
- * length of converted form.\r
- * \param flags A combination of the B64_FLAGS enumeration, that moderate the\r
- * behaviour of the function.\r
- * \param rc The return code representing the status of the operation. May be NULL.\r
- * \param badChar If the flags parameter does not contain B64_F_STOP_ON_NOTHING, this\r
- * parameter specifies the address of a pointer that will be set to point to any\r
- * character in the sequence that stops the parsing, as dictated by the flags\r
- * parameter. May be NULL.\r
- *\r
- * \return 0 if the size of the buffer was insufficient, or the length of the\r
- * converted buffer was longer than \c destSize, or a bad character stopped parsing.\r
- *\r
- * \note The function returns the required length if \c dest is NULL. The returned size\r
- * might be larger than the actual required size, but will never be smaller.\r
- *\r
- * \note The behaviour of both\r
- * \link b64::b64_encode2 b64_encode2()\endlink\r
- * and\r
- * \link b64::b64_decode2 b64_decode2()\endlink\r
- * are undefined if the line length is not a multiple of 4.\r
- *\r
- * \note Threading: The function is fully re-entrant.\r
- *\r
- * \see b64::decode()\r
- */\r
-size_t b64_decode2( char const *src\r
- , size_t srcLen\r
- , void *dest\r
- , size_t destSize\r
- , unsigned flags\r
- , char const **badChar /* = NULL */\r
- , B64_RC *rc /* = NULL */);\r
-\r
-\r
-/** \brief Returns the textual description of the error\r
- *\r
- * \param code The \link b64::B64_RC error code\endlink\r
- */\r
-char const *b64_getErrorString(B64_RC code);\r
-\r
-/** \brief Returns the length of the textual description of the error\r
- *\r
- * \see b64_getErrorString()\r
- *\r
- * \param code The \link b64::B64_RC error code\endlink\r
- */\r
-size_t b64_getErrorStringLength(B64_RC code);\r
-\r
-\r
-#ifdef __cplusplus\r
-} /* extern "C" */\r
-#endif /* __cplusplus */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Namespace\r
- */\r
-\r
-#ifndef B64_NO_NAMESPACE\r
-} /* namespace B64_NAMESPACE */\r
-\r
-# ifndef B64_DOCUMENTATION_SKIP_SECTION\r
-\r
-namespace stlsoft\r
-{\r
-\r
- inline char const *c_str_data_a( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);\r
- }\r
- inline char const *c_str_data( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);\r
- }\r
-\r
- inline size_t c_str_len_a( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);\r
- }\r
- inline size_t c_str_len( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);\r
- }\r
-\r
- inline char const *c_str_ptr_a( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);\r
- }\r
- inline char const *c_str_ptr( B64_NAMESPACE_QUALIFIER::B64_RC code)\r
- {\r
- return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);\r
- }\r
-\r
-} /* namespace stlsoft */\r
-\r
-# endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-\r
-#endif /* !B64_NO_NAMESPACE */\r
-\r
-/* ////////////////////////////////////////////////////////////////////////// */\r
-\r
-#endif /* B64_INCL_B64_H_B64 */\r
-\r
-/* ////////////////////////////////////////////////////////////////////////// */\r
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef ortp_events_h
-#define ortp_events_h
-
-#include <ortp/str_utils.h>
-
-typedef mblk_t OrtpEvent;
-
-typedef unsigned long OrtpEventType;
-
-typedef struct RtpEndpoint{
-#ifdef ORTP_INET6
- struct sockaddr_storage addr;
-#else
- struct sockaddr addr;
-#endif
- socklen_t addrlen;
-}RtpEndpoint;
-
-
-struct _OrtpEventData{
- mblk_t *packet; /* most events are associated to a received packet */
- RtpEndpoint *ep;
- union {
- int telephone_event;
- int payload_type;
- } info;
-};
-
-typedef struct _OrtpEventData OrtpEventData;
-
-
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen);
-RtpEndpoint *rtp_endpoint_dup(const RtpEndpoint *ep);
-
-OrtpEvent * ortp_event_new(OrtpEventType tp);
-OrtpEventType ortp_event_get_type(const OrtpEvent *ev);
-/* type is one of the following*/
-#define ORTP_EVENT_STUN_PACKET_RECEIVED 1
-#define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2
-#define ORTP_EVENT_TELEPHONE_EVENT 3
-#define ORTP_EVENT_RTCP_PACKET_RECEIVED 4
-OrtpEventData * ortp_event_get_data(OrtpEvent *ev);
-void ortp_event_destroy(OrtpEvent *ev);
-OrtpEvent *ortp_event_dup(OrtpEvent *ev);
-
-typedef struct OrtpEvQueue{
- queue_t q;
- ortp_mutex_t mutex;
-} OrtpEvQueue;
-
-OrtpEvQueue * ortp_ev_queue_new(void);
-void ortp_ev_queue_destroy(OrtpEvQueue *q);
-OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q);
-void ortp_ev_queue_flush(OrtpEvQueue * qp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/** \mainpage oRTP API documentation
- *
- * \section init Initializing oRTP
- *
- * see ortp.h documentation.
- *
- * \section rtpsession the RtpSession object
- *
- * see the rtpsession.h documentation.
- *
- * \section payloadtypes Managing PayloadType(s) and RtpProfile(s)
- *
- * see the payloadtype.h documentation.
- *
- * \section telephonevents Sending and receiving telephone-event (RFC2833)
- *
- * see the telephonyevents.h documentation.
- * To get informed about incoming telephone-event you can register a callback
- * using rtp_session_signal_connect() or by registering an event queue using
- * rtp_session_register_event_queue().
- *
- * \section sessionset Managing several RtpSession simultaneously
- *
- * see the sessionset.h documentation.
- *
- * \section rtcp Parsing incoming rtcp packets.
- *
- * The parsing api is defined in rtcp.h (not yet documented).
- *
- * \section examples Examples
- *
- * oRTP comes with a set of examples in src/tests.
- * - rtprecv.c rtpsend.c show how to receive and send a single RTP stream.
- * - mrtprecv.c mrtpsend.c show how to receive and send multiple RTP streams
- * simultaneously
- *
- */
-
-/**
- * \file ortp.h
- * \brief General purpose library functions.
- *
-**/
-
-#ifndef ORTP_H
-#define ORTP_H
-
-#include <ortp/rtpsession.h>
-#include <ortp/sessionset.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-bool_t ortp_min_version_required(int major, int minor, int micro);
-void ortp_init(void);
-void ortp_scheduler_init(void);
-void ortp_exit(void);
-
-/***************/
-/* logging api */
-/***************/
-
-typedef enum {
- ORTP_DEBUG=1,
- ORTP_MESSAGE=1<<1,
- ORTP_WARNING=1<<2,
- ORTP_ERROR=1<<3,
- ORTP_FATAL=1<<4,
- ORTP_LOGLEV_END=1<<5
-} OrtpLogLevel;
-
-
-typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
-
-void ortp_set_log_file(FILE *file);
-void ortp_set_log_handler(OrtpLogFunc func);
-
-VAR_DECLSPEC OrtpLogFunc ortp_logv_out;
-
-extern unsigned int __ortp_log_mask;
-
-#define ortp_log_level_enabled(level) (__ortp_log_mask & (level))
-
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-#define ortp_logv(level,fmt,args) \
-{\
- if (ortp_logv_out!=NULL && ortp_log_level_enabled(level)) \
- ortp_logv_out(level,fmt,args);\
- if ((level)==ORTP_FATAL) abort();\
-}while(0)
-#else
-void ortp_logv(int level, const char *fmt, va_list args);
-#endif
-
-void ortp_set_log_level_mask(int levelmask);
-
-#ifdef ORTP_DEBUG_MODE
-static inline void ortp_debug(const char *fmt,...)
-{
- va_list args;
- va_start (args, fmt);
- ortp_logv(ORTP_DEBUG, fmt, args);
- va_end (args);
-}
-#else
-
-#define ortp_debug(...)
-
-#endif
-
-#ifdef ORTP_NOMESSAGE_MODE
-
-#define ortp_log(...)
-#define ortp_message(...)
-#define ortp_warning(...)
-
-#else
-
-static inline void ortp_log(OrtpLogLevel lev, const char *fmt,...){
- va_list args;
- va_start (args, fmt);
- ortp_logv(lev, fmt, args);
- va_end (args);
-}
-
-static inline void ortp_message(const char *fmt,...)
-{
- va_list args;
- va_start (args, fmt);
- ortp_logv(ORTP_MESSAGE, fmt, args);
- va_end (args);
-}
-
-static inline void ortp_warning(const char *fmt,...)
-{
- va_list args;
- va_start (args, fmt);
- ortp_logv(ORTP_WARNING, fmt, args);
- va_end (args);
-}
-
-#endif
-
-static inline void ortp_error(const char *fmt,...)
-{
- va_list args;
- va_start (args, fmt);
- ortp_logv(ORTP_ERROR, fmt, args);
- va_end (args);
-}
-
-static inline void ortp_fatal(const char *fmt,...)
-{
- va_list args;
- va_start (args, fmt);
- ortp_logv(ORTP_FATAL, fmt, args);
- va_end (args);
-}
-
-
-/****************/
-/*statistics api*/
-/****************/
-
-extern rtp_stats_t ortp_global_stats;
-
-void ortp_global_stats_reset(void);
-rtp_stats_t *ortp_get_global_stats(void);
-
-void ortp_global_stats_display(void);
-void rtp_stats_display(const rtp_stats_t *stats, const char *header);
-void rtp_stats_reset(rtp_stats_t *stats);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/**
- * \file payloadtype.h
- * \brief Using and creating standart and custom RTP profiles
- *
-**/
-
-#ifndef PAYLOADTYPE_H
-#define PAYLOADTYPE_H
-#include <ortp/port.h>
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-/* flags for PayloadType::flags */
-
-#define PAYLOAD_TYPE_ALLOCATED (1)
- /* private flags for future use by ortp */
-#define PAYLOAD_TYPE_PRIV1 (1<<1)
-#define PAYLOAD_TYPE_PRIV2 (1<<2)
-#define PAYLOAD_TYPE_PRIV3 (1<<3)
- /* user flags, can be used by the application on top of oRTP */
-#define PAYLOAD_TYPE_USER_FLAG_0 (1<<4)
-#define PAYLOAD_TYPE_USER_FLAG_1 (1<<5)
-#define PAYLOAD_TYPE_USER_FLAG_2 (1<<6)
- /* ask for more if you need*/
-
-#define PAYLOAD_AUDIO_CONTINUOUS 0
-#define PAYLOAD_AUDIO_PACKETIZED 1
-#define PAYLOAD_VIDEO 2
-#define PAYLOAD_OTHER 3 /* ?? */
-
-struct _PayloadType
-{
- int type; /**< one of PAYLOAD_* macros*/
- int clock_rate; /**< rtp clock rate*/
- char bits_per_sample; /* in case of continuous audio data */
- char *zero_pattern;
- int pattern_length;
- /* other useful information for the application*/
- int normal_bitrate; /*in bit/s */
- char *mime_type; /**<actually the submime, ex: pcm, pcma, gsm*/
- int channels; /**< number of channels of audio */
- char *recv_fmtp; /* various format parameters for the incoming stream */
- char *send_fmtp; /* various format parameters for the outgoing stream */
- int flags;
- void *user_data;
-};
-
-#ifndef PayloadType_defined
-#define PayloadType_defined
-typedef struct _PayloadType PayloadType;
-#endif
-
-#define payload_type_set_flag(pt,flag) (pt)->flags|=((int)flag)
-#define payload_type_unset_flag(pt,flag) (pt)->flags&=(~(int)flag)
-#define payload_type_get_flags(pt) (pt)->flags
-
-#define RTP_PROFILE_MAX_PAYLOADS 128
-
-/**
- * The RTP profile is a table RTP_PROFILE_MAX_PAYLOADS entries to make the matching
- * between RTP payload type number and the PayloadType that defines the type of
- * media.
-**/
-struct _RtpProfile
-{
- char *name;
- PayloadType *payload[RTP_PROFILE_MAX_PAYLOADS];
-};
-
-
-typedef struct _RtpProfile RtpProfile;
-
-PayloadType *payload_type_new(void);
-PayloadType *payload_type_clone(PayloadType *payload);
-char *payload_type_get_rtpmap(PayloadType *pt);
-void payload_type_destroy(PayloadType *pt);
-void payload_type_set_recv_fmtp(PayloadType *pt, const char *fmtp);
-void payload_type_set_send_fmtp(PayloadType *pt, const char *fmtp);
-void payload_type_append_recv_fmtp(PayloadType *pt, const char *fmtp);
-void payload_type_append_send_fmtp(PayloadType *pt, const char *fmtp);
-
-
-bool_t fmtp_get_value(const char *fmtp, const char *param_name, char *result, size_t result_len);
-
-VAR_DECLSPEC RtpProfile av_profile;
-
-#define payload_type_set_user_data(pt,p) (pt)->user_data=(p)
-#define payload_type_get_user_data(pt) ((pt)->user_data)
-
-#define rtp_profile_get_name(profile) (const char*)((profile)->name)
-
-void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt);
-
-/**
- * Set payload type number @index unassigned in the profile.
- *
- *@param profile an RTP profile
- *@param index the payload type number
-**/
-#define rtp_profile_clear_payload(profile,index) \
- rtp_profile_set_payload(profile,index,NULL)
-
-/* I prefer have this function inlined because it is very often called in the code */
-/**
- *
- * Gets the payload description of the payload type @index in the profile.
- *
- *@param profile an RTP profile (a #RtpProfile object)
- *@param index the payload type number
- *@return the payload description (a PayloadType object)
-**/
-static inline PayloadType * rtp_profile_get_payload(RtpProfile *prof, int idx){
- if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
- return NULL;
- }
- return prof->payload[idx];
-}
-void rtp_profile_clear_all(RtpProfile *prof);
-void rtp_profile_set_name(RtpProfile *prof, const char *name);
-PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
-PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
-int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
-int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
-int rtp_profile_find_payload_number(RtpProfile *prof,const char *mime,int rate, int channels);
-PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate, int channels);
-int rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);
-
-RtpProfile * rtp_profile_new(const char *name);
-/* clone a profile, payload are not cloned */
-RtpProfile * rtp_profile_clone(RtpProfile *prof);
-
-
-/*clone a profile and its payloads (ie payload type are newly allocated, not reusing payload types of the reference profile) */
-RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
-/* frees the profile and all its PayloadTypes*/
-void rtp_profile_destroy(RtpProfile *prof);
-
-
-/* some payload types */
-/* audio */
-VAR_DECLSPEC PayloadType payload_type_pcmu8000;
-VAR_DECLSPEC PayloadType payload_type_pcma8000;
-VAR_DECLSPEC PayloadType payload_type_pcm8000;
-VAR_DECLSPEC PayloadType payload_type_l16_mono;
-VAR_DECLSPEC PayloadType payload_type_l16_stereo;
-VAR_DECLSPEC PayloadType payload_type_lpc1016;
-VAR_DECLSPEC PayloadType payload_type_g729;
-VAR_DECLSPEC PayloadType payload_type_g7231;
-VAR_DECLSPEC PayloadType payload_type_g7221;
-VAR_DECLSPEC PayloadType payload_type_g726_40;
-VAR_DECLSPEC PayloadType payload_type_g726_32;
-VAR_DECLSPEC PayloadType payload_type_g726_24;
-VAR_DECLSPEC PayloadType payload_type_g726_16;
-VAR_DECLSPEC PayloadType payload_type_gsm;
-VAR_DECLSPEC PayloadType payload_type_lpc;
-VAR_DECLSPEC PayloadType payload_type_lpc1015;
-VAR_DECLSPEC PayloadType payload_type_speex_nb;
-VAR_DECLSPEC PayloadType payload_type_speex_wb;
-VAR_DECLSPEC PayloadType payload_type_speex_uwb;
-VAR_DECLSPEC PayloadType payload_type_ilbc;
-VAR_DECLSPEC PayloadType payload_type_amr;
-VAR_DECLSPEC PayloadType payload_type_amrwb;
-VAR_DECLSPEC PayloadType payload_type_truespeech;
-VAR_DECLSPEC PayloadType payload_type_evrc0;
-VAR_DECLSPEC PayloadType payload_type_evrcb0;
-
-/* video */
-VAR_DECLSPEC PayloadType payload_type_mpv;
-VAR_DECLSPEC PayloadType payload_type_h261;
-VAR_DECLSPEC PayloadType payload_type_h263;
-VAR_DECLSPEC PayloadType payload_type_h263_1998;
-VAR_DECLSPEC PayloadType payload_type_h263_2000;
-VAR_DECLSPEC PayloadType payload_type_mp4v;
-VAR_DECLSPEC PayloadType payload_type_theora;
-VAR_DECLSPEC PayloadType payload_type_h264;
-VAR_DECLSPEC PayloadType payload_type_x_snow;
-VAR_DECLSPEC PayloadType payload_type_jpeg;
-
-VAR_DECLSPEC PayloadType payload_type_t140;
-
-/* non standard file transfer over UDP */
-VAR_DECLSPEC PayloadType payload_type_x_udpftp;
-
-/* telephone-event */
-VAR_DECLSPEC PayloadType payload_type_telephone_event;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-/* this file is responsible of the portability of the stack */
-
-#ifndef ORTP_PORT_H
-#define ORTP_PORT_H
-
-
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-/********************************/
-/* definitions for UNIX flavour */
-/********************************/
-
-#include <errno.h>
-#include <sys/types.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#ifdef __linux
-#include <stdint.h>
-#endif
-
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#if defined(_XOPEN_SOURCE_EXTENDED) || !defined(__hpux)
-#include <arpa/inet.h>
-#endif
-
-
-
-#include <sys/time.h>
-
-#ifdef ORTP_INET6
-#include <netdb.h>
-#endif
-
-typedef int ortp_socket_t;
-typedef pthread_t ortp_thread_t;
-typedef pthread_mutex_t ortp_mutex_t;
-typedef pthread_cond_t ortp_cond_t;
-
-#ifdef __INTEL_COMPILER
-#pragma warning(disable : 111) // statement is unreachable
-#pragma warning(disable : 181) // argument is incompatible with corresponding format string conversion
-#pragma warning(disable : 188) // enumerated type mixed with another type
-#pragma warning(disable : 593) // variable "xxx" was set but never used
-#pragma warning(disable : 810) // conversion from "int" to "unsigned short" may lose significant bits
-#pragma warning(disable : 869) // parameter "xxx" was never referenced
-#pragma warning(disable : 981) // operands are evaluated in unspecified order
-#pragma warning(disable : 1418) // external function definition with no prior declaration
-#pragma warning(disable : 1419) // external declaration in primary source file
-#pragma warning(disable : 1469) // "cc" clobber ignored
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int __ortp_thread_join(ortp_thread_t thread, void **ptr);
-int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routine)(void*), void *arg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#define ortp_thread_create __ortp_thread_create
-#define ortp_thread_join __ortp_thread_join
-#define ortp_thread_exit pthread_exit
-#define ortp_mutex_init pthread_mutex_init
-#define ortp_mutex_lock pthread_mutex_lock
-#define ortp_mutex_unlock pthread_mutex_unlock
-#define ortp_mutex_destroy pthread_mutex_destroy
-#define ortp_cond_init pthread_cond_init
-#define ortp_cond_signal pthread_cond_signal
-#define ortp_cond_broadcast pthread_cond_broadcast
-#define ortp_cond_wait pthread_cond_wait
-#define ortp_cond_destroy pthread_cond_destroy
-
-#define SOCKET_OPTION_VALUE void *
-#define SOCKET_BUFFER void *
-
-#define getSocketError() strerror(errno)
-#define getSocketErrorCode() (errno)
-
-#define ortp_log10f(x) log10f(x)
-
-
-#else
-/*********************************/
-/* definitions for WIN32 flavour */
-/*********************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-
-#ifdef _MSC_VER
-#pragma push_macro("_WINSOCKAPI_")
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
-
-typedef unsigned __int64 uint64_t;
-typedef __int64 int64_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef int int32_t;
-typedef unsigned char uint8_t;
-typedef __int16 int16_t;
-#else
-#include <stdint.h> /*provided by mingw32*/
-#endif
-
-#define vsnprintf _vsnprintf
-#define srandom srand
-#define random rand
-
-
-typedef SOCKET ortp_socket_t;
-typedef HANDLE ortp_cond_t;
-typedef HANDLE ortp_mutex_t;
-typedef HANDLE ortp_thread_t;
-
-#define ortp_thread_create WIN_thread_create
-#define ortp_thread_join WIN_thread_join
-#define ortp_thread_exit(arg)
-#define ortp_mutex_init WIN_mutex_init
-#define ortp_mutex_lock WIN_mutex_lock
-#define ortp_mutex_unlock WIN_mutex_unlock
-#define ortp_mutex_destroy WIN_mutex_destroy
-#define ortp_cond_init WIN_cond_init
-#define ortp_cond_signal WIN_cond_signal
-#define ortp_cond_broadcast WIN_cond_broadcast
-#define ortp_cond_wait WIN_cond_wait
-#define ortp_cond_destroy WIN_cond_destroy
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int WIN_mutex_init(ortp_mutex_t *m, void *attr_unused);
-int WIN_mutex_lock(ortp_mutex_t *mutex);
-int WIN_mutex_unlock(ortp_mutex_t *mutex);
-int WIN_mutex_destroy(ortp_mutex_t *mutex);
-int WIN_thread_create(ortp_thread_t *t, void *attr_unused, void *(*func)(void*), void *arg);
-int WIN_thread_join(ortp_thread_t thread, void **unused);
-int WIN_cond_init(ortp_cond_t *cond, void *attr_unused);
-int WIN_cond_wait(ortp_cond_t * cond, ortp_mutex_t * mutex);
-int WIN_cond_signal(ortp_cond_t * cond);
-int WIN_cond_broadcast(ortp_cond_t * cond);
-int WIN_cond_destroy(ortp_cond_t * cond);
-
-#ifdef __cplusplus
-}
-#endif
-
-#define SOCKET_OPTION_VALUE char *
-#define inline __inline
-
-#if defined(_WIN32_WCE)
-
-#define ortp_log10f(x) (float)log10 ((double)x)
-
-#ifdef assert
- #undef assert
-#endif /*assert*/
-#define assert(exp) ((void)0)
-
-#ifdef errno
- #undef errno
-#endif /*errno*/
-#define errno GetLastError()
-#ifdef strerror
- #undef strerror
-#endif /*strerror*/
-const char * ortp_strerror(DWORD value);
-#define strerror ortp_strerror
-
-
-#else /*_WIN32_WCE*/
-
-#define ortp_log10f(x) log10f(x)
-
-#endif
-
-const char *getWinSocketError(int error);
-#define getSocketErrorCode() WSAGetLastError()
-#define getSocketError() getWinSocketError(WSAGetLastError())
-
-#define snprintf _snprintf
-#define strcasecmp _stricmp
-
-#if 0
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif
-
-int gettimeofday (struct timeval *tv, void* tz);
-#ifdef _WORKAROUND_MINGW32_BUGS
-char * WSAAPI gai_strerror(int errnum);
-#endif
-
-
-#endif
-
-typedef unsigned char bool_t;
-#undef TRUE
-#undef FALSE
-#define TRUE 1
-#define FALSE 0
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-void* ortp_malloc(size_t sz);
-void ortp_free(void *ptr);
-void* ortp_realloc(void *ptr, size_t sz);
-void* ortp_malloc0(size_t sz);
-char * ortp_strdup(const char *tmp);
-
-/*override the allocator with this method, to be called BEFORE ortp_init()*/
-typedef struct _OrtpMemoryFunctions{
- void *(*malloc_fun)(size_t sz);
- void *(*realloc_fun)(void *ptr, size_t sz);
- void (*free_fun)(void *ptr);
-}OrtpMemoryFunctions;
-
-void ortp_set_memory_functions(OrtpMemoryFunctions *functions);
-
-#define ortp_new(type,count) ortp_malloc(sizeof(type)*(count))
-#define ortp_new0(type,count) ortp_malloc0(sizeof(type)*(count))
-
-int close_socket(ortp_socket_t sock);
-int set_non_blocking_socket(ortp_socket_t sock);
-
-char *ortp_strndup(const char *str,int n);
-char *ortp_strdup_printf(const char *fmt,...);
-char *ortp_strdup_vprintf(const char *fmt, va_list ap);
-
-int ortp_file_exist(const char *pathname);
-
-/* portable named pipes */
-#if !defined(_WIN32_WCE)
-#ifdef WIN32
-typedef HANDLE ortp_pipe_t;
-#define ORTP_PIPE_INVALID INVALID_HANDLE_VALUE
-#else
-typedef int ortp_pipe_t;
-#define ORTP_PIPE_INVALID (-1)
-#endif
-
-ortp_pipe_t ortp_server_pipe_create(const char *name);
-/*
- * warning: on win32 ortp_server_pipe_accept_client() might return INVALID_HANDLE_VALUE without
- * any specific error, this happens when ortp_server_pipe_close() is called on another pipe.
- * This pipe api is not thread-safe.
-*/
-ortp_pipe_t ortp_server_pipe_accept_client(ortp_pipe_t server);
-int ortp_server_pipe_close(ortp_pipe_t spipe);
-int ortp_server_pipe_close_client(ortp_pipe_t client);
-
-ortp_pipe_t ortp_client_pipe_connect(const char *name);
-int ortp_client_pipe_close(ortp_pipe_t sock);
-
-int ortp_pipe_read(ortp_pipe_t p, uint8_t *buf, int len);
-int ortp_pipe_write(ortp_pipe_t p, const uint8_t *buf, int len);
-#endif
-
-#ifdef __cplusplus
-}
-
-#endif
-
-
-#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(ORTP_STATIC)
-#ifdef ORTP_EXPORTS
- #define VAR_DECLSPEC __declspec(dllexport)
-#else
- #define VAR_DECLSPEC __declspec(dllimport)
-#endif
-#else
- #define VAR_DECLSPEC extern
-#endif
-
-
-#endif
-
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#ifndef RTCP_H
-#define RTCP_H
-
-#include <ortp/port.h>
-
-#define RTCP_MAX_RECV_BUFSIZE 1024
-
-#define RTCP_SENDER_INFO_SIZE 20
-#define RTCP_REPORT_BLOCK_SIZE 24
-#define RTCP_COMMON_HEADER_SIZE 4
-#define RTCP_SSRC_FIELD_SIZE 4
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-/* RTCP common header */
-
-typedef enum {
- RTCP_SR = 200,
- RTCP_RR = 201,
- RTCP_SDES = 202,
- RTCP_BYE = 203,
- RTCP_APP = 204
-} rtcp_type_t;
-
-
-typedef struct rtcp_common_header
-{
-#ifdef ORTP_BIGENDIAN
- uint16_t version:2;
- uint16_t padbit:1;
- uint16_t rc:5;
- uint16_t packet_type:8;
-#else
- uint16_t rc:5;
- uint16_t padbit:1;
- uint16_t version:2;
- uint16_t packet_type:8;
-#endif
- uint16_t length:16;
-} rtcp_common_header_t;
-
-#define rtcp_common_header_set_version(ch,v) (ch)->version=v
-#define rtcp_common_header_set_padbit(ch,p) (ch)->padbit=p
-#define rtcp_common_header_set_rc(ch,rc) (ch)->rc=rc
-#define rtcp_common_header_set_packet_type(ch,pt) (ch)->packet_type=pt
-#define rtcp_common_header_set_length(ch,l) (ch)->length=htons(l)
-
-#define rtcp_common_header_get_version(ch) ((ch)->version)
-#define rtcp_common_header_get padbit(ch) ((ch)->padbit)
-#define rtcp_common_header_get_rc(ch) ((ch)->rc)
-#define rtcp_common_header_get_packet_type(ch) ((ch)->packet_type)
-#define rtcp_common_header_get_length(ch) ntohs((ch)->length)
-
-
-/* SR or RR packets */
-
-typedef struct sender_info
-{
- uint32_t ntp_timestamp_msw;
- uint32_t ntp_timestamp_lsw;
- uint32_t rtp_timestamp;
- uint32_t senders_packet_count;
- uint32_t senders_octet_count;
-} sender_info_t;
-
-uint64_t sender_info_get_ntp_timestamp(const sender_info_t *si);
-#define sender_info_get_rtp_timestamp(si) ((si)->rtp_timestamp)
-#define sender_info_get_packet_count(si) \
- ntohl((si)->senders_packet_count)
-#define sender_info_get_octet_count(si) \
- ntohl((si)->senders_octet_count)
-
-
-typedef struct report_block
-{
- uint32_t ssrc;
- uint32_t fl_cnpl;/*fraction lost + cumulative number of packet lost*/
- uint32_t ext_high_seq_num_rec; /*extended highest sequence number received */
- uint32_t interarrival_jitter;
- uint32_t lsr; /*last SR */
- uint32_t delay_snc_last_sr; /*delay since last sr*/
-} report_block_t;
-
-#define report_block_get_ssrc(rb) \
- ntohl((rb)->ssrc)
-#define report_block_get_fraction_lost(rb) \
- (((uint32_t)ntohl((rb)->fl_cnpl))>>24)
-#define report_block_get_cum_packet_loss(rb) \
- (((uint32_t)ntohl((rb)->fl_cnpl)) & 0xFFFFFF)
-#define report_block_get_high_ext_seq(rb) \
- ntohl(((report_block_t*)(rb))->ext_high_seq_num_rec)
-#define report_block_get_interarrival_jitter(rb) \
- ntohl(((report_block_t*)(rb))->interarrival_jitter)
-#define report_block_get_last_SR_time(rb) \
- ntohl(((report_block_t*)(rb))->lsr)
-#define report_block_get_last_SR_delay(rb) \
- ntohl(((report_block_t*)(rb))->delay_snc_last_sr)
-
-#define report_block_set_fraction_lost(rb,fl)\
- ((rb)->fl_cnpl)=htonl( (ntohl((rb)->fl_cnpl) & 0xFFFFFF) | (((fl) & 0xFF)<<24))
-
-#define report_block_set_cum_packet_lost(rb,cpl)\
- ((rb)->fl_cnpl)=htonl( (ntohl((rb)->fl_cnpl) & 0xFF000000) | (((cpl) & 0xFFFFFF)))
-
-/* SDES packets */
-
-typedef enum {
- RTCP_SDES_END = 0,
- RTCP_SDES_CNAME = 1,
- RTCP_SDES_NAME = 2,
- RTCP_SDES_EMAIL = 3,
- RTCP_SDES_PHONE = 4,
- RTCP_SDES_LOC = 5,
- RTCP_SDES_TOOL = 6,
- RTCP_SDES_NOTE = 7,
- RTCP_SDES_PRIV = 8,
- RTCP_SDES_MAX = 9
-} rtcp_sdes_type_t;
-
-typedef struct sdes_chunk
-{
- uint32_t csrc;
-} sdes_chunk_t;
-
-
-#define sdes_chunk_get_csrc(c) ntohl((c)->csrc)
-
-typedef struct sdes_item
-{
- uint8_t item_type;
- uint8_t len;
- char content[1];
-} sdes_item_t;
-
-#define RTCP_SDES_MAX_STRING_SIZE 255
-#define RTCP_SDES_ITEM_HEADER_SIZE 2
-#define RTCP_SDES_CHUNK_DEFAULT_SIZE 1024
-#define RTCP_SDES_CHUNK_HEADER_SIZE (sizeof(sdes_chunk_t))
-
-/* RTCP bye packet */
-
-typedef struct rtcp_bye_reason
-{
- uint8_t len;
- char content[1];
-} rtcp_bye_reason_t;
-
-typedef struct rtcp_bye
-{
- rtcp_common_header_t ch;
- uint32_t ssrc[1]; /* the bye may contain several ssrc/csrc */
-} rtcp_bye_t;
-#define RTCP_BYE_HEADER_SIZE sizeof(rtcp_bye_t)
-#define RTCP_BYE_REASON_MAX_STRING_SIZE 255
-
-
-
-typedef struct rtcp_sr{
- rtcp_common_header_t ch;
- uint32_t ssrc;
- sender_info_t si;
- report_block_t rb[1];
-} rtcp_sr_t;
-
-typedef struct rtcp_rr{
- rtcp_common_header_t ch;
- uint32_t ssrc;
- report_block_t rb[1];
-} rtcp_rr_t;
-
-typedef struct rtcp_app{
- rtcp_common_header_t ch;
- uint32_t ssrc;
- char name[4];
-} rtcp_app_t;
-
-struct _RtpSession;
-void rtp_session_rtcp_process_send(struct _RtpSession *s);
-void rtp_session_rtcp_process_recv(struct _RtpSession *s);
-
-#define RTCP_DEFAULT_REPORT_INTERVAL 5
-
-
-/* packet parsing api */
-
-/*in case of coumpound packet, set read pointer of m to the beginning of the next RTCP
-packet */
-bool_t rtcp_next_packet(mblk_t *m);
-/* put the read pointer at the first RTCP packet of the compound packet (as before any previous calls ot rtcp_next_packet() */
-void rtcp_rewind(mblk_t *m);
-/* get common header*/
-const rtcp_common_header_t * rtcp_get_common_header(const mblk_t *m);
-
-/*Sender Report accessors */
-/* check if this packet is a SR and if it is correct */
-bool_t rtcp_is_SR(const mblk_t *m);
-uint32_t rtcp_SR_get_ssrc(const mblk_t *m);
-const sender_info_t * rtcp_SR_get_sender_info(const mblk_t *m);
-const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int idx);
-
-/*Receiver report accessors*/
-bool_t rtcp_is_RR(const mblk_t *m);
-uint32_t rtcp_RR_get_ssrc(const mblk_t *m);
-const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int idx);
-
-/*SDES accessors */
-bool_t rtcp_is_SDES(const mblk_t *m);
-typedef void (*SdesItemFoundCallback)(void *user_data, uint32_t csrc, rtcp_sdes_type_t t, const char *content, uint8_t content_len);
-void rtcp_sdes_parse(const mblk_t *m, SdesItemFoundCallback cb, void *user_data);
-
-/*BYE accessors */
-bool_t rtcp_is_BYE(const mblk_t *m);
-bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc);
-bool_t rtcp_BYE_get_reason(const mblk_t *m, const char **reason, int *reason_len);
-
-/*APP accessors */
-bool_t rtcp_is_APP(const mblk_t *m);
-int rtcp_APP_get_subtype(const mblk_t *m);
-uint32_t rtcp_APP_get_ssrc(const mblk_t *m);
-/* name argument is supposed to be at least 4 characters (note: no '\0' written)*/
-void rtcp_APP_get_name(const mblk_t *m, char *name);
-/* retrieve the data. when returning, data points directly into the mblk_t */
-void rtcp_APP_get_data(const mblk_t *m, uint8_t **data, int *len);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#ifndef RTP_H
-#define RTP_H
-
-#include <ortp/port.h>
-#include <ortp/str_utils.h>
-
-#define IPMAXLEN 20
-#define UDP_MAX_SIZE 1500
-#define RTP_FIXED_HEADER_SIZE 12
-#define RTP_DEFAULT_JITTER_TIME 80 /*miliseconds*/
-#define RTP_DEFAULT_MULTICAST_TTL 5 /*hops*/
-#define RTP_DEFAULT_MULTICAST_LOOPBACK 0 /*false*/
-#define RTP_DEFAULT_DSCP 0x00 /*best effort*/
-
-
-
-typedef struct rtp_header
-{
-#ifdef ORTP_BIGENDIAN
- uint16_t version:2;
- uint16_t padbit:1;
- uint16_t extbit:1;
- uint16_t cc:4;
- uint16_t markbit:1;
- uint16_t paytype:7;
-#else
- uint16_t cc:4;
- uint16_t extbit:1;
- uint16_t padbit:1;
- uint16_t version:2;
- uint16_t paytype:7;
- uint16_t markbit:1;
-#endif
- uint16_t seq_number;
- uint32_t timestamp;
- uint32_t ssrc;
- uint32_t csrc[16];
-} rtp_header_t;
-
-
-
-
-typedef struct rtp_stats
-{
- uint64_t packet_sent;
- uint64_t sent; /* bytes sent */
- uint64_t recv; /* bytes of payload received and delivered in time to the application */
- uint64_t hw_recv; /* bytes of payload received */
- uint64_t packet_recv; /* number of packets received */
- uint64_t unavaillable; /* packets not availlable when they were queried */
- uint64_t outoftime; /* number of packets that were received too late */
- uint64_t cum_packet_loss; /* cumulative number of packet lost */
- uint64_t bad; /* packets that did not appear to be RTP */
- uint64_t discarded; /* incoming packets discarded because the queue exceeds its max size */
-} rtp_stats_t;
-
-#define RTP_TIMESTAMP_IS_NEWER_THAN(ts1,ts2) \
- ((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2))< (uint32_t)(1<<31))
-
-#define RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(ts1,ts2) \
- ( ((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2))< (uint32_t)(1<<31)) && (ts1)!=(ts2) )
-
-#define TIME_IS_NEWER_THAN(t1,t2) RTP_TIMESTAMP_IS_NEWER_THAN(t1,t2)
-
-#define TIME_IS_STRICTLY_NEWER_THAN(t1,t2) RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(t1,t2)
-
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-/* packet api */
-/* the first argument is a mblk_t. The header is supposed to be not splitted */
-#define rtp_set_markbit(mp,value) ((rtp_header_t*)((mp)->b_rptr))->markbit=(value)
-#define rtp_set_seqnumber(mp,seq) ((rtp_header_t*)((mp)->b_rptr))->seq_number=(seq)
-#define rtp_set_timestamp(mp,ts) ((rtp_header_t*)((mp)->b_rptr))->timestamp=(ts)
-#define rtp_set_ssrc(mp,_ssrc) ((rtp_header_t*)((mp)->b_rptr))->ssrc=(_ssrc)
-void rtp_add_csrc(mblk_t *mp ,uint32_t csrc);
-#define rtp_set_payload_type(mp,pt) ((rtp_header_t*)((mp)->b_rptr))->paytype=(pt)
-
-#define rtp_get_markbit(mp) (((rtp_header_t*)((mp)->b_rptr))->markbit)
-#define rtp_get_timestamp(mp) (((rtp_header_t*)((mp)->b_rptr))->timestamp)
-#define rtp_get_seqnumber(mp) (((rtp_header_t*)((mp)->b_rptr))->seq_number)
-#define rtp_get_payload_type(mp) (((rtp_header_t*)((mp)->b_rptr))->paytype)
-#define rtp_get_ssrc(mp) (((rtp_header_t*)((mp)->b_rptr))->ssrc)
-#define rtp_get_cc(mp) (((rtp_header_t*)((mp)->b_rptr))->cc)
-#define rtp_get_csrc(mp, idx) (((rtp_header_t*)((mp)->b_rptr))->csrc[idx])
-
-int rtp_get_payload(mblk_t *packet, unsigned char **start);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/**
- * \file rtpsession.h
- * \brief The RtpSession api
- *
- * The RtpSession objects represent a RTP session: once it is configured with
- * local and remote network addresses and a payload type is given, it let you send
- * and recv a media stream.
-**/
-
-
-#ifndef RTPSESSION_H
-#define RTPSESSION_H
-
-
-#include <ortp/port.h>
-#include <ortp/rtp.h>
-#include <ortp/payloadtype.h>
-#include <ortp/sessionset.h>
-#include <ortp/rtcp.h>
-#include <ortp/str_utils.h>
-#include <ortp/rtpsignaltable.h>
-#include <ortp/event.h>
-
-
-
-typedef enum {
- RTP_SESSION_RECVONLY,
- RTP_SESSION_SENDONLY,
- RTP_SESSION_SENDRECV
-} RtpSessionMode;
-
-
-/*! Jitter buffer parameters
-*/
-typedef struct _JBParameters{
- int min_size; /**< in milliseconds*/
- int nom_size; /**< idem */
- int max_size; /**< idem */
- bool_t adaptive;
- bool_t pad[3];
- int max_packets; /**< max number of packets allowed to be queued in the jitter buffer */
-} JBParameters;
-
-typedef struct _JitterControl
-{
- int count;
- int jitt_comp; /* the user jitt_comp in miliseconds*/
- int jitt_comp_ts; /* the jitt_comp converted in rtp time (same unit as timestamp) */
- int adapt_jitt_comp_ts;
- int64_t slide;
- int64_t prev_slide;
- float jitter;
- int olddiff;
- float inter_jitter; /* interarrival jitter as defined in the RFC */
- int corrective_step;
- int corrective_slide;
- bool_t adaptive;
- bool_t enabled;
-} JitterControl;
-
-typedef struct _WaitPoint
-{
- ortp_mutex_t lock;
- ortp_cond_t cond;
- uint32_t time;
- bool_t wakeup;
-} WaitPoint;
-
-typedef struct _RtpTransport
-{
- void *data;
- ortp_socket_t (*t_getsocket)(struct _RtpTransport *t);
- int (*t_sendto)(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen);
- int (*t_recvfrom)(struct _RtpTransport *t, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen);
- struct _RtpSession *session;//<back pointer to the owning session, set by oRTP
-} RtpTransport;
-
-
-
-typedef struct _RtpStream
-{
- ortp_socket_t socket;
- struct _RtpTransport *tr;
- int sockfamily;
- int max_rq_size;
- int time_jump;
- uint32_t ts_jump;
- queue_t rq;
- queue_t tev_rq;
- mblk_t *cached_mp;
- int loc_port;
-#ifdef ORTP_INET6
- struct sockaddr_storage rem_addr;
-#else
- struct sockaddr_in rem_addr;
-#endif
- int rem_addrlen;
- JitterControl jittctl;
- uint32_t snd_time_offset;/*the scheduler time when the application send its first timestamp*/
- uint32_t snd_ts_offset; /* the first application timestamp sent by the application */
- uint32_t snd_rand_offset; /* a random number added to the user offset to make the stream timestamp*/
- uint32_t snd_last_ts; /* the last stream timestamp sended */
- uint32_t rcv_time_offset; /*the scheduler time when the application ask for its first timestamp*/
- uint32_t rcv_ts_offset; /* the first stream timestamp */
- uint32_t rcv_query_ts_offset; /* the first user timestamp asked by the application */
- uint32_t rcv_last_ts; /* the last stream timestamp got by the application */
- uint32_t rcv_last_app_ts; /* the last application timestamp asked by the application */
- uint32_t rcv_last_ret_ts; /* the timestamp of the last sample returned (only for continuous audio)*/
- uint32_t hwrcv_extseq; /* last received on socket extended sequence number */
- uint32_t hwrcv_seq_at_last_SR;
- uint32_t hwrcv_since_last_SR;
- uint32_t last_rcv_SR_ts; /* NTP timestamp (middle 32 bits) of last received SR */
- struct timeval last_rcv_SR_time; /* time at which last SR was received */
- uint16_t snd_seq; /* send sequence number */
- uint32_t last_rtcp_report_snt_r; /* the time of the last rtcp report sent, in recv timestamp unit */
- uint32_t last_rtcp_report_snt_s; /* the time of the last rtcp report sent, in send timestamp unit */
- uint32_t rtcp_report_snt_interval; /* the interval in timestamp unit between rtcp report sent */
- uint32_t last_rtcp_packet_count; /*the sender's octet count in the last sent RTCP SR*/
- uint32_t sent_payload_bytes; /*used for RTCP sender reports*/
- unsigned int sent_bytes; /* used for bandwidth estimation */
- struct timeval send_bw_start; /* used for bandwidth estimation */
- unsigned int recv_bytes; /* used for bandwidth estimation */
- struct timeval recv_bw_start; /* used for bandwidth estimation */
- rtp_stats_t stats;
- int recv_errno;
- int send_errno;
- int snd_socket_size;
- int rcv_socket_size;
-}RtpStream;
-
-typedef struct _RtcpStream
-{
- ortp_socket_t socket;
- int sockfamily;
- struct _RtpTransport *tr;
-
- mblk_t *cached_mp;
-#ifdef ORTP_INET6
- struct sockaddr_storage rem_addr;
-#else
- struct sockaddr_in rem_addr;
-#endif
- int rem_addrlen;
- bool_t enabled; /*tells whether we can send RTCP packets */
-} RtcpStream;
-
-typedef struct _RtpSession RtpSession;
-
-
-/**
- * An object representing a bi-directional RTP session.
- * It holds sockets, jitter buffer, various counters (timestamp, sequence numbers...)
- * Applications SHOULD NOT try to read things within the RtpSession object but use
- * instead its public API (the rtp_session_* methods) where RtpSession is used as a
- * pointer.
- * rtp_session_new() allocates and initialize a RtpSession.
-**/
-struct _RtpSession
-{
- RtpSession *next; /* next RtpSession, when the session are enqueued by the scheduler */
- int mask_pos; /* the position in the scheduler mask of RtpSession : do not move this field: it is part of the ABI since the session_set macros use it*/
- struct {
- RtpProfile *profile;
- int pt;
- unsigned int ssrc;
- WaitPoint wp;
- int telephone_events_pt; /* the payload type used for telephony events */
- } snd,rcv;
- unsigned int inc_ssrc_candidate;
- int inc_same_ssrc_count;
- int hw_recv_pt; /* recv payload type before jitter buffer */
- int recv_buf_size;
- RtpSignalTable on_ssrc_changed;
- RtpSignalTable on_payload_type_changed;
- RtpSignalTable on_telephone_event_packet;
- RtpSignalTable on_telephone_event;
- RtpSignalTable on_timestamp_jump;
- RtpSignalTable on_network_error;
- RtpSignalTable on_rtcp_bye;
- struct _OList *signal_tables;
- struct _OList *eventqs;
- msgb_allocator_t allocator;
- RtpStream rtp;
- RtcpStream rtcp;
- RtpSessionMode mode;
- struct _RtpScheduler *sched;
- uint32_t flags;
- int dscp;
- int multicast_ttl;
- int multicast_loopback;
- void * user_data;
- /* FIXME: Should be a table for all session participants. */
- struct timeval last_recv_time; /* Time of receiving the RTP/RTCP packet. */
- mblk_t *pending;
- /* telephony events extension */
- mblk_t *current_tev; /* the pending telephony events */
- mblk_t *sd;
- queue_t contributing_sources;
- bool_t symmetric_rtp;
- bool_t permissive; /*use the permissive algorithm*/
- bool_t use_connect; /* use connect() on the socket */
- bool_t ssrc_set;
-};
-
-
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* public API */
-RtpSession *rtp_session_new(int mode);
-void rtp_session_set_scheduling_mode(RtpSession *session, int yesno);
-void rtp_session_set_blocking_mode(RtpSession *session, int yesno);
-void rtp_session_set_profile(RtpSession *session, RtpProfile *profile);
-void rtp_session_set_send_profile(RtpSession *session,RtpProfile *profile);
-void rtp_session_set_recv_profile(RtpSession *session,RtpProfile *profile);
-RtpProfile *rtp_session_get_profile(RtpSession *session);
-RtpProfile *rtp_session_get_send_profile(RtpSession *session);
-RtpProfile *rtp_session_get_recv_profile(RtpSession *session);
-int rtp_session_signal_connect(RtpSession *session,const char *signal_name, RtpCallback cb, unsigned long user_data);
-int rtp_session_signal_disconnect_by_callback(RtpSession *session,const char *signal_name, RtpCallback cb);
-void rtp_session_set_ssrc(RtpSession *session, uint32_t ssrc);
-void rtp_session_set_seq_number(RtpSession *session, uint16_t seq);
-uint16_t rtp_session_get_seq_number(RtpSession *session);
-
-void rtp_session_enable_jitter_buffer(RtpSession *session , bool_t enabled);
-bool_t rtp_session_jitter_buffer_enabled(const RtpSession *session);
-void rtp_session_set_jitter_buffer_params(RtpSession *session, const JBParameters *par);
-void rtp_session_get_jitter_buffer_params(RtpSession *session, JBParameters *par);
-
-/*deprecated jitter control functions*/
-void rtp_session_set_jitter_compensation(RtpSession *session, int milisec);
-void rtp_session_enable_adaptive_jitter_compensation(RtpSession *session, bool_t val);
-bool_t rtp_session_adaptive_jitter_compensation_enabled(RtpSession *session);
-
-void rtp_session_set_time_jump_limit(RtpSession *session, int miliseconds);
-int rtp_session_set_local_addr(RtpSession *session,const char *addr, int port);
-int rtp_session_get_local_port(const RtpSession *session);
-
-int
-rtp_session_set_remote_addr_full (RtpSession * session, const char * addr, int rtp_port, int rtcp_port);
-/*same as previous function, old name:*/
-int rtp_session_set_remote_addr_and_port (RtpSession * session, const char * addr, int rtp_port, int rtcp_port);
-int rtp_session_set_remote_addr(RtpSession *session,const char *addr, int port);
-/* alternatively to the set_remote_addr() and set_local_addr(), an application can give
-a valid socket (potentially connect()ed )to be used by the RtpSession */
-void rtp_session_set_sockets(RtpSession *session, int rtpfd, int rtcpfd);
-void rtp_session_set_transports(RtpSession *session, RtpTransport *rtptr, RtpTransport *rtcptr);
-
-/*those methods are provided for people who wants to send non-RTP messages using the RTP/RTCP sockets */
-ortp_socket_t rtp_session_get_rtp_socket(const RtpSession *session);
-ortp_socket_t rtp_session_get_rtcp_socket(const RtpSession *session);
-
-
-/* QOS / DSCP */
-int rtp_session_set_dscp(RtpSession *session, int dscp);
-int rtp_session_get_dscp(const RtpSession *session);
-
-
-/* Multicast methods */
-int rtp_session_set_multicast_ttl(RtpSession *session, int ttl);
-int rtp_session_get_multicast_ttl(RtpSession *session);
-
-int rtp_session_set_multicast_loopback(RtpSession *session, int yesno);
-int rtp_session_get_multicast_loopback(RtpSession *session);
-
-
-
-int rtp_session_set_send_payload_type(RtpSession *session, int paytype);
-int rtp_session_get_send_payload_type(const RtpSession *session);
-
-int rtp_session_get_recv_payload_type(const RtpSession *session);
-int rtp_session_set_recv_payload_type(RtpSession *session, int pt);
-
-int rtp_session_set_payload_type(RtpSession *session, int pt);
-
-void rtp_session_set_symmetric_rtp (RtpSession * session, bool_t yesno);
-
-void rtp_session_set_connected_mode(RtpSession *session, bool_t yesno);
-
-void rtp_session_enable_rtcp(RtpSession *session, bool_t yesno);
-
-/*low level recv and send functions */
-mblk_t * rtp_session_recvm_with_ts (RtpSession * session, uint32_t user_ts);
-mblk_t * rtp_session_create_packet(RtpSession *session,int header_size, const uint8_t *payload, int payload_size);
-mblk_t * rtp_session_create_packet_with_data(RtpSession *session, uint8_t *payload, int payload_size, void (*freefn)(void*));
-mblk_t * rtp_session_create_packet_in_place(RtpSession *session,uint8_t *buffer, int size, void (*freefn)(void*) );
-int rtp_session_sendm_with_ts (RtpSession * session, mblk_t *mp, uint32_t userts);
-/* high level recv and send functions */
-int rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int len, uint32_t ts, int *have_more);
-int rtp_session_send_with_ts(RtpSession *session, const uint8_t *buffer, int len, uint32_t userts);
-
-/* event API*/
-void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q);
-void rtp_session_unregister_event_queue(RtpSession *session, OrtpEvQueue *q);
-
-
-/* IP bandwidth usage estimation functions, returning bits/s*/
-float rtp_session_compute_send_bandwidth(RtpSession *session);
-float rtp_session_compute_recv_bandwidth(RtpSession *session);
-
-void rtp_session_send_rtcp_APP(RtpSession *session, uint8_t subtype, const char *name, const uint8_t *data, int datalen);
-
-uint32_t rtp_session_get_current_send_ts(RtpSession *session);
-uint32_t rtp_session_get_current_recv_ts(RtpSession *session);
-void rtp_session_flush_sockets(RtpSession *session);
-void rtp_session_release_sockets(RtpSession *session);
-void rtp_session_resync(RtpSession *session);
-void rtp_session_reset(RtpSession *session);
-void rtp_session_destroy(RtpSession *session);
-
-const rtp_stats_t * rtp_session_get_stats(const RtpSession *session);
-void rtp_session_reset_stats(RtpSession *session);
-
-void rtp_session_set_data(RtpSession *session, void *data);
-void *rtp_session_get_data(const RtpSession *session);
-
-void rtp_session_set_recv_buf_size(RtpSession *session, int bufsize);
-void rtp_session_set_rtp_socket_send_buffer_size(RtpSession * session, unsigned int size);
-void rtp_session_set_rtp_socket_recv_buffer_size(RtpSession * session, unsigned int size);
-
-/* in use with the scheduler to convert a timestamp in scheduler time unit (ms) */
-uint32_t rtp_session_ts_to_time(RtpSession *session,uint32_t timestamp);
-uint32_t rtp_session_time_to_ts(RtpSession *session, int millisecs);
-/* this function aims at simulating senders with "imprecise" clocks, resulting in
-rtp packets sent with timestamp uncorrelated with the system clock .
-This is only availlable to sessions working with the oRTP scheduler */
-void rtp_session_make_time_distorsion(RtpSession *session, int milisec);
-
-/*RTCP functions */
-void rtp_session_set_source_description(RtpSession *session, const char *cname,
- const char *name, const char *email, const char *phone,
- const char *loc, const char *tool, const char *note);
-void rtp_session_add_contributing_source(RtpSession *session, uint32_t csrc,
- const char *cname, const char *name, const char *email, const char *phone,
- const char *loc, const char *tool, const char *note);
-void rtp_session_remove_contributing_sources(RtpSession *session, uint32_t csrc);
-mblk_t* rtp_session_create_rtcp_sdes_packet(RtpSession *session);
-
-void rtp_session_get_last_recv_time(RtpSession *session, struct timeval *tv);
-int rtp_session_bye(RtpSession *session, const char *reason);
-
-int rtp_session_get_last_send_error_code(RtpSession *session);
-void rtp_session_clear_send_error_code(RtpSession *session);
-int rtp_session_get_last_recv_error_code(RtpSession *session);
-void rtp_session_clear_recv_error_code(RtpSession *session);
-
-/*private */
-void rtp_session_init(RtpSession *session, int mode);
-#define rtp_session_set_flag(session,flag) (session)->flags|=(flag)
-#define rtp_session_unset_flag(session,flag) (session)->flags&=~(flag)
-void rtp_session_uninit(RtpSession *session);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef rtpsignaltable_h
-#define rtpsignaltable_h
-
-#define RTP_CALLBACK_TABLE_MAX_ENTRIES 5
-
-typedef void (*RtpCallback)(struct _RtpSession *, ...);
-
-struct _RtpSignalTable
-{
- RtpCallback callback[RTP_CALLBACK_TABLE_MAX_ENTRIES];
- unsigned long user_data[RTP_CALLBACK_TABLE_MAX_ENTRIES];
- struct _RtpSession *session;
- const char *signal_name;
- int count;
-};
-
-typedef struct _RtpSignalTable RtpSignalTable;
-
-void rtp_signal_table_init(RtpSignalTable *table,struct _RtpSession *session, const char *signal_name);
-
-int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, unsigned long user_data);
-
-void rtp_signal_table_emit(RtpSignalTable *table);
-
-/* emit but with a second arg */
-void rtp_signal_table_emit2(RtpSignalTable *table, unsigned long arg);
-
-/* emit but with a third arg */
-void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2);
-
-int rtp_signal_table_remove_by_callback(RtpSignalTable *table,RtpCallback cb);
-
-#endif
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-/**
- * \file sessionset.h
- * \brief Sending and receiving multiple streams together with only one thread.
- *
-**/
-#ifndef SESSIONSET_H
-#define SESSIONSET_H
-
-
-#include <ortp/rtpsession.h>
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
-/* UNIX */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#define ORTP_FD_SET(d, s) FD_SET(d, s)
-#define ORTP_FD_CLR(d, s) FD_CLR(d, s)
-#define ORTP_FD_ISSET(d, s) FD_ISSET(d, s)
-#define ORTP_FD_ZERO(s) FD_ZERO(s)
-
-typedef fd_set ortp_fd_set;
-
-
-#else
-/* WIN32 */
-
-#define ORTP_FD_ZERO(s) \
- do { \
- unsigned int __i; \
- ortp_fd_set *__arr = (s); \
- for (__i = 0; __i < sizeof (ortp_fd_set) / sizeof (ortp__fd_mask); ++__i) \
- ORTP__FDS_BITS (__arr)[__i] = 0; \
- } while (0)
-#define ORTP_FD_SET(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] |= ORTP__FDMASK(d))
-#define ORTP_FD_CLR(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] &= ~ORTP__FDMASK(d))
-#define ORTP_FD_ISSET(d, s) ((ORTP__FDS_BITS (s)[ORTP__FDELT(d)] & ORTP__FDMASK(d)) != 0)
-
-
-
-/* The fd_set member is required to be an array of longs. */
-typedef long int ortp__fd_mask;
-
-
-/* Number of bits per word of `fd_set' (some code assumes this is 32). */
-#define ORTP__FD_SETSIZE 1024
-
-/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
-#define ORTP__NFDBITS (8 * sizeof (ortp__fd_mask))
-#define ORTP__FDELT(d) ((d) / ORTP__NFDBITS)
-#define ORTP__FDMASK(d) ((ortp__fd_mask) 1 << ((d) % ORTP__NFDBITS))
-
-
-/* fd_set for select and pselect. */
-typedef struct
- {
- ortp__fd_mask fds_bits[ORTP__FD_SETSIZE / ORTP__NFDBITS];
-# define ORTP__FDS_BITS(set) ((set)->fds_bits)
- } ortp_fd_set;
-
-
-#endif /*end WIN32*/
-
-struct _SessionSet
-{
- ortp_fd_set rtpset;
-};
-
-
-typedef struct _SessionSet SessionSet;
-
-#define session_set_init(ss) ORTP_FD_ZERO(&(ss)->rtpset)
-
-SessionSet * session_set_new(void);
-/**
- * This macro adds the rtp session to the set.
- * @param ss a set (SessionSet object)
- * @param rtpsession a RtpSession
-**/
-#define session_set_set(ss,rtpsession) ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)
-
-/**
- * This macro tests if the session is part of the set. 1 is returned if true, 0 else.
- *@param ss a set (#SessionSet object)
- *@param rtpsession a rtp session
- *
-**/
-#define session_set_is_set(ss,rtpsession) ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)
-
-/**
- * Removes the session from the set.
- *@param ss a set of sessions.
- *@param rtpsession a rtp session.
- *
- *
-**/
-#define session_set_clr(ss,rtpsession) ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)
-
-#define session_set_copy(dest,src) memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))
-
-
-/**
- * Frees a SessionSet.
-**/
-void session_set_destroy(SessionSet *set);
-
-
-int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors);
-int session_set_timedselect(SessionSet *recvs, SessionSet *sends, SessionSet *errors, struct timeval *timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef ortp_srtp_h
-#define ortp_srtp_h
-
-#include <srtp/srtp.h>
-#include <ortp/rtpsession.h>
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-
-err_status_t ortp_srtp_init(void);
-err_status_t ortp_srtp_create(srtp_t *session, const srtp_policy_t *policy);
-err_status_t ortp_srtp_dealloc(srtp_t session);
-err_status_t ortp_srtp_add_stream(srtp_t session, const srtp_policy_t *policy);
-
-bool_t ortp_srtp_supported(void);
-
-int srtp_transport_new(srtp_t srtp, RtpTransport **rtpt, RtpTransport **rtcpt );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef STR_UTILS_H
-#define STR_UTILS_H
-
-
-#include <ortp/port.h>
-
-
-typedef struct msgb
-{
- struct msgb *b_prev;
- struct msgb *b_next;
- struct msgb *b_cont;
- struct datab *b_datap;
- unsigned char *b_rptr;
- unsigned char *b_wptr;
- uint32_t reserved1;
- uint32_t reserved2;
-} mblk_t;
-
-typedef struct datab
-{
- unsigned char *db_base;
- unsigned char *db_lim;
- void (*db_freefn)(void*);
- int db_ref;
-} dblk_t;
-
-typedef struct _queue
-{
- mblk_t _q_stopper;
- int q_mcount; /*number of packet in the q */
-} queue_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void qinit(queue_t *q);
-
-void putq(queue_t *q, mblk_t *m);
-
-mblk_t * getq(queue_t *q);
-
-void insq(queue_t *q,mblk_t *emp, mblk_t *mp);
-
-void remq(queue_t *q, mblk_t *mp);
-
-mblk_t * peekq(queue_t *q);
-
-/* remove and free all messages in the q */
-#define FLUSHALL 0
-void flushq(queue_t *q, int how);
-
-void mblk_init(mblk_t *mp);
-
-/* allocates a mblk_t, that points to a datab_t, that points to a buffer of size size. */
-mblk_t *allocb(int size, int unused);
-#define BPRI_MED 0
-
-/* allocates a mblk_t, that points to a datab_t, that points to buf; buf will be freed using freefn */
-mblk_t *esballoc(uint8_t *buf, int size, int pri, void (*freefn)(void*) );
-
-/* frees a mblk_t, and if the datab ref_count is 0, frees it and the buffer too */
-void freeb(mblk_t *m);
-
-/* frees recursively (follow b_cont) a mblk_t, and if the datab
-ref_count is 0, frees it and the buffer too */
-void freemsg(mblk_t *mp);
-
-/* duplicates a mblk_t , buffer is not duplicated*/
-mblk_t *dupb(mblk_t *m);
-
-/* duplicates a complex mblk_t, buffer is not duplicated */
-mblk_t *dupmsg(mblk_t* m);
-
-/* returns the size of data of a message */
-int msgdsize(const mblk_t *mp);
-
-/* concatenates all fragment of a complex message*/
-void msgpullup(mblk_t *mp,int len);
-
-/* duplicates a single message, but with buffer included */
-mblk_t *copyb(mblk_t *mp);
-
-/* duplicates a complex message with buffer included */
-mblk_t *copymsg(mblk_t *mp);
-
-mblk_t * appendb(mblk_t *mp, const char *data, int size, bool_t pad);
-void msgappend(mblk_t *mp, const char *data, int size, bool_t pad);
-
-mblk_t *concatb(mblk_t *mp, mblk_t *newm);
-
-#define qempty(q) (&(q)->_q_stopper==(q)->_q_stopper.b_next)
-#define qfirst(q) ((q)->_q_stopper.b_next!=&(q)->_q_stopper ? (q)->_q_stopper.b_next : NULL)
-#define qbegin(q) ((q)->_q_stopper.b_next)
-#define qlast(q) ((q)->_q_stopper.b_prev!=&(q)->_q_stopper ? (q)->_q_stopper.b_prev : NULL)
-#define qend(q,mp) ((mp)==&(q)->_q_stopper)
-#define qnext(q,mp) ((mp)->b_next)
-
-typedef struct _msgb_allocator{
- queue_t q;
-}msgb_allocator_t;
-
-void msgb_allocator_init(msgb_allocator_t *pa);
-mblk_t *msgb_allocator_alloc(msgb_allocator_t *pa, int size);
-void msgb_allocator_uninit(msgb_allocator_t *pa);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* ====================================================================
- * The Vovida Software License, Version 1.0
- *
- * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The names "VOCAL", "Vovida Open Communication Application Library",
- * and "Vovida Open Communication Application Library (VOCAL)" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact vocal@vovida.org.
- *
- * 4. Products derived from this software may not be called "VOCAL", nor
- * may "VOCAL" appear in their name, without prior written
- * permission of Vovida Networks, Inc.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
- * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
- * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
- * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * ====================================================================
- *
- * This software consists of voluntary contributions made by Vovida
- * Networks, Inc. and many individuals on behalf of Vovida Networks,
- * Inc. For more information on Vovida Networks, Inc., please see
- * <http://www.vovida.org/>.
- *
- */
-
-
-#ifndef __STUN_H__
-#define __STUN_H__
-
-#include <stdio.h>
-#include <time.h>
-#include <ortp/port.h>
-#include <ortp/stun_udp.h>
-
-#ifdef __APPLE__
- #include "TargetConditionals.h"
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* if you change this version, change in makefile too */
-#define STUN_VERSION "0.99"
-
-#define STUN_MAX_STRING 256
-#define STUN_MAX_UNKNOWN_ATTRIBUTES 8
-#define STUN_MAX_MESSAGE_SIZE 2048
-
-#define STUN_PORT 3478
-
-/* define some basic types */
-#if 0
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-typedef unsigned __int64 uint64_t;
-#else
-typedef unsigned long long uint64_t;
-#endif
-#endif
-typedef struct { unsigned char octet[12]; } UInt96;
-
-/* define a structure to hold a stun address */
-#define IPv4Family 0x01
-#define IPv6Family 0x02
-
-/* define flags */
-#define ChangeIpFlag 0x04
-#define ChangePortFlag 0x02
-
-/* define stun attribute */
-#define SA_MAPPEDADDRESS 0x0001
-#define SA_RESPONSEADDRESS 0x0002 /** deprecated **/
-#define SA_CHANGEREQUEST 0x0003 /** deprecated **/
-#define SA_SOURCEADDRESS 0x0004 /** deprecated **/
-#define SA_CHANGEDADDRESS 0x0005 /** deprecated **/
-#define SA_USERNAME 0x0006
-#define SA_PASSWORD 0x0007 /** deprecated **/
-#define SA_MESSAGEINTEGRITY 0x0008
-#define SA_ERRORCODE 0x0009
-#define SA_UNKNOWNATTRIBUTE 0x000A
-#define SA_REFLECTEDFROM 0x000B /** deprecated **/
-#define SA_REALM 0x0014
-#define SA_NONCE 0x0015
-#define SA_XORMAPPEDADDRESS 0x0020
-
-#define SA_XORMAPPEDADDRESS2 0x8020 /* Non standard extention */
-#define SA_XORONLY 0x0021 /* deprecated */
-#define SA_SECONDARYADDRESS 0x0050 /* Non standard extention */
-
-#define SA_SOFTWARE 0x8022
-#define SA_ALTERNATESERVER 0x8023
-#define SA_FINGERPRINT 0x8028
-
-/* define turn attribute */
-#define TA_CHANNELNUMBER 0x000C
-#define TA_LIFETIME 0x000D
-#define TA_DEPRECATEDBANDWIDTH 0x0010
-#define TA_XORPEERADDRESS 0x0012
-#define TA_DATA 0x0013
-#define TA_XORRELAYEDADDRESS 0x0016
-#define TA_EVENPORT 0x0018
-#define TA_REQUESTEDTRANSPORT 0x0019
-#define TA_DONTFRAGMENT 0x001A
-#define TA_DEPRECATEDTIMERVAL 0x0021
-#define TA_RESERVATIONTOKEN 0x0022
-
-#define ICEA_PRIORITY 0x0024
-#define ICEA_USECANDIDATE 0x0025
-#define ICEA_ICECONTROLLED 0x8029
-#define ICEA_ICECONTROLLING 0x802a
-
-#define STUN_REQUEST 0x0000
-#define STUN_INDICATION 0x0010
-#define STUN_SUCCESS_RESP 0x0100
-#define STUN_ERR_RESP 0x0110
-
-#define STUN_IS_REQUEST(msg_type) (((msg_type) & 0x0110) == 0x0000)
-#define STUN_IS_INDICATION(msg_type) (((msg_type) & 0x0110) == 0x0010)
-#define STUN_IS_SUCCESS_RESP(msg_type) (((msg_type) & 0x0110) == 0x0100)
-#define STUN_IS_ERR_RESP(msg_type) (((msg_type) & 0x0110) == 0x0110)
-
-/* define types for a stun message */
-#define STUN_METHOD_BINDING 0x0001
-#define TURN_MEDHOD_ALLOCATE 0x0003 //(only request/response semantics defined)
-#define TURN_METHOD_REFRESH 0x0004 //(only request/response semantics defined)
-#define TURN_METHOD_CREATEPERMISSION 0x0008 //(only request/response semantics defined
-#define TURN_METHOD_CHANNELBIND 0x0009 //(only request/response semantics defined)
-
-//#define BindResponseMsg 0x0101
-//#define BindErrorResponseMsg 0x0111
-#define SharedSecretRequestMsg 0x0002
-#define SharedSecretResponseMsg 0x0102
-#define SharedSecretErrorResponseMsg 0x0112
-
-#define TURN_INDICATION_SEND 0x0006 //(only indication semantics defined)
-#define TURN_INDICATION_DATA 0x0007 //(only indication semantics defined)
-
-typedef struct
-{
- uint16_t msgType;
- uint16_t msgLength;
- uint32_t magic_cookie;
- UInt96 tr_id;
-} StunMsgHdr;
-
-
-typedef struct
-{
- uint16_t type;
- uint16_t length;
-} StunAtrHdr;
-
-typedef struct
-{
- uint16_t port;
- uint32_t addr;
-} StunAddress4;
-
-typedef struct
-{
- uint8_t pad;
- uint8_t family;
- StunAddress4 ipv4;
-} StunAtrAddress4;
-
-typedef struct
-{
- uint32_t value;
-} StunAtrChangeRequest;
-
-typedef struct
-{
- uint16_t pad; /* all 0 */
- uint8_t errorClass;
- uint8_t number;
- char reason[STUN_MAX_STRING];
- uint16_t sizeReason;
-} StunAtrError;
-
-typedef struct
-{
- uint16_t attrType[STUN_MAX_UNKNOWN_ATTRIBUTES];
- uint16_t numAttributes;
-} StunAtrUnknown;
-
-typedef struct
-{
- uint16_t channelNumber;
- uint16_t rffu; /* Reserved For Future Use */
-} TurnAtrChannelNumber;
-
-typedef struct
-{
- uint32_t lifetime;
-} TurnAtrLifetime;
-
-typedef struct
-{
- char value[1500];
- uint16_t sizeValue;
-} TurnAtrData;
-
-typedef struct
-{
- uint8_t proto;
- uint8_t pad1;
- uint8_t pad2;
- uint8_t pad3;
-} TurnAtrRequestedTransport;
-
-typedef struct
-{
- uint64_t value;
-} TurnAtrReservationToken;
-
-typedef struct
-{
- uint32_t fingerprint;
-} StunAtrFingerprint;
-
-
-typedef struct
-{
- char value[STUN_MAX_STRING];
- uint16_t sizeValue;
-} StunAtrString;
-
-typedef struct
-{
- uint32_t priority;
-} IceAtrPriority;
-
-typedef struct
-{
- uint64_t value;
-} IceAtrIceControll;
-
-typedef struct
-{
- char hash[20];
-} StunAtrIntegrity;
-
-typedef enum
-{
- HmacUnkown=0,
- HmacOK,
- HmacBadUserName,
- HmacUnkownUserName,
- HmacFailed
-} StunHmacStatus;
-
-
-typedef struct
-{
- uint16_t attrType[STUN_MAX_UNKNOWN_ATTRIBUTES];
- uint16_t numAttributes;
-} TurnAtrUnknown;
-
-typedef struct
-{
- StunMsgHdr msgHdr;
-
- bool_t hasMappedAddress;
- StunAtrAddress4 mappedAddress;
-
- bool_t hasResponseAddress;
- StunAtrAddress4 responseAddress;
-
- bool_t hasChangeRequest;
- StunAtrChangeRequest changeRequest;
-
- bool_t hasSourceAddress;
- StunAtrAddress4 sourceAddress;
-
- bool_t hasChangedAddress;
- StunAtrAddress4 changedAddress;
-
- bool_t hasUsername;
- StunAtrString username;
-
- bool_t hasPassword;
- StunAtrString password;
-
- bool_t hasMessageIntegrity;
- StunAtrIntegrity messageIntegrity;
-
- bool_t hasErrorCode;
- StunAtrError errorCode;
-
- bool_t hasUnknownAttributes;
- StunAtrUnknown unknownAttributes;
-
- bool_t hasReflectedFrom;
- StunAtrAddress4 reflectedFrom;
-
- bool_t hasRealm;
- StunAtrString realmName;
-
- bool_t hasNonce;
- StunAtrString nonceName;
-
- bool_t hasXorMappedAddress;
- StunAtrAddress4 xorMappedAddress;
-
- bool_t hasSoftware;
- StunAtrString softwareName;
-
- bool_t hasXorPeerAddress;
- StunAtrAddress4 xorPeerAddress;
-
- bool_t hasXorRelayedAddress;
- StunAtrAddress4 xorRelayedAddress;
-
- bool_t hasFingerprint;
- StunAtrFingerprint fingerprint;
-
- /* Turn elements */
- bool_t hasChannelNumberAttributes;
- TurnAtrChannelNumber channelNumberAttributes;
-
- bool_t hasLifetimeAttributes;
- TurnAtrLifetime lifetimeAttributes;
-
- bool_t hasData;
- TurnAtrData data;
-
- bool_t hasRequestedTransport;
- TurnAtrRequestedTransport requestedTransport;
-
- bool_t hasDontFragment;
-
- bool_t hasReservationToken;
- TurnAtrReservationToken reservationToken;
-
- bool_t hasPriority;
- IceAtrPriority priority;
-
- bool_t hasUseCandidate;
-
- bool_t hasIceControlled;
- IceAtrIceControll iceControlled;
-
- bool_t hasIceControlling;
- IceAtrIceControll iceControlling;
-} StunMessage;
-
-
-/* Define enum with different types of NAT */
-typedef enum
-{
- StunTypeUnknown=0,
- StunTypeOpen,
- StunTypeConeNat,
- StunTypeRestrictedNat,
- StunTypePortRestrictedNat,
- StunTypeSymNat,
- StunTypeSymFirewall,
- StunTypeBlocked,
- StunTypeFailure
-} NatType;
-
-
-#define MAX_MEDIA_RELAYS 500
-#define MAX_RTP_MSG_SIZE 1500
-#define MEDIA_RELAY_TIMEOUT 3*60
-
-typedef struct
-{
- int relayPort; /* media relay port */
- int fd; /* media relay file descriptor */
- StunAddress4 destination; /* NAT IP:port */
- time_t expireTime; /* if no activity after time, close the socket */
-} StunMediaRelay;
-
-typedef struct
-{
- StunAddress4 myAddr;
- StunAddress4 altAddr;
- Socket myFd;
- Socket altPortFd;
- Socket altIpFd;
- Socket altIpPortFd;
- bool_t relay; /* true if media relaying is to be done */
- StunMediaRelay relays[MAX_MEDIA_RELAYS];
-} StunServerInfo;
-
-void
-stunCalculateIntegrity_longterm(char* hmac, const char* input, int length,
- const char *username, const char *realm, const char *password);
-void
-stunCalculateIntegrity_shortterm(char* hmac, const char* input, int length, const char* key);
-uint32_t
-stunCalculateFingerprint(const char* input, int length);
-
-bool_t
-stunParseMessage( char* buf,
- unsigned int bufLen,
- StunMessage *message);
-
-void
-stunBuildReqSimple( StunMessage* msg,
- const StunAtrString *username,
- bool_t changePort, bool_t changeIp, unsigned int id );
-
-unsigned int
-stunEncodeMessage( const StunMessage *message,
- char* buf,
- unsigned int bufLen,
- const StunAtrString *password);
-
-void
-stunCreateUserName(const StunAddress4 *addr, StunAtrString* username);
-
-void
-stunGetUserNameAndPassword( const StunAddress4 *dest,
- StunAtrString* username,
- StunAtrString* password);
-
-void
-stunCreatePassword(const StunAtrString *username, StunAtrString* password);
-
-int
-stunRand(void);
-
-uint64_t
-stunGetSystemTimeSecs(void);
-
-/* find the IP address of a the specified stun server - return false is fails parse */
-bool_t
-stunParseServerName( const char* serverName, StunAddress4 *stunServerAddr);
-
-bool_t
-stunParseHostName( const char* peerName,
- uint32_t *ip,
- uint16_t *portVal,
- uint16_t defaultPort );
-
-/* return true if all is OK
- Create a media relay and do the STERN thing if startMediaPort is non-zero */
-bool_t
-stunInitServer(StunServerInfo *info,
- const StunAddress4 *myAddr,
- const StunAddress4 *altAddr,
- int startMediaPort);
-
-void
-stunStopServer(StunServerInfo *info);
-
-/* returns number of address found - take array or addres */
-int
-stunFindLocalInterfaces(uint32_t* addresses, int maxSize );
-
-int
-stunTest( StunAddress4 *dest, int testNum, StunAddress4* srcAddr, StunAddress4 *sMappedAddr, StunAddress4* sChangedAddr);
-
-NatType
-stunNatType( StunAddress4 *dest,
- bool_t* preservePort, /* if set, is return for if NAT preservers ports or not */
- bool_t* hairpin , /* if set, is the return for if NAT will hairpin packets */
- int port, /* port to use for the test, 0 to choose random port */
- StunAddress4* sAddr /* NIC to use */
- );
-
-bool_t
-stunServerProcessMsg( char* buf,
- unsigned int bufLen,
- StunAddress4 *from,
- StunAddress4 *myAddr,
- StunAddress4 *altAddr,
- StunMessage *resp,
- StunAddress4 *destination,
- StunAtrString *hmacPassword,
- bool_t* changePort,
- bool_t* changeIp);
-
-int
-stunOpenSocket( StunAddress4 *dest,
- StunAddress4* mappedAddr,
- int port,
- StunAddress4* srcAddr);
-
-bool_t
-stunOpenSocketPair(StunAddress4 *dest,
- StunAddress4* mapAddr_rtp,
- StunAddress4* mapAddr_rtcp,
- int* fd1, int* fd2,
- int srcPort, StunAddress4* srcAddr);
-
-bool_t
-turnAllocateSocketPair(StunAddress4 *dest,
- StunAddress4* mapAddr_rtp,
- StunAddress4* mapAddr_rtcp,
- int* fd1, int* fd2,
- int srcPort, StunAddress4* srcAddr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* ====================================================================
- * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc. For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>.
- *
- */
-
-#ifndef __STUN_UDP_H__
-#define __STUN_UDP_H__
-
-#ifndef __cplusplus
-//#define bool int
-//#define false 0
-//#define true 1
-#endif
-
-#ifdef __MACH__
-#include <sys/socket.h>
-#ifndef _SOCKLEN_T
-typedef int socklen_t;
-#endif
-#endif
-
-#include <ortp/port.h>
-
-#if !defined(_WIN32_WCE)
-#include <errno.h>
-#endif
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#define snprintf _snprintf
-
-#include <winsock2.h>
-/* #include <io.h> */
-
-typedef int socklen_t;
-typedef SOCKET Socket;
-
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EINPROGRESS WSAEINPROGRESS
-#define EALREADY WSAEALREADY
-#define ENOTSOCK WSAENOTSOCK
-#define EDESTADDRREQ WSAEDESTADDRREQ
-#define EMSGSIZE WSAEMSGSIZE
-#define EPROTOTYPE WSAEPROTOTYPE
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define EADDRINUSE WSAEADDRINUSE
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#define ENETDOWN WSAENETDOWN
-#define ENETUNREACH WSAENETUNREACH
-#define ENETRESET WSAENETRESET
-#define ECONNABORTED WSAECONNABORTED
-#define ECONNRESET WSAECONNRESET
-#define ENOBUFS WSAENOBUFS
-#define EISCONN WSAEISCONN
-#define ENOTCONN WSAENOTCONN
-#define ESHUTDOWN WSAESHUTDOWN
-#define ETOOMANYREFS WSAETOOMANYREFS
-#define ETIMEDOUT WSAETIMEDOUT
-#define ECONNREFUSED WSAECONNREFUSED
-#define ELOOP WSAELOOP
-#define EHOSTDOWN WSAEHOSTDOWN
-#define EHOSTUNREACH WSAEHOSTUNREACH
-#define EPROCLIM WSAEPROCLIM
-#define EUSERS WSAEUSERS
-#define EDQUOT WSAEDQUOT
-#define ESTALE WSAESTALE
-#define EREMOTE WSAEREMOTE
-
-typedef LONGLONG Int64;
-
-#else
-
-typedef int Socket;
-#define INVALID_SOCKET -1
-#define SOCKET_ERROR -1
-
-#define closesocket(fd) close(fd)
-
-#define WSANOTINITIALISED EPROTONOSUPPORT
-
-#endif
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-int getErrno(void);
-
-/* Open a UDP socket to receive on the given port - if port is 0, pick a a
- port, if interfaceIp!=0 then use ONLY the interface specified instead of
- all of them */
-Socket
-openPort( unsigned short port, unsigned int interfaceIp);
-
-
-/* recive a UDP message */
-bool_t
-getMessage( Socket fd, char* buf, int* len,
- unsigned int* srcIp, unsigned short* srcPort);
-
-
-/* send a UDP message */
-bool_t
-sendMessage( Socket fd, char* msg, int len,
- unsigned int dstIp, unsigned short dstPort);
-
-
-/* set up network - does nothing in unix but needed for windows */
-void
-initNetwork(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/**
- * \file telephonyevents.h
- * \brief Receiving and sending telephone events (RFC2833)
- *
-**/
-
-
-#ifndef TELEPHONYEVENTS_H
-#define TELEPHONYEVENTS_H
-
-#include <ortp/rtpsession.h>
-
-
-struct _telephone_event
-{
-#ifdef ORTP_BIGENDIAN
- uint32_t event:8;
- uint32_t E:1;
- uint32_t R:1;
- uint32_t volume:6;
- uint32_t duration:16;
-#else
- uint32_t event:8;
- uint32_t volume:6;
- uint32_t R:1;
- uint32_t E:1;
- uint32_t duration:16;
-#endif
-};
-
-typedef struct _telephone_event telephone_event_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* tell if the session supports telephony events. For this the telephony events payload_type
- must be present in the rtp profile used by the session */
-
-/* low level functions */
-int rtp_session_telephone_events_supported(RtpSession *session);
-int rtp_session_send_telephone_events_supported(RtpSession *session);
-int rtp_session_recv_telephone_events_supported(RtpSession *session);
-
-mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start);
-
-int rtp_session_add_telephone_event(RtpSession *session,
- mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration);
-
-int rtp_session_read_telephone_event(RtpSession *session,
- mblk_t *packet,telephone_event_t **tab);
-
-/* high level functions*/
-int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts);
-int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration);
-/* for high level telephony event callback */
-void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* the size allocated for telephony events packets */
-#define TELEPHONY_EVENTS_ALLOCATED_SIZE (4*sizeof(telephone_event_t))
-
-/* list of named events */
-#define TEV_DTMF_0 (0)
-#define TEV_DTMF_1 (1)
-#define TEV_DTMF_2 (2)
-#define TEV_DTMF_3 (3)
-#define TEV_DTMF_4 (4)
-#define TEV_DTMF_5 (5)
-#define TEV_DTMF_6 (6)
-#define TEV_DTMF_7 (7)
-#define TEV_DTMF_8 (8)
-#define TEV_DTMF_9 (9)
-#define TEV_DTMF_STAR (10)
-#define TEV_DTMF_POUND (11)
-#define TEV_DTMF_A (12)
-#define TEV_DTMF_B (13)
-#define TEV_DTMF_C (14)
-#define TEV_DTMF_D (15)
-#define TEV_FLASH (16)
-
-
-#endif
+++ /dev/null
-# Anjuta Version 1.1.97
-Compatibility Level: 1
-
-<PROJECT_DESCRIPTION_START>
-Some description<PROJECT_DESCRIPTION_END>
-<CONFIG_PROGS_START>
-<CONFIG_PROGS_END>
-<CONFIG_LIBS_START>
-<CONFIG_LIBS_END>
-<CONFIG_HEADERS_START>
-<CONFIG_HEADERS_END>
-<CONFIG_CHARACTERISTICS_START>
-<CONFIG_CHARACTERISTICS_END>
-<CONFIG_LIB_FUNCS_START>
-<CONFIG_LIB_FUNCS_END>
-<CONFIG_ADDITIONAL_START>
-<CONFIG_ADDITIONAL_END>
-<CONFIG_FILES_START>
-<CONFIG_FILES_END>
-<MAKEFILE_AM_START>
-<MAKEFILE_AM_END>
-
-props.file.type=project
-
-anjuta.version=1.1.97
-anjuta.compatibility.level=1
-
-project.name=oRTP
-project.type=GENERIC
-project.target.type=EXECUTABLE
-project.version=0.99
-project.author=Simon Morlat
-project.source.target=Rtp stack
-project.has.gettext=0
-project.gui.command=
-project.programming.language=C
-project.excluded.modules=intl
-
-project.config.extra.modules.before=
-project.config.extra.modules.after=
-project.config.blocked=1
-project.config.disable.overwriting=1 1 1 1 1 1 1 1 1
-
-project.menu.entry=oRTP Version 0.99
-project.menu.group=Application
-project.menu.comment=oRTP Version 0.99
-project.menu.icon=
-project.menu.need.terminal=0
-
-project.configure.options=
-anjuta.program.arguments=
-preferences.build.option.jobs=0
-preferences.build.option.silent=0
-preferences.build.option.autosave=1
-preferences.anjuta.make.options=-k
-preferences.make=make
-preferences.build.option.keep.going=1
-preferences.build.option.warn.undef=0
-preferences.autoformat.custom.style= -i8 -sc -bli0 -bl0 -cbi0 -ss
-preferences.autoformat.style=Style of Kangleipak
-preferences.indent.opening=0
-preferences.autoformat.disable=0
-preferences.indent.automatic=1
-preferences.use.tabs=1
-preferences.indent.size=4
-preferences.tabsize=4
-preferences.indent.closing=0
-
-module.include.name=.
-module.include.type=
-module.include.files=\
- src/errno-win32.h\
- src/export.h\
- src/ortp-config-win32.h\
- src/ortp.h\
- src/payloadtype.h\
- src/port_fct.h\
- src/rtp.h\
- src/rtpmod.h\
- src/rtpport.h\
- src/rtpsession.h\
- src/rtpsignaltable.h\
- src/rtptimer.h\
- src/scheduler.h\
- src/sessionset.h\
- src/str_utils.h\
- src/telephonyevents.h\
- src/rtcp.h\
- ortp-config.h
-
-module.source.name=.
-module.source.type=
-module.source.files=\
- src/avprofile.c\
- src/export.c\
- src/mrtprecv.c\
- src/mrtpsend.c\
- src/ortp.c\
- src/ortpdlkm.c\
- src/payloadtype.c\
- src/port_fct.c\
- src/posixtimer.c\
- src/rtpmemtest.c\
- src/rtpmod.c\
- src/rtpparse.c\
- src/rtprecv.c\
- src/rtpsend.c\
- src/rtpsession.c\
- src/rtpsignaltable.c\
- src/rtptimer.c\
- src/scheduler.c\
- src/sessionset.c\
- src/str_utils.c\
- src/telephonyevents.c\
- src/test_tevrecv.c\
- src/test_tevsend.c\
- src/test_timer.c\
- src/tevmrtprecv.c\
- src/tevrtprecv.c\
- src/tevrtpsend.c
-
-module.pixmap.name=.
-module.pixmap.type=
-module.pixmap.files=\
- docs/html/home.png\
- docs/html/left.png\
- docs/html/right.png\
- docs/html/up.png
-
-module.data.name=.
-module.data.type=
-module.data.files=
-
-module.help.name=.
-module.help.type=
-module.help.files=
-
-module.doc.name=.
-module.doc.type=
-module.doc.files=\
- build/win32/oRTP/README\
- AUTHORS\
- COPYING\
- ChangeLog\
- INSTALL\
- NEWS\
- README\
- TODO\
- docs/tmpl/multiplexing.sgml\
- docs/tmpl/ortp-unused.sgml\
- docs/tmpl/payloads.sgml\
- docs/tmpl/rtpsessionapi.sgml\
- docs/tmpl/stackinit.sgml\
- docs/tmpl/stackmanagement.sgml\
- docs/tmpl/telephoneevents.sgml\
- docs/sgml/payloads.sgml\
- docs/sgml/tree_index.sgml\
- docs/sgml/object_index.sgml\
- docs/sgml/rtpsessionapi.sgml\
- docs/sgml/stackmanagement.sgml\
- docs/sgml/multiplexing.sgml\
- docs/sgml/telephoneevents.sgml\
- docs/ortp-docs.sgml\
- docs/html/book1.html\
- docs/html/ortpapi.html\
- docs/html/ortp-stack-management-functions.html\
- docs/html/ortp-rtpsession-api.html\
- docs/html/ortp-rtp-payloads-and-profiles.html\
- docs/html/ortp-multiplexing-sessions-(in-a-one-thread-design).html\
- docs/html/ortp-telephone-events-(rfc2833)-.html\
- docs/html/index.sgml\
- docs/html/ortp-library-management-functions.html
-
-module.po.files=
-
-compiler.options.supports=
-compiler.options.include.paths=\
- .\
- ..
-compiler.options.library.paths=
-compiler.options.libraries=
-compiler.options.libraries.selected=
-compiler.options.defines=\
- HAVE_CONFIG_H
-compiler.options.defines.selected=
-compiler.options.warning.buttons=0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0
-compiler.options.optimize.buttons=0 0 1 0
-compiler.options.other.buttons=1 0
-compiler.options.other.c.flags=
-compiler.options.other.l.flags=
-compiler.options.other.l.libs=
-
-project.src.paths=
+++ /dev/null
-
-[executer]
-RunInTerminal=true
-
-[Project DBase]
-ShowLocals=true
-
-[filenumbers]
-0=1846
-1=270
-2=1
-3=34
-4=43
-5=1
-6=4
-7=27
-8=9
-
-[filemarkers]
-0=
-1=
-2=
-3=
-4=
-5=
-6=
-7=
-8=
-
-[File View]
-filter.file.unmatch=*.so *.o *.a *.la
-filter.file.ignore.hidden=0
-filter.dir.ignore.hidden=0
-
-[filelist]
-0=/home/sangamon/src/devel/linphone/oRTP/src/rtpsession.c
-1=/home/sangamon/src/devel/linphone/oRTP/src/rtpsession.h
-2=/home/sangamon/src/devel/linphone/oRTP/src/rtcp.h
-3=/home/sangamon/src/devel/linphone/oRTP/src/scheduler.c
-
-[Project Tree]
-0=0
-1=0:1
-
-[File Tree]
-0=0
-
-[replace_text]
-0=telephone_event
-1=session->rtp
-2=PAYLOAD_AUDIO_CONTINUOUS
-3=ortp_global_stats
-4=session->rtp.rq
-5=session->rtp.wq
-
-[find_text]
-0=rtp_session_create
-1=chunk_item_new
-2=rtcp_calculate_sdes_padding
-3=rtp_session_process
-4=scheduler
-5=rtp
-6=rtp_send
-7=RtpSession
-
-[find_in_files]
-0=exit
+++ /dev/null
-# Doxyfile 1.5.1
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = oRTP
-PROJECT_NUMBER = @ORTP_VERSION@
-OUTPUT_DIRECTORY = doc
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = @srcdir@/src @srcdir@/include/ortp
-FILE_PATTERNS = *.c *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH = @srcdir@/src/tests
-EXAMPLE_PATTERNS = *.c
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-CALLER_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
+++ /dev/null
-# This is a comment
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-includedir=@includedir@
-
-Name: oRTP
-Description: Implement the RFC3550 (RTP) with a easy to use API with high and low level access.
-Version: @ORTP_PKGCONFIG_VERSION@
-Libs: -L@libdir@ -lortp @ORTPDEPS_LIBS@
-Cflags: -I@includedir@ @ORTPDEPS_CFLAGS@
+++ /dev/null
-# -*- rpm-spec -*-
-#
-# ortp -- Real-time Transport Protocol Stack
-#
-# Default is optimized for Pentium IV but will execute on Pentium II &
-# later (i686).
-
-%ifarch %ix86
-%define ortp_cpu pentium4
-%endif
-
-Summary: Real-time Transport Protocol Stack
-Name: ortp
-Version: @ORTP_PKGCONFIG_VERSION@
-Release: 1
-License: LGPL
-Group: Applications/Communications
-URL: http://linphone.org/ortp/
-Source0: %{name}-@ORTP_PKGCONFIG_VERSION@.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-%ifarch %ix86
-BuildArch: i686
-%endif
-
-%description
-oRTP is a LGPL licensed C library implementing the RTP protocol
-(rfc1889). It is available for most unix clones (primilarly Linux and
-HP-UX), and Microsoft Windows.
-
-%package devel
-Summary: Headers, libraries and docs for the oRTP library
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description devel
-oRTP is a LGPL licensed C library implementing the RTP protocol
-(rfc1889). It is available for most unix clones (primilarly Linux and
-HP-UX), and Microsoft Windows.
-
-This package contains header files and development libraries needed to
-develop programs using the oRTP library.
-
-%ifarch %ix86
-%define ortp_arch_cflags -malign-double -march=i686 -mcpu=%{ortp_cpu}
-%else
-# Must be non-empty
-%define ortp_arch_cflags -Wall
-%endif
-%define ortp_cflags %ortp_arch_cflags -Wall -g -pipe -pthread -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fstrict-aliasing
-
-%prep
-%setup -q
-
-%build
-%configure \
- --enable-shared \
- --enable-static
-%{__make} -j$RPM_BUILD_NCPUS CFLAGS="%ortp_cflags" CXXFLAGS="%ortp_cflags"
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%makeinstall
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root,-)
-%doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
-%{_libdir}/*.so.*
-
-%files devel
-%defattr(-,root,root,-)
-%doc doc/html
-%{_libdir}/*.la
-%{_libdir}/*.a
-%{_libdir}/*.so
-%{_libdir}/pkgconfig/*.pc
-%{_includedir}
-
-%changelog
-* Tue Oct 25 2005 Francois-Xavier Kowalski <fix@hp.com>
-- Add to oRTP distribution with "make rpm" target
+++ /dev/null
-# -*- rpm-spec -*- ############################################################
-#
-# EPM list file. See epm(1) and epm.list(5) for details
-#
-###############################################################################
-
-%product ${SUMMARY}
-%version ${VERSION}
-%release ${RELEASE}
-%description ${SUMMARY}
-%vendor ${VENDOR}
-%copyright ${LICENSE}
-%license ${LICENSE}
-%readme ${srcdir}/README
-%packager ${PACKAGER}
-
-%system linux
-
-# Package all-in one: should be split later on...
-%provides ortp-devel
-
-%postinstall << EOF
-ldconfig 2>&1 | logger -i -s -t ${PACKAGE}
-EOF
-
-%postremove << EOF
-ldconfig 2>&1 | logger -i -s -t ${PACKAGE}
-EOF
-
-%system hpux
-
-%system all
-
-%include files.list
-
-%provides ortp
-%replaces ortp
-
+++ /dev/null
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
-libortp.la
-mrtprecv
-mrtpsend
-rtpmemtest
-rtprecv
-rtpsend
-test_timer
-tevmrtprecv
-tevrtprecv
-tevrtpsend
+++ /dev/null
-
-EXTRA_DIST=ortp-config-win32.h dll_entry.c
-
-AM_CFLAGS= $(PTHREAD_CFLAGS) -I$(top_srcdir) $(TRUESPEECH_CFLAGS) $(SRTP_CFLAGS)
-AM_LDFLAGS= $(PTHREAD_LDFLAGS)
-
-INCLUDES=-I$(top_srcdir)/include/
-
-lib_LTLIBRARIES = libortp.la
-
-libortp_la_SOURCES= str_utils.c \
- port.c \
- rtpparse.c \
- rtpsession.c \
- rtpsession_inet.c \
- rtpsession_priv.h \
- jitterctl.c jitterctl.h \
- rtpsignaltable.c \
- rtptimer.c rtptimer.h \
- posixtimer.c \
- ortp.c \
- scheduler.c scheduler.h \
- avprofile.c \
- sessionset.c \
- telephonyevents.c \
- payloadtype.c \
- rtcp.c \
- utils.c utils.h \
- rtcpparse.c \
- event.c \
- stun.c stun_udp.c \
- srtp.c \
- b64.c
-
-
-libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS)
-
-libortp_la_LDFLAGS= -version-info $(LIBORTP_SO_VERSION) -no-undefined
-
-
-SUBDIRS= . tests
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#include <ortp/payloadtype.h>
-
-char offset127=127;
-char offset0xD5=(char)0xD5;
-char offset0[4] = {0x00, 0x00, 0x00, 0x00};
-
-/*
- * IMPORTANT : some compiler don't support the tagged-field syntax. Those
- * macros are there to trap the problem This means that if you want to keep
- * portability, payload types must be defined with their fields in the right
- * order.
- */
-#if defined(_ISOC99_SOURCE)
-// ISO C99's tagged syntax
-#define TYPE(val) .type=(val)
-#define CLOCK_RATE(val) .clock_rate=(val)
-#define BITS_PER_SAMPLE(val) .bits_per_sample=(val)
-#define ZERO_PATTERN(val) .zero_pattern=(val)
-#define PATTERN_LENGTH(val) .pattern_length=(val)
-#define NORMAL_BITRATE(val) .normal_bitrate=(val)
-#define MIME_TYPE(val) .mime_type=(val)
-#define CHANNELS(val) .channels=(val)
-#define FMTP(val) .FMTP=(val)
-#elif defined(__GNUC__)
-// GCC's legacy tagged syntax (even old versions have it)
-#define TYPE(val) type: (val)
-#define CLOCK_RATE(val) clock_rate: (val)
-#define BITS_PER_SAMPLE(val) bits_per_sample: (val)
-#define ZERO_PATTERN(val) zero_pattern: (val)
-#define PATTERN_LENGTH(val) pattern_length: (val)
-#define NORMAL_BITRATE(val) normal_bitrate: (val)
-#define MIME_TYPE(val) mime_type: (val)
-#define CHANNELS(val) channels: (val)
-#define FMTP(val) FMTP: (val)
-#else
-// No tagged syntax supported
-#define TYPE(val) (val)
-#define CLOCK_RATE(val) (val)
-#define BITS_PER_SAMPLE(val) (val)
-#define ZERO_PATTERN(val) (val)
-#define PATTERN_LENGTH(val) (val)
-#define NORMAL_BITRATE(val) (val)
-#define MIME_TYPE(val) (val)
-#define CHANNELS(val) (val)
-#define FMTP(val) (val)
-
-#endif
-
-PayloadType payload_type_pcmu8000={
- TYPE( PAYLOAD_AUDIO_CONTINUOUS),
- CLOCK_RATE( 8000),
- BITS_PER_SAMPLE(8),
- ZERO_PATTERN( &offset127),
- PATTERN_LENGTH( 1),
- NORMAL_BITRATE( 64000),
- MIME_TYPE ("PCMU"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_pcma8000={
- TYPE( PAYLOAD_AUDIO_CONTINUOUS),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(8),
- ZERO_PATTERN( &offset0xD5),
- PATTERN_LENGTH( 1),
- NORMAL_BITRATE( 64000),
- MIME_TYPE ("PCMA"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_pcm8000={
- TYPE( PAYLOAD_AUDIO_CONTINUOUS),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(16),
- ZERO_PATTERN( offset0),
- PATTERN_LENGTH(1),
- NORMAL_BITRATE( 128000),
- MIME_TYPE ("PCM"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_l16_mono={
- TYPE( PAYLOAD_AUDIO_CONTINUOUS),
- CLOCK_RATE(44100),
- BITS_PER_SAMPLE(16),
- ZERO_PATTERN( offset0 ),
- PATTERN_LENGTH(2),
- NORMAL_BITRATE(705600), /* (44100 x 16bits per frame x 1 channel) */
- MIME_TYPE ("L16"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_l16_stereo={
- TYPE( PAYLOAD_AUDIO_CONTINUOUS),
- CLOCK_RATE(44100),
- BITS_PER_SAMPLE(32), /* 16bits x 2 channels */
- ZERO_PATTERN( offset0 ),
- PATTERN_LENGTH(4),
- NORMAL_BITRATE(1411200), /* (44100 x 16bits per frame x 2 channels) */
- MIME_TYPE ("L16"),
- CHANNELS(2)
-};
-
-PayloadType payload_type_lpc1016={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN( NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 2400),
- MIME_TYPE ("1016"),
- CHANNELS(1)
-};
-
-
-PayloadType payload_type_gsm=
-{
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 13500),
- MIME_TYPE ("GSM"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_lpc=
-{
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 5600), /* 20ms / 14 octets per frame */
- MIME_TYPE ("LPC"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g7231=
-{
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 6300),
- MIME_TYPE ("G723"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g729={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 8000),
- MIME_TYPE ("G729"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g7221={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(16000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 24000),
- MIME_TYPE ("G7221"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g726_40={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 8000),
- MIME_TYPE ("G726-40"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g726_32={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 8000),
- MIME_TYPE ("G726-32"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g726_24={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 8000),
- MIME_TYPE ("G726-24"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_g726_16={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE( 8000),
- MIME_TYPE ("G726-16"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_mpv=
-{
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE( 256000),
- MIME_TYPE ("MPV"),
- CHANNELS(0)
-};
-
-
-PayloadType payload_type_h261={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("H261"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_h263={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("H263"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_truespeech=
-{
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE( 0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH( 0),
- NORMAL_BITRATE(8536),
- MIME_TYPE ("TSP0"),
- CHANNELS(0)
-};
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-RtpProfile av_profile;
-#ifdef __cplusplus
-}
-#endif
-
-
-void av_profile_init(RtpProfile *profile)
-{
- rtp_profile_clear_all(profile);
- profile->name="AV profile";
- rtp_profile_set_payload(profile,0,&payload_type_pcmu8000);
- rtp_profile_set_payload(profile,1,&payload_type_lpc1016);
- rtp_profile_set_payload(profile,3,&payload_type_gsm);
- rtp_profile_set_payload(profile,7,&payload_type_lpc);
- rtp_profile_set_payload(profile,4,&payload_type_g7231);
- rtp_profile_set_payload(profile,8,&payload_type_pcma8000);
- rtp_profile_set_payload(profile,10,&payload_type_l16_stereo);
- rtp_profile_set_payload(profile,11,&payload_type_l16_mono);
- rtp_profile_set_payload(profile,18,&payload_type_g729);
- rtp_profile_set_payload(profile,31,&payload_type_h261);
- rtp_profile_set_payload(profile,32,&payload_type_mpv);
- rtp_profile_set_payload(profile,34,&payload_type_h263);
-}
-
-/* these are extra payload types that can be used dynamically */
-PayloadType payload_type_lpc1015={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(2400),
- MIME_TYPE ("1015"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_speex_nb={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(8000), /*not true: 8000 is the minimum*/
- MIME_TYPE ("speex"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_speex_wb={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(16000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(28000),
- MIME_TYPE ("speex"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_speex_uwb={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(32000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(28000),
- MIME_TYPE ("speex"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_ilbc={
- TYPE( PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(13300), /* the minimum, with 30ms frames */
- MIME_TYPE ("iLBC"),
- CHANNELS(1),
-};
-
-PayloadType payload_type_amr={
- TYPE(PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("AMR"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_amrwb={
- TYPE(PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(16000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("AMR-WB"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_mp4v={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("MP4V-ES"),
- CHANNELS(0)
-};
-
-
-PayloadType payload_type_evrc0={
- TYPE(PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("EVRC0"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_evrcb0={
- TYPE(PAYLOAD_AUDIO_PACKETIZED),
- CLOCK_RATE(8000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("EVRCB0"),
- CHANNELS(1)
-};
-
-PayloadType payload_type_h263_1998={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("H263-1998"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_h263_2000={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(0),
- MIME_TYPE ("H263-2000"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_theora={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("theora"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_h264={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("H264"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_x_snow={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("x-snow"),
- CHANNELS(0)
-};
-
-PayloadType payload_type_jpeg={
- TYPE( PAYLOAD_VIDEO),
- CLOCK_RATE(90000),
- BITS_PER_SAMPLE(0),
- ZERO_PATTERN(NULL),
- PATTERN_LENGTH(0),
- NORMAL_BITRATE(256000),
- MIME_TYPE ("JPEG"),
- CHANNELS(0)
-};
-
-
-PayloadType payload_type_t140={
- PAYLOAD_AUDIO_PACKETIZED, /*type */
- 1000,
- 0,
- NULL,
- 0,
- 0,
- "t140",
- 0,
- 0
-};
-
-PayloadType payload_type_x_udpftp={
- PAYLOAD_AUDIO_PACKETIZED, /*type */
- 1000,
- 0,
- NULL,
- 0,
- 0,
- "x-udpftp",
- 0,
- 0
-};
-
+++ /dev/null
-/* /////////////////////////////////////////////////////////////////////////////\r
- * File: b64.c\r
- *\r
- * Purpose: Implementation file for the b64 library\r
- *\r
- * Created: 18th October 2004\r
- * Updated: 3rd May 2008\r
- *\r
- * Home: http://synesis.com.au/software/\r
- *\r
- * Copyright (c) 2004-2008, Matthew Wilson and Synesis Software\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without \r
- * modification, are permitted provided that the following conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above copyright notice, this\r
- * list of conditions and the following disclaimer. \r
- * - Redistributions in binary form must reproduce the above copyright notice,\r
- * this list of conditions and the following disclaimer in the documentation\r
- * and/or other materials provided with the distribution.\r
- * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of\r
- * any contributors may be used to endorse or promote products derived from\r
- * this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
- * POSSIBILITY OF SUCH DAMAGE.\r
- *\r
- * ////////////////////////////////////////////////////////////////////////// */\r
-\r
-\r
-/** \file b64.c Implementation file for the b64 library\r
- */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Version information\r
- */\r
-\r
-#ifndef B64_DOCUMENTATION_SKIP_SECTION\r
-# define B64_VER_C_B64_MAJOR 1\r
-# define B64_VER_C_B64_MINOR 2\r
-# define B64_VER_C_B64_REVISION 3\r
-# define B64_VER_C_B64_EDIT 17\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Includes\r
- */\r
-\r
-#include "ortp/b64.h"\r
-\r
-#include <assert.h>\r
-#include <string.h>\r
-#include "ortp/port.h"\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Constants and definitions\r
- */\r
-\r
-#ifndef B64_DOCUMENTATION_SKIP_SECTION\r
-# define NUM_PLAIN_DATA_BYTES (3)\r
-# define NUM_ENCODED_DATA_BYTES (4)\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Macros\r
- */\r
-\r
-#ifndef NUM_ELEMENTS\r
-# define NUM_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))\r
-#endif /* !NUM_ELEMENTS */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Warnings\r
- */\r
-\r
-#if defined(_MSC_VER) && \\r
- _MSC_VER < 1000\r
-# pragma warning(disable : 4705)\r
-#endif /* _MSC_VER < 1000 */\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Data\r
- */\r
-\r
-static const char b64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\r
-\r
-static const signed char b64_indexes[] = \r
-{\r
- /* 0 - 31 / 0x00 - 0x1f */\r
- -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1\r
- /* 32 - 63 / 0x20 - 0x3f */\r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, 62, -1, -1, -1, 63 /* ... , '+', ... '/' */\r
- , 52, 53, 54, 55, 56, 57, 58, 59 /* '0' - '7' */\r
- , 60, 61, -1, -1, -1, -1, -1, -1 /* '8', '9', ... */\r
- /* 64 - 95 / 0x40 - 0x5f */\r
- , -1, 0, 1, 2, 3, 4, 5, 6 /* ..., 'A' - 'G' */\r
- , 7, 8, 9, 10, 11, 12, 13, 14 /* 'H' - 'O' */\r
- , 15, 16, 17, 18, 19, 20, 21, 22 /* 'P' - 'W' */\r
- , 23, 24, 25, -1, -1, -1, -1, -1 /* 'X', 'Y', 'Z', ... */\r
- /* 96 - 127 / 0x60 - 0x7f */\r
- , -1, 26, 27, 28, 29, 30, 31, 32 /* ..., 'a' - 'g' */\r
- , 33, 34, 35, 36, 37, 38, 39, 40 /* 'h' - 'o' */\r
- , 41, 42, 43, 44, 45, 46, 47, 48 /* 'p' - 'w' */\r
- , 49, 50, 51, -1, -1, -1, -1, -1 /* 'x', 'y', 'z', ... */\r
-\r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
-\r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
-\r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
-\r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
- , -1, -1, -1, -1, -1, -1, -1, -1 \r
-};\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * Helper functions\r
- */\r
-\r
-/** This function reads in 3 bytes at a time, and translates them into 4\r
- * characters.\r
- */\r
-static size_t b64_encode_( unsigned char const *src\r
- , size_t srcSize\r
- , char *const dest\r
- , size_t destLen\r
- , unsigned lineLen\r
- , B64_RC *rc)\r
-{\r
- size_t total = ((srcSize + (NUM_PLAIN_DATA_BYTES - 1)) / NUM_PLAIN_DATA_BYTES) * NUM_ENCODED_DATA_BYTES;\r
-\r
- assert(NULL != rc);\r
- *rc = B64_RC_OK;\r
-\r
- if(lineLen > 0)\r
- {\r
- size_t numLines = (total + (lineLen - 1)) / lineLen;\r
-\r
- total += 2 * (numLines - 1);\r
- }\r
-\r
- if(NULL == dest)\r
- {\r
- return total;\r
- }\r
- else if(destLen < total)\r
- {\r
- *rc = B64_RC_INSUFFICIENT_BUFFER;\r
-\r
- return 0;\r
- }\r
- else\r
- {\r
- char *p = dest;\r
- char *end = dest + destLen;\r
- size_t len = 0;\r
-\r
- for(; NUM_PLAIN_DATA_BYTES <= srcSize; srcSize -= NUM_PLAIN_DATA_BYTES)\r
- {\r
- char characters[NUM_ENCODED_DATA_BYTES];\r
-\r
- /* \r
- * \r
- * | 0 | 1 | 2 |\r
- *\r
- * | | | |\r
- * | | | | | | |\r
- * | | | | | | | | | | | | |\r
- * | | | | | | | | | | | | | | | | | | | | | | | | |\r
- * \r
- * | 0 | 1 | 2 | 3 |\r
- * \r
- */\r
-\r
- /* characters[0] is the 6 left-most bits of src[0] */\r
- characters[0] = (char)((src[0] & 0xfc) >> 2);\r
- /* characters[0] is the right-most 2 bits of src[0] and the left-most 4 bits of src[1] */\r
- characters[1] = (char)(((src[0] & 0x03) << 4) + ((src[1] & 0xf0) >> 4));\r
- /* characters[0] is the right-most 4 bits of src[1] and the 2 left-most bits of src[2] */\r
- characters[2] = (char)(((src[1] & 0x0f) << 2) + ((src[2] & 0xc0) >> 6));\r
- /* characters[3] is the right-most 6 bits of src[2] */\r
- characters[3] = (char)(src[2] & 0x3f);\r
-\r
-#ifndef __WATCOMC__\r
- assert(characters[0] >= 0 && characters[0] < 64);\r
- assert(characters[1] >= 0 && characters[1] < 64);\r
- assert(characters[2] >= 0 && characters[2] < 64);\r
- assert(characters[3] >= 0 && characters[3] < 64);\r
-#endif /* __WATCOMC__ */\r
-\r
- src += NUM_PLAIN_DATA_BYTES;\r
- *p++ = b64_chars[(unsigned char)characters[0]];\r
- assert(NULL != strchr(b64_chars, *(p-1)));\r
- ++len;\r
- assert(len != lineLen);\r
-\r
- *p++ = b64_chars[(unsigned char)characters[1]];\r
- assert(NULL != strchr(b64_chars, *(p-1)));\r
- ++len;\r
- assert(len != lineLen);\r
-\r
- *p++ = b64_chars[(unsigned char)characters[2]];\r
- assert(NULL != strchr(b64_chars, *(p-1)));\r
- ++len;\r
- assert(len != lineLen);\r
-\r
- *p++ = b64_chars[(unsigned char)characters[3]];\r
- assert(NULL != strchr(b64_chars, *(p-1)));\r
-\r
- if( ++len == lineLen &&\r
- p != end)\r
- {\r
- *p++ = '\r';\r
- *p++ = '\n';\r
- len = 0;\r
- }\r
- }\r
-\r
- if(0 != srcSize)\r
- {\r
- /* Deal with the overspill, by boosting it up to three bytes (using 0s)\r
- * and then appending '=' for any missing characters.\r
- *\r
- * This is done into a temporary buffer, so we can call ourselves and\r
- * have the output continue to be written direct to the destination.\r
- */\r
-\r
- unsigned char dummy[NUM_PLAIN_DATA_BYTES];\r
- size_t i;\r
-\r
- for(i = 0; i < srcSize; ++i)\r
- {\r
- dummy[i] = *src++;\r
- }\r
-\r
- for(; i < NUM_PLAIN_DATA_BYTES; ++i)\r
- {\r
- dummy[i] = '\0';\r
- }\r
-\r
- b64_encode_(&dummy[0], NUM_PLAIN_DATA_BYTES, p, NUM_ENCODED_DATA_BYTES * (1 + 2), 0, rc);\r
-\r
- for(p += 1 + srcSize; srcSize++ < NUM_PLAIN_DATA_BYTES; )\r
- {\r
- *p++ = '=';\r
- }\r
- }\r
-\r
- return total;\r
- }\r
-}\r
-\r
-/** This function reads in a character string in 4-character chunks, and writes \r
- * out the converted form in 3-byte chunks to the destination.\r
- */\r
-static size_t b64_decode_( char const *src\r
- , size_t srcLen\r
- , unsigned char *dest\r
- , size_t destSize\r
- , unsigned flags\r
- , char const **badChar\r
- , B64_RC *rc)\r
-{\r
- const size_t wholeChunks = (srcLen / NUM_ENCODED_DATA_BYTES);\r
- const size_t remainderBytes = (srcLen % NUM_ENCODED_DATA_BYTES);\r
- size_t maxTotal = (wholeChunks + (0 != remainderBytes)) * NUM_PLAIN_DATA_BYTES;\r
- unsigned char *dest_ = dest;\r
-\r
- ((void)remainderBytes);\r
-\r
- assert(NULL != badChar);\r
- assert(NULL != rc);\r
-\r
- *badChar = NULL;\r
- *rc = B64_RC_OK;\r
-\r
- if(NULL == dest)\r
- {\r
- return maxTotal;\r
- }\r
- else if(destSize < maxTotal)\r
- {\r
- *rc = B64_RC_INSUFFICIENT_BUFFER;\r
-\r
- return 0;\r
- }\r
- else\r
- {\r
- /* Now we iterate through the src, collecting together four characters\r
- * at a time from the Base-64 alphabet, until the end-point is reached.\r
- *\r
- * \r
- */\r
-\r
- char const *begin = src;\r
- char const *const end = begin + srcLen;\r
- size_t currIndex = 0;\r
- size_t numPads = 0;\r
- signed char indexes[NUM_ENCODED_DATA_BYTES]; /* 4 */\r
-\r
- for(; begin != end; ++begin)\r
- {\r
- const char ch = *begin;\r
-\r
- if('=' == ch)\r
- {\r
- assert(currIndex < NUM_ENCODED_DATA_BYTES);\r
-\r
- indexes[currIndex++] = '\0';\r
-\r
- ++numPads;\r
- }\r
- else\r
- {\r
- /* NOTE: Had to rename 'index' to 'ix', due to name clash with GCC on 64-bit Linux. */\r
- signed char ix = b64_indexes[(unsigned char)ch];\r
-\r
- if(-1 == ix)\r
- {\r
- switch(ch)\r
- {\r
- case ' ':\r
- case '\t':\r
- case '\b':\r
- case '\v':\r
- if(B64_F_STOP_ON_UNEXPECTED_WS & flags)\r
- {\r
- *rc = B64_RC_DATA_ERROR;\r
- *badChar = begin;\r
- return 0;\r
- }\r
- else\r
- {\r
- /* Fall through */\r
- }\r
- case '\r':\r
- case '\n':\r
- continue;\r
- default:\r
- if(B64_F_STOP_ON_UNKNOWN_CHAR & flags)\r
- {\r
- *rc = B64_RC_DATA_ERROR;\r
- *badChar = begin;\r
- return 0;\r
- }\r
- else\r
- {\r
- continue;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- numPads = 0;\r
-\r
- assert(currIndex < NUM_ENCODED_DATA_BYTES);\r
-\r
- indexes[currIndex++] = ix;\r
- }\r
- }\r
-\r
- if(NUM_ENCODED_DATA_BYTES == currIndex)\r
- {\r
- unsigned char bytes[NUM_PLAIN_DATA_BYTES]; /* 3 */\r
-\r
- bytes[0] = (unsigned char)((indexes[0] << 2) + ((indexes[1] & 0x30) >> 4));\r
-\r
- currIndex = 0;\r
-\r
- *dest++ = bytes[0];\r
- if(2 != numPads)\r
- {\r
- bytes[1] = (unsigned char)(((indexes[1] & 0xf) << 4) + ((indexes[2] & 0x3c) >> 2));\r
-\r
- *dest++ = bytes[1];\r
-\r
- if(1 != numPads)\r
- {\r
- bytes[2] = (unsigned char)(((indexes[2] & 0x3) << 6) + indexes[3]);\r
-\r
- *dest++ = bytes[2];\r
- }\r
- }\r
- if(0 != numPads)\r
- {\r
- break;\r
- }\r
- }\r
- }\r
-\r
- return (size_t)(dest - dest_);\r
- }\r
-}\r
-\r
-/* /////////////////////////////////////////////////////////////////////////////\r
- * API functions\r
- */\r
-\r
-size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen)\r
-{\r
- /* Use Null Object (Variable) here for rc, so do not need to check\r
- * elsewhere.\r
- */\r
- B64_RC rc_;\r
-\r
- return b64_encode_((unsigned char const*)src, srcSize, dest, destLen, 0, &rc_);\r
-}\r
-\r
-size_t b64_encode2( void const *src\r
- , size_t srcSize\r
- , char *dest\r
- , size_t destLen\r
- , unsigned flags\r
- , int lineLen /* = -1 */\r
- , B64_RC *rc /* = NULL */)\r
-{\r
- /* Use Null Object (Variable) here for rc, so do not need to check\r
- * elsewhere\r
- */\r
- B64_RC rc_;\r
- if(NULL == rc)\r
- {\r
- rc = &rc_;\r
- }\r
-\r
- switch(B64_F_LINE_LEN_MASK & flags)\r
- {\r
- case B64_F_LINE_LEN_USE_PARAM:\r
- if(lineLen >= 0)\r
- {\r
- break;\r
- }\r
- /* Fall through to 64 */\r
- case B64_F_LINE_LEN_64:\r
- lineLen = 64;\r
- break;\r
- case B64_F_LINE_LEN_76:\r
- lineLen = 76;\r
- break;\r
- default:\r
- /*the following assert makes a compiler error with icc*/\r
- /*assert(!"Bad line length flag specified to b64_encode2()");*/\r
- case B64_F_LINE_LEN_INFINITE:\r
- lineLen = 0;\r
- break;\r
- }\r
-\r
- assert(0 == (lineLen % 4));\r
-\r
- return b64_encode_((unsigned char const*)src, srcSize, dest, destLen, (unsigned)lineLen, rc);\r
-}\r
-\r
-size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize)\r
-{\r
- /* Use Null Object (Variable) here for rc and badChar, so do not need to\r
- * check elsewhere.\r
- */\r
- char const *badChar_;\r
- B64_RC rc_;\r
-\r
- return b64_decode_(src, srcLen, (unsigned char*)dest, destSize, B64_F_STOP_ON_NOTHING, &badChar_, &rc_);\r
-}\r
-\r
-size_t b64_decode2( char const *src\r
- , size_t srcLen\r
- , void *dest\r
- , size_t destSize\r
- , unsigned flags\r
- , char const **badChar /* = NULL */\r
- , B64_RC *rc /* = NULL */)\r
-{\r
- char const *badChar_;\r
- B64_RC rc_;\r
-\r
- /* Use Null Object (Variable) here for rc and badChar, so do not need to\r
- * check elsewhere.\r
- */\r
- if(NULL == badChar)\r
- {\r
- badChar = &badChar_;\r
- }\r
- if(NULL == rc)\r
- {\r
- rc = &rc_;\r
- }\r
-\r
- return b64_decode_(src, srcLen, (unsigned char*)dest, destSize, flags, badChar, rc);\r
-}\r
-\r
-/* ////////////////////////////////////////////////////////////////////////// */\r
-\r
-#ifdef B64_DOCUMENTATION_SKIP_SECTION\r
-struct b64ErrorString_t_\r
-#else /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-typedef struct b64ErrorString_t_ b64ErrorString_t_;\r
-struct b64ErrorString_t_\r
-#endif /* !B64_DOCUMENTATION_SKIP_SECTION */\r
-{\r
- int code; /*!< The error code. */\r
- char const *str; /*!< The string. */\r
- size_t len; /*!< The string length. */\r
-};\r
-\r
-\r
-\r
-#define SEVERITY_STR_DECL(rc, desc) \\r
- \\r
- static const char s_str##rc[] = desc; \\r
- static const b64ErrorString_t_ s_rct##rc = { rc, s_str##rc, NUM_ELEMENTS(s_str##rc) - 1 }\r
-\r
-\r
-#define SEVERITY_STR_ENTRY(rc) \\r
- \\r
- &s_rct##rc\r
-\r
-\r
-static char const *b64_LookupCodeA_(int code, b64ErrorString_t_ const **mappings, size_t cMappings, size_t *len)\r
-{\r
- /* Use Null Object (Variable) here for len, so do not need to check\r
- * elsewhere.\r
- */\r
- size_t len_;\r
-\r
- if(NULL == len)\r
- {\r
- len = &len_;\r
- }\r
-\r
- /* Checked, indexed search. */\r
- if( code >= 0 &&\r
- code < B64_max_RC_value)\r
- {\r
- if(code == mappings[code]->code)\r
- {\r
- return (*len = mappings[code]->len, mappings[code]->str);\r
- }\r
- }\r
-\r
- /* Linear search. Should only be needed if order in\r
- * b64_LookupErrorStringA_() messed up.\r
- */\r
- { size_t i; for(i = 0; i < cMappings; ++i)\r
- {\r
- if(code == mappings[i]->code)\r
- {\r
- return (*len = mappings[i]->len, mappings[i]->str);\r
- }\r
- }}\r
-\r
- return (*len = 0, "");\r
-}\r
-\r
-static char const *b64_LookupErrorStringA_(int error, size_t *len)\r
-{\r
- SEVERITY_STR_DECL(B64_RC_OK , "Operation was successful" );\r
- SEVERITY_STR_DECL(B64_RC_INSUFFICIENT_BUFFER , "The given translation buffer was not of sufficient size" );\r
- SEVERITY_STR_DECL(B64_RC_TRUNCATED_INPUT , "The input did not represent a fully formed stream of octet couplings" );\r
- SEVERITY_STR_DECL(B64_RC_DATA_ERROR , "Invalid data" );\r
-\r
- static const b64ErrorString_t_ *s_strings[] = \r
- {\r
- SEVERITY_STR_ENTRY(B64_RC_OK),\r
- SEVERITY_STR_ENTRY(B64_RC_INSUFFICIENT_BUFFER),\r
- SEVERITY_STR_ENTRY(B64_RC_TRUNCATED_INPUT),\r
- SEVERITY_STR_ENTRY(B64_RC_DATA_ERROR),\r
- };\r
-\r
- return b64_LookupCodeA_(error, s_strings, NUM_ELEMENTS(s_strings), len);\r
-}\r
-\r
-char const *b64_getErrorString(B64_RC code)\r
-{\r
- return b64_LookupErrorStringA_((int)code, NULL);\r
-}\r
-\r
-size_t b64_getErrorStringLength(B64_RC code)\r
-{\r
- size_t len;\r
-\r
- return (b64_LookupErrorStringA_((int)code, &len), len);\r
-}\r
-\r
-/* ////////////////////////////////////////////////////////////////////////// */\r
+++ /dev/null
-
-#ifdef WIN32
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-#include "ortp/ortp.h"
-
-typedef struct __STRUCT_SHARED_DATA__
-{
- DWORD m_nReference;
- DWORD m_dwStartTime;
- BOOL m_bInitialize;
-
-} SHARED_DATA, * LPSHARED_DATA;
-
-#ifdef EXTERNAL_LOGGER
-#include "logger.h"
-#else
-#define RegisterLog(logVar, logString);
-#define UnregisterLog(logVar, logString);
-#endif
-
-extern DWORD dwoRTPLogLevel;
-
-#define SHMEMSIZE sizeof(SHARED_DATA)
-
-static LPSHARED_DATA lpSharedData;
-static HANDLE hMapObject = NULL; // handle to file mapping
-
-BOOL WINAPI DllMain(
- HINSTANCE hinstDLL, // handle to DLL module
- DWORD fdwReason, // reason for calling function
- LPVOID lpReserved // reserved
- )
-{
- BOOL fInit = FALSE;
- WORD wVersionRequested;
- WSADATA wsaData;
-
- // Perform actions based on the reason for calling.
- switch( fdwReason )
- {
- case DLL_PROCESS_ATTACH:
-
- OutputDebugString("--> dll_entry.c - oRTP.dll - DLL_PROCESS_ATTACH()\n");
-
- wVersionRequested = MAKEWORD( 1, 0 );
-
- if (WSAStartup(wVersionRequested,&wsaData)!=0)
- {
- return FALSE;
- }
-
- // Create a named file mapping object.
- hMapObject = CreateFileMapping( INVALID_HANDLE_VALUE, // use paging file
- NULL, // default security attributes
- PAGE_READWRITE, // read/write access
- 0, // size: high 32-bits
- SHMEMSIZE, // size: low 32-bits
- "oRTPSharedMemory"); // name of map object
-
- if (hMapObject == NULL)
- return FALSE;
-
- // The first process to attach initializes memory.
- fInit = (GetLastError() != ERROR_ALREADY_EXISTS);
-
- // Get a pointer to the file-mapped shared memory.
-
- lpSharedData = (LPSHARED_DATA) MapViewOfFile( hMapObject, // object to map view of
- FILE_MAP_WRITE, // read/write access
- 0, // high offset: map from
- 0, // low offset: beginning
- 0); // default: map entire file
- if (lpSharedData == NULL)
- return FALSE;
-
- // Initialize memory if this is the first process.
-
- if (fInit)
- {
- OutputDebugString("--> dll_entry.c - oRTP.dll - Initializing module\n");
-
- lpSharedData->m_dwStartTime = GetTickCount();
- lpSharedData->m_nReference = 1;
- lpSharedData->m_bInitialize = FALSE;
-
- // Register the log
- RegisterLog(&dwoRTPLogLevel, "LOG_ORTP");
- }
- else
- {
- OutputDebugString("--> dll_entry.c - oRTP.dll - Binding\n");
- lpSharedData->m_nReference++;
- }
- break;
-
- case DLL_THREAD_ATTACH:
-
- if (lpSharedData != NULL)
- {
- if (lpSharedData->m_bInitialize == FALSE)
- {
- // Initialize oRTP
- ortp_init();
-
- // Start the scheduler
- //ortp_scheduler_init();
-
- lpSharedData->m_bInitialize = TRUE;
- }
- }
- break;
-
- case DLL_THREAD_DETACH:
- break;
-
- case DLL_PROCESS_DETACH:
-
- if (lpSharedData != NULL)
- {
- OutputDebugString("--> dll_entry.c - oRTP.dll - Binding\n");
- lpSharedData->m_nReference--;
-
- if (lpSharedData->m_nReference == 0)
- {
- OutputDebugString("--> dll_entry.c - oRTP.dll - Detaching\n");
-
- ortp_exit();
- UnregisterLog(&dwoRTPLogLevel, "LOG_ORTP");
-
-
- // Unmap shared memory from the process's address space.
- UnmapViewOfFile(lpSharedData);
- lpSharedData = NULL;
-
- // Close the process's handle to the file-mapping object.
- CloseHandle(hMapObject);
- hMapObject = INVALID_HANDLE_VALUE;
- }
- }
- break;
- }
-
- return TRUE; // Successful DLL_PROCESS_ATTACH.
-}
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/event.h"
-#include "ortp/ortp.h"
-
-RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen){
- RtpEndpoint *ep=ortp_new(RtpEndpoint,1);
- if (sizeof(ep->addr)<addrlen){
- ortp_free(ep);
- ortp_fatal("Bad socklen_t size !");
- return NULL;
- }
- memcpy(&ep->addr,addr,addrlen);
- ep->addrlen=addrlen;
- return ep;
-}
-
-void rtp_endpoint_destroy(RtpEndpoint *ep){
- ortp_free(ep);
-}
-
-RtpEndpoint *rtp_endpoint_dup(const RtpEndpoint *ep){
- return rtp_endpoint_new((struct sockaddr*)&ep->addr,ep->addrlen);
-}
-
-OrtpEvent * ortp_event_new(unsigned long type){
- const int size=sizeof(OrtpEventType)+sizeof(OrtpEventData);
- mblk_t *m=allocb(size,0);
- memset(m->b_wptr,0,size);
- *((OrtpEventType*)m->b_wptr)=type;
- return m;
-}
-
-OrtpEvent *ortp_event_dup(OrtpEvent *ev){
-#if 0
- OrtpEvent *nev=dupb(ev);
-#else
- OrtpEvent *nev = ortp_event_new(ortp_event_get_type(ev));
- OrtpEventData * ed = ortp_event_get_data(ev);
- OrtpEventData * edv = ortp_event_get_data(nev);
-
- if (ed->ep) edv->ep = rtp_endpoint_dup(ed->ep);
- if (ed->packet) edv->packet = copymsg(ed->packet);
- edv->info.telephone_event = ed->info.telephone_event;
-#endif
- return nev;
-}
-
-OrtpEventType ortp_event_get_type(const OrtpEvent *ev){
- return ((OrtpEventType*)ev->b_rptr)[0];
-}
-
-OrtpEventData * ortp_event_get_data(OrtpEvent *ev){
- return (OrtpEventData*)(ev->b_rptr+sizeof(OrtpEventType));
-}
-
-void ortp_event_destroy(OrtpEvent *ev){
- OrtpEventData *d=ortp_event_get_data(ev);
- if (ev->b_datap->db_ref==1){
- if (d->packet) freemsg(d->packet);
- if (d->ep) rtp_endpoint_destroy(d->ep);
- }
- freemsg(ev);
-}
-
-OrtpEvQueue * ortp_ev_queue_new(){
- OrtpEvQueue *q=ortp_new(OrtpEvQueue,1);
- qinit(&q->q);
- ortp_mutex_init(&q->mutex,NULL);
- return q;
-}
-
-void ortp_ev_queue_flush(OrtpEvQueue * qp){
- OrtpEvent *ev;
- while((ev=ortp_ev_queue_get(qp))!=NULL){
- ortp_event_destroy(ev);
- }
-}
-
-OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q){
- OrtpEvent *ev;
- ortp_mutex_lock(&q->mutex);
- ev=getq(&q->q);
- ortp_mutex_unlock(&q->mutex);
- return ev;
-}
-
-void ortp_ev_queue_destroy(OrtpEvQueue * qp){
- ortp_ev_queue_flush(qp);
- ortp_mutex_destroy(&qp->mutex);
- ortp_free(qp);
-}
-
-void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev){
- ortp_mutex_lock(&q->mutex);
- putq(&q->q,ev);
- ortp_mutex_unlock(&q->mutex);
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-/***************************************************************************
- * jitterctl.c
- *
- * Mon Nov 8 11:53:21 2004
- * Copyright 2004 Simon MORLAT
- * Email simon.morlat@linphone.org
- ****************************************************************************/
-
-#include "ortp/rtpsession.h"
-#include "ortp/payloadtype.h"
-#include "ortp/ortp.h"
-#include "utils.h"
-#include "rtpsession_priv.h"
-#include <math.h>
-
-#define JC_BETA 0.01
-#define JC_GAMMA (JC_BETA)
-
-#include "jitterctl.h"
-
-void jitter_control_init(JitterControl *ctl, int base_jiitt_time, PayloadType *payload){
- ctl->count=0;
- ctl->slide=0;
- ctl->prev_slide=0;
- ctl->jitter=0;
- ctl->inter_jitter=0;
- ctl->slide=0;
- if (base_jiitt_time!=-1) ctl->jitt_comp = base_jiitt_time;
- /* convert in timestamp unit: */
- if (payload!=NULL){
- jitter_control_set_payload(ctl,payload);
- }
- ctl->adapt_jitt_comp_ts=ctl->jitt_comp_ts;
- ctl->corrective_slide=0;
-}
-
-void jitter_control_enable_adaptive(JitterControl *ctl, bool_t val){
- ctl->adaptive=val;
-}
-
-void jitter_control_set_payload(JitterControl *ctl, PayloadType *pt){
- ctl->jitt_comp_ts =
- (int) (((double) ctl->jitt_comp / 1000.0) * (pt->clock_rate));
- ctl->corrective_step=(160 * 8000 )/pt->clock_rate; /* This formula got to me after some beers */
- ctl->adapt_jitt_comp_ts=ctl->jitt_comp_ts;
-}
-
-
-void jitter_control_dump_stats(JitterControl *ctl){
- ortp_message("JitterControl:\n\tslide=%g,jitter=%g,count=%i",
- (double)ctl->slide,ctl->jitter, ctl->count);
-}
-
-/*the goal of this method is to compute "corrective_slide": a timestamp unit'd value to be added
- to recv timestamp to make them reflect the instant they are delivered by the jitter buffer. */
-void jitter_control_update_corrective_slide(JitterControl *ctl){
- int tmp;
- tmp=(int)(ctl->slide)-ctl->prev_slide;
- if (tmp>ctl->corrective_step) {
- ctl->corrective_slide+=ctl->corrective_step;
- ctl->prev_slide=ctl->slide+ctl->corrective_step;
- }
- else if (tmp<-ctl->corrective_step) {
- ctl->corrective_slide-=ctl->corrective_step;
- ctl->prev_slide=ctl->slide-ctl->corrective_step;
- }
-}
-
-/*
- The algorithm computes two values:
- slide: an average of difference between the expected and the socket-received timestamp
- jitter: an average of the absolute value of the difference between socket-received timestamp and slide.
- slide is used to make clock-slide detection and correction.
- jitter is added to the initial jitt_comp_time value. It compensates bursty packets arrival (packets
- not arriving at regular interval ).
-*/
-void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t cur_str_ts){
- int64_t diff=(int64_t)packet_ts - (int64_t)cur_str_ts;
- double gap,slide;
- int d;
- //printf("diff=%g\n",diff);
- if (ctl->count==0){
- slide=ctl->slide=ctl->prev_slide=diff;
- ctl->olddiff=diff;
- ctl->jitter=0;
- }else{
- slide=((double)ctl->slide*(1-JC_BETA)) + ((double)diff*JC_BETA);
- }
- gap=(double)diff - slide;
- gap=gap<0 ? -gap : 0; /*compute only for late packets*/
- ctl->jitter=(float) ((ctl->jitter*(1-JC_GAMMA)) + (gap*JC_GAMMA));
- d=diff-ctl->olddiff;
- ctl->inter_jitter=(float) (ctl->inter_jitter+ (( (float)abs(d) - ctl->inter_jitter)*(1/16.0)));
- ctl->olddiff=diff;
- ctl->count++;
- if (ctl->adaptive){
-
- if (ctl->count%50==0) {
- ctl->adapt_jitt_comp_ts=(int) MAX(ctl->jitt_comp_ts,2*ctl->jitter);
- /*jitter_control_dump_stats(ctl);*/
- }
-
- ctl->slide=slide;
- }else {
- /*ctl->slide and jitter size are not updated*/
- }
- return ;
-}
-
-
-
-
-
-/**
- *rtp_session_set_jitter_compensation:
- *@session: a RtpSession
- *@milisec: the time interval in milisec to be jitter compensed.
- *
- * Sets the time interval for which packet are buffered instead of being delivered to the
- * application.
- **/
-void
-rtp_session_set_jitter_compensation (RtpSession * session, int milisec)
-{
- PayloadType *payload=NULL;
- if (session->rcv.pt!=-1) {
- payload = rtp_profile_get_payload (session->rcv.profile,session->rcv.pt);
- }/*else not set yet */
- jitter_control_init(&session->rtp.jittctl,milisec,payload);
-}
-
-void rtp_session_enable_adaptive_jitter_compensation(RtpSession *session, bool_t val){
- jitter_control_enable_adaptive(&session->rtp.jittctl,val);
-}
-
-bool_t rtp_session_adaptive_jitter_compensation_enabled(RtpSession *session){
- return session->rtp.jittctl.adaptive;
-}
-
-void rtp_session_enable_jitter_buffer(RtpSession *session, bool_t enabled){
- session->rtp.jittctl.enabled=enabled;
- session->flags|=RTP_SESSION_RECV_SYNC;
-}
-
-bool_t rtp_session_jitter_buffer_enabled(const RtpSession *session){
- return session->rtp.jittctl.enabled;
-}
-
-void rtp_session_set_jitter_buffer_params(RtpSession *session, const JBParameters *par){
- /* FIXME min_size and max_size to be implemented */
- rtp_session_set_jitter_compensation(session,par->nom_size);
- jitter_control_enable_adaptive(&session->rtp.jittctl,par->adaptive);
- session->rtp.max_rq_size=par->max_packets;
-}
-
-void rtp_session_get_jitter_buffer_params(RtpSession *session, JBParameters *par){
- int nom_size=session->rtp.jittctl.jitt_comp;
- par->min_size=nom_size;
- par->nom_size=nom_size;
- par->max_size=-1;
- par->adaptive=session->rtp.jittctl.adaptive;
- par->max_packets=session->rtp.max_rq_size;
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-/***************************************************************************
- * jitterctl.c
- *
- * Mon Nov 8 11:53:21 2004
- * Copyright 2004 Simon MORLAT
- * Email simon.morlat@linphone.org
- ****************************************************************************/
-
-#ifndef JITTERCTL_H
-#define JITTERCTL_H
-
-
-void jitter_control_init(JitterControl *ctl, int base_jiitt_time, PayloadType *pt);
-void jitter_control_enable_adaptive(JitterControl *ctl, bool_t val);
-void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t cur_str_ts);
-#define jitter_control_adaptive_enabled(ctl) ((ctl)->adaptive)
-void jitter_control_set_payload(JitterControl *ctl, PayloadType *pt);
-void jitter_control_update_corrective_slide(JitterControl *ctl);
-static inline uint32_t jitter_control_get_compensated_timestamp(JitterControl *obj , uint32_t user_ts){
- return user_ts+obj->slide-obj->adapt_jitt_comp_ts;
-}
-
-#endif
+++ /dev/null
-*############################################################
-*#
-*# $Header: /sources/linphone/linphone/oRTP/src/master,v 1.1 2002/02/25 08:41:53 smorlat Exp $
-*#
-*# $Source: /sources/linphone/linphone/oRTP/src/master,v $
-*# $Revision: 1.1 $
-*# $Locker: $
-*#
-*############################################################
-$VERSION
-1
-$$$
-
-$DRIVER_INSTALL
-oRTP -1 -1
-$$$
-
-$LOADABLE
-$$$
-
-$INTERFACE
-base
-$$$
-
-$DRIVER_DEPENDENCY
-$$$
-
-$TYPE
-oRTP wsio_class pseudo pmi -1 -1
-$$$
-
-$TUNABLE
-$$$
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-/* ortp-config-win32.h. Generated manually... */
-#define ORTP_VERSION "0.8.2"
-#define ORTP_MAJOR_VERSION 0
-#define ORTP_MINOR_VERSION 8
-#define ORTP_MICRO_VERSION 2
-#define ORTP_EXTRA_VERSION
-
-/* define the debug mode */
-#define RTP_DEBUG 1
-
-#define HAVE_SRTP 1
-
-/* enables SO_REUSEADDR socket option in the rtp_session_set_local_addr() function */
-#define SO_REUSE_ADDR 1
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-#include "ortp/ortp.h"
-#include "scheduler.h"
-
-rtp_stats_t ortp_global_stats;
-
-#ifdef ENABLE_MEMCHECK
-int ortp_allocations=0;
-#endif
-
-
-RtpScheduler *__ortp_scheduler;
-
-
-
-extern void av_profile_init(RtpProfile *profile);
-
-static void init_random_number_generator(){
- struct timeval t;
- gettimeofday(&t,NULL);
- srandom(t.tv_usec+t.tv_sec);
-}
-
-
-#ifdef WIN32
-static bool_t win32_init_sockets(void){
- WORD wVersionRequested;
- WSADATA wsaData;
- int i;
-
- wVersionRequested = MAKEWORD(2,0);
- if( (i = WSAStartup(wVersionRequested, &wsaData))!=0)
- {
- ortp_error("Unable to initialize windows socket api, reason: %d (%s)",i,getWinSocketError(i));
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
-/**
- * Initialize the oRTP library. You should call this function first before using
- * oRTP API.
-**/
-void ortp_init()
-{
- static bool_t initialized=FALSE;
- if (initialized) return;
- initialized=TRUE;
-
-#ifdef WIN32
- win32_init_sockets();
-#endif
-
- av_profile_init(&av_profile);
- ortp_global_stats_reset();
- init_random_number_generator();
- ortp_message("oRTP-" ORTP_VERSION " initialized.");
-}
-
-
-/**
- * Initialize the oRTP scheduler. You only have to do that if you intend to use the
- * scheduled mode of the #RtpSession in your application.
- *
-**/
-void ortp_scheduler_init()
-{
- static bool_t initialized=FALSE;
- if (initialized) return;
- initialized=TRUE;
-#ifdef __hpux
- /* on hpux, we must block sigalrm on the main process, because signal delivery
- is ?random?, well, sometimes the SIGALRM goes to both the main thread and the
- scheduler thread */
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set,SIGALRM);
- sigprocmask(SIG_BLOCK,&set,NULL);
-#endif /* __hpux */
-
- __ortp_scheduler=rtp_scheduler_new();
- rtp_scheduler_start(__ortp_scheduler);
- //sleep(1);
-}
-
-
-/**
- * Gracefully uninitialize the library, including shutdowning the scheduler if it was started.
- *
-**/
-void ortp_exit()
-{
- if (__ortp_scheduler!=NULL)
- {
- rtp_scheduler_destroy(__ortp_scheduler);
- __ortp_scheduler=NULL;
- }
-}
-
-RtpScheduler * ortp_get_scheduler()
-{
- if (__ortp_scheduler==NULL) ortp_error("Cannot use the scheduled mode: the scheduler is not "
- "started. Call ortp_scheduler_init() at the begginning of the application.");
- return __ortp_scheduler;
-}
-
-
-static FILE *__log_file=0;
-
-/**
- *@param file a FILE pointer where to output the ortp logs.
- *
-**/
-void ortp_set_log_file(FILE *file)
-{
- __log_file=file;
-}
-
-static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args);
-
-OrtpLogFunc ortp_logv_out=__ortp_logv_out;
-
-/**
- *@param func: your logging function, compatible with the OrtpLogFunc prototype.
- *
-**/
-void ortp_set_log_handler(OrtpLogFunc func){
- ortp_logv_out=func;
-}
-
-
-unsigned int __ortp_log_mask=ORTP_WARNING|ORTP_ERROR|ORTP_FATAL;
-
-/**
- * @ param levelmask a mask of ORTP_DEBUG, ORTP_MESSAGE, ORTP_WARNING, ORTP_ERROR
- * ORTP_FATAL .
-**/
-void ortp_set_log_level_mask(int levelmask){
- __ortp_log_mask=levelmask;
-}
-
-char * ortp_strdup_vprintf(const char *fmt, va_list ap)
-{
- /* Guess we need no more than 100 bytes. */
- int n, size = 200;
- char *p,*np;
-#ifdef __linux
- va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
-#endif
- if ((p = (char *) ortp_malloc (size)) == NULL)
- return NULL;
- while (1)
- {
- /* Try to print in the allocated space. */
-#ifdef __linux
- va_copy(cap,ap);
- n = vsnprintf (p, size, fmt, cap);
- va_end(cap);
-#else
- /*this works on 32 bits, luckily*/
- n = vsnprintf (p, size, fmt, ap);
-#endif
- /* If that worked, return the string. */
- if (n > -1 && n < size)
- return p;
- //printf("Reallocing space.\n");
- /* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size *= 2; /* twice the old size */
- if ((np = (char *) ortp_realloc (p, size)) == NULL)
- {
- free(p);
- return NULL;
- }
- else
- {
- p = np;
- }
- }
-}
-
-char *ortp_strdup_printf(const char *fmt,...){
- char *ret;
- va_list args;
- va_start (args, fmt);
- ret=ortp_strdup_vprintf(fmt, args);
- va_end (args);
- return ret;
-}
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#define ENDLINE "\r\n"
-#else
-#define ENDLINE "\n"
-#endif
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-void ortp_logv(int level, const char *fmt, va_list args)
-{
- if (ortp_logv_out!=NULL && ortp_log_level_enabled(level))
- ortp_logv_out(level,fmt,args);
-#if !defined(_WIN32_WCE)
- if ((level)==ORTP_FATAL) abort();
-#endif
-}
-#endif
-
-static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
- const char *lname="undef";
- char *msg;
- if (__log_file==NULL) __log_file=stderr;
- switch(lev){
- case ORTP_DEBUG:
- lname="debug";
- break;
- case ORTP_MESSAGE:
- lname="message";
- break;
- case ORTP_WARNING:
- lname="warning";
- break;
- case ORTP_ERROR:
- lname="error";
- break;
- case ORTP_FATAL:
- lname="fatal";
- break;
- default:
- ortp_fatal("Bad level !");
- }
- msg=ortp_strdup_vprintf(fmt,args);
-#if defined(_MSC_VER) && !defined(_WIN32_WCE)
- OutputDebugString(msg);
- OutputDebugString("\r\n");
-#else
- fprintf(__log_file,"ortp-%s-%s" ENDLINE,lname,msg);
- fflush(__log_file);
-#endif
-
- ortp_free(msg);
-}
-
-/**
- * Display global statistics (cumulative for all RtpSession)
-**/
-void ortp_global_stats_display()
-{
- rtp_stats_display(&ortp_global_stats,"Global statistics");
-#ifdef ENABLE_MEMCHECK
- printf("Unfreed allocations: %i\n",ortp_allocations);
-#endif
-}
-
-/**
- * Print RTP statistics.
-**/
-void rtp_stats_display(const rtp_stats_t *stats, const char *header)
-{
-#ifndef WIN32
- ortp_log(ORTP_MESSAGE,
- "oRTP-stats:\n %s :",
- header);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet sent=%lld",
- (long long)stats->packet_sent);
- ortp_log(ORTP_MESSAGE,
- " number of rtp bytes sent=%lld bytes",
- (long long)stats->sent);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet received=%lld",
- (long long)stats->packet_recv);
- ortp_log(ORTP_MESSAGE,
- " number of rtp bytes received=%lld bytes",
- (long long)stats->hw_recv);
- ortp_log(ORTP_MESSAGE,
- " number of incoming rtp bytes successfully delivered to the application=%lld ",
- (long long)stats->recv);
- ortp_log(ORTP_MESSAGE,
- " number of times the application queried a packet that didn't exist=%lld ",
- (long long)stats->unavaillable);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet lost=%lld",
- (long long) stats->cum_packet_loss);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packets received too late=%lld",
- (long long)stats->outoftime);
- ortp_log(ORTP_MESSAGE,
- " number of bad formatted rtp packets=%lld",
- (long long)stats->bad);
- ortp_log(ORTP_MESSAGE,
- " number of packet discarded because of queue overflow=%lld",
- (long long)stats->discarded);
-#else
- ortp_log(ORTP_MESSAGE,
- "oRTP-stats:\n %s :",
- header);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet sent=%I64d",
- (uint64_t)stats->packet_sent);
- ortp_log(ORTP_MESSAGE,
- " number of rtp bytes sent=%I64d bytes",
- (uint64_t)stats->sent);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet received=%I64d",
- (uint64_t)stats->packet_recv);
- ortp_log(ORTP_MESSAGE,
- " number of rtp bytes received=%I64d bytes",
- (uint64_t)stats->hw_recv);
- ortp_log(ORTP_MESSAGE,
- " number of incoming rtp bytes successfully delivered to the application=%I64d ",
- (uint64_t)stats->recv);
- ortp_log(ORTP_MESSAGE,
- " number of times the application queried a packet that didn't exist=%I64d ",
- (uint64_t)stats->unavaillable);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packet lost=%I64d",
- (uint64_t) stats->cum_packet_loss);
- ortp_log(ORTP_MESSAGE,
- " number of rtp packets received too late=%I64d",
- (uint64_t)stats->outoftime);
- ortp_log(ORTP_MESSAGE,
- " number of bad formatted rtp packets=%I64d",
- (uint64_t)stats->bad);
- ortp_log(ORTP_MESSAGE,
- " number of packet discarded because of queue overflow=%I64d",
- (uint64_t)stats->discarded);
-#endif
-}
-
-void ortp_global_stats_reset(){
- memset(&ortp_global_stats,0,sizeof(rtp_stats_t));
-}
-
-rtp_stats_t *ortp_get_global_stats(){
- return &ortp_global_stats;
-}
-
-void rtp_stats_reset(rtp_stats_t *stats){
- memset((void*)stats,0,sizeof(rtp_stats_t));
-}
-
-
-/**
- * This function give the opportunity to programs to check if the libortp they link to
- * has the minimum version number they need.
- *
- * Returns: true if ortp has a version number greater or equal than the required one.
-**/
-bool_t ortp_min_version_required(int major, int minor, int micro){
- return ((major*1000000) + (minor*1000) + micro) <=
- ((ORTP_MAJOR_VERSION*1000000) + (ORTP_MINOR_VERSION*1000) + ORTP_MICRO_VERSION);
-}
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/ortp.h"
-#include "ortp/payloadtype.h"
-#include "utils.h"
-
-char *payload_type_get_rtpmap(PayloadType *pt)
-{
- int len=(int)strlen(pt->mime_type)+15;
- char *rtpmap=(char *) ortp_malloc(len);
- if (pt->channels>0)
- snprintf(rtpmap,len,"%s/%i/%i",pt->mime_type,pt->clock_rate,pt->channels);
- else
- snprintf(rtpmap,len,"%s/%i",pt->mime_type,pt->clock_rate);
- return rtpmap;
-}
-
-PayloadType *payload_type_new()
-{
- PayloadType *newpayload=(PayloadType *)ortp_new0(PayloadType,1);
- newpayload->flags|=PAYLOAD_TYPE_ALLOCATED;
- return newpayload;
-}
-
-
-PayloadType *payload_type_clone(PayloadType *payload)
-{
- PayloadType *newpayload=(PayloadType *)ortp_new0(PayloadType,1);
- memcpy(newpayload,payload,sizeof(PayloadType));
- newpayload->mime_type=ortp_strdup(payload->mime_type);
- if (payload->recv_fmtp!=NULL) {
- newpayload->recv_fmtp=ortp_strdup(payload->recv_fmtp);
- }
- if (payload->send_fmtp!=NULL){
- newpayload->send_fmtp=ortp_strdup(payload->send_fmtp);
- }
- newpayload->flags|=PAYLOAD_TYPE_ALLOCATED;
- return newpayload;
-}
-
-static bool_t canWrite(PayloadType *pt){
- if (!(pt->flags & PAYLOAD_TYPE_ALLOCATED)) {
- ortp_error("Cannot change parameters of statically defined payload types: make your"
- " own copy using payload_type_clone() first.");
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- * Sets a recv parameters (fmtp) for the PayloadType.
- * This method is provided for applications using RTP with SDP, but
- * actually the ftmp information is not used for RTP processing.
-**/
-void payload_type_set_recv_fmtp(PayloadType *pt, const char *fmtp){
- if (canWrite(pt)){
- if (pt->recv_fmtp!=NULL) ortp_free(pt->recv_fmtp);
- if (fmtp!=NULL) pt->recv_fmtp=ortp_strdup(fmtp);
- else pt->recv_fmtp=NULL;
- }
-}
-
-/**
- * Sets a send parameters (fmtp) for the PayloadType.
- * This method is provided for applications using RTP with SDP, but
- * actually the ftmp information is not used for RTP processing.
-**/
-void payload_type_set_send_fmtp(PayloadType *pt, const char *fmtp){
- if (canWrite(pt)){
- if (pt->send_fmtp!=NULL) ortp_free(pt->send_fmtp);
- if (fmtp!=NULL) pt->send_fmtp=ortp_strdup(fmtp);
- else pt->send_fmtp=NULL;
- }
-}
-
-
-
-void payload_type_append_recv_fmtp(PayloadType *pt, const char *fmtp){
- if (canWrite(pt)){
- if (pt->recv_fmtp==NULL)
- pt->recv_fmtp=ortp_strdup(fmtp);
- else{
- char *tmp=ortp_strdup_printf("%s;%s",pt->recv_fmtp,fmtp);
- ortp_free(pt->recv_fmtp);
- pt->recv_fmtp=tmp;
- }
- }
-}
-
-void payload_type_append_send_fmtp(PayloadType *pt, const char *fmtp){
- if (canWrite(pt)){
- if (pt->send_fmtp==NULL)
- pt->send_fmtp=ortp_strdup(fmtp);
- else{
- char *tmp=ortp_strdup_printf("%s;%s",pt->send_fmtp,fmtp);
- ortp_free(pt->send_fmtp);
- pt->send_fmtp=tmp;
- }
- }
-}
-
-
-/**
- * Frees a PayloadType.
-**/
-void payload_type_destroy(PayloadType *pt)
-{
- if (pt->mime_type) ortp_free(pt->mime_type);
- if (pt->recv_fmtp) ortp_free(pt->recv_fmtp);
- if (pt->send_fmtp) ortp_free(pt->send_fmtp);
- ortp_free(pt);
-}
-
-/**
- * Parses a fmtp string such as "profile=0;level=10", finds the value matching
- * parameter param_name, and writes it into result.
- * Despite fmtp strings are not used anywhere within oRTP, this function can
- * be useful for people using RTP streams described from SDP.
- * @param fmtp the fmtp line (format parameters)
- * @param param_name the parameter to search for
- * @param result the value given for the parameter (if found)
- * @param result_len the size allocated to hold the result string
- * @return TRUE if the parameter was found, else FALSE.
-**/
-bool_t fmtp_get_value(const char *fmtp, const char *param_name, char *result, size_t result_len){
- const char *pos=strstr(fmtp,param_name);
- memset(result, '\0', result_len);
- if (pos){
- const char *equal=strchr(pos,'=');
- if (equal){
- int copied;
- const char *end=strchr(equal+1,';');
- if (end==NULL) end=fmtp+strlen(fmtp); /*assuming this is the last param */
- copied=MIN(result_len-1,end-(equal+1));
- strncpy(result,equal+1,copied);
- result[copied]='\0';
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime)
-{
- PayloadType *pt;
- int i;
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++)
- {
- pt=rtp_profile_get_payload(profile,i);
- if (pt!=NULL)
- {
- if (strcasecmp(pt->mime_type,mime)==0){
- return i;
- }
- }
- }
- return -1;
-}
-
-int rtp_profile_find_payload_number(RtpProfile*profile,const char *mime,int rate,int channels)
-{
- int i;
- PayloadType *pt;
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++)
- {
- pt=rtp_profile_get_payload(profile,i);
- if (pt!=NULL)
- {
- if (strcasecmp(pt->mime_type,mime)==0 &&
- pt->clock_rate==rate &&
- (pt->channels==channels || channels<=0 || pt->channels<=0)) {
- /*we don't look at channels if it is undefined
- ie a negative or zero value*/
-
- return i;
- }
- }
- }
- return -1;
-}
-
-int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile,const char *rtpmap)
-{
- int clock_rate, channels, ret;
- char* subtype = ortp_strdup( rtpmap );
- char* rate_str = NULL;
- char* chan_str = NULL;
-
-
- /* find the slash after the subtype */
- rate_str = strchr(subtype, '/');
- if (rate_str && strlen(rate_str)>1) {
- *rate_str = 0;
- rate_str++;
-
- /* Look for another slash */
- chan_str = strchr(rate_str, '/');
- if (chan_str && strlen(chan_str)>1) {
- *chan_str = 0;
- chan_str++;
- } else {
- chan_str = NULL;
- }
- } else {
- rate_str = NULL;
- }
-
- // Use default clock rate if none given
- if (rate_str) clock_rate = atoi(rate_str);
- else clock_rate = 8000;
-
- // Use default number of channels if none given
- if (chan_str) channels = atoi(chan_str);
- else channels = -1;
-
- //printf("Searching for payload %s at freq %i with %i channels\n",subtype,clock_rate,ch1annels);
- ret=rtp_profile_find_payload_number(profile,subtype,clock_rate,channels);
- ortp_free(subtype);
- return ret;
-}
-
-PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate,int channels)
-{
- int i;
- i=rtp_profile_find_payload_number(prof,mime,rate,channels);
- if (i>=0) return rtp_profile_get_payload(prof,i);
- return NULL;
-}
-
-
-PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime)
-{
- int pt;
- pt=rtp_profile_get_payload_number_from_mime(profile,mime);
- if (pt==-1) return NULL;
- else return rtp_profile_get_payload(profile,pt);
-}
-
-
-PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap)
-{
- int pt = rtp_profile_get_payload_number_from_rtpmap(profile,rtpmap);
- if (pt==-1) return NULL;
- else return rtp_profile_get_payload(profile,pt);
-}
-
-int rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos){
- prof->payload[newpos]=prof->payload[oldpos];
- prof->payload[oldpos]=NULL;
- return 0;
-}
-
-RtpProfile * rtp_profile_new(const char *name)
-{
- RtpProfile *prof=(RtpProfile*)ortp_new0(RtpProfile,1);
- rtp_profile_set_name(prof,name);
- return prof;
-}
-
-/**
- * Assign payload type number index to payload type desribed in pt for the RTP profile profile.
- * @param profile a RTP profile
- * @param idx the payload type number
- * @param pt the payload type description
- *
-**/
-void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt){
- if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
- ortp_error("Bad index %i",idx);
- return;
- }
- prof->payload[idx]=pt;
-}
-
-/**
- * Initialize the profile to the empty profile (all payload type are unassigned).
- *@param profile a RTP profile
- *
-**/
-void rtp_profile_clear_all(RtpProfile *obj){
- int i;
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++){
- obj->payload[i]=0;
- }
-}
-
-
-/**
- * Set a name to the rtp profile. (This is not required)
- * @param profile a rtp profile object
- * @param nm a string
- *
-**/
-void rtp_profile_set_name(RtpProfile *obj, const char *name){
- if (obj->name!=NULL) ortp_free(obj->name);
- obj->name=ortp_strdup(name);
-}
-
-/* ! payload are not cloned*/
-RtpProfile * rtp_profile_clone(RtpProfile *prof)
-{
- int i;
- PayloadType *pt;
- RtpProfile *newprof=rtp_profile_new(prof->name);
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++){
- pt=rtp_profile_get_payload(prof,i);
- if (pt!=NULL){
- rtp_profile_set_payload(newprof,i,pt);
- }
- }
- return newprof;
-}
-
-
-/*clone a profile and its payloads */
-RtpProfile * rtp_profile_clone_full(RtpProfile *prof)
-{
- int i;
- PayloadType *pt;
- RtpProfile *newprof=rtp_profile_new(prof->name);
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++){
- pt=rtp_profile_get_payload(prof,i);
- if (pt!=NULL){
- rtp_profile_set_payload(newprof,i,payload_type_clone(pt));
- }
- }
- return newprof;
-}
-
-void rtp_profile_destroy(RtpProfile *prof)
-{
- int i;
- PayloadType *payload;
- if (prof->name) {
- ortp_free(prof->name);
- prof->name = NULL;
- }
- for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++)
- {
- payload=rtp_profile_get_payload(prof,i);
- if (payload!=NULL && (payload->flags & PAYLOAD_TYPE_ALLOCATED))
- payload_type_destroy(payload);
- }
- ortp_free(prof);
-}
+++ /dev/null
-
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-#include "ortp/port.h"
-#include "ortp/ortp.h"
-#include "utils.h"
-
-#if defined(_WIN32) && !defined(_WIN32_WCE)
-#include <process.h>
-#endif
-
-static void *ortp_libc_malloc(size_t sz){
- return malloc(sz);
-}
-
-static void *ortp_libc_realloc(void *ptr, size_t sz){
- return realloc(ptr,sz);
-}
-
-static void ortp_libc_free(void*ptr){
- free(ptr);
-}
-
-static bool_t allocator_used=FALSE;
-
-static OrtpMemoryFunctions ortp_allocator={
- ortp_libc_malloc,
- ortp_libc_realloc,
- ortp_libc_free
-};
-
-void ortp_set_memory_functions(OrtpMemoryFunctions *functions){
- if (allocator_used){
- ortp_fatal("ortp_set_memory_functions() must be called before "
- "first use of ortp_malloc or ortp_realloc");
- return;
- }
- ortp_allocator=*functions;
-}
-
-void* ortp_malloc(size_t sz){
- allocator_used=TRUE;
- return ortp_allocator.malloc_fun(sz);
-}
-
-void* ortp_realloc(void *ptr, size_t sz){
- allocator_used=TRUE;
- return ortp_allocator.realloc_fun(ptr,sz);
-}
-
-void ortp_free(void* ptr){
- ortp_allocator.free_fun(ptr);
-}
-
-void * ortp_malloc0(size_t size){
- void *ptr=ortp_malloc(size);
- memset(ptr,0,size);
- return ptr;
-}
-
-char * ortp_strdup(const char *tmp){
- size_t sz;
- char *ret;
- if (tmp==NULL)
- return NULL;
- sz=strlen(tmp)+1;
- ret=(char*)ortp_malloc(sz);
- strcpy(ret,tmp);
- ret[sz-1]='\0';
- return ret;
-}
-
-/*
- * this method is an utility method that calls fnctl() on UNIX or
- * ioctlsocket on Win32.
- * int retrun the result of the system method
- */
-int set_non_blocking_socket (ortp_socket_t sock)
-{
-
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
- return fcntl (sock, F_SETFL, O_NONBLOCK);
-#else
- unsigned long nonBlock = 1;
- return ioctlsocket(sock, FIONBIO , &nonBlock);
-#endif
-}
-
-
-/*
- * this method is an utility method that calls close() on UNIX or
- * closesocket on Win32.
- * int retrun the result of the system method
- */
-int close_socket(ortp_socket_t sock){
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
- return close (sock);
-#else
- return closesocket(sock);
-#endif
-}
-
-#if defined (_WIN32_WCE) || defined(_MSC_VER)
-int ortp_file_exist(const char *pathname) {
- FILE* fd;
- if (pathname==NULL) return -1;
- fd=fopen(pathname,"r");
- if (fd==NULL) {
- return -1;
- } else {
- fclose(fd);
- return 0;
- }
-}
-#else
-int ortp_file_exist(const char *pathname) {
- return access(pathname,F_OK);
-}
-#endif /*_WIN32_WCE*/
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
- /* Use UNIX inet_aton method */
-#else
- int inet_aton (const char * cp, struct in_addr * addr)
- {
- unsigned long retval;
-
- retval = inet_addr (cp);
-
- if (retval == INADDR_NONE)
- {
- return -1;
- }
- else
- {
- addr->S_un.S_addr = retval;
- return 1;
- }
- }
-#endif
-
-char *ortp_strndup(const char *str,int n){
- int min=MIN((int)strlen(str),n)+1;
- char *ret=(char*)ortp_malloc(min);
- strncpy(ret,str,n);
- ret[min-1]='\0';
- return ret;
-}
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
-int __ortp_thread_join(ortp_thread_t thread, void **ptr){
- int err=pthread_join(thread,ptr);
- if (err!=0) {
- ortp_error("pthread_join error: %s",strerror(err));
- }
- return err;
-}
-
-int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routine)(void*), void *arg){
- pthread_attr_t my_attr;
- pthread_attr_init(&my_attr);
- if (attr)
- my_attr = *attr;
-#ifdef ORTP_DEFAULT_THREAD_STACK_SIZE
- if (ORTP_DEFAULT_THREAD_STACK_SIZE!=0)
- pthread_attr_setstacksize(&my_attr, ORTP_DEFAULT_THREAD_STACK_SIZE);
-#endif
- return pthread_create(thread, &my_attr, routine, arg);
-}
-
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE)
-
-int WIN_mutex_init(ortp_mutex_t *mutex, void *attr)
-{
- *mutex=CreateMutex(NULL, FALSE, NULL);
- return 0;
-}
-
-int WIN_mutex_lock(ortp_mutex_t * hMutex)
-{
- WaitForSingleObject(*hMutex, INFINITE); /* == WAIT_TIMEOUT; */
- return 0;
-}
-
-int WIN_mutex_unlock(ortp_mutex_t * hMutex)
-{
- ReleaseMutex(*hMutex);
- return 0;
-}
-
-int WIN_mutex_destroy(ortp_mutex_t * hMutex)
-{
- CloseHandle(*hMutex);
- return 0;
-}
-
-typedef struct thread_param{
- void * (*func)(void *);
- void * arg;
-}thread_param_t;
-
-static unsigned WINAPI thread_starter(void *data){
- thread_param_t *params=(thread_param_t*)data;
- void *ret=params->func(params->arg);
- ortp_free(data);
- return (DWORD)ret;
-}
-
-#if defined _WIN32_WCE
-# define _beginthreadex CreateThread
-# define _endthreadex ExitThread
-#endif
-
-int WIN_thread_create(ortp_thread_t *th, void *attr, void * (*func)(void *), void *data)
-{
- thread_param_t *params=ortp_new(thread_param_t,1);
- params->func=func;
- params->arg=data;
- *th=(HANDLE)_beginthreadex( NULL, 0, (LPTHREAD_START_ROUTINE)thread_starter, params, 0, NULL);
- return 0;
-}
-
-int WIN_thread_join(ortp_thread_t thread_h, void **unused)
-{
- if (thread_h!=NULL)
- {
- WaitForSingleObject(thread_h, INFINITE);
- CloseHandle(thread_h);
- }
- return 0;
-}
-
-int WIN_cond_init(ortp_cond_t *cond, void *attr)
-{
- *cond=CreateEvent(NULL, FALSE, FALSE, NULL);
- return 0;
-}
-
-int WIN_cond_wait(ortp_cond_t* hCond, ortp_mutex_t * hMutex)
-{
- //gulp: this is not very atomic ! bug here ?
- WIN_mutex_unlock(hMutex);
- WaitForSingleObject(*hCond, INFINITE);
- WIN_mutex_lock(hMutex);
- return 0;
-}
-
-int WIN_cond_signal(ortp_cond_t * hCond)
-{
- SetEvent(*hCond);
- return 0;
-}
-
-int WIN_cond_broadcast(ortp_cond_t * hCond)
-{
- WIN_cond_signal(hCond);
- return 0;
-}
-
-int WIN_cond_destroy(ortp_cond_t * hCond)
-{
- CloseHandle(*hCond);
- return 0;
-}
-
-
-#if defined(_WIN32_WCE)
-#include <time.h>
-
-const char * ortp_strerror(DWORD value) {
- static TCHAR msgBuf[256];
- FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- value,
- 0, // Default language
- (LPTSTR) &msgBuf,
- 0,
- NULL
- );
- return (const char *)msgBuf;
-}
-
-int
-gettimeofday (struct timeval *tv, void *tz)
-{
- DWORD timemillis = GetTickCount();
- tv->tv_sec = timemillis/1000;
- tv->tv_usec = (timemillis - (tv->tv_sec*1000)) * 1000;
- return 0;
-}
-
-#else
-
-int gettimeofday (struct timeval *tv, void* tz)
-{
- union
- {
- __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
- FILETIME fileTime;
- } now;
-
- GetSystemTimeAsFileTime (&now.fileTime);
- tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL);
- tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL);
- return (0);
-}
-
-#endif
-
-const char *getWinSocketError(int error)
-{
- static char buf[80];
-
- switch (error)
- {
- case WSANOTINITIALISED: return "Windows sockets not initialized : call WSAStartup";
- case WSAEADDRINUSE: return "Local Address already in use";
- case WSAEADDRNOTAVAIL: return "The specified address is not a valid address for this machine";
- case WSAEINVAL: return "The socket is already bound to an address.";
- case WSAENOBUFS: return "Not enough buffers available, too many connections.";
- case WSAENOTSOCK: return "The descriptor is not a socket.";
- case WSAECONNRESET: return "Connection reset by peer";
-
- default :
- sprintf(buf, "Error code : %d", error);
- return buf;
- break;
- }
-
- return buf;
-}
-
-#ifdef _WORKAROUND_MINGW32_BUGS
-char * WSAAPI gai_strerror(int errnum){
- return (char*)getWinSocketError(errnum);
-}
-#endif
-
-#endif
-
-#ifndef WIN32
-
-#include <sys/socket.h>
-#include <netdb.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-
-static char *make_pipe_name(const char *name){
- return ortp_strdup_printf("/tmp/%s",name);
-}
-
-/* portable named pipes */
-ortp_socket_t ortp_server_pipe_create(const char *name){
- struct sockaddr_un sa;
- char *pipename=make_pipe_name(name);
- ortp_socket_t sock;
- sock=socket(AF_UNIX,SOCK_STREAM,0);
- sa.sun_family=AF_UNIX;
- strncpy(sa.sun_path,pipename,sizeof(sa.sun_path)-1);
- unlink(pipename);/*in case we didn't finished properly previous time */
- ortp_free(pipename);
- fchmod(sock,S_IRUSR|S_IWUSR);
- if (bind(sock,(struct sockaddr*)&sa,sizeof(sa))!=0){
- ortp_error("Failed to bind command unix socket: %s",strerror(errno));
- return -1;
- }
- listen(sock,1);
- return sock;
-}
-
-ortp_socket_t ortp_server_pipe_accept_client(ortp_socket_t server){
- struct sockaddr_un su;
- socklen_t ssize=sizeof(su);
- ortp_socket_t client_sock=accept(server,(struct sockaddr*)&su,&ssize);
- return client_sock;
-}
-
-int ortp_server_pipe_close_client(ortp_socket_t client){
- return close(client);
-}
-
-int ortp_server_pipe_close(ortp_socket_t spipe){
- return close(spipe);
-}
-
-ortp_socket_t ortp_client_pipe_connect(const char *name){
- struct sockaddr_un sa;
- char *pipename=make_pipe_name(name);
- ortp_socket_t sock=socket(AF_UNIX,SOCK_STREAM,0);
- sa.sun_family=AF_UNIX;
- strncpy(sa.sun_path,pipename,sizeof(sa.sun_path)-1);
- ortp_free(pipename);
- if (connect(sock,(struct sockaddr*)&sa,sizeof(sa))!=0){
- close(sock);
- return -1;
- }
- return sock;
-}
-
-int ortp_pipe_read(ortp_socket_t p, uint8_t *buf, int len){
- return read(p,buf,len);
-}
-
-int ortp_pipe_write(ortp_socket_t p, const uint8_t *buf, int len){
- return write(p,buf,len);
-}
-
-int ortp_client_pipe_close(ortp_socket_t sock){
- return close(sock);
-}
-
-
-#elif defined(WIN32) && !defined(_WIN32_WCE)
-
-static char *make_pipe_name(const char *name){
- return ortp_strdup_printf("\\\\.\\pipe\\%s",name);
-}
-
-static HANDLE event=NULL;
-
-/* portable named pipes */
-ortp_pipe_t ortp_server_pipe_create(const char *name){
- ortp_pipe_t h;
- char *pipename=make_pipe_name(name);
- h=CreateNamedPipe(pipename,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_MESSAGE|PIPE_WAIT,1,
- 32768,32768,0,NULL);
- ortp_free(pipename);
- if (h==INVALID_HANDLE_VALUE){
- ortp_error("Fail to create named pipe %s",pipename);
- }
- if (event==NULL) event=CreateEvent(NULL,TRUE,FALSE,NULL);
- return h;
-}
-
-
-/*this function is a bit complex because we need to wakeup someday
-even if nobody connects to the pipe.
-ortp_server_pipe_close() makes this function to exit.
-*/
-ortp_pipe_t ortp_server_pipe_accept_client(ortp_pipe_t server){
- OVERLAPPED ol;
- DWORD undef;
- HANDLE handles[2];
- memset(&ol,0,sizeof(ol));
- ol.hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
- ConnectNamedPipe(server,&ol);
- handles[0]=ol.hEvent;
- handles[1]=event;
- WaitForMultipleObjects(2,handles,FALSE,INFINITE);
- if (GetOverlappedResult(server,&ol,&undef,FALSE)){
- CloseHandle(ol.hEvent);
- return server;
- }
- CloseHandle(ol.hEvent);
- return INVALID_HANDLE_VALUE;
-}
-
-int ortp_server_pipe_close_client(ortp_pipe_t server){
- return DisconnectNamedPipe(server)==TRUE ? 0 : -1;
-}
-
-int ortp_server_pipe_close(ortp_pipe_t spipe){
- SetEvent(event);
- //CancelIoEx(spipe,NULL); /*vista only*/
- return CloseHandle(spipe);
-}
-
-ortp_pipe_t ortp_client_pipe_connect(const char *name){
- char *pipename=make_pipe_name(name);
- ortp_pipe_t hpipe = CreateFile(
- pipename, // pipe name
- GENERIC_READ | // read and write access
- GENERIC_WRITE,
- 0, // no sharing
- NULL, // default security attributes
- OPEN_EXISTING, // opens existing pipe
- 0, // default attributes
- NULL); // no template file
- ortp_free(pipename);
- return hpipe;
-}
-
-int ortp_pipe_read(ortp_pipe_t p, uint8_t *buf, int len){
- DWORD ret=0;
- if (ReadFile(p,buf,len,&ret,NULL))
- return ret;
- /*ortp_error("Could not read from pipe: %s",strerror(GetLastError()));*/
- return -1;
-}
-
-int ortp_pipe_write(ortp_pipe_t p, const uint8_t *buf, int len){
- DWORD ret=0;
- if (WriteFile(p,buf,len,&ret,NULL))
- return ret;
- /*ortp_error("Could not write to pipe: %s",strerror(GetLastError()));*/
- return -1;
-}
-
-
-int ortp_client_pipe_close(ortp_pipe_t sock){
- return CloseHandle(sock);
-}
-
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-
-#include "ortp/ortp.h"
-#include "rtptimer.h"
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
-
-#ifdef __linux__
-#include <sys/select.h>
-#endif
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-
-static struct timeval orig,cur;
-static uint32_t posix_timer_time=0; /*in milisecond */
-
-void posix_timer_init()
-{
- posix_timer.state=RTP_TIMER_RUNNING;
- gettimeofday(&orig,NULL);
- posix_timer_time=0;
-}
-
-
-
-
-void posix_timer_do()
-{
- int diff,time;
- struct timeval tv;
- gettimeofday(&cur,NULL);
- time=((cur.tv_usec-orig.tv_usec)/1000 ) + ((cur.tv_sec-orig.tv_sec)*1000 );
- if ( (diff=time-posix_timer_time)>50){
- ortp_warning("Must catchup %i miliseconds.",diff);
- }
- while((diff = posix_timer_time-time) > 0)
- {
- tv.tv_sec = diff/1000;
- tv.tv_usec = (diff%1000)*1000;
-#if defined(_WIN32) || defined(_WIN32_WCE)
- /* this kind of select is not supported on windows */
- Sleep(tv.tv_usec/1000 + tv.tv_sec * 1000);
-#else
- select(0,NULL,NULL,NULL,&tv);
-#endif
- gettimeofday(&cur,NULL);
- time=((cur.tv_usec-orig.tv_usec)/1000 ) + ((cur.tv_sec-orig.tv_sec)*1000 );
- }
- posix_timer_time+=POSIXTIMER_INTERVAL/1000;
-
-}
-
-void posix_timer_uninit()
-{
- posix_timer.state=RTP_TIMER_STOPPED;
-}
-
-RtpTimer posix_timer={ 0,
- posix_timer_init,
- posix_timer_do,
- posix_timer_uninit,
- {0,POSIXTIMER_INTERVAL}};
-
-
-#else //WIN32
-
-
-#include <windows.h>
-#include <mmsystem.h>
-
-
-MMRESULT timerId;
-HANDLE TimeEvent;
-int late_ticks;
-
-
-static DWORD posix_timer_time;
-static DWORD offset_time;
-
-
-#define TIME_INTERVAL 50
-#define TIME_RESOLUTION 10
-#define TIME_TIMEOUT 100
-
-
-
-void CALLBACK timerCb(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- // Check timerId
- if (timerId == uID)
- {
- SetEvent(TimeEvent);
- posix_timer_time += TIME_INTERVAL;
- }
-}
-
-
-void win_timer_init(void)
-{
- timerId = timeSetEvent(TIME_INTERVAL,10,timerCb,0,TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
- TimeEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
-
- late_ticks = 0;
-
- offset_time = GetTickCount();
- posix_timer_time=0;
-}
-
-
-void win_timer_do(void)
-{
- DWORD diff;
-
- // If timer have expired while we where out of this method
- // Try to run after lost time.
- if (late_ticks > 0)
- {
- late_ticks--;
- posix_timer_time+=TIME_INTERVAL;
- return;
- }
-
-
- diff = GetTickCount() - posix_timer_time - offset_time;
- if( diff>TIME_INTERVAL && (diff<(1<<31)))
- {
- late_ticks = diff/TIME_INTERVAL;
- ortp_warning("we must catchup %i ticks.",late_ticks);
- return;
- }
-
- WaitForSingleObject(TimeEvent,TIME_TIMEOUT);
- return;
-}
-
-
-void win_timer_close(void)
-{
- timeKillEvent(timerId);
-}
-
-RtpTimer toto;
-
-RtpTimer posix_timer={ 0,
- win_timer_init,
- win_timer_do,
- win_timer_close,
- {0,TIME_INTERVAL * 1000}};
-
-
-#endif // _WIN32
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/***************************************************************************
- * rtcp.c
- *
- * Wed Dec 1 11:45:30 2004
- * Copyright 2004 Simon Morlat
- * Email simon dot morlat at linphone dot org
- ****************************************************************************/
-#include "ortp/ortp.h"
-#include "ortp/rtpsession.h"
-#include "ortp/rtcp.h"
-#include "utils.h"
-#include "rtpsession_priv.h"
-
-#define rtcp_bye_set_ssrc(b,pos,ssrc) (b)->ssrc[pos]=htonl(ssrc)
-#define rtcp_bye_get_ssrc(b,pos) ntohl((b)->ssrc[pos])
-
-
-void rtcp_common_header_init(rtcp_common_header_t *ch, RtpSession *s,int type, int rc, int bytes_len){
- rtcp_common_header_set_version(ch,2);
- rtcp_common_header_set_padbit(ch,0);
- rtcp_common_header_set_packet_type(ch,type);
- rtcp_common_header_set_rc(ch,rc); /* as we don't yet support multi source receiving */
- rtcp_common_header_set_length(ch,(bytes_len/4)-1);
-}
-
-static mblk_t *sdes_chunk_new(uint32_t ssrc){
- mblk_t *m=allocb(RTCP_SDES_CHUNK_DEFAULT_SIZE,0);
- sdes_chunk_t *sc=(sdes_chunk_t*)m->b_rptr;
- sc->csrc=htonl(ssrc);
- m->b_wptr+=sizeof(sc->csrc);
- return m;
-}
-
-
-static mblk_t * sdes_chunk_append_item(mblk_t *m, rtcp_sdes_type_t sdes_type, const char *content)
-{
- if ( content )
- {
- sdes_item_t si;
- si.item_type=sdes_type;
- si.len=(uint8_t) MIN(strlen(content),RTCP_SDES_MAX_STRING_SIZE);
- m=appendb(m,(char*)&si,RTCP_SDES_ITEM_HEADER_SIZE,FALSE);
- m=appendb(m,content,si.len,FALSE);
- }
- return m;
-}
-
-static void sdes_chunk_set_ssrc(mblk_t *m, uint32_t ssrc){
- sdes_chunk_t *sc=(sdes_chunk_t*)m->b_rptr;
- sc->csrc=htonl(ssrc);
-}
-
-#define sdes_chunk_get_ssrc(m) ntohl(((sdes_chunk_t*)((m)->b_rptr))->csrc)
-
-static mblk_t * sdes_chunk_pad(mblk_t *m){
- return appendb(m,"",1,TRUE);
-}
-
-/**
- * Set session's SDES item for automatic sending of RTCP compound packets.
- * If some items are not specified, use NULL.
-**/
-void rtp_session_set_source_description(RtpSession *session,
- const char *cname, const char *name, const char *email, const char *phone,
- const char *loc, const char *tool, const char *note){
- mblk_t *chunk = sdes_chunk_new(session->snd.ssrc);
- mblk_t *m=chunk;
- const char *_cname=cname;
- if (_cname==NULL)
- {
- _cname="Unknown";
- }
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_CNAME, _cname);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_NAME, name);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_EMAIL, email);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_PHONE, phone);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_LOC, loc);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_TOOL, tool);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_NOTE, note);
- chunk=sdes_chunk_pad(chunk);
- if (session->sd!=NULL) freemsg(session->sd);
- session->sd=m;
-}
-
-void
-rtp_session_add_contributing_source(RtpSession *session, uint32_t csrc,
- const char *cname, const char *name, const char *email, const char *phone,
- const char *loc, const char *tool, const char *note)
-{
- mblk_t *chunk = sdes_chunk_new(csrc);
- mblk_t *m=chunk;
- char *_cname=(char*)cname;
- if (_cname==NULL)
- {
- _cname="toto";
- }
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_CNAME, cname);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_NAME, name);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_EMAIL, email);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_PHONE, phone);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_LOC, loc);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_TOOL, tool);
- chunk=sdes_chunk_append_item(chunk, RTCP_SDES_NOTE, note);
- chunk=sdes_chunk_pad(chunk);
- putq(&session->contributing_sources,m);
-}
-
-
-
-mblk_t* rtp_session_create_rtcp_sdes_packet(RtpSession *session)
-{
- mblk_t *mp=allocb(sizeof(rtcp_common_header_t),0);
- rtcp_common_header_t *rtcp;
- mblk_t *tmp,*m=mp;
- queue_t *q;
- int rc=0;
- rtcp = (rtcp_common_header_t*)mp->b_wptr;
- mp->b_wptr+=sizeof(rtcp_common_header_t);
-
- /* concatenate all sdes chunks */
- sdes_chunk_set_ssrc(session->sd,session->snd.ssrc);
- m=concatb(m,dupmsg(session->sd));
- rc++;
-
- q=&session->contributing_sources;
- for (tmp=qbegin(q); !qend(q,tmp); tmp=qnext(q,mp)){
- m=concatb(m,dupmsg(tmp));
- rc++;
- }
- rtcp_common_header_init(rtcp,session,RTCP_SDES,rc,msgdsize(mp));
- return mp;
-}
-
-
-mblk_t *rtcp_create_simple_bye_packet(uint32_t ssrc, const char *reason)
-{
- int packet_size;
- int strsize = 0;
- int strpadding = 0;
- mblk_t *mp;
- rtcp_bye_t *rtcp;
-
- packet_size = RTCP_BYE_HEADER_SIZE;
- if (reason!=NULL) {
- strsize=(int)MIN(strlen(reason),RTCP_BYE_REASON_MAX_STRING_SIZE);
- if (strsize > 0) {
- strpadding = 3 - (strsize % 4);
- packet_size += 1 + strsize + strpadding;
- }
- }
- mp = allocb(packet_size, 0);
-
- rtcp = (rtcp_bye_t*)mp->b_rptr;
- rtcp_common_header_init(&rtcp->ch,NULL,RTCP_BYE,1,packet_size);
- rtcp->ssrc[0] = htonl(ssrc);
- mp->b_wptr += RTCP_BYE_HEADER_SIZE;
- /* append the reason if any*/
- if (reason!=NULL) {
- const char pad[] = {0, 0, 0};
- unsigned char strsize_octet = (unsigned char)strsize;
-
- appendb(mp, (const char*)&strsize_octet, 1, FALSE);
- appendb(mp, reason,strsize, FALSE);
- appendb(mp, pad,strpadding, FALSE);
- }
- return mp;
-}
-
-void rtp_session_remove_contributing_sources(RtpSession *session, uint32_t ssrc)
-{
- queue_t *q=&session->contributing_sources;
- mblk_t *tmp;
- for (tmp=qbegin(q); !qend(q,tmp); tmp=qnext(q,tmp)){
- uint32_t csrc=sdes_chunk_get_ssrc(tmp);
- if (csrc==ssrc) {
- remq(q,tmp);
- break;
- }
- }
- tmp=rtcp_create_simple_bye_packet(ssrc, NULL);
- rtp_session_rtcp_send(session,tmp);
-}
-
-static void sender_info_init(sender_info_t *info, RtpSession *session){
- struct timeval tv;
- uint32_t tmp;
- gettimeofday(&tv,NULL);
- info->ntp_timestamp_msw=htonl(tv.tv_sec + 0x83AA7E80); /* 0x83AA7E80 is the number of seconds from 1900 to 1970 */
-#if defined(_WIN32_WCE)
- tmp=(uint32_t)((double)tv.tv_usec*(double)(((uint64_t)1)<<32)*1.0e-6);
-#else
- tmp=(uint32_t)((double)tv.tv_usec*(double)(1LL<<32)*1.0e-6);
-#endif
- info->ntp_timestamp_lsw=htonl(tmp);
- info->rtp_timestamp=htonl(session->rtp.snd_last_ts);
- info->senders_packet_count=(uint32_t) htonl((u_long) session->rtp.stats.packet_sent);
- info->senders_octet_count=(uint32_t) htonl((u_long) session->rtp.sent_payload_bytes);
- session->rtp.last_rtcp_packet_count=session->rtp.stats.packet_sent;
-}
-
-
-
-static void report_block_init(report_block_t *b, RtpSession *session){
- int packet_loss=0;
- uint8_t loss_fraction=0;
- RtpStream *stream=&session->rtp;
- uint32_t delay_snc_last_sr=0;
- uint32_t fl_cnpl;
-
- /* compute the statistics */
- /*printf("hwrcv_extseq.one=%u, hwrcv_seq_at_last_SR=%u hwrcv_since_last_SR=%u\n",
- stream->hwrcv_extseq.one,
- stream->hwrcv_seq_at_last_SR,
- stream->hwrcv_since_last_SR
- );*/
- if (stream->hwrcv_seq_at_last_SR!=0){
- packet_loss=(stream->hwrcv_extseq - stream->hwrcv_seq_at_last_SR) - stream->hwrcv_since_last_SR;
- if (packet_loss<0)
- packet_loss=0;
- stream->stats.cum_packet_loss+=packet_loss;
- loss_fraction=(int)(256.0*(float)packet_loss/(float)stream->hwrcv_since_last_SR);
- }
- /* reset them */
- stream->hwrcv_since_last_SR=0;
- stream->hwrcv_seq_at_last_SR=stream->hwrcv_extseq;
-
- if (stream->last_rcv_SR_time.tv_sec!=0){
- struct timeval now;
- float delay;
- gettimeofday(&now,NULL);
- delay=(float) ((now.tv_sec-stream->last_rcv_SR_time.tv_sec)*1e6 ) + (now.tv_usec-stream->last_rcv_SR_time.tv_usec);
- delay=(float) (delay*65536*1e-6);
- delay_snc_last_sr=(uint32_t) delay;
- }
-
- b->ssrc=htonl(session->rcv.ssrc);
- fl_cnpl=((loss_fraction&0xFF)<<24) | (stream->stats.cum_packet_loss & 0xFFFFFF);
- b->fl_cnpl=htonl(fl_cnpl);
- b->interarrival_jitter=htonl((uint32_t) stream->jittctl.inter_jitter);
- b->ext_high_seq_num_rec=htonl(stream->hwrcv_extseq);
- b->lsr=htonl(stream->last_rcv_SR_ts);
- b->delay_snc_last_sr=htonl(delay_snc_last_sr);
-}
-
-
-
-static int rtcp_sr_init(RtpSession *session, uint8_t *buf, int size){
- rtcp_sr_t *sr=(rtcp_sr_t*)buf;
- int rr=(session->rtp.stats.packet_recv>0);
- int sr_size=sizeof(rtcp_sr_t)-sizeof(report_block_t)+(rr*sizeof(report_block_t));
- if (size<sr_size) return 0;
- rtcp_common_header_init(&sr->ch,session,RTCP_SR,rr,sr_size);
- sr->ssrc=htonl(session->snd.ssrc);
- sender_info_init(&sr->si,session);
- /*only include a report block if packets were received*/
- if (rr)
- report_block_init(&sr->rb[0],session);
- return sr_size;
-}
-
-static int rtcp_rr_init(RtpSession *session, uint8_t *buf, int size){
- rtcp_rr_t *rr=(rtcp_rr_t*)buf;
- if (size<sizeof(rtcp_rr_t)) return 0;
- rtcp_common_header_init(&rr->ch,session,RTCP_RR,1,sizeof(rtcp_rr_t));
- rr->ssrc=htonl(session->snd.ssrc);
- report_block_init(&rr->rb[0],session);
- return sizeof(rtcp_rr_t);
-}
-
-static int rtcp_app_init(RtpSession *session, uint8_t *buf, uint8_t subtype, const char *name, int size){
- rtcp_app_t *app=(rtcp_app_t*)buf;
- if (size<sizeof(rtcp_app_t)) return 0;
- rtcp_common_header_init(&app->ch,session,RTCP_APP,subtype,size);
- app->ssrc=htonl(session->snd.ssrc);
- memset(app->name,0,4);
- strncpy(app->name,name,4);
- return sizeof(rtcp_app_t);
-}
-
-static mblk_t * make_rr(RtpSession *session){
- mblk_t *cm=NULL;
- mblk_t *sdes=NULL;
-
- cm=allocb(sizeof(rtcp_sr_t),0);
- cm->b_wptr+=rtcp_rr_init(session,cm->b_wptr,sizeof(rtcp_rr_t));
- /* make a SDES packet */
- if (session->sd!=NULL)
- sdes=rtp_session_create_rtcp_sdes_packet(session);
- /* link them */
- cm->b_cont=sdes;
- return cm;
-}
-
-
-static mblk_t * make_sr(RtpSession *session){
- mblk_t *cm=NULL;
- mblk_t *sdes=NULL;
-
- cm=allocb(sizeof(rtcp_sr_t),0);
- cm->b_wptr+=rtcp_sr_init(session,cm->b_wptr,sizeof(rtcp_sr_t));
- /* make a SDES packet */
- if (session->sd!=NULL)
- sdes=rtp_session_create_rtcp_sdes_packet(session);
- /* link them */
- cm->b_cont=sdes;
- return cm;
-}
-
-void rtp_session_rtcp_process_send(RtpSession *session){
- RtpStream *st=&session->rtp;
- mblk_t *m;
- if (st->rcv_last_app_ts - st->last_rtcp_report_snt_r > st->rtcp_report_snt_interval
- || st->snd_last_ts - st->last_rtcp_report_snt_s > st->rtcp_report_snt_interval){
- st->last_rtcp_report_snt_r=st->rcv_last_app_ts;
- st->last_rtcp_report_snt_s=st->snd_last_ts;
- m=make_sr(session);
- /* send the compound packet */
- rtp_session_rtcp_send(session,m);
- ortp_debug("Rtcp compound message sent.");
- }
-}
-
-void rtp_session_rtcp_process_recv(RtpSession *session){
- RtpStream *st=&session->rtp;
- mblk_t *m=NULL;
- if (st->rcv_last_app_ts - st->last_rtcp_report_snt_r > st->rtcp_report_snt_interval
- || st->snd_last_ts - st->last_rtcp_report_snt_s > st->rtcp_report_snt_interval){
- st->last_rtcp_report_snt_r=st->rcv_last_app_ts;
- st->last_rtcp_report_snt_s=st->snd_last_ts;
-
- if (session->rtp.last_rtcp_packet_count<session->rtp.stats.packet_sent){
- m=make_sr(session);
- session->rtp.last_rtcp_packet_count=session->rtp.stats.packet_sent;
- }else if (session->rtp.stats.packet_recv>0){
- /*don't send RR when no packet are received yet*/
- m=make_rr(session);
- }
- if (m!=NULL){
- /* send the compound packet */
- rtp_session_rtcp_send(session,m);
- ortp_debug("Rtcp compound message sent.");
- }
- }
-}
-
-void rtp_session_send_rtcp_APP(RtpSession *session, uint8_t subtype, const char *name, const uint8_t *data, int datalen){
- mblk_t *h=allocb(sizeof(rtcp_app_t),0);
- mblk_t *d;
- h->b_wptr+=rtcp_app_init(session,h->b_wptr,subtype,name,datalen+sizeof(rtcp_app_t));
- d=esballoc((uint8_t*)data,datalen,0,NULL);
- h->b_cont=d;
- rtp_session_rtcp_send(session,h);
-}
-
-/**
- * Sends a RTCP bye packet.
- *@param session RtpSession
- *@param reason the reason phrase.
-**/
-int
-rtp_session_bye(RtpSession *session, const char *reason)
-{
- mblk_t *cm;
- mblk_t *sdes = NULL;
- mblk_t *bye = NULL;
- int ret;
-
- /* Make a BYE packet (will be on the end of the compund packet). */
- bye = rtcp_create_simple_bye_packet(session->snd.ssrc, reason);
-
- /* SR or RR is determined by the fact whether stream was sent*/
- if (session->rtp.stats.packet_sent>0)
- {
- cm = allocb(sizeof(rtcp_sr_t), 0);
- cm->b_wptr += rtcp_sr_init(session,cm->b_wptr, sizeof(rtcp_sr_t));
- /* make a SDES packet */
- sdes = rtp_session_create_rtcp_sdes_packet(session);
- /* link them */
- concatb(concatb(cm, sdes), bye);
- } else if (session->rtp.stats.packet_recv>0){
- /* make a RR packet */
- cm = allocb(sizeof(rtcp_rr_t), 0);
- cm->b_wptr += rtcp_rr_init(session, cm->b_wptr, sizeof(rtcp_rr_t));
- /* link them */
- cm->b_cont = bye;
- }else cm=bye;
-
- /* Send compound packet. */
- ret = rtp_session_rtcp_send(session, cm);
-
- return ret;
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#include "ortp/ortp.h"
-#include "utils.h"
-
-
-/*in case of coumpound packet, set read pointer of m to the beginning of the next RTCP
-packet */
-bool_t rtcp_next_packet(mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch){
- int nextlen=sizeof(rtcp_common_header_t)+
- (rtcp_common_header_get_length(ch)*4);
- if (m->b_rptr+nextlen<m->b_wptr){
- m->b_rptr+=nextlen;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void rtcp_rewind(mblk_t *m){
- m->b_rptr=m->b_datap->db_base;
-}
-
-/* get common header; this function will also check the sanity of the packet*/
-const rtcp_common_header_t * rtcp_get_common_header(const mblk_t *m){
- int size=msgdsize(m);
- rtcp_common_header_t *ch;
- if (m->b_cont!=NULL){
- ortp_fatal("RTCP parser does not work on fragmented mblk_t. Use msgpullup() before to re-assemble the packet.");
- return NULL;
- }
- if (size<sizeof(rtcp_common_header_t)){
- ortp_warning("Bad RTCP packet, too short.");
- return NULL;
- }
- ch=(rtcp_common_header_t*)m->b_rptr;
- return ch;
-}
-
-bool_t rtcp_is_SR(const mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch!=NULL && rtcp_common_header_get_packet_type(ch)==RTCP_SR){
- if (msgdsize(m)<sizeof(rtcp_sr_t)){
- ortp_warning("Too short RTCP SR packet.");
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-/*Sender Report accessors */
-uint32_t rtcp_SR_get_ssrc(const mblk_t *m){
- rtcp_sr_t *sr=(rtcp_sr_t*)m->b_rptr;
- return ntohl(sr->ssrc);
-}
-
-const sender_info_t * rtcp_SR_get_sender_info(const mblk_t *m){
- rtcp_sr_t *sr=(rtcp_sr_t*)m->b_rptr;
- return &sr->si;
-}
-
-const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int idx){
- rtcp_sr_t *sr=(rtcp_sr_t*)m->b_rptr;
- report_block_t *rb=&sr->rb[idx];
- int size=sizeof(rtcp_common_header_t)+(4*rtcp_common_header_get_length(&sr->ch));
- if ( ( (uint8_t*)rb)+sizeof(report_block_t) <= m->b_rptr + size ) {
- return rb;
- }else{
- if (idx<rtcp_common_header_get_rc(&sr->ch)){
- ortp_warning("RTCP packet should include a report_block_t at pos %i but has no space for it.",idx);
- }
- }
- return NULL;
-}
-
-/*Receiver report accessors*/
-bool_t rtcp_is_RR(const mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch!=NULL && rtcp_common_header_get_packet_type(ch)==RTCP_RR){
- if (msgdsize(m)<sizeof(rtcp_rr_t)){
- ortp_warning("Too short RTCP RR packet.");
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-uint32_t rtcp_RR_get_ssrc(const mblk_t *m){
- rtcp_rr_t *rr=(rtcp_rr_t*)m->b_rptr;
- return ntohl(rr->ssrc);
-}
-
-const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int idx){
- rtcp_rr_t *rr=(rtcp_rr_t*)m->b_rptr;
- report_block_t *rb=&rr->rb[idx];
- int size=sizeof(rtcp_common_header_t)+(4*rtcp_common_header_get_length(&rr->ch));
- if ( ( (uint8_t*)rb)+sizeof(report_block_t) <= (m->b_rptr + size ) ){
- return rb;
- }else{
- if (idx<rtcp_common_header_get_rc(&rr->ch)){
- ortp_warning("RTCP packet should include a report_block_t at pos %i but has no space for it.",idx);
- }
- }
- return NULL;
-}
-
-/*SDES accessors */
-bool_t rtcp_is_SDES(const mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch && rtcp_common_header_get_packet_type(ch)==RTCP_SDES){
- if (msgdsize(m)<sizeof(rtcp_common_header_t)+
- (4*rtcp_common_header_get_length(ch))){
- ortp_warning("Too short RTCP SDES packet.");
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-void rtcp_sdes_parse(const mblk_t *m, SdesItemFoundCallback cb, void *user_data){
- uint8_t *rptr=(uint8_t*)m->b_rptr+sizeof(rtcp_common_header_t);
- const rtcp_common_header_t *ch=(rtcp_common_header_t*)m->b_rptr;
- uint8_t *end=rptr+sizeof(rtcp_common_header_t)+
- (4*rtcp_common_header_get_length(ch));
- uint32_t ssrc=0;
- int nchunk=0;
- bool_t chunk_start=TRUE;
-
- if (end>(uint8_t*)m->b_wptr) end=(uint8_t*)m->b_wptr;
-
- while(rptr<end){
- if (chunk_start){
- if (rptr+4<=end){
- ssrc=ntohl(*(uint32_t*)rptr);
- rptr+=4;
- }else{
- ortp_warning("incorrect chunk start in RTCP SDES");
- break;
- }
- chunk_start=FALSE;
- }else{
- if (rptr+2<=end){
- uint8_t type=rptr[0];
- uint8_t len=rptr[1];
-
- if (type==RTCP_SDES_END){
- /* pad to next 32bit boundary*/
- rptr=(uint8_t*)(((unsigned long)rptr+4) & ~0x3);
- nchunk++;
- if (nchunk<rtcp_common_header_get_rc(ch)){
- chunk_start=TRUE;
- continue;
- }else break;
- }
- rptr+=2;
- if (rptr+len<=end){
- cb(user_data,ssrc,type,(char*)rptr,len);
- rptr+=len;
- }else{
- ortp_warning("bad item length in RTCP SDES");
- break;
- }
- }else{
- /*end of packet */
- break;
- }
- }
- }
-}
-
-/*BYE accessors */
-bool_t rtcp_is_BYE(const mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch && rtcp_common_header_get_packet_type(ch)==RTCP_BYE){
- if (msgdsize(m)<sizeof(rtcp_common_header_t)+
- rtcp_common_header_get_length(ch)){
- ortp_warning("Too short RTCP BYE packet.");
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc){
- rtcp_bye_t *bye=(rtcp_bye_t*)m->b_rptr;
- int rc=rtcp_common_header_get_rc(&bye->ch);
- int len=rtcp_common_header_get_length(&bye->ch);
- if (idx<rc){
- if ((uint8_t*)&bye->ssrc[idx]<=(m->b_rptr
- +sizeof(rtcp_common_header_t)+len-4)) {
- *ssrc=ntohl(bye->ssrc[idx]);
- return TRUE;
- }else{
- ortp_warning("RTCP BYE should contain %i ssrc, but there is not enough room for it.");
- }
- }
- return FALSE;
-}
-
-bool_t rtcp_BYE_get_reason(const mblk_t *m, const char **reason, int *reason_len){
- rtcp_bye_t *bye=(rtcp_bye_t*)m->b_rptr;
- int rc=rtcp_common_header_get_rc(&bye->ch);
- int len=rtcp_common_header_get_length(&bye->ch);
- uint8_t *rptr=(uint8_t*)m->b_rptr+sizeof(rtcp_common_header_t)+rc*4;
- uint8_t *end=(uint8_t*)(m->b_rptr+sizeof(rtcp_common_header_t)+len);
- if (rptr<end){
- uint8_t content_len=rptr[0];
- if (rptr+1+content_len<=end){
- *reason=(char*)rptr+1;
- *reason_len=content_len;
- return TRUE;
- }else{
- ortp_warning("RTCP BYE has not enough space for reason phrase.");
- return FALSE;
- }
- }
- return FALSE;
-}
-
-/*APP accessors */
-bool_t rtcp_is_APP(const mblk_t *m){
- const rtcp_common_header_t *ch=rtcp_get_common_header(m);
- if (ch!=NULL && rtcp_common_header_get_packet_type(ch)==RTCP_APP){
- if (msgdsize(m)<sizeof(rtcp_common_header_t)+
- rtcp_common_header_get_length(ch)){
- ortp_warning("Too short RTCP APP packet.");
- return FALSE;
- }
- if (sizeof(rtcp_common_header_t)+rtcp_common_header_get_length(ch)
- < sizeof(rtcp_app_t)){
- ortp_warning("Bad RTCP APP packet.");
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int rtcp_APP_get_subtype(const mblk_t *m){
- rtcp_app_t *app=(rtcp_app_t*)m->b_rptr;
- return rtcp_common_header_get_rc(&app->ch);
-}
-
-uint32_t rtcp_APP_get_ssrc(const mblk_t *m){
- rtcp_app_t *app=(rtcp_app_t*)m->b_rptr;
- return ntohl(app->ssrc);
-}
-/* name argument is supposed to be at least 4 characters (note: no '\0' written)*/
-void rtcp_APP_get_name(const mblk_t *m, char *name){
- rtcp_app_t *app=(rtcp_app_t*)m->b_rptr;
- memcpy(name,app->name,4);
-}
-/* retrieve the data. when returning, data points directly into the mblk_t */
-void rtcp_APP_get_data(const mblk_t *m, uint8_t **data, int *len){
- rtcp_app_t *app=(rtcp_app_t*)m->b_rptr;
- int datalen=sizeof(rtcp_common_header_t)+rtcp_common_header_get_length(&app->ch)-8;
- if (datalen>0){
- *data=(uint8_t*)m->b_rptr+sizeof(rtcp_app_t);
- *len=datalen;
- }else{
- *len=0;
- *data=NULL;
- }
-}
-
-/*old functions: deprecated, but some useful code parts can be reused */
-/* Start from now this source code file was written by Nicola Baldo as an extension of
- the oRTP library. Copyright (C) 2005 Nicola Baldo nicola@baldo.biz*/
-
-void report_block_parse(RtpSession *session, report_block_t *rb, struct timeval rcv_time_tv)
-{
- rb->ssrc = ntohl(rb->ssrc);
-
- if ( rb->ssrc != session->snd.ssrc )
-
- {
- ortp_debug("Received rtcp report block related to unknown ssrc (not from us)... discarded");
- return;
- }
-
- else
-
- {
- uint32_t rcv_time_msw;
- uint32_t rcv_time_lsw;
- uint32_t rcv_time;
- double rtt;
-
- rcv_time_msw = rcv_time_tv.tv_sec;
-#if defined(_WIN32_WCE)
- rcv_time_lsw = (uint32_t) ((double)rcv_time_tv.tv_usec*(double)(((uint64_t)1)<<32)*1.0e-6);
-#else
- rcv_time_lsw = (uint32_t) ((double)rcv_time_tv.tv_usec*(double)(1LL<<32)*1.0e-6);
-#endif
- rcv_time = (rcv_time_msw<<16) | (rcv_time_lsw >> 16);
-
-/*
- rb->cum_num_packet_lost = ntoh24(rb->cum_num_packet_lost);
- rb->ext_high_seq_num_rec = ntohl(rb->ext_high_seq_num_rec);
- rb->interarrival_jitter = ntohl(rb->interarrival_jitter);
- rb->lsr = ntohl(rb->lsr);
- rb->delay_snc_last_sr = ntohl(rb->delay_snc_last_sr);
-*/
-
- /* calculating Round Trip Time*/
- if (rb->lsr != 0)
- {
- rtt = (double) (rcv_time - rb->delay_snc_last_sr - rb->lsr);
- rtt = rtt/65536;
- //printf("RTT = %f s\n",rtt);
- }
-
- }
-
-}
-
-void rtp_session_rtcp_parse(RtpSession *session, mblk_t *mp)
-{
- rtcp_common_header_t *rtcp;
- int msgsize;
- int rtcp_pk_size;
- RtpStream *rtpstream=&session->rtp;
- struct timeval rcv_time_tv;
-
-
- gettimeofday(&rcv_time_tv,NULL);
-
- return_if_fail(mp!=NULL);
-
- msgsize=(int) (mp->b_wptr-mp->b_rptr);
-
- if (msgsize < RTCP_COMMON_HEADER_SIZE)
- {
- ortp_debug("Receiving too short rtcp packet... discarded");
- return;
- }
-
- rtcp=(rtcp_common_header_t *)mp->b_rptr;
-
- /* compound rtcp packet can be composed by more than one rtcp message */
- while (msgsize >= RTCP_COMMON_HEADER_SIZE)
- {
-
- if (rtcp->version!=2)
- {
- ortp_debug("Receiving rtcp packet with version number !=2...discarded");
- return;
- }
-
- /* convert header data from network order to host order */
- rtcp->length = ntohs(rtcp->length);
-
- /* compute length */
- rtcp_pk_size = (rtcp->length + 1) * 4;
- /* Sanity check of simple RTCP packet length. */
- if (rtcp_pk_size > msgsize)
- {
- ortp_debug("Receiving rtcp packet shorter than the specified length.. discared");
- return;
- }
-
- switch (rtcp->packet_type)
-
- {
-
- case RTCP_SR:
-
- {
- rtcp_sr_t *sr = (rtcp_sr_t *) rtcp;
- report_block_t *rb;
- int i;
-
- if ( ntohl(sr->ssrc) != session->rcv.ssrc )
- {
- ortp_debug("Receiving rtcp sr packet from unknown ssrc.. discarded");
- return;
- }
-
- if (msgsize < RTCP_COMMON_HEADER_SIZE + RTCP_SSRC_FIELD_SIZE + RTCP_SENDER_INFO_SIZE + (RTCP_REPORT_BLOCK_SIZE*sr->ch.rc))
- {
- ortp_debug("Receiving too short rtcp sr packet... discarded");
- return;
- }
-
- /* parsing RTCP Sender Info */
- sr->si.ntp_timestamp_msw = ntohl(sr->si.ntp_timestamp_msw);
- sr->si.ntp_timestamp_lsw = ntohl(sr->si.ntp_timestamp_lsw);
- sr->si.rtp_timestamp = ntohl(sr->si.rtp_timestamp);
- sr->si.senders_packet_count = ntohl(sr->si.senders_packet_count);
- sr->si.senders_octet_count = ntohl(sr->si.senders_octet_count);
-
- /* saving data to fill LSR and DLSR field in next RTCP report to be transmitted */
- rtpstream->last_rcv_SR_ts = (sr->si.ntp_timestamp_msw << 16) | (sr->si.ntp_timestamp_lsw >> 16);
- rtpstream->last_rcv_SR_time.tv_usec = rcv_time_tv.tv_usec;
- rtpstream->last_rcv_SR_time.tv_sec = rcv_time_tv.tv_sec;
-
-
- /* parsing all RTCP report blocks */
- for (i=0; i<sr->ch.rc; i++)
- {
- rb = &(sr->rb[i]);
- report_block_parse(session, rb, rcv_time_tv);
- }
-
- }
- break;
-
-
-
- case RTCP_RR:
-
- {
- rtcp_rr_t *rr = (rtcp_rr_t *) rtcp;
- report_block_t *rb;
- int i;
-
- if (session->rcv.ssrc == 0)
- {
- /* rcv.ssrc is not set, so we adopt the incoming one */
- session->rcv.ssrc = ntohl(rr->ssrc);
- }
- else if ( ntohl(rr->ssrc) != session->rcv.ssrc )
- {
- ortp_debug("Receiving rtcp rr packet from unknown ssrc.. discarded");
- return;
- }
-
- if (msgsize < RTCP_COMMON_HEADER_SIZE + RTCP_SSRC_FIELD_SIZE + (RTCP_REPORT_BLOCK_SIZE*rr->ch.rc))
- {
- ortp_debug("Receiving too short rtcp sr packet... discarded");
- return;
- }
-
- /* parsing all RTCP report blocks */
- for (i=0; i<rr->ch.rc; i++)
- {
- rb = &(rr->rb[i]);
- report_block_parse(session, rb, rcv_time_tv);
- }
-
- }
- break;
-
-
- case RTCP_SDES:
- /* to be implemented */
- break;
-
-
- case RTCP_BYE:
- {
- rtcp_bye_t *bye = (rtcp_bye_t *) rtcp;
- unsigned sclen = bye->ch.rc * 4;
- int reason_space_len = rtcp_pk_size
- - sizeof (rtcp_common_header_t)
- - sclen;
- int i;
- char *reason = NULL;
- bool_t rcv_ssrc_match = FALSE;
-
- if (reason_space_len < 0) {
- ortp_debug("Receiving too short RTCP BYE packet... discarded");
- return;
- }
- for (i = 0; i < bye->ch.rc; i++) {
- if (ntohl(bye->ssrc[i]) == session->rcv.ssrc) {
- rcv_ssrc_match = TRUE;
- break;
- }
- }
- if (rcv_ssrc_match) {
- if (session->on_rtcp_bye.count > 0) {
- /* Get reason. */
- if (reason_space_len > 1) {
- uint8_t *reasonbuf = (uint8_t *) rtcp
- + sizeof (rtcp_common_header_t)
- + sclen;
- if (reasonbuf[0] <= reason_space_len-1)
- reason = ortp_strndup((char *)(reasonbuf+1), reasonbuf[0]);
- else
- ortp_debug("Incorrect RTCP BYE reason length");
- }
- rtp_signal_table_emit2(&session->on_rtcp_bye,
- (long)reason);
- if (reason)
- ortp_free(reason);
- } else {
- ortp_debug("Got RTCP BYE without RTCP BYE handler");
- }
- } else {
- ortp_debug("No SSRC in the BYE packet matched our rcv.ssrc.");
- }
- break;
- }
-
- case RTCP_APP:
- /* to be implemented */
- break;
-
-
- default:
-
- ortp_debug("Receiving unknown rtcp packet type... discarded");
- return;
-
- }
-
-
- msgsize -= rtcp_pk_size; /* size of unparsed portion of UDP packet, in octets */
- rtcp = (rtcp_common_header_t *) (rtcp_pk_size + (char *) rtcp); /* pointer to next RTCP packet in current UDP packet */
-
- }
-
- /* The function did not failed sanity checks, write down the RTPC/RTCP
- reception time. */
- session->last_recv_time = rcv_time_tv;
-}
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#include <ortp/ortp.h>
-#include "jitterctl.h"
-#include "utils.h"
-#include "rtpsession_priv.h"
-
-#define SSRC_CHANGED_THRESHOLD 50
-
-static void queue_packet(queue_t *q, int maxrqsz, mblk_t *mp, rtp_header_t *rtp, int *discarded)
-{
- mblk_t *tmp;
- int header_size;
- *discarded=0;
- header_size=RTP_FIXED_HEADER_SIZE+ (4*rtp->cc);
- if ((mp->b_wptr - mp->b_rptr)==header_size){
- ortp_debug("Rtp packet contains no data.");
- (*discarded)++;
- freemsg(mp);
- return;
- }
- /* and then add the packet to the queue */
-
- rtp_putq(q,mp);
- /* make some checks: q size must not exceed RtpStream::max_rq_size */
- while (q->q_mcount > maxrqsz)
- {
- /* remove the oldest mblk_t */
- tmp=getq(q);
- if (mp!=NULL)
- {
- ortp_debug("rtp_putq: Queue is full. Discarding message with ts=%i",((rtp_header_t*)mp->b_rptr)->timestamp);
- freemsg(tmp);
- (*discarded)++;
- }
- }
-}
-
-void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_ts, struct sockaddr *addr, socklen_t addrlen)
-{
- int i;
- rtp_header_t *rtp;
- int msgsize;
- RtpStream *rtpstream=&session->rtp;
- rtp_stats_t *stats=&rtpstream->stats;
-
- msgsize=mp->b_wptr-mp->b_rptr;
-
- if (msgsize<RTP_FIXED_HEADER_SIZE){
- ortp_warning("Packet too small to be a rtp packet (%i)!",msgsize);
- rtpstream->stats.bad++;
- ortp_global_stats.bad++;
- freemsg(mp);
- return;
- }
- rtp=(rtp_header_t*)mp->b_rptr;
- if (rtp->version!=2)
- {
- /* try to see if it is a STUN packet */
- uint16_t stunlen=*((uint16_t*)(mp->b_rptr + sizeof(uint16_t)));
- stunlen = ntohs(stunlen);
- if (stunlen+20==mp->b_wptr-mp->b_rptr){
- /* this looks like a stun packet */
- if (session->eventqs!=NULL){
- OrtpEvent *ev=ortp_event_new(ORTP_EVENT_STUN_PACKET_RECEIVED);
- OrtpEventData *ed=ortp_event_get_data(ev);
- ed->packet=mp;
- ed->ep=rtp_endpoint_new(addr,addrlen);
- rtp_session_dispatch_event(session,ev);
- return;
- }
- }
- /* discard in two case: the packet is not stun OR nobody is interested by STUN (no eventqs) */
- ortp_debug("Receiving rtp packet with version number !=2...discarded");
- stats->bad++;
- ortp_global_stats.bad++;
- freemsg(mp);
- return;
- }
-
- /* only count non-stun packets. */
- ortp_global_stats.packet_recv++;
- stats->packet_recv++;
- ortp_global_stats.hw_recv+=msgsize;
- stats->hw_recv+=msgsize;
- session->rtp.hwrcv_since_last_SR++;
-
-
- /* convert all header data from network order to host order */
- rtp->seq_number=ntohs(rtp->seq_number);
- rtp->timestamp=ntohl(rtp->timestamp);
- rtp->ssrc=ntohl(rtp->ssrc);
- /* convert csrc if necessary */
- if (rtp->cc*sizeof(uint32_t) > (uint32_t) (msgsize-RTP_FIXED_HEADER_SIZE)){
- ortp_debug("Receiving too short rtp packet.");
- stats->bad++;
- ortp_global_stats.bad++;
- freemsg(mp);
- return;
- }
-
-#ifndef PERF
- /* Write down the last RTP/RTCP packet reception time. */
- gettimeofday(&session->last_recv_time, NULL);
-#endif
-
- for (i=0;i<rtp->cc;i++)
- rtp->csrc[i]=ntohl(rtp->csrc[i]);
- /*the goal of the following code is to lock on an incoming SSRC to avoid
- receiving "mixed streams"*/
- if (session->ssrc_set){
- /*the ssrc is set, so we must check it */
- if (session->rcv.ssrc!=rtp->ssrc){
- if (session->inc_ssrc_candidate==rtp->ssrc){
- session->inc_same_ssrc_count++;
- }else{
- session->inc_same_ssrc_count=0;
- session->inc_ssrc_candidate=rtp->ssrc;
- }
- if (session->inc_same_ssrc_count>SSRC_CHANGED_THRESHOLD){
-
- /* store the sender rtp address to do symmetric RTP */
- if (!session->use_connect){
- if (session->rtp.socket>0 && session->symmetric_rtp){
- /* store the sender rtp address to do symmetric RTP */
- memcpy(&session->rtp.rem_addr,addr,addrlen);
- session->rtp.rem_addrlen=addrlen;
- }
- }
- session->rtp.rcv_last_ts = rtp->timestamp;
- session->rcv.ssrc=rtp->ssrc;
- rtp_signal_table_emit(&session->on_ssrc_changed);
- }else{
- /*discard the packet*/
- ortp_debug("Receiving packet with unknown ssrc.");
- stats->bad++;
- ortp_global_stats.bad++;
- freemsg(mp);
- return;
- }
- }
- else{
- /* The SSRC change must not happen if we still receive
- ssrc from the initial source. */
- session->inc_same_ssrc_count=0;
- }
-
- }else{
- session->ssrc_set=TRUE;
- session->rcv.ssrc=rtp->ssrc;
-
- if (!session->use_connect){
- if (session->rtp.socket>0 && session->symmetric_rtp){
- /* store the sender rtp address to do symmetric RTP */
- memcpy(&session->rtp.rem_addr,addr,addrlen);
- session->rtp.rem_addrlen=addrlen;
- }
- }
- }
-
- /* update some statistics */
- {
- poly32_t *extseq=(poly32_t*)&rtpstream->hwrcv_extseq;
- if (rtp->seq_number>extseq->split.lo){
- extseq->split.lo=rtp->seq_number;
- }else if (rtp->seq_number<200 && extseq->split.lo>((1<<16) - 200)){
- /* this is a check for sequence number looping */
- extseq->split.lo=rtp->seq_number;
- extseq->split.hi++;
- }
- }
-
- /* check for possible telephone events */
- if (rtp->paytype==session->rcv.telephone_events_pt){
- queue_packet(&session->rtp.tev_rq,session->rtp.max_rq_size,mp,rtp,&i);
- stats->discarded+=i;
- ortp_global_stats.discarded+=i;
- return;
- }
-
- /* check for possible payload type change, in order to update accordingly our clock-rate dependant
- parameters */
- if (session->hw_recv_pt!=rtp->paytype){
- rtp_session_update_payload_type(session,rtp->paytype);
- }
-
- jitter_control_new_packet(&session->rtp.jittctl,rtp->timestamp,local_str_ts);
-
- if (session->flags & RTP_SESSION_FIRST_PACKET_DELIVERED) {
- /* detect timestamp important jumps in the future, to workaround stupid rtp senders */
- if (RTP_TIMESTAMP_IS_NEWER_THAN(rtp->timestamp,session->rtp.rcv_last_ts+session->rtp.ts_jump)){
- ortp_debug("rtp_parse: timestamp jump ?");
- rtp_signal_table_emit2(&session->on_timestamp_jump,(long)&rtp->timestamp);
- }
- else if (RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(session->rtp.rcv_last_ts,rtp->timestamp)){
- /* don't queue packets older than the last returned packet to the application*/
- /* Call timstamp jumb in case of
- * large negative Ts jump or if ts is set to 0
- */
-
- if ( RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(session->rtp.rcv_last_ts, rtp->timestamp + session->rtp.ts_jump) ){
- ortp_warning("rtp_parse: negative timestamp jump");
- rtp_signal_table_emit2(&session->on_timestamp_jump,
- (long)&rtp->timestamp);
- }
- ortp_debug("rtp_parse: discarding too old packet (ts=%i)",rtp->timestamp);
- freemsg(mp);
- stats->outoftime++;
- ortp_global_stats.outoftime++;
- return;
- }
- }
-
- queue_packet(&session->rtp.rq,session->rtp.max_rq_size,mp,rtp,&i);
- stats->discarded+=i;
- ortp_global_stats.discarded+=i;
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-
-#include "ortp/ortp.h"
-#include "ortp/telephonyevents.h"
-#include "ortp/rtcp.h"
-#include "jitterctl.h"
-#include "scheduler.h"
-#include "utils.h"
-#include "rtpsession_priv.h"
-
-extern mblk_t *rtcp_create_simple_bye_packet(uint32_t ssrc, const char *reason);
-extern int rtcp_sr_init(RtpSession *session, char *buf, int size);
-extern int rtcp_rr_init(RtpSession *session, char *buf, int size);
-
-
-
-/* this function initialize all session parameter's that depend on the payload type */
-static void payload_type_changed(RtpSession *session, PayloadType *pt){
- jitter_control_set_payload(&session->rtp.jittctl,pt);
- session->rtp.rtcp_report_snt_interval=RTCP_DEFAULT_REPORT_INTERVAL*pt->clock_rate;
- rtp_session_set_time_jump_limit(session,session->rtp.time_jump);
- if (pt->type==PAYLOAD_VIDEO){
- session->permissive=TRUE;
- ortp_message("Using permissive algorithm");
- }
- else session->permissive=FALSE;
-}
-
-void wait_point_init(WaitPoint *wp){
- ortp_mutex_init(&wp->lock,NULL);
- ortp_cond_init(&wp->cond,NULL);
- wp->time=0;
- wp->wakeup=FALSE;
-}
-void wait_point_uninit(WaitPoint *wp){
- ortp_cond_destroy(&wp->cond);
- ortp_mutex_destroy(&wp->lock);
-}
-
-#define wait_point_lock(wp) ortp_mutex_lock(&(wp)->lock)
-#define wait_point_unlock(wp) ortp_mutex_unlock(&(wp)->lock)
-
-void wait_point_wakeup_at(WaitPoint *wp, uint32_t t, bool_t dosleep){
- wp->time=t;
- wp->wakeup=TRUE;
- if (dosleep) ortp_cond_wait(&wp->cond,&wp->lock);
-}
-
-
-bool_t wait_point_check(WaitPoint *wp, uint32_t t){
- bool_t ok=FALSE;
-
- if (wp->wakeup){
- if (TIME_IS_NEWER_THAN(t,wp->time)){
- wp->wakeup=FALSE;
- ok=TRUE;
-
- }
- }
- return ok;
-}
-#define wait_point_wakeup(wp) ortp_cond_signal(&(wp)->cond);
-
-extern void rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_ts,
- struct sockaddr *addr, socklen_t addrlen);
-
-
-static uint32_t uint32_t_random(){
- return random();
-}
-
-
-#define RTP_SEQ_IS_GREATER(seq1,seq2)\
- ((uint16_t)((uint16_t)(seq1) - (uint16_t)(seq2))< (uint16_t)(1<<15))
-
-/* put an rtp packet in queue. It is called by rtp_parse()*/
-void rtp_putq(queue_t *q, mblk_t *mp)
-{
- mblk_t *tmp;
- rtp_header_t *rtp=(rtp_header_t*)mp->b_rptr,*tmprtp;
- /* insert message block by increasing time stamp order : the last (at the bottom)
- message of the queue is the newest*/
- ortp_debug("rtp_putq(): Enqueuing packet with ts=%i and seq=%i",rtp->timestamp,rtp->seq_number);
-
- if (qempty(q)) {
- putq(q,mp);
- return;
- }
- tmp=qlast(q);
- /* we look at the queue from bottom to top, because enqueued packets have a better chance
- to be enqueued at the bottom, since there are surely newer */
- while (!qend(q,tmp))
- {
- tmprtp=(rtp_header_t*)tmp->b_rptr;
- ortp_debug("rtp_putq(): Seeing packet with seq=%i",tmprtp->seq_number);
-
- if (rtp->seq_number == tmprtp->seq_number)
- {
- /* this is a duplicated packet. Don't queue it */
- ortp_debug("rtp_putq: duplicated message.");
- freemsg(mp);
- return;
- }else if (RTP_SEQ_IS_GREATER(rtp->seq_number,tmprtp->seq_number)){
-
- insq(q,tmp->b_next,mp);
- return;
- }
- tmp=tmp->b_prev;
- }
- /* this packet is the oldest, it has to be
- placed on top of the queue */
- insq(q,qfirst(q),mp);
-
-}
-
-
-
-mblk_t *rtp_getq(queue_t *q,uint32_t timestamp, int *rejected)
-{
- mblk_t *tmp,*ret=NULL,*old=NULL;
- rtp_header_t *tmprtp;
- uint32_t ts_found=0;
-
- *rejected=0;
- ortp_debug("rtp_getq(): Timestamp %i wanted.",timestamp);
-
- if (qempty(q))
- {
- /*ortp_debug("rtp_getq: q is empty.");*/
- return NULL;
- }
- /* return the packet with ts just equal or older than the asked timestamp */
- /* packets with older timestamps are discarded */
- while ((tmp=qfirst(q))!=NULL)
- {
- tmprtp=(rtp_header_t*)tmp->b_rptr;
- ortp_debug("rtp_getq: Seeing packet with ts=%i",tmprtp->timestamp);
- if ( RTP_TIMESTAMP_IS_NEWER_THAN(timestamp,tmprtp->timestamp) )
- {
- if (ret!=NULL && tmprtp->timestamp==ts_found) {
- /* we've found two packets with same timestamp. return the first one */
- break;
- }
- if (old!=NULL) {
- ortp_debug("rtp_getq: discarding too old packet with ts=%i",ts_found);
- (*rejected)++;
- freemsg(old);
- }
- ret=getq(q); /* dequeue the packet, since it has an interesting timestamp*/
- ts_found=tmprtp->timestamp;
- ortp_debug("rtp_getq: Found packet with ts=%i",tmprtp->timestamp);
- old=ret;
- }
- else
- {
- break;
- }
- }
- return ret;
-}
-
-mblk_t *rtp_getq_permissive(queue_t *q,uint32_t timestamp, int *rejected)
-{
- mblk_t *tmp,*ret=NULL;
- rtp_header_t *tmprtp;
-
- *rejected=0;
- ortp_debug("rtp_getq_permissive(): Timestamp %i wanted.",timestamp);
-
- if (qempty(q))
- {
- /*ortp_debug("rtp_getq: q is empty.");*/
- return NULL;
- }
- /* return the packet with the older timestamp (provided that it is older than
- the asked timestamp) */
- tmp=qfirst(q);
- tmprtp=(rtp_header_t*)tmp->b_rptr;
- ortp_debug("rtp_getq_permissive: Seeing packet with ts=%i",tmprtp->timestamp);
- if ( RTP_TIMESTAMP_IS_NEWER_THAN(timestamp,tmprtp->timestamp) )
- {
- ret=getq(q); /* dequeue the packet, since it has an interesting timestamp*/
- ortp_debug("rtp_getq_permissive: Found packet with ts=%i",tmprtp->timestamp);
- }
- return ret;
-}
-
-
-void
-rtp_session_init (RtpSession * session, int mode)
-{
- JBParameters jbp;
- if (session == NULL)
- {
- ortp_debug("rtp_session_init: Invalid paramter (session=NULL)");
- return;
- }
- memset (session, 0, sizeof (RtpSession));
- session->mode = (RtpSessionMode) mode;
- if ((mode == RTP_SESSION_RECVONLY) || (mode == RTP_SESSION_SENDRECV))
- {
- rtp_session_set_flag (session, RTP_SESSION_RECV_SYNC);
- rtp_session_set_flag (session, RTP_SESSION_RECV_NOT_STARTED);
-
- }
- if ((mode == RTP_SESSION_SENDONLY) || (mode == RTP_SESSION_SENDRECV))
- {
- rtp_session_set_flag (session, RTP_SESSION_SEND_NOT_STARTED);
- session->snd.ssrc=uint32_t_random();
- /* set default source description */
- rtp_session_set_source_description(session,"unknown@unknown",NULL,NULL,
- NULL,NULL,"oRTP-" ORTP_VERSION,"This is free sofware (LGPL) !");
- }
- session->snd.telephone_events_pt=-1; /* not defined a priori */
- session->rcv.telephone_events_pt=-1; /* not defined a priori */
- rtp_session_set_profile (session, &av_profile); /*the default profile to work with */
- session->rtp.socket=-1;
- session->rtcp.socket=-1;
-#ifndef WIN32
- session->rtp.snd_socket_size=0; /*use OS default value unless on windows where they are definitely too short*/
- session->rtp.rcv_socket_size=0;
-#else
- session->rtp.snd_socket_size=session->rtp.rcv_socket_size=65536;
-#endif
- session->dscp=RTP_DEFAULT_DSCP;
- session->multicast_ttl=RTP_DEFAULT_MULTICAST_TTL;
- session->multicast_loopback=RTP_DEFAULT_MULTICAST_LOOPBACK;
- qinit(&session->rtp.rq);
- qinit(&session->rtp.tev_rq);
- qinit(&session->contributing_sources);
- session->eventqs=NULL;
- /* init signal tables */
- rtp_signal_table_init (&session->on_ssrc_changed, session,"ssrc_changed");
- rtp_signal_table_init (&session->on_payload_type_changed, session,"payload_type_changed");
- rtp_signal_table_init (&session->on_telephone_event, session,"telephone-event");
- rtp_signal_table_init (&session->on_telephone_event_packet, session,"telephone-event_packet");
- rtp_signal_table_init (&session->on_timestamp_jump,session,"timestamp_jump");
- rtp_signal_table_init (&session->on_network_error,session,"network_error");
- rtp_signal_table_init (&session->on_rtcp_bye,session,"rtcp_bye");
- wait_point_init(&session->snd.wp);
- wait_point_init(&session->rcv.wp);
- /*defaults send payload type to 0 (pcmu)*/
- rtp_session_set_send_payload_type(session,0);
- /*sets supposed recv payload type to undefined */
- rtp_session_set_recv_payload_type(session,-1);
- /* configure jitter buffer with working default parameters */
- jbp.min_size=RTP_DEFAULT_JITTER_TIME;
- jbp.nom_size=RTP_DEFAULT_JITTER_TIME;
- jbp.max_size=-1;
- jbp.max_packets= 100;/* maximum number of packet allowed to be queued */
- jbp.adaptive=TRUE;
- rtp_session_enable_jitter_buffer(session,TRUE);
- rtp_session_set_jitter_buffer_params(session,&jbp);
- rtp_session_set_time_jump_limit(session,5000);
- rtp_session_enable_rtcp(session,TRUE);
- session->recv_buf_size = UDP_MAX_SIZE;
- session->symmetric_rtp = FALSE;
- session->permissive=FALSE;
- msgb_allocator_init(&session->allocator);
-}
-
-
-/**
- * Creates a new rtp session.
- * If the session is able to send data (RTP_SESSION_SENDONLY or
- * RTP_SESSION_SENDRECV), then a random SSRC number is choosed for
- * the outgoing stream.
- * @param mode One of the RtpSessionMode flags.
- *
- * @return the newly created rtp session.
-**/
-RtpSession *
-rtp_session_new (int mode)
-{
- RtpSession *session;
- session = (RtpSession *) ortp_malloc (sizeof (RtpSession));
- if (session == NULL)
- {
- ortp_error("rtp_session_new: Memory allocation failed");
- return NULL;
- }
- rtp_session_init (session, mode);
- return session;
-}
-
-/**
- * Sets the scheduling mode of the rtp session. If @yesno is TRUE, the rtp session is in
- * the scheduled mode, that means that you can use session_set_select() to block until it's time
- * to receive or send on this session according to the timestamp passed to the respective functions.
- * You can also use blocking mode (see rtp_session_set_blocking_mode() ), to simply block within
- * the receive and send functions.
- * If @yesno is FALSE, the ortp scheduler will not manage those sessions, meaning that blocking mode
- * and the use of session_set_select() for this session are disabled.
- *@param session a rtp session.
- *@param yesno a boolean to indicate the scheduling mode.
- *
- *
-**/
-void
-rtp_session_set_scheduling_mode (RtpSession * session, int yesno)
-{
- if (yesno)
- {
- RtpScheduler *sched;
- sched = ortp_get_scheduler ();
- if (sched != NULL)
- {
- rtp_session_set_flag (session, RTP_SESSION_SCHEDULED);
- session->sched = sched;
- rtp_scheduler_add_session (sched, session);
- }
- else
- ortp_warning
- ("rtp_session_set_scheduling_mode: Cannot use scheduled mode because the "
- "scheduler is not started. Use ortp_scheduler_init() before.");
- }
- else
- rtp_session_unset_flag (session, RTP_SESSION_SCHEDULED);
-}
-
-
-/**
- * This function implicitely enables the scheduling mode if yesno is TRUE.
- * rtp_session_set_blocking_mode() defines the behaviour of the rtp_session_recv_with_ts() and
- * rtp_session_send_with_ts() functions. If @yesno is TRUE, rtp_session_recv_with_ts()
- * will block until it is time for the packet to be received, according to the timestamp
- * passed to the function. After this time, the function returns.
- * For rtp_session_send_with_ts(), it will block until it is time for the packet to be sent.
- * If @yesno is FALSE, then the two functions will return immediately.
- *
- * @param session a rtp session
- * @param yesno a boolean
-**/
-void
-rtp_session_set_blocking_mode (RtpSession * session, int yesno)
-{
- if (yesno){
- rtp_session_set_scheduling_mode(session,TRUE);
- rtp_session_set_flag (session, RTP_SESSION_BLOCKING_MODE);
- }else
- rtp_session_unset_flag (session, RTP_SESSION_BLOCKING_MODE);
-}
-
-/**
- * Set the RTP profile to be used for the session. By default, all session are created by
- * rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application
- * can set any other profile instead using that function.
- *
- * @param session a rtp session
- * @param profile a rtp profile
-**/
-
-void
-rtp_session_set_profile (RtpSession * session, RtpProfile * profile)
-{
- session->snd.profile = profile;
- session->rcv.profile = profile;
- rtp_session_telephone_events_supported(session);
-}
-
-/**
- * By default oRTP automatically sends RTCP SR or RR packets. If
- * yesno is set to FALSE, the RTCP sending of packet is disabled.
- * This functionnality might be needed for some equipments that do not
- * support RTCP, leading to a traffic of ICMP errors on the network.
- * It can also be used to save bandwidth despite the RTCP bandwidth is
- * actually and usually very very low.
-**/
-void rtp_session_enable_rtcp(RtpSession *session, bool_t yesno){
- session->rtcp.enabled=yesno;
-}
-
-/**
- * Set the RTP profile to be used for the sending by this session. By default, all session are created by
- * rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application
- * can set any other profile instead using that function.
- * @param session a rtp session
- * @param profile a rtp profile
- *
-**/
-
-void
-rtp_session_set_send_profile (RtpSession * session, RtpProfile * profile)
-{
- session->snd.profile = profile;
- rtp_session_send_telephone_events_supported(session);
-}
-
-
-
-/**
- * Set the RTP profile to be used for the receiveing by this session. By default, all session are created by
- * rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application
- * can set any other profile instead using that function.
- *
- * @param session a rtp session
- * @param profile a rtp profile
-**/
-
-void
-rtp_session_set_recv_profile (RtpSession * session, RtpProfile * profile)
-{
- session->rcv.profile = profile;
- rtp_session_recv_telephone_events_supported(session);
-}
-
-/**
- *@param session a rtp session
- *
- * DEPRECATED! Returns current send profile.
- * Use rtp_session_get_send_profile() or rtp_session_get_recv_profile()
- *
-**/
-RtpProfile *rtp_session_get_profile(RtpSession *session){
- return session->snd.profile;
-}
-
-
-/**
- *@param session a rtp session
- *
- * Returns current send profile.
- *
-**/
-RtpProfile *rtp_session_get_send_profile(RtpSession *session){
- return session->snd.profile;
-}
-
-/**
- *@param session a rtp session
- *
- * Returns current receive profile.
- *
-**/
-RtpProfile *rtp_session_get_recv_profile(RtpSession *session){
- return session->rcv.profile;
-}
-
-/**
- * The default value is UDP_MAX_SIZE bytes, a value which is working for mostly everyone.
- * However if your application can make assumption on the sizes of received packet,
- * it can be interesting to set it to a lower value in order to save memory.
- *
- * @param session a rtp session
- * @param bufsize max size in bytes for receiving packets
-**/
-void rtp_session_set_recv_buf_size(RtpSession *session, int bufsize){
- session->recv_buf_size=bufsize;
-}
-
-/**
- * Set kernel send maximum buffer size for the rtp socket.
- * A value of zero defaults to the operating system default.
-**/
-void rtp_session_set_rtp_socket_send_buffer_size(RtpSession * session, unsigned int size){
- session->rtp.snd_socket_size=size;
-}
-
-/**
- * Set kernel recv maximum buffer size for the rtp socket.
- * A value of zero defaults to the operating system default.
-**/
-void rtp_session_set_rtp_socket_recv_buffer_size(RtpSession * session, unsigned int size){
- session->rtp.rcv_socket_size=size;
-}
-
-/**
- * This function provides the way for an application to be informed of various events that
- * may occur during a rtp session. @signal is a string identifying the event, and @cb is
- * a user supplied function in charge of processing it. The application can register
- * several callbacks for the same signal, in the limit of #RTP_CALLBACK_TABLE_MAX_ENTRIES.
- * Here are name and meaning of supported signals types:
- *
- * "ssrc_changed" : the SSRC of the incoming stream has changed.
- *
- * "payload_type_changed" : the payload type of the incoming stream has changed.
- *
- * "telephone-event_packet" : a telephone-event rtp packet (RFC2833) is received.
- *
- * "telephone-event" : a telephone event has occured. This is a high-level shortcut for "telephone-event_packet".
- *
- * "network_error" : a network error happened on a socket. Arguments of the callback functions are
- * a const char * explaining the error, an int errno error code and the user_data as usual.
- *
- * "timestamp_jump" : we have received a packet with timestamp in far future compared to last timestamp received.
- * The farness of far future is set by rtp_sesssion_set_time_jump_limit()
- * "rtcp_bye": we have received a RTCP bye packet. Arguments of the callback
- * functions are a const char * containing the leaving reason and
- * the user_data.
- *
- * Returns: 0 on success, -EOPNOTSUPP if the signal does not exists, -1 if no more callbacks
- * can be assigned to the signal type.
- *
- * @param session a rtp session
- * @param signal_name the name of a signal
- * @param cb a RtpCallback
- * @param user_data a pointer to any data to be passed when invoking the callback.
- *
-**/
-int
-rtp_session_signal_connect (RtpSession * session, const char *signal_name,
- RtpCallback cb, unsigned long user_data)
-{
- OList *elem;
- for (elem=session->signal_tables;elem!=NULL;elem=o_list_next(elem)){
- RtpSignalTable *s=(RtpSignalTable*) elem->data;
- if (strcmp(signal_name,s->signal_name)==0){
- return rtp_signal_table_add(s,cb,user_data);
- }
- }
- ortp_warning ("rtp_session_signal_connect: inexistant signal %s",signal_name);
- return -1;
-}
-
-
-/**
- * Removes callback function @cb to the list of callbacks for signal @signal.
- *
- * @param session a rtp session
- * @param signal_name a signal name
- * @param cb a callback function.
- * @return: 0 on success, a negative value if the callback was not found.
-**/
-int
-rtp_session_signal_disconnect_by_callback (RtpSession * session, const char *signal_name,
- RtpCallback cb)
-{
- OList *elem;
- for (elem=session->signal_tables;elem!=NULL;elem=o_list_next(elem)){
- RtpSignalTable *s=(RtpSignalTable*) elem->data;
- if (strcmp(signal_name,s->signal_name)==0){
- return rtp_signal_table_remove_by_callback(s,cb);
- }
- }
- ortp_warning ("rtp_session_signal_connect: inexistant signal %s",signal_name);
- return -1;
-}
-
-
-/**
- * sets the initial sequence number of a sending session.
- * @param session a rtp session freshly created.
- * @param addr a 16 bit unsigned number.
- *
-**/
-void rtp_session_set_seq_number(RtpSession *session, uint16_t seq){
- session->rtp.snd_seq=seq;
-}
-
-
-uint16_t rtp_session_get_seq_number(RtpSession *session){
- return session->rtp.snd_seq;
-}
-
-
-/**
- * Sets the SSRC for the outgoing stream.
- * If not done, a random ssrc is used.
- *
- * @param session a rtp session.
- * @param ssrc an unsigned 32bit integer representing the synchronisation source identifier (SSRC).
-**/
-void
-rtp_session_set_ssrc (RtpSession * session, uint32_t ssrc)
-{
- session->snd.ssrc = ssrc;
-}
-
-
-void rtp_session_update_payload_type(RtpSession *session, int paytype){
- /* check if we support this payload type */
- PayloadType *pt=rtp_profile_get_payload(session->rcv.profile,paytype);
- if (pt!=0){
- session->hw_recv_pt=paytype;
- ortp_message ("payload type changed to %i(%s) !",
- paytype,pt->mime_type);
- payload_type_changed(session,pt);
- }else{
- ortp_warning("Receiving packet with unknown payload type %i.",paytype);
- }
-}
-/**
- * Sets the payload type of the rtp session. It decides of the payload types written in the
- * of the rtp header for the outgoing stream, if the session is SENDRECV or SENDONLY.
- * For payload type in incoming packets, the application can be informed by registering
- * for the "payload_type_changed" signal, so that it can make the necessary changes
- * on the downstream decoder that deals with the payload of the packets.
- *
- * @param session a rtp session
- * @param paytype the payload type number
- * @return 0 on success, -1 if the payload is not defined.
-**/
-
-int
-rtp_session_set_send_payload_type (RtpSession * session, int paytype)
-{
- session->snd.pt=paytype;
- return 0;
-}
-
-/**
- *@param session a rtp session
- *
- *@return the payload type currently used in outgoing rtp packets
-**/
-int rtp_session_get_send_payload_type(const RtpSession *session){
- return session->snd.pt;
-}
-
-/**
- *
- * Sets the expected payload type for incoming packets.
- * If the actual payload type in incoming packets is different that this expected payload type, thus
- * the "payload_type_changed" signal is emitted.
- *
- *@param session a rtp session
- *@param paytype the payload type number
- *@return 0 on success, -1 if the payload is not defined.
-**/
-
-int
-rtp_session_set_recv_payload_type (RtpSession * session, int paytype)
-{
- PayloadType *pt;
- session->rcv.pt=paytype;
- session->hw_recv_pt=paytype;
- pt=rtp_profile_get_payload(session->rcv.profile,paytype);
- if (pt!=NULL){
- payload_type_changed(session,pt);
- }
- return 0;
-}
-
-/**
- *@param session a rtp session
- *
- * @return the payload type currently used in incoming rtp packets
-**/
-int rtp_session_get_recv_payload_type(const RtpSession *session){
- return session->rcv.pt;
-}
-
-/**
- * Sets the expected payload type for incoming packets and payload type to be used for outgoing packets.
- * If the actual payload type in incoming packets is different that this expected payload type, thus
- * the "payload_type_changed" signal is emitted.
- *
- * @param session a rtp session
- * @param paytype the payload type number
- * @return 0 on success, -1 if the payload is not defined.
-**/
-int rtp_session_set_payload_type(RtpSession *session, int pt){
- if (rtp_session_set_send_payload_type(session,pt)<0) return -1;
- if (rtp_session_set_recv_payload_type(session,pt)<0) return -1;
- return 0;
-}
-
-
-static void rtp_header_init_from_session(rtp_header_t *rtp, RtpSession *session){
- rtp->version = 2;
- rtp->padbit = 0;
- rtp->extbit = 0;
- rtp->markbit= 0;
- rtp->cc = 0;
- rtp->paytype = session->snd.pt;
- rtp->ssrc = session->snd.ssrc;
- rtp->timestamp = 0; /* set later, when packet is sended */
- /* set a seq number */
- rtp->seq_number=session->rtp.snd_seq;
-}
-
-/**
- * Allocates a new rtp packet. In the header, ssrc and payload_type according to the session's
- * context. Timestamp is not set, it will be set when the packet is going to be
- * sent with rtp_session_sendm_with_ts(). Sequence number is initalized to previous sequence number sent + 1
- * If payload_size is zero, thus an empty packet (just a RTP header) is returned.
- *
- *@param session a rtp session.
- *@param header_size the rtp header size. For standart size (without extensions), it is RTP_FIXED_HEADER_SIZE
- *@param payload data to be copied into the rtp packet.
- *@param payload_size size of data carried by the rtp packet.
- *@return a rtp packet in a mblk_t (message block) structure.
-**/
-mblk_t * rtp_session_create_packet(RtpSession *session,int header_size, const uint8_t *payload, int payload_size)
-{
- mblk_t *mp;
- int msglen=header_size+payload_size;
- rtp_header_t *rtp;
-
- mp=allocb(msglen,BPRI_MED);
- rtp=(rtp_header_t*)mp->b_rptr;
- rtp_header_init_from_session(rtp,session);
- /*copy the payload, if any */
- mp->b_wptr+=header_size;
- if (payload_size){
- memcpy(mp->b_wptr,payload,payload_size);
- mp->b_wptr+=payload_size;
- }
- return mp;
-}
-
-/**
- * Creates a new rtp packet using the given payload buffer (no copy). The header will be allocated separetely.
- * In the header, ssrc and payload_type according to the session's
- * context. Timestamp and seq number are not set, there will be set when the packet is going to be
- * sent with rtp_session_sendm_with_ts().
- * oRTP will send this packet using libc's sendmsg() (if this function is availlable!) so that there will be no
- * packet concatenation involving copies to be done in user-space.
- * @freefn can be NULL, in that case payload will be kept untouched.
- *
- * @param session a rtp session.
- * @param payload the data to be sent with this packet
- * @param payload_size size of data
- * @param freefn a function that will be called when the payload buffer is no more needed.
- * @return: a rtp packet in a mblk_t (message block) structure.
-**/
-
-mblk_t * rtp_session_create_packet_with_data(RtpSession *session, uint8_t *payload, int payload_size, void (*freefn)(void*))
-{
- mblk_t *mp,*mpayload;
- int header_size=RTP_FIXED_HEADER_SIZE; /* revisit when support for csrc is done */
- rtp_header_t *rtp;
-
- mp=allocb(header_size,BPRI_MED);
- rtp=(rtp_header_t*)mp->b_rptr;
- rtp_header_init_from_session(rtp,session);
- mp->b_wptr+=header_size;
- /* create a mblk_t around the user supplied payload buffer */
- mpayload=esballoc(payload,payload_size,BPRI_MED,freefn);
- mpayload->b_wptr+=payload_size;
- /* link it with the header */
- mp->b_cont=mpayload;
- return mp;
-}
-
-
-/**
- * Creates a new rtp packet using the buffer given in arguments (no copy).
- * In the header, ssrc and payload_type according to the session's
- *context. Timestamp and seq number are not set, there will be set when the packet is going to be
- * sent with rtp_session_sendm_with_ts().
- * @freefn can be NULL, in that case payload will be kept untouched.
- *
- * @param session a rtp session.
- * @param buffer a buffer that contains first just enough place to write a RTP header, then the data to send.
- * @param size the size of the buffer
- * @param freefn a function that will be called once the buffer is no more needed (the data has been sent).
- * @return a rtp packet in a mblk_t (message block) structure.
-**/
-mblk_t * rtp_session_create_packet_in_place(RtpSession *session,uint8_t *buffer, int size, void (*freefn)(void*) )
-{
- mblk_t *mp;
- rtp_header_t *rtp;
-
- mp=esballoc(buffer,size,BPRI_MED,freefn);
-
- rtp=(rtp_header_t*)mp->b_rptr;
- rtp_header_init_from_session(rtp,session);
- return mp;
-}
-
-
-int
-__rtp_session_sendm_with_ts (RtpSession * session, mblk_t *mp, uint32_t packet_ts, uint32_t send_ts)
-{
- rtp_header_t *rtp;
- uint32_t packet_time;
- int error = 0;
- int packsize;
- RtpScheduler *sched=session->sched;
- RtpStream *stream=&session->rtp;
-
- if (session->flags & RTP_SESSION_SEND_NOT_STARTED)
- {
- session->rtp.snd_ts_offset = send_ts;
- /* Set initial last_rcv_time to first send time. */
- if ((session->flags & RTP_SESSION_RECV_NOT_STARTED)
- || session->mode == RTP_SESSION_SENDONLY)
- {
- gettimeofday(&session->last_recv_time, NULL);
- }
- if (session->flags & RTP_SESSION_SCHEDULED)
- {
- session->rtp.snd_time_offset = sched->time_;
- }
- rtp_session_unset_flag (session,RTP_SESSION_SEND_NOT_STARTED);
- }
- /* if we are in blocking mode, then suspend the process until the scheduler it's time to send the
- * next packet */
- /* if the timestamp of the packet queued is older than current time, then you we must
- * not block */
- if (session->flags & RTP_SESSION_SCHEDULED)
- {
- wait_point_lock(&session->snd.wp);
- packet_time =
- rtp_session_ts_to_time (session,
- send_ts -
- session->rtp.snd_ts_offset) +
- session->rtp.snd_time_offset;
- /*ortp_message("rtp_session_send_with_ts: packet_time=%i time=%i",packet_time,sched->time_);*/
- if (TIME_IS_STRICTLY_NEWER_THAN (packet_time, sched->time_))
- {
- wait_point_wakeup_at(&session->snd.wp,packet_time,(session->flags & RTP_SESSION_BLOCKING_MODE)!=0);
- session_set_clr(&sched->w_sessions,session); /* the session has written */
- }
- else session_set_set(&sched->w_sessions,session); /*to indicate select to return immediately */
- wait_point_unlock(&session->snd.wp);
- }
-
- if(mp==NULL) {/*for people who just want to be blocked but
- do not want to send anything.*/
- session->rtp.snd_last_ts = packet_ts;
- return 0;
- }
-
- rtp=(rtp_header_t*)mp->b_rptr;
-
- packsize = msgdsize(mp) ;
-
- rtp->timestamp=packet_ts;
- if (session->snd.telephone_events_pt==rtp->paytype)
- {
- rtp->seq_number = session->rtp.snd_seq;
- session->rtp.snd_seq++;
- }
- else
- session->rtp.snd_seq=rtp->seq_number+1;
- session->rtp.snd_last_ts = packet_ts;
-
-
- ortp_global_stats.sent += packsize;
- stream->sent_payload_bytes+=packsize-RTP_FIXED_HEADER_SIZE;
- stream->stats.sent += packsize;
- ortp_global_stats.packet_sent++;
- stream->stats.packet_sent++;
-
- error = rtp_session_rtp_send (session, mp);
- /*send RTCP packet if needed */
- rtp_session_rtcp_process_send(session);
- /* receives rtcp packet if session is send-only*/
- /*otherwise it is done in rtp_session_recvm_with_ts */
- if (session->mode==RTP_SESSION_SENDONLY) rtp_session_rtcp_recv(session);
- return error;
-}
-
-/**
- * Send the rtp datagram @mp to the destination set by rtp_session_set_remote_addr()
- * with timestamp @timestamp. For audio data, the timestamp is the number
- * of the first sample resulting of the data transmitted. See rfc1889 for details.
- * The packet (@mp) is freed once it is sended.
- *
- *@param session a rtp session.
- *@param mp a rtp packet presented as a mblk_t.
- *@param timestamp the timestamp of the data to be sent.
- * @return the number of bytes sent over the network.
-**/
-
-int rtp_session_sendm_with_ts(RtpSession *session, mblk_t *packet, uint32_t timestamp){
- return __rtp_session_sendm_with_ts(session,packet,timestamp,timestamp);
-}
-
-
-
-
-/**
- * Send a rtp datagram to the destination set by rtp_session_set_remote_addr() containing
- * the data from @buffer with timestamp @userts. This is a high level function that uses
- * rtp_session_create_packet() and rtp_session_sendm_with_ts() to send the data.
- *
- *@param session a rtp session.
- *@param buffer a buffer containing the data to be sent in a rtp packet.
- *@param len the length of the data buffer, in bytes.
- *@param userts the timestamp of the data to be sent. Refer to the rfc to know what it is.
- *
- *@param return the number of bytes sent over the network.
-**/
-int
-rtp_session_send_with_ts (RtpSession * session, const uint8_t * buffer, int len,
- uint32_t userts)
-{
- mblk_t *m;
- int err;
-#ifdef USE_SENDMSG
- m=rtp_session_create_packet_with_data(session,(uint8_t*)buffer,len,NULL);
-#else
- m = rtp_session_create_packet(session,RTP_FIXED_HEADER_SIZE,(uint8_t*)buffer,len);
-#endif
- err=rtp_session_sendm_with_ts(session,m,userts);
- return err;
-}
-
-
-
-extern void rtcp_parse(RtpSession *session, mblk_t *mp);
-
-
-
-static void payload_type_changed_notify(RtpSession *session, int paytype){
- PayloadType *pt = rtp_profile_get_payload(session->rcv.profile,paytype);
- if (pt) {
- session->rcv.pt = paytype;
- rtp_signal_table_emit (&session->on_payload_type_changed);
- }
-}
-
-
-/**
- * Try to get a rtp packet presented as a mblk_t structure from the rtp session.
- * The @user_ts parameter is relative to the first timestamp of the incoming stream. In other
- * words, the application does not have to know the first timestamp of the stream, it can
- * simply call for the first time this function with @user_ts=0, and then incrementing it
- * as it want. The RtpSession takes care of synchronisation between the stream timestamp
- * and the user timestamp given here.
- *
- * This function returns the entire packet (with header).
- *
- * The behaviour of this function has changed since version 0.15.0. Previously the payload data could be
- * accessed using mblk_t::b_cont::b_rptr field of the returned mblk_t.
- * This is no more the case.
- * The convenient way of accessing the payload data is to use rtp_get_payload() :
- * @code
- * unsigned char *payload;
- * int payload_size;
- * payload_size=rtp_get_payload(mp,&payload);
- * @endcode
- * OR simply skip the header this way, the data is then comprised between mp->b_rptr and mp->b_wptr:
- * @code
- * rtp_get_payload(mp,&mp->b_rptr);
- * @endcode
- *
- *
- * @param session a rtp session.
- * @param user_ts a timestamp.
- *
- * @return a rtp packet presented as a mblk_t.
-**/
-
-mblk_t *
-rtp_session_recvm_with_ts (RtpSession * session, uint32_t user_ts)
-{
- mblk_t *mp = NULL;
- rtp_header_t *rtp;
- uint32_t ts;
- uint32_t packet_time;
- RtpScheduler *sched=session->sched;
- RtpStream *stream=&session->rtp;
- int rejected=0;
- bool_t read_socket=TRUE;
-
- /* if we are scheduled, remember the scheduler time at which the application has
- * asked for its first timestamp */
-
- if (session->flags & RTP_SESSION_RECV_NOT_STARTED)
- {
- session->rtp.rcv_query_ts_offset = user_ts;
- /* Set initial last_rcv_time to first recv time. */
- if ((session->flags & RTP_SESSION_SEND_NOT_STARTED)
- || session->mode == RTP_SESSION_RECVONLY){
- gettimeofday(&session->last_recv_time, NULL);
- }
- if (session->flags & RTP_SESSION_SCHEDULED)
- {
- session->rtp.rcv_time_offset = sched->time_;
- //ortp_message("setting snd_time_offset=%i",session->rtp.snd_time_offset);
- }
- rtp_session_unset_flag (session,RTP_SESSION_RECV_NOT_STARTED);
- }else{
- /*prevent reading from the sockets when two
- consecutives calls for a same timestamp*/
- if (user_ts==session->rtp.rcv_last_app_ts)
- read_socket=FALSE;
- }
- session->rtp.rcv_last_app_ts = user_ts;
- if (read_socket){
- rtp_session_rtp_recv (session, user_ts);
- rtp_session_rtcp_recv(session);
- }
- /* check for telephone event first */
- mp=getq(&session->rtp.tev_rq);
- if (mp!=NULL){
- int msgsize=msgdsize(mp);
- ortp_global_stats.recv += msgsize;
- stream->stats.recv += msgsize;
- rtp_signal_table_emit2(&session->on_telephone_event_packet,(long)mp);
- rtp_session_check_telephone_events(session,mp);
- freemsg(mp);
- mp=NULL;
- }
-
- /* then now try to return a media packet, if possible */
- /* first condition: if the session is starting, don't return anything
- * until the queue size reaches jitt_comp */
-
- if (session->flags & RTP_SESSION_RECV_SYNC)
- {
- queue_t *q = &session->rtp.rq;
- if (qempty(q))
- {
- ortp_debug ("Queue is empty.");
- goto end;
- }
- rtp = (rtp_header_t *) qfirst(q)->b_rptr;
- session->rtp.rcv_ts_offset = rtp->timestamp;
- session->rtp.rcv_last_ret_ts = user_ts; /* just to have an init value */
- session->rcv.ssrc = rtp->ssrc;
- /* delete the recv synchronisation flag */
- rtp_session_unset_flag (session, RTP_SESSION_RECV_SYNC);
- }
-
- /*calculate the stream timestamp from the user timestamp */
- ts = jitter_control_get_compensated_timestamp(&session->rtp.jittctl,user_ts);
- if (session->rtp.jittctl.enabled==TRUE){
- if (session->permissive)
- mp = rtp_getq_permissive(&session->rtp.rq, ts,&rejected);
- else{
- mp = rtp_getq(&session->rtp.rq, ts,&rejected);
- }
- }else mp=getq(&session->rtp.rq);/*no jitter buffer at all*/
-
- stream->stats.outoftime+=rejected;
- ortp_global_stats.outoftime+=rejected;
-
- goto end;
-
- end:
- if (mp != NULL)
- {
- int msgsize = msgdsize (mp); /* evaluate how much bytes (including header) is received by app */
- uint32_t packet_ts;
- ortp_global_stats.recv += msgsize;
- stream->stats.recv += msgsize;
- rtp = (rtp_header_t *) mp->b_rptr;
- packet_ts=rtp->timestamp;
- ortp_debug("Returning mp with ts=%i", packet_ts);
- /* check for payload type changes */
- if (session->rcv.pt != rtp->paytype)
- {
- payload_type_changed_notify(session, rtp->paytype);
- }
- /* update the packet's timestamp so that it corrected by the
- adaptive jitter buffer mechanism */
- if (session->rtp.jittctl.adaptive){
- uint32_t changed_ts;
- /* only update correction offset between packets of different
- timestamps*/
- if (packet_ts!=session->rtp.rcv_last_ts)
- jitter_control_update_corrective_slide(&session->rtp.jittctl);
- changed_ts=packet_ts+session->rtp.jittctl.corrective_slide;
- rtp->timestamp=changed_ts;
- /*ortp_debug("Returned packet has timestamp %u, with clock slide compensated it is %u",packet_ts,rtp->timestamp);*/
- }
- session->rtp.rcv_last_ts = packet_ts;
- if (!(session->flags & RTP_SESSION_FIRST_PACKET_DELIVERED)){
- rtp_session_set_flag(session,RTP_SESSION_FIRST_PACKET_DELIVERED);
- }
- }
- else
- {
- ortp_debug ("No mp for timestamp queried");
- stream->stats.unavaillable++;
- ortp_global_stats.unavaillable++;
- }
- rtp_session_rtcp_process_recv(session);
-
- if (session->flags & RTP_SESSION_SCHEDULED)
- {
- /* if we are in blocking mode, then suspend the calling process until timestamp
- * wanted expires */
- /* but we must not block the process if the timestamp wanted by the application is older
- * than current time */
- wait_point_lock(&session->rcv.wp);
- packet_time =
- rtp_session_ts_to_time (session,
- user_ts -
- session->rtp.rcv_query_ts_offset) +
- session->rtp.rcv_time_offset;
- ortp_debug ("rtp_session_recvm_with_ts: packet_time=%i, time=%i",packet_time, sched->time_);
-
- if (TIME_IS_STRICTLY_NEWER_THAN (packet_time, sched->time_))
- {
- wait_point_wakeup_at(&session->rcv.wp,packet_time, (session->flags & RTP_SESSION_BLOCKING_MODE)!=0);
- session_set_clr(&sched->r_sessions,session);
- }
- else session_set_set(&sched->r_sessions,session); /*to unblock _select() immediately */
- wait_point_unlock(&session->rcv.wp);
- }
- return mp;
-}
-
-
-/**
- * NOTE: use of this function is discouraged when sending payloads other than
- * pcm/pcmu/pcma/adpcm types.
- * rtp_session_recvm_with_ts() does better job.
- *
- * Tries to read the bytes of the incoming rtp stream related to timestamp ts. In case
- * where the user supplied buffer @buffer is not large enough to get all the data
- * related to timestamp ts, then *( have_more) is set to 1 to indicate that the application
- * should recall the function with the same timestamp to get more data.
- *
- * When the rtp session is scheduled (see rtp_session_set_scheduling_mode() ), and the
- * blocking mode is on (see rtp_session_set_blocking_mode() ), then the calling thread
- * is suspended until the timestamp given as argument expires, whatever a received packet
- * fits the query or not.
- *
- * Important note: it is clear that the application cannot know the timestamp of the first
- * packet of the incoming stream, because it can be random. The @ts timestamp given to the
- * function is used relatively to first timestamp of the stream. In simple words, 0 is a good
- * value to start calling this function.
- *
- * This function internally calls rtp_session_recvm_with_ts() to get a rtp packet. The content
- * of this packet is then copied into the user supplied buffer in an intelligent manner:
- * the function takes care of the size of the supplied buffer and the timestamp given in
- * argument. Using this function it is possible to read continous audio data (e.g. pcma,pcmu...)
- * with for example a standart buffer of size of 160 with timestamp incrementing by 160 while the incoming
- * stream has a different packet size.
- *
- *Returns: if a packet was availlable with the corresponding timestamp supplied in argument
- * then the number of bytes written in the user supplied buffer is returned. If no packets
- * are availlable, either because the sender has not started to send the stream, or either
- * because silence packet are not transmitted, or either because the packet was lost during
- * network transport, then the function returns zero.
- *@param session a rtp session.
- *@param buffer a user supplied buffer to write the data.
- *@param len the length in bytes of the user supplied buffer.
- *@param ts the timestamp wanted.
- *@param have_more the address of an integer to indicate if more data is availlable for the given timestamp.
- *
-**/
-int rtp_session_recv_with_ts (RtpSession * session, uint8_t * buffer,
- int len, uint32_t ts, int * have_more){
- mblk_t *mp=NULL;
- int plen,blen=0;
- *have_more=0;
- while(1){
- if (session->pending){
- mp=session->pending;
- session->pending=NULL;
- }else {
- mp=rtp_session_recvm_with_ts(session,ts);
- if (mp!=NULL) rtp_get_payload(mp,&mp->b_rptr);
- }
- if (mp){
- plen=mp->b_wptr-mp->b_rptr;
- if (plen<=len){
- memcpy(buffer,mp->b_rptr,plen);
- buffer+=plen;
- blen+=plen;
- len-=plen;
- freemsg(mp);
- mp=NULL;
- }else{
- memcpy(buffer,mp->b_rptr,len);
- mp->b_rptr+=len;
- buffer+=len;
- blen+=len;
- len=0;
- session->pending=mp;
- *have_more=1;
- break;
- }
- }else break;
- }
- return blen;
-}
-/**
- * When the rtp session is scheduled and has started to send packets, this function
- * computes the timestamp that matches to the present time. Using this function can be
- * usefull when sending discontinuous streams. Some time can be elapsed between the end
- * of a stream burst and the begin of a new stream burst, and the application may be not
- * not aware of this elapsed time. In order to get a valid (current) timestamp to pass to
- * #rtp_session_send_with_ts() or #rtp_session_sendm_with_ts(), the application may
- * use rtp_session_get_current_send_ts().
- *
- * @param session a rtp session.
- * @return the current send timestamp for the rtp session.
-**/
-uint32_t rtp_session_get_current_send_ts(RtpSession *session)
-{
- uint32_t userts;
- uint32_t session_time;
- RtpScheduler *sched=session->sched;
- PayloadType *payload;
- payload=rtp_profile_get_payload(session->snd.profile,session->snd.pt);
- return_val_if_fail(payload!=NULL, 0);
- if ( (session->flags & RTP_SESSION_SCHEDULED)==0 ){
- ortp_warning("can't guess current timestamp because session is not scheduled.");
- return 0;
- }
- session_time=sched->time_-session->rtp.snd_time_offset;
- userts= (uint32_t)( ( (double)(session_time) * (double) payload->clock_rate )/ 1000.0)
- + session->rtp.snd_ts_offset;
- return userts;
-}
-
-/**
- * Same thing as rtp_session_get_current_send_ts() except that it's for an incoming stream.
- * Works only on scheduled mode.
- *
- * @param session a rtp session.
- * @return the theoritical that would have to be receive now.
- *
-**/
-uint32_t rtp_session_get_current_recv_ts(RtpSession *session){
- uint32_t userts;
- uint32_t session_time;
- RtpScheduler *sched=ortp_get_scheduler();
- PayloadType *payload;
- payload=rtp_profile_get_payload(session->rcv.profile,session->rcv.pt);
- return_val_if_fail(payload!=NULL, 0);
- if ( (session->flags & RTP_SESSION_SCHEDULED)==0 ){
- ortp_warning("can't guess current timestamp because session is not scheduled.");
- return 0;
- }
- session_time=sched->time_-session->rtp.rcv_time_offset;
- userts= (uint32_t)( ( (double)(session_time) * (double) payload->clock_rate )/ 1000.0)
- + session->rtp.rcv_ts_offset;
- return userts;
-}
-
-/**
- * oRTP has the possibility to inform the application through a callback registered
- * with rtp_session_signal_connect about crazy incoming RTP stream that jumps from
- * a timestamp N to N+some_crazy_value. This lets the opportunity for the application
- * to reset the session in order to resynchronize, or any other action like stopping the call
- * and reporting an error.
- * @param session the rtp session
- * @param ts_step a time interval in miliseconds
- *
-**/
-void rtp_session_set_time_jump_limit(RtpSession *session, int milisecs){
- uint32_t ts;
- session->rtp.time_jump=milisecs;
- ts=rtp_session_time_to_ts(session,milisecs);
- if (ts==0) session->rtp.ts_jump=1<<31; /* do not detect ts jump */
- else session->rtp.ts_jump=ts;
-}
-
-/**
- * Closes the rtp and rtcp sockets.
-**/
-void rtp_session_release_sockets(RtpSession *session){
- if (session->rtp.socket>=0) close_socket (session->rtp.socket);
- if (session->rtcp.socket>=0) close_socket (session->rtcp.socket);
- session->rtp.socket=-1;
- session->rtcp.socket=-1;
-
- session->rtp.tr = 0;
- session->rtcp.tr = 0;
-
- /* don't discard remote addresses, then can be preserved for next use.
- session->rtp.rem_addrlen=0;
- session->rtcp.rem_addrlen=0;
- */
-}
-
-ortp_socket_t rtp_session_get_rtp_socket(const RtpSession *session){
- return rtp_session_using_transport(session, rtp) ? (session->rtp.tr->t_getsocket)(session->rtp.tr) : session->rtp.socket;
-}
-
-ortp_socket_t rtp_session_get_rtcp_socket(const RtpSession *session){
- return rtp_session_using_transport(session, rtcp) ? (session->rtcp.tr->t_getsocket)(session->rtcp.tr) : session->rtcp.socket;
-}
-
-/**
- * Register an event queue.
- * An application can use an event queue to get informed about various RTP events.
-**/
-void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q){
- session->eventqs=o_list_append(session->eventqs,q);
-}
-
-void rtp_session_unregister_event_queue(RtpSession *session, OrtpEvQueue *q){
- session->eventqs=o_list_remove(session->eventqs,q);
-}
-
-void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev){
- OList *it;
- int i;
- for(i=0,it=session->eventqs;it!=NULL;it=it->next,++i){
- ortp_ev_queue_put((OrtpEvQueue*)it->data,ortp_event_dup(ev));
- }
- ortp_event_destroy(ev);
-}
-
-
-void rtp_session_uninit (RtpSession * session)
-{
- /* first of all remove the session from the scheduler */
- if (session->flags & RTP_SESSION_SCHEDULED)
- {
- rtp_scheduler_remove_session (session->sched,session);
- }
- /*flush all queues */
- flushq(&session->rtp.rq, FLUSHALL);
- flushq(&session->rtp.tev_rq, FLUSHALL);
-
- if (session->eventqs!=NULL) o_list_free(session->eventqs);
- /* close sockets */
- rtp_session_release_sockets(session);
-
- wait_point_uninit(&session->snd.wp);
- wait_point_uninit(&session->rcv.wp);
- if (session->current_tev!=NULL) freemsg(session->current_tev);
- if (session->rtp.cached_mp!=NULL) freemsg(session->rtp.cached_mp);
- if (session->rtcp.cached_mp!=NULL) freemsg(session->rtcp.cached_mp);
- if (session->sd!=NULL) freemsg(session->sd);
-
- session->signal_tables = o_list_free(session->signal_tables);
- msgb_allocator_uninit(&session->allocator);
-}
-
-/**
- * Resynchronize to the incoming RTP streams.
- * This can be useful to handle discoutinuous timestamps.
- * For example, call this function from the timestamp_jump signal handler.
- * @param session the rtp session
-**/
-void rtp_session_resync(RtpSession *session){
- flushq (&session->rtp.rq, FLUSHALL);
- rtp_session_set_flag(session, RTP_SESSION_RECV_SYNC);
- rtp_session_unset_flag(session,RTP_SESSION_FIRST_PACKET_DELIVERED);
- jitter_control_init(&session->rtp.jittctl,-1,NULL);
-}
-
-/**
- * Reset the session: local and remote addresses are kept. It resets timestamp, sequence
- * number, and calls rtp_session_resync().
- *
- * @param session a rtp session.
-**/
-void rtp_session_reset (RtpSession * session)
-{
- rtp_session_set_flag (session, RTP_SESSION_RECV_NOT_STARTED);
- rtp_session_set_flag (session, RTP_SESSION_SEND_NOT_STARTED);
- //session->ssrc=0;
- session->rtp.snd_time_offset = 0;
- session->rtp.snd_ts_offset = 0;
- session->rtp.snd_rand_offset = 0;
- session->rtp.snd_last_ts = 0;
- session->rtp.rcv_time_offset = 0;
- session->rtp.rcv_ts_offset = 0;
- session->rtp.rcv_query_ts_offset = 0;
- session->rtp.rcv_last_ts = 0;
- session->rtp.rcv_last_app_ts = 0;
- session->rtp.hwrcv_extseq = 0;
- session->rtp.hwrcv_since_last_SR=0;
- session->rtp.snd_seq = 0;
- session->rtp.sent_payload_bytes=0;
- rtp_session_clear_send_error_code(session);
- rtp_session_clear_recv_error_code(session);
- rtp_stats_reset(&session->rtp.stats);
- rtp_session_resync(session);
- session->ssrc_set=FALSE;
-}
-
-/**
- * Retrieve the session's statistics.
-**/
-const rtp_stats_t * rtp_session_get_stats(const RtpSession *session){
- return &session->rtp.stats;
-}
-
-void rtp_session_reset_stats(RtpSession *session){
- memset(&session->rtp.stats,0,sizeof(rtp_stats_t));
-}
-
-/**
- * Stores some application specific data into the session, so that it is easy to retrieve it from the signal callbacks using rtp_session_get_data().
- * @param session a rtp session
- * @param data an opaque pointer to be stored in the session
-**/
-
-void rtp_session_set_data(RtpSession *session, void *data){
- session->user_data=data;
-}
-
-/**
- * @param session a rtp session
- * @return the void pointer previously set using rtp_session_set_data()
-**/
-void *rtp_session_get_data(const RtpSession *session){
- return session->user_data;
-}
-
-/**
- * Enable or disable the "rtp symmetric" hack which consists of the following:
- * after the first packet is received, the source address of the packet
- * is set to be the destination address for all next packets.
- * This is useful to pass-through firewalls.
- * @param session a rtp session
- * @param yesno a boolean to enable or disable the feature
- *
-**/
-void
-rtp_session_set_symmetric_rtp (RtpSession * session, bool_t yesno)
-{
- session->symmetric_rtp =yesno;
-}
-
-/**
- * If yesno is TRUE, thus a connect() syscall is done on the socket to
- * the destination address set by rtp_session_set_remote_addr(), or
- * if the session does symmetric rtp (see rtp_session_set_symmetric_rtp())
- * a the connect() is done to the source address of the first packet received.
- * Connecting a socket has effect of rejecting all incoming packets that
- * don't come from the address specified in connect().
- * It also makes ICMP errors (such as connection refused) available to the
- * application.
- * @param session a rtp session
- * @param yesno a boolean to enable or disable the feature
- *
-**/
-void rtp_session_set_connected_mode(RtpSession *session, bool_t yesno){
- session->use_connect=yesno;
-}
-
-static float compute_bw(struct timeval *orig, unsigned int bytes){
- struct timeval current;
- float bw;
- float time;
- if (bytes==0) return 0;
- gettimeofday(¤t,NULL);
- time=(float)(current.tv_sec - orig->tv_sec) +
- ((float)(current.tv_usec - orig->tv_usec)*1e-6);
- bw=((float)bytes)*8/(time+0.001);
- /*+0.0001 avoids a division by zero without changing the results significatively*/
- return bw;
-}
-
-float rtp_session_compute_recv_bandwidth(RtpSession *session){
- float bw;
- bw=compute_bw(&session->rtp.recv_bw_start,session->rtp.recv_bytes);
- session->rtp.recv_bytes=0;
- return bw;
-}
-
-float rtp_session_compute_send_bandwidth(RtpSession *session){
- float bw;
- bw=compute_bw(&session->rtp.send_bw_start,session->rtp.sent_bytes);
- session->rtp.sent_bytes=0;
- return bw;
-}
-
-int rtp_session_get_last_send_error_code(RtpSession *session){
- return session->rtp.send_errno;
-}
-
-void rtp_session_clear_send_error_code(RtpSession *session){
- session->rtp.send_errno=0;
-}
-
-int rtp_session_get_last_recv_error_code(RtpSession *session){
- return session->rtp.recv_errno;
-}
-
-void rtp_session_clear_recv_error_code(RtpSession *session){
- session->rtp.send_errno=0;
-}
-
-/**
- * Destroys a rtp session.
- * All memory allocated for the RtpSession is freed.
- *
- * @param session a rtp session.
-**/
-void rtp_session_destroy (RtpSession * session)
-{
- rtp_session_uninit (session);
- ortp_free (session);
-}
-
-void rtp_session_make_time_distorsion(RtpSession *session, int milisec)
-{
- session->rtp.snd_time_offset+=milisec;
-}
-
-
-/* packet api */
-
-void rtp_add_csrc(mblk_t *mp, uint32_t csrc)
-{
- rtp_header_t *hdr=(rtp_header_t*)mp->b_rptr;
- hdr->csrc[hdr->cc]=csrc;
- hdr->cc++;
-}
-
-/**
- * Get a pointer to the beginning of the payload data of the RTP packet.
- * @param packet a RTP packet represented as a mblk_t
- * @param start a pointer to the beginning of the payload data, pointing inside the packet.
- * @return the length of the payload data.
-**/
-int rtp_get_payload(mblk_t *packet, unsigned char **start){
- unsigned char *tmp;
- int header_len=RTP_FIXED_HEADER_SIZE+(rtp_get_cc(packet)*4);
- tmp=packet->b_rptr+header_len;
- if (tmp>packet->b_wptr){
- if (packet->b_cont!=NULL){
- tmp=packet->b_cont->b_rptr+(header_len- (packet->b_wptr-packet->b_rptr));
- if (tmp<=packet->b_cont->b_wptr){
- *start=tmp;
- return packet->b_cont->b_wptr-tmp;
- }
- }
- ortp_warning("Invalid RTP packet");
- return -1;
- }
- *start=tmp;
- return packet->b_wptr-tmp;
-}
-
-
-/**
- * Gets last time a valid RTP or RTCP packet was received.
- * @param session RtpSession to get last receive time from.
- * @param tv Pointer to struct timeval to fill.
- *
-**/
-void
-rtp_session_get_last_recv_time(RtpSession *session, struct timeval *tv)
-{
-#ifdef PERF
- ortp_error("rtp_session_get_last_recv_time() feature disabled.");
-#else
- *tv = session->last_recv_time;
-#endif
-}
-
-
-
-uint32_t rtp_session_time_to_ts(RtpSession *session, int millisecs){
- PayloadType *payload;
- payload =
- rtp_profile_get_payload (session->snd.profile,
- session->snd.pt);
- if (payload == NULL)
- {
- ortp_warning
- ("rtp_session_ts_to_t: use of unsupported payload type %d.", session->snd.pt);
- return 0;
- }
- /* the return value is in milisecond */
- return (uint32_t) (payload->clock_rate*(double) (millisecs/1000.0f));
-}
-
-/* function used by the scheduler only:*/
-uint32_t rtp_session_ts_to_time (RtpSession * session, uint32_t timestamp)
-{
- PayloadType *payload;
- payload =
- rtp_profile_get_payload (session->snd.profile,
- session->snd.pt);
- if (payload == NULL)
- {
- ortp_warning
- ("rtp_session_ts_to_t: use of unsupported payload type %d.", session->snd.pt);
- return 0;
- }
- /* the return value is in milisecond */
- return (uint32_t) (1000.0 *
- ((double) timestamp /
- (double) payload->clock_rate));
-}
-
-
-/* time is the number of miliseconds elapsed since the start of the scheduler */
-void rtp_session_process (RtpSession * session, uint32_t time, RtpScheduler *sched)
-{
- wait_point_lock(&session->snd.wp);
- if (wait_point_check(&session->snd.wp,time)){
- session_set_set(&sched->w_sessions,session);
- wait_point_wakeup(&session->snd.wp);
- }
- wait_point_unlock(&session->snd.wp);
-
- wait_point_lock(&session->rcv.wp);
- if (wait_point_check(&session->rcv.wp,time)){
- session_set_set(&sched->r_sessions,session);
- wait_point_wakeup(&session->rcv.wp);
- }
- wait_point_unlock(&session->rcv.wp);
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/ortp.h"
-#include "utils.h"
-#include "ortp/rtpsession.h"
-#include "rtpsession_priv.h"
-
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h" /*needed for HAVE_SYS_UIO_H */
-#endif
-
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#define USE_SENDMSG 1
-#endif
-
-#define can_connect(s) ( (s)->use_connect && !(s)->symmetric_rtp)
-
-static bool_t try_connect(int fd, const struct sockaddr *dest, socklen_t addrlen){
- if (connect(fd,dest,addrlen)<0){
- ortp_warning("Could not connect() socket: %s",getSocketError());
- return FALSE;
- }
- return TRUE;
-}
-
-static ortp_socket_t create_and_bind(const char *addr, int port, int *sock_family, bool_t reuse_addr){
- int err;
- int optval = 1;
- ortp_socket_t sock=-1;
-
-#ifdef ORTP_INET6
- char num[8];
- struct addrinfo hints, *res0, *res;
-#else
- struct sockaddr_in saddr;
-#endif
-
-#ifdef ORTP_INET6
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- snprintf(num, sizeof(num), "%d",port);
- err = getaddrinfo(addr,num, &hints, &res0);
- if (err!=0) {
- ortp_warning ("Error in getaddrinfo on (addr=%s port=%i): %s", addr, port, gai_strerror(err));
- return -1;
- }
-
- for (res = res0; res; res = res->ai_next) {
- sock = socket(res->ai_family, res->ai_socktype, 0);
- if (sock==-1)
- continue;
-
- if (reuse_addr){
- err = setsockopt (sock, SOL_SOCKET, SO_REUSEADDR,
- (SOCKET_OPTION_VALUE)&optval, sizeof (optval));
- if (err < 0)
- {
- ortp_warning ("Fail to set rtp address reusable: %s.", getSocketError());
- }
- }
-
- *sock_family=res->ai_family;
- err = bind (sock, res->ai_addr, res->ai_addrlen);
- if (err != 0){
- ortp_warning ("Fail to bind rtp socket to (addr=%s port=%i) : %s.", addr,port, getSocketError());
- close_socket (sock);
- sock=-1;
- continue;
- }
-#ifndef __hpux
- switch (res->ai_family)
- {
- case AF_INET:
- if (IN_MULTICAST(ntohl(((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr)))
- {
- struct ip_mreq mreq;
- mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr;
- mreq.imr_interface.s_addr = INADDR_ANY;
- err = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (SOCKET_OPTION_VALUE) &mreq, sizeof(mreq));
- if (err < 0){
- ortp_warning ("Fail to join address group: %s.", getSocketError());
- close_socket (sock);
- sock=-1;
- continue;
- }
- }
- break;
- case AF_INET6:
- if (IN6_IS_ADDR_MULTICAST(&(((struct sockaddr_in6 *) res->ai_addr)->sin6_addr)))
- {
- struct ipv6_mreq mreq;
- mreq.ipv6mr_multiaddr = ((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
- mreq.ipv6mr_interface = 0;
- err = setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (SOCKET_OPTION_VALUE)&mreq, sizeof(mreq));
- if (err < 0)
- {
- ortp_warning ("Fail to join address group: %s.", getSocketError());
- close_socket (sock);
- sock=-1;
- continue;
- }
- }
- break;
- }
-#endif /*hpux*/
- break;
- }
- freeaddrinfo(res0);
-#else
- saddr.sin_family = AF_INET;
- *sock_family=AF_INET;
- err = inet_aton (addr, &saddr.sin_addr);
- if (err < 0)
- {
- ortp_warning ("Error in socket address:%s.", getSocketError());
- return -1;
- }
- saddr.sin_port = htons (port);
-
- sock = socket (PF_INET, SOCK_DGRAM, 0);
- if (sock==-1) return -1;
-
- if (reuse_addr){
- err = setsockopt (sock, SOL_SOCKET, SO_REUSEADDR,
- (SOCKET_OPTION_VALUE)&optval, sizeof (optval));
- if (err < 0)
- {
- ortp_warning ("Fail to set rtp address reusable: %s.",getSocketError());
- }
- }
-
- err = bind (sock,
- (struct sockaddr *) &saddr,
- sizeof (saddr));
-
- if (err != 0)
- {
- ortp_warning ("Fail to bind rtp socket to port %i: %s.", port, getSocketError());
- close_socket (sock);
- return -1;
- }
-#endif
- if (sock!=-1){
- set_non_blocking_socket (sock);
- }
- return sock;
-}
-
-static void set_socket_sizes(int sock, unsigned int sndbufsz, unsigned int rcvbufsz){
- int err;
- bool_t done=FALSE;
- if (sndbufsz>0){
-#ifdef SO_SNDBUFFORCE
- err = setsockopt(sock, SOL_SOCKET, SO_SNDBUFFORCE, (void *)&sndbufsz, sizeof(sndbufsz));
- if (err == -1) {
- ortp_error("Fail to increase socket's send buffer size with SO_SNDBUFFORCE: %s.", getSocketError());
- }else done=TRUE;
-#endif
- if (!done){
- err = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void *)&sndbufsz, sizeof(sndbufsz));
- if (err == -1) {
- ortp_error("Fail to increase socket's send buffer size with SO_SNDBUF: %s.", getSocketError());
- }
- }
- }
- done=FALSE;
- if (rcvbufsz>0){
-#ifdef SO_RCVBUFFORCE
- err = setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, (void *)&rcvbufsz, sizeof(rcvbufsz));
- if (err == -1) {
- ortp_error("Fail to increase socket's recv buffer size with SO_RCVBUFFORCE: %s.", getSocketError());
- }
-#endif
- if (!done){
- err = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&rcvbufsz, sizeof(rcvbufsz));
- if (err == -1) {
- ortp_error("Fail to increase socket's recv buffer size with SO_RCVBUF: %s.", getSocketError());
- }
- }
-
- }
-}
-
-static ortp_socket_t create_and_bind_random(const char *localip, int *sock_family, int *port){
- int retry;
- ortp_socket_t sock = -1;
- for (retry=0;retry<100;retry++)
- {
- int localport;
- do
- {
- localport = (rand () + 5000) & 0xfffe;
- }
- while ((localport < 5000) || (localport > 0xffff));
- /*do not set REUSEADDR in case of random allocation */
- sock = create_and_bind(localip, localport, sock_family,FALSE);
- if (sock!=-1) {
- *port=localport;
- return sock;
- }
- }
- ortp_warning("create_and_bind_random: Could not find a random port for %s !",localip);
- return -1;
-}
-
-/**
- *rtp_session_set_local_addr:
- *@session: a rtp session freshly created.
- *@addr: a local IP address in the xxx.xxx.xxx.xxx form.
- *@port: a local port or -1 to let oRTP choose the port randomly
- *
- * Specify the local addr to be use to listen for rtp packets or to send rtp packet from.
- * In case where the rtp session is send-only, then it is not required to call this function:
- * when calling rtp_session_set_remote_addr(), if no local address has been set, then the
- * default INADRR_ANY (0.0.0.0) IP address with a random port will be used. Calling
- * rtp_sesession_set_local_addr() is mandatory when the session is recv-only or duplex.
- *
- * Returns: 0 on success.
-**/
-
-int
-rtp_session_set_local_addr (RtpSession * session, const char * addr, int port)
-{
- ortp_socket_t sock;
- int sockfamily;
- bool_t reuse_addr;
- if (session->rtp.socket>=0){
- /* don't rebind, but close before*/
- rtp_session_release_sockets(session);
- }
-#ifdef SO_REUSE_ADDR
- reuse_addr=TRUE;
-#else
- reuse_addr=FALSE;
-#endif
- /* try to bind the rtp port */
- if (port>0)
- sock=create_and_bind(addr,port,&sockfamily,reuse_addr);
- else
- sock=create_and_bind_random(addr,&sockfamily,&port);
- if (sock!=-1){
- set_socket_sizes(sock,session->rtp.snd_socket_size,session->rtp.rcv_socket_size);
- session->rtp.sockfamily=sockfamily;
- session->rtp.socket=sock;
- session->rtp.loc_port=port;
- /*try to bind rtcp port */
- sock=create_and_bind(addr,port+1,&sockfamily,reuse_addr);
- if (sock!=-1){
- session->rtcp.sockfamily=sockfamily;
- session->rtcp.socket=sock;
- }else{
- ortp_warning("Could not create and bind rtcp socket.");
- }
-
- /* set socket options (but don't change chosen states) */
- rtp_session_set_dscp( session, -1 );
- rtp_session_set_multicast_ttl( session, -1 );
- rtp_session_set_multicast_loopback( session, -1 );
-
- return 0;
- }
- return -1;
-}
-
-
-/**
- *rtp_session_set_multicast_ttl:
- *@session: a rtp session
- *@ttl: desired Multicast Time-To-Live
- *
- * Sets the TTL (Time-To-Live) for outgoing multicast packets.
- *
- * Returns: 0 on success.
- *
-**/
-int rtp_session_set_multicast_ttl(RtpSession *session, int ttl)
-{
- int retval;
-
- // Store new TTL if one is specified
- if (ttl>0) session->multicast_ttl = ttl;
-
- // Don't do anything if socket hasn't been created yet
- if (session->rtp.socket < 0) return 0;
-
- switch (session->rtp.sockfamily) {
- case AF_INET: {
-
- retval= setsockopt(session->rtp.socket, IPPROTO_IP, IP_MULTICAST_TTL,
- (SOCKET_OPTION_VALUE) &session->multicast_ttl, sizeof(session->multicast_ttl));
-
- if (retval<0) break;
-
- retval= setsockopt(session->rtcp.socket, IPPROTO_IP, IP_MULTICAST_TTL,
- (SOCKET_OPTION_VALUE) &session->multicast_ttl, sizeof(session->multicast_ttl));
-
- } break;
-#ifdef ORTP_INET6
- case AF_INET6: {
-
- retval= setsockopt(session->rtp.socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- (SOCKET_OPTION_VALUE)&session->multicast_ttl, sizeof(session->multicast_ttl));
-
- if (retval<0) break;
-
- retval= setsockopt(session->rtcp.socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- (SOCKET_OPTION_VALUE) &session->multicast_ttl, sizeof(session->multicast_ttl));
-
- } break;
-#endif
- default:
- retval=-1;
- }
-
- if (retval<0)
- ortp_warning("Failed to set multicast TTL on socket.");
-
-
- return retval;
-}
-
-
-/**
- *rtp_session_get_multicast_ttl:
- *@session: a rtp session
- *
- * Returns the TTL (Time-To-Live) for outgoing multicast packets.
- *
-**/
-int rtp_session_get_multicast_ttl(RtpSession *session)
-{
- return session->multicast_ttl;
-}
-
-
-/**
- *rtp_session_set_multicast_loopback:
- *@session: a rtp session
- *@ttl: desired Multicast Time-To-Live
- *
- * Sets the TTL (Time-To-Live) for outgoing multicast packets.
- *
- * Returns: 0 on success.
- *
-**/
-int rtp_session_set_multicast_loopback(RtpSession *session, int yesno)
-{
- int retval;
-
- // Store new loopback state if one is specified
- if (yesno==0) {
- // Don't loop back
- session->multicast_loopback = 0;
- } else if (yesno>0) {
- // Do loop back
- session->multicast_loopback = 1;
- }
-
- // Don't do anything if socket hasn't been created yet
- if (session->rtp.socket < 0) return 0;
-
- switch (session->rtp.sockfamily) {
- case AF_INET: {
-
- retval= setsockopt(session->rtp.socket, IPPROTO_IP, IP_MULTICAST_LOOP,
- (SOCKET_OPTION_VALUE) &session->multicast_loopback, sizeof(session->multicast_loopback));
-
- if (retval<0) break;
-
- retval= setsockopt(session->rtcp.socket, IPPROTO_IP, IP_MULTICAST_LOOP,
- (SOCKET_OPTION_VALUE) &session->multicast_loopback, sizeof(session->multicast_loopback));
-
- } break;
-#ifdef ORTP_INET6
- case AF_INET6: {
-
- retval= setsockopt(session->rtp.socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- (SOCKET_OPTION_VALUE) &session->multicast_loopback, sizeof(session->multicast_loopback));
-
- if (retval<0) break;
-
- retval= setsockopt(session->rtcp.socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- (SOCKET_OPTION_VALUE) &session->multicast_loopback, sizeof(session->multicast_loopback));
-
- } break;
-#endif
- default:
- retval=-1;
- }
-
- if (retval<0)
- ortp_warning("Failed to set multicast loopback on socket.");
-
-
- return retval;
-}
-
-
-/**
- *rtp_session_get_multicast_loopback:
- *@session: a rtp session
- *
- * Returns the multicast loopback state of rtp session (true or false).
- *
-**/
-int rtp_session_get_multicast_loopback(RtpSession *session)
-{
- return session->multicast_loopback;
-}
-
-/**
- *rtp_session_set_dscp:
- *@session: a rtp session
- *@dscp: desired DSCP PHB value
- *
- * Sets the DSCP (Differentiated Services Code Point) for outgoing RTP packets.
- *
- * Returns: 0 on success.
- *
-**/
-int rtp_session_set_dscp(RtpSession *session, int dscp){
- int retval=0;
- int tos;
-
- // Store new DSCP value if one is specified
- if (dscp>=0) session->dscp = dscp;
-
- // Don't do anything if socket hasn't been created yet
- if (session->rtp.socket < 0) return 0;
-
- // DSCP value is in the upper six bits of the TOS field
- tos = (session->dscp << 2) & 0xFC;
- switch (session->rtp.sockfamily) {
- case AF_INET:
- retval = setsockopt(session->rtp.socket, IPPROTO_IP, IP_TOS, (SOCKET_OPTION_VALUE)&tos, sizeof(tos));
- break;
-#ifdef ORTP_INET6
- case AF_INET6:
-# ifdef IPV6_TCLASS /*seems not defined by my libc*/
- retval = setsockopt(session->rtp.socket, IPPROTO_IPV6, IPV6_TCLASS,
- (SOCKET_OPTION_VALUE)&tos, sizeof(tos));
-# else
- /*in case that works:*/
- retval = setsockopt(session->rtp.socket, IPPROTO_IPV6, IP_TOS,
- (SOCKET_OPTION_VALUE)&tos, sizeof(tos));
-#endif
- break;
-#endif
- default:
- retval=-1;
- }
- if (retval<0)
- ortp_warning("Failed to set DSCP value on socket.");
-
- return retval;
-}
-
-
-/**
- *rtp_session_get_dscp:
- *@session: a rtp session
- *
- * Returns the DSCP (Differentiated Services Code Point) for outgoing RTP packets.
- *
-**/
-int rtp_session_get_dscp(const RtpSession *session)
-{
- return session->dscp;
-}
-
-
-/**
- *rtp_session_get_local_port:
- *@session: a rtp session for which rtp_session_set_local_addr() or rtp_session_set_remote_addr() has been called
- *
- * This function can be useful to retrieve the local port that was randomly choosen by
- * rtp_session_set_remote_addr() when rtp_session_set_local_addr() was not called.
- *
- * Returns: the local port used to listen for rtp packets, -1 if not set.
-**/
-
-int rtp_session_get_local_port(const RtpSession *session){
- return (session->rtp.loc_port>0) ? session->rtp.loc_port : -1;
-}
-
-
-static char * ortp_inet_ntoa(struct sockaddr *addr, int addrlen, char *dest, int destlen){
-#ifdef ORTP_INET6
- int err;
- dest[0]=0;
- err=getnameinfo(addr,addrlen,dest,destlen,NULL,0,NI_NUMERICHOST);
- if (err!=0){
- ortp_warning("getnameinfo error: %s",gai_strerror(err));
- }
-#else
- char *tmp=inet_ntoa(((struct sockaddr_in*)addr)->sin_addr);
- strncpy(dest,tmp,destlen);
- dest[destlen-1]='\0';
-#endif
- return dest;
-}
-
-/**
- *rtp_session_set_remote_addr:
- *@session: a rtp session freshly created.
- *@addr: a local IP address in the xxx.xxx.xxx.xxx form.
- *@port: a local port.
- *
- * Sets the remote address of the rtp session, ie the destination address where rtp packet
- * are sent. If the session is recv-only or duplex, it also sets the origin of incoming RTP
- * packets. Rtp packets that don't come from addr:port are discarded.
- *
- * Returns: 0 on success.
-**/
-int
-rtp_session_set_remote_addr (RtpSession * session, const char * addr, int port){
- return rtp_session_set_remote_addr_full (session, addr, port, port+1);
-}
-
-/**
- *rtp_session_set_remote_addr_full:
- *@session: a rtp session freshly created.
- *@addr: a local IP address in the xxx.xxx.xxx.xxx form.
- *@rtp_port: a local rtp port.
- *@rtcp_port: a local rtcp port.
- *
- * Sets the remote address of the rtp session, ie the destination address where rtp packet
- * are sent. If the session is recv-only or duplex, it also sets the origin of incoming RTP
- * packets. Rtp packets that don't come from addr:port are discarded.
- *
- * Returns: 0 on success.
-**/
-
-int
-rtp_session_set_remote_addr_full (RtpSession * session, const char * addr, int rtp_port, int rtcp_port)
-{
- int err;
-#ifdef ORTP_INET6
- struct addrinfo hints, *res0, *res;
- char num[8];
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- snprintf(num, sizeof(num), "%d", rtp_port);
- err = getaddrinfo(addr, num, &hints, &res0);
- if (err) {
- ortp_warning ("Error in socket address: %s", gai_strerror(err));
- return -1;
- }
-#endif
- if (session->rtp.socket == -1){
- /* the session has not its socket bound, do it */
- ortp_message ("Setting random local addresses.");
-#ifdef ORTP_INET6
- /* bind to an address type that matches the destination address */
- if (res0->ai_addr->sa_family==AF_INET6)
- err = rtp_session_set_local_addr (session, "::", -1);
- else err=rtp_session_set_local_addr (session, "0.0.0.0", -1);
-#else
- err = rtp_session_set_local_addr (session, "0.0.0.0", -1);
-#endif
- if (err<0) return -1;
- }
-
-#ifdef ORTP_INET6
- err=1;
- for (res = res0; res; res = res->ai_next) {
- /* set a destination address that has the same type as the local address */
- if (res->ai_family==session->rtp.sockfamily ) {
- memcpy( &session->rtp.rem_addr, res->ai_addr, res->ai_addrlen);
- session->rtp.rem_addrlen=res->ai_addrlen;
- err=0;
- break;
- }
- }
- freeaddrinfo(res0);
- if (err) {
- ortp_warning("Could not set destination for RTP socket to %s:%i.",addr,rtp_port);
- return -1;
- }
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- snprintf(num, sizeof(num), "%d", rtcp_port);
- err = getaddrinfo(addr, num, &hints, &res0);
- if (err) {
- ortp_warning ("Error: %s", gai_strerror(err));
- return err;
- }
- err=1;
- for (res = res0; res; res = res->ai_next) {
- /* set a destination address that has the same type as the local address */
- if (res->ai_family==session->rtp.sockfamily ) {
- err=0;
- memcpy( &session->rtcp.rem_addr, res->ai_addr, res->ai_addrlen);
- session->rtcp.rem_addrlen=res->ai_addrlen;
- break;
- }
- }
- freeaddrinfo(res0);
- if (err) {
- ortp_warning("Could not set destination for RCTP socket to %s:%i.",addr,rtcp_port);
- return -1;
- }
-#else
- session->rtp.rem_addrlen=sizeof(session->rtp.rem_addr);
- session->rtp.rem_addr.sin_family = AF_INET;
-
- err = inet_aton (addr, &session->rtp.rem_addr.sin_addr);
- if (err < 0)
- {
- ortp_warning ("Error in socket address:%s.", getSocketError());
- return err;
- }
- session->rtp.rem_addr.sin_port = htons (rtp_port);
-
- memcpy (&session->rtcp.rem_addr, &session->rtp.rem_addr,
- sizeof (struct sockaddr_in));
- session->rtcp.rem_addr.sin_port = htons (rtcp_port);
- session->rtcp.rem_addrlen=sizeof(session->rtcp.rem_addr);
-#endif
- if (can_connect(session)){
- if (try_connect(session->rtp.socket,(struct sockaddr*)&session->rtp.rem_addr,session->rtp.rem_addrlen))
- session->flags|=RTP_SOCKET_CONNECTED;
- if (session->rtcp.socket>=0){
- if (try_connect(session->rtcp.socket,(struct sockaddr*)&session->rtcp.rem_addr,session->rtcp.rem_addrlen))
- session->flags|=RTCP_SOCKET_CONNECTED;
- }
- }else if (session->flags & RTP_SOCKET_CONNECTED){
- /*must dissolve association done by connect().
- See connect(2) manpage*/
- struct sockaddr sa;
- sa.sa_family=AF_UNSPEC;
- if (connect(session->rtp.socket,&sa,sizeof(sa))<0){
- ortp_error("Cannot dissolve connect() association for rtp socket: %s", getSocketError());
- }
- if (connect(session->rtcp.socket,&sa,sizeof(sa))<0){
- ortp_error("Cannot dissolve connect() association for rtcp socket: %s", getSocketError());
- }
- session->flags&=~RTP_SOCKET_CONNECTED;
- session->flags&=~RTCP_SOCKET_CONNECTED;
- }
- return 0;
-}
-
-int
-rtp_session_set_remote_addr_and_port(RtpSession * session, const char * addr, int rtp_port, int rtcp_port){
- return rtp_session_set_remote_addr_full(session,addr,rtp_port,rtcp_port);
-}
-
-void rtp_session_set_sockets(RtpSession *session, int rtpfd, int rtcpfd)
-{
- if (rtpfd>=0) set_non_blocking_socket(rtpfd);
- if (rtcpfd>=0) set_non_blocking_socket(rtcpfd);
- session->rtp.socket=rtpfd;
- session->rtcp.socket=rtcpfd;
- if (rtpfd>=0 || rtcpfd>=0 )
- session->flags|=(RTP_SESSION_USING_EXT_SOCKETS|RTP_SOCKET_CONNECTED|RTCP_SOCKET_CONNECTED);
- else session->flags&=~(RTP_SESSION_USING_EXT_SOCKETS|RTP_SOCKET_CONNECTED|RTCP_SOCKET_CONNECTED);
-}
-
-void rtp_session_set_transports(RtpSession *session, struct _RtpTransport *rtptr, struct _RtpTransport *rtcptr)
-{
- session->rtp.tr = rtptr;
- session->rtcp.tr = rtcptr;
- if (rtptr)
- rtptr->session=session;
- if (rtcptr)
- rtcptr->session=session;
-
- if (rtptr || rtcptr )
- session->flags|=(RTP_SESSION_USING_TRANSPORT);
- else session->flags&=~(RTP_SESSION_USING_TRANSPORT);
-}
-
-
-
-/**
- *rtp_session_flush_sockets:
- *@session: a rtp session
- *
- * Flushes the sockets for all pending incoming packets.
- * This can be usefull if you did not listen to the stream for a while
- * and wishes to start to receive again. During the time no receive is made
- * packets get bufferised into the internal kernel socket structure.
- *
-**/
-void rtp_session_flush_sockets(RtpSession *session){
- unsigned char trash[4096];
-#ifdef ORTP_INET6
- struct sockaddr_storage from;
-#else
- struct sockaddr from;
-#endif
- socklen_t fromlen=sizeof(from);
- if (rtp_session_using_transport(session, rtp))
- {
- mblk_t *trashmp=esballoc(trash,sizeof(trash),0,NULL);
-
- while (session->rtp.tr->t_recvfrom(session->rtp.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
-
- if (session->rtcp.tr)
- while (session->rtcp.tr->t_recvfrom(session->rtcp.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
- freemsg(trashmp);
- return;
- }
-
- if (session->rtp.socket>=0){
- while (recvfrom(session->rtp.socket,(char*)trash,sizeof(trash),0,(struct sockaddr *)&from,&fromlen)>0){};
- }
- if (session->rtcp.socket>=0){
- while (recvfrom(session->rtcp.socket,(char*)trash,sizeof(trash),0,(struct sockaddr*)&from,&fromlen)>0){};
- }
-}
-
-
-#ifdef USE_SENDMSG
-#define MAX_IOV 30
-static int rtp_sendmsg(int sock,mblk_t *m, struct sockaddr *rem_addr, int addr_len){
- int error;
- struct msghdr msg;
- struct iovec iov[MAX_IOV];
- int iovlen;
- for(iovlen=0; iovlen<MAX_IOV && m!=NULL; m=m->b_cont,iovlen++){
- iov[iovlen].iov_base=m->b_rptr;
- iov[iovlen].iov_len=m->b_wptr-m->b_rptr;
- }
- if (iovlen==MAX_IOV){
- ortp_error("Too long msgb, didn't fit into iov, end discarded.");
- }
- msg.msg_name=(void*)rem_addr;
- msg.msg_namelen=addr_len;
- msg.msg_iov=&iov[0];
- msg.msg_iovlen=iovlen;
- msg.msg_control=NULL;
- msg.msg_controllen=0;
- msg.msg_flags=0;
- error=sendmsg(sock,&msg,0);
- return error;
-}
-#endif
-
-#define IP_UDP_OVERHEAD (20+8)
-
-static void update_sent_bytes(RtpSession*s, int nbytes){
- if (s->rtp.sent_bytes==0){
- gettimeofday(&s->rtp.send_bw_start,NULL);
- }
- s->rtp.sent_bytes+=nbytes+IP_UDP_OVERHEAD;
-}
-
-static void update_recv_bytes(RtpSession*s, int nbytes){
- if (s->rtp.recv_bytes==0){
- gettimeofday(&s->rtp.recv_bw_start,NULL);
- }
- s->rtp.recv_bytes+=nbytes+IP_UDP_OVERHEAD;
-}
-
-int
-rtp_session_rtp_send (RtpSession * session, mblk_t * m)
-{
- int error;
- int i;
- rtp_header_t *hdr;
- struct sockaddr *destaddr=(struct sockaddr*)&session->rtp.rem_addr;
- socklen_t destlen=session->rtp.rem_addrlen;
- ortp_socket_t sockfd=session->rtp.socket;
-
- hdr = (rtp_header_t *) m->b_rptr;
- /* perform host to network conversions */
- hdr->ssrc = htonl (hdr->ssrc);
- hdr->timestamp = htonl (hdr->timestamp);
- hdr->seq_number = htons (hdr->seq_number);
- for (i = 0; i < hdr->cc; i++)
- hdr->csrc[i] = htonl (hdr->csrc[i]);
-
- if (session->flags & RTP_SOCKET_CONNECTED) {
- destaddr=NULL;
- destlen=0;
- }
-
- if (rtp_session_using_transport(session, rtp)){
- error = (session->rtp.tr->t_sendto) (session->rtp.tr,m,0,destaddr,destlen);
- }else{
-#ifdef USE_SENDMSG
- error=rtp_sendmsg(sockfd,m,destaddr,destlen);
-#else
- if (m->b_cont!=NULL)
- msgpullup(m,-1);
- error = sendto (sockfd, (char*)m->b_rptr, (int) (m->b_wptr - m->b_rptr),
- 0,destaddr,destlen);
-#endif
- }
- if (error < 0){
- if (session->on_network_error.count>0){
- rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTP packet",INT_TO_POINTER(getSocketErrorCode()));
- }else ortp_warning ("Error sending rtp packet: %s ; socket=%i", getSocketError(), sockfd);
- session->rtp.send_errno=getSocketErrorCode();
- }else{
- update_sent_bytes(session,error);
- }
- freemsg (m);
- return error;
-}
-
-int
-rtp_session_rtcp_send (RtpSession * session, mblk_t * m)
-{
- int error=0;
- ortp_socket_t sockfd=session->rtcp.socket;
- struct sockaddr *destaddr=(struct sockaddr*)&session->rtcp.rem_addr;
- socklen_t destlen=session->rtcp.rem_addrlen;
- bool_t using_connected_socket=(session->flags & RTCP_SOCKET_CONNECTED)!=0;
-
- if (using_connected_socket) {
- destaddr=NULL;
- destlen=0;
- }
-
- if (session->rtcp.enabled &&
- ( (sockfd>=0 && (session->rtcp.rem_addrlen>0 ||using_connected_socket))
- || rtp_session_using_transport(session, rtcp) ) ){
- if (rtp_session_using_transport(session, rtcp)){
- error = (session->rtcp.tr->t_sendto) (session->rtcp.tr, m, 0,
- destaddr, destlen);
- }
- else{
-#ifdef USE_SENDMSG
- error=rtp_sendmsg(sockfd,m,destaddr, destlen);
-#else
- if (m->b_cont!=NULL){
- msgpullup(m,-1);
- }
- error = sendto (sockfd, (char*)m->b_rptr,
- (int) (m->b_wptr - m->b_rptr), 0,
- destaddr, destlen);
-#endif
- }
- if (error < 0){
- char host[65];
- if (session->on_network_error.count>0){
- rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTCP packet",INT_TO_POINTER(getSocketErrorCode()));
- }else ortp_warning ("Error sending rtcp packet: %s ; socket=%i; addr=%s", getSocketError(), session->rtcp.socket, ortp_inet_ntoa((struct sockaddr*)&session->rtcp.rem_addr,session->rtcp.rem_addrlen,host,sizeof(host)) );
- }
- }else ortp_message("Not sending rtcp report: sockfd=%i, rem_addrlen=%i, connected=%i",sockfd,session->rtcp.rem_addrlen,using_connected_socket);
- freemsg (m);
- return error;
-}
-
-int
-rtp_session_rtp_recv (RtpSession * session, uint32_t user_ts)
-{
- int error;
- ortp_socket_t sockfd=session->rtp.socket;
-#ifdef ORTP_INET6
- struct sockaddr_storage remaddr;
-#else
- struct sockaddr remaddr;
-#endif
- socklen_t addrlen = sizeof (remaddr);
- mblk_t *mp;
-
- if ((sockfd<0) && !rtp_session_using_transport(session, rtp)) return -1; /*session has no sockets for the moment*/
-
- while (1)
- {
- int bufsz;
- bool_t sock_connected=!!(session->flags & RTP_SOCKET_CONNECTED);
-
- if (session->rtp.cached_mp==NULL)
- session->rtp.cached_mp = msgb_allocator_alloc(&session->allocator,session->recv_buf_size);
- mp=session->rtp.cached_mp;
- bufsz=(int) (mp->b_datap->db_lim - mp->b_datap->db_base);
- if (sock_connected){
- error=recv(sockfd,(char*)mp->b_wptr,bufsz,0);
- }else if (rtp_session_using_transport(session, rtp))
- error = (session->rtp.tr->t_recvfrom)(session->rtp.tr, mp, 0,
- (struct sockaddr *) &remaddr,
- &addrlen);
- else error = recvfrom(sockfd, (char*)mp->b_wptr,
- bufsz, 0,
- (struct sockaddr *) &remaddr,
- &addrlen);
- if (error > 0){
- if (session->symmetric_rtp && !sock_connected){
- if (session->use_connect){
- /* store the sender rtp address to do symmetric RTP */
- memcpy(&session->rtp.rem_addr,&remaddr,addrlen);
- session->rtp.rem_addrlen=addrlen;
- if (try_connect(sockfd,(struct sockaddr*)&remaddr,addrlen))
- session->flags|=RTP_SOCKET_CONNECTED;
- }
- }
- /* then parse the message and put on queue */
- mp->b_wptr+=error;
- rtp_session_rtp_parse (session, mp, user_ts, (struct sockaddr*)&remaddr,addrlen);
- session->rtp.cached_mp=NULL;
- /*for bandwidth measurements:*/
- update_recv_bytes(session,error);
- }
- else
- {
- int errnum=getSocketErrorCode();
- if (error == 0){
- /*0 can be returned by RtpTransport functions in case of EWOULDBLOCK*/
- /*we ignore it*/
- /*ortp_warning
- ("rtp_recv: strange... recv() returned zero.");*/
- }
- else if (!is_would_block_error(errnum))
- {
- if (session->on_network_error.count>0){
- rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTP packet",INT_TO_POINTER(getSocketErrorCode()));
- }else ortp_warning("Error receiving RTP packet: %s.",getSocketError());
- }
- /* don't free the cached_mp, it will be reused next time */
- return -1; /* avoids an infinite loop ! */
- }
- }
- return error;
-}
-
-void rtp_session_notify_inc_rtcp(RtpSession *session, mblk_t *m){
- if (session->eventqs!=NULL){
- OrtpEvent *ev=ortp_event_new(ORTP_EVENT_RTCP_PACKET_RECEIVED);
- OrtpEventData *d=ortp_event_get_data(ev);
- d->packet=m;
- rtp_session_dispatch_event(session,ev);
- }
- else freemsg(m); /* avoid memory leak */
-}
-
-int
-rtp_session_rtcp_recv (RtpSession * session)
-{
- int error;
-#ifdef ORTP_INET6
- struct sockaddr_storage remaddr;
-#else
- struct sockaddr remaddr;
-#endif
- socklen_t addrlen=0;
- mblk_t *mp;
-
- if (session->rtcp.socket<0 && !rtp_session_using_transport(session, rtcp)) return -1; /*session has no rtcp sockets for the moment*/
-
-
- while (1)
- {
- bool_t sock_connected=!!(session->flags & RTCP_SOCKET_CONNECTED);
- if (session->rtcp.cached_mp==NULL)
- session->rtcp.cached_mp = allocb (RTCP_MAX_RECV_BUFSIZE, 0);
-
- mp=session->rtcp.cached_mp;
- if (sock_connected){
- error=recv(session->rtcp.socket,(char*)mp->b_wptr,RTCP_MAX_RECV_BUFSIZE,0);
- }else {
- addrlen=sizeof (remaddr);
-
- if (rtp_session_using_transport(session, rtcp))
- error=(session->rtcp.tr->t_recvfrom)(session->rtcp.tr, mp, 0,
- (struct sockaddr *) &remaddr,
- &addrlen);
- else
- error=recvfrom (session->rtcp.socket,(char*) mp->b_wptr,
- RTCP_MAX_RECV_BUFSIZE, 0,
- (struct sockaddr *) &remaddr,
- &addrlen);
- }
- if (error > 0)
- {
- mp->b_wptr += error;
- /* post an event to notify the application*/
- {
- rtp_session_notify_inc_rtcp(session,mp);
- }
- session->rtcp.cached_mp=NULL;
- if (session->symmetric_rtp && !sock_connected){
- /* store the sender rtp address to do symmetric RTP */
- memcpy(&session->rtcp.rem_addr,&remaddr,addrlen);
- session->rtcp.rem_addrlen=addrlen;
- if (session->use_connect){
- if (try_connect(session->rtcp.socket,(struct sockaddr*)&remaddr,addrlen))
- session->flags|=RTCP_SOCKET_CONNECTED;
- }
- }
- }
- else
- {
- int errnum=getSocketErrorCode();
-
- if (error == 0)
- {
- ortp_warning
- ("rtcp_recv: strange... recv() returned zero.");
- }
- else if (!is_would_block_error(errnum))
- {
- if (session->on_network_error.count>0){
- rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTCP packet",INT_TO_POINTER(errnum));
- }else ortp_warning("Error receiving RTCP packet: %s.",getSocketError());
- session->rtp.recv_errno=errnum;
- }
- /* don't free the cached_mp, it will be reused next time */
- return -1; /* avoids an infinite loop ! */
- }
- }
- return error;
-}
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef rtpsession_priv_h
-#define rtpsession_priv_h
-
-#include "ortp/rtpsession.h"
-
-typedef enum {
- RTP_SESSION_RECV_SYNC=1, /* the rtp session is synchronising in the incoming stream */
- RTP_SESSION_FIRST_PACKET_DELIVERED=1<<1,
- RTP_SESSION_SCHEDULED=1<<2,/* the scheduler controls this session*/
- RTP_SESSION_BLOCKING_MODE=1<<3, /* in blocking mode */
- RTP_SESSION_RECV_NOT_STARTED=1<<4, /* the application has not started to try to recv */
- RTP_SESSION_SEND_NOT_STARTED=1<<5, /* the application has not started to send something */
- RTP_SESSION_IN_SCHEDULER=1<<6, /* the rtp session is in the scheduler list */
- RTP_SESSION_USING_EXT_SOCKETS=1<<7, /* the session is using externaly supplied sockets */
- RTP_SOCKET_CONNECTED=1<<8,
- RTCP_SOCKET_CONNECTED=1<<9,
- RTP_SESSION_USING_TRANSPORT=1<<10
-}RtpSessionFlags;
-
-#define rtp_session_using_transport(s, stream) (((s)->flags & RTP_SESSION_USING_TRANSPORT) && (s->stream.tr != 0))
-
-void rtp_session_update_payload_type(RtpSession * session, int pt);
-void rtp_putq(queue_t *q, mblk_t *mp);
-mblk_t * rtp_getq(queue_t *q, uint32_t ts, int *rejected);
-int rtp_session_rtp_recv(RtpSession * session, uint32_t ts);
-int rtp_session_rtcp_recv(RtpSession * session);
-int rtp_session_rtp_send (RtpSession * session, mblk_t * m);
-int rtp_session_rtcp_send (RtpSession * session, mblk_t * m);
-
-void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_ts, struct sockaddr *addr, socklen_t addrlen);
-void rtp_session_rtcp_parse(RtpSession *session, mblk_t *mp);
-
-void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev);
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-
-#include <ortp/rtpsession.h>
-#include "utils.h"
-
-
-void rtp_signal_table_init(RtpSignalTable *table,RtpSession *session, const char *signal_name)
-{
- memset(table,0,sizeof(RtpSignalTable));
- table->session=session;
- table->signal_name=signal_name;
- session->signal_tables=o_list_append(session->signal_tables,(void*)table);
-}
-
-int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, unsigned long user_data)
-{
- int i;
-
- for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
- if (table->callback[i]==NULL){
- table->callback[i]=cb;
- table->user_data[i]=user_data;
- table->count++;
- return 0;
- }
- }
- return -1;
-}
-
-void rtp_signal_table_emit(RtpSignalTable *table)
-{
- int i,c;
-
- for (i=0,c=0;c<table->count;i++){
- if (table->callback[i]!=NULL){
- c++; /*I like it*/
- table->callback[i](table->session,table->user_data[i]);
- }
- }
-}
-
-void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
-{
- int i,c;
-
- for (i=0,c=0;c<table->count;i++){
- if (table->callback[i]!=NULL){
- c++; /*I like it*/
- table->callback[i](table->session,arg,table->user_data[i]);
- }
- }
-}
-
-void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
-{
- int i,c;
-
- for (i=0,c=0;c<table->count;i++){
- if (table->callback[i]!=NULL){
- c++; /*I like it*/
- table->callback[i](table->session,arg1,arg2,table->user_data[i]);
- }
- }
-}
-
-int rtp_signal_table_remove_by_callback(RtpSignalTable *table,RtpCallback cb)
-{
- int i;
-
- for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
- if (table->callback[i]==cb){
- table->callback[i]=NULL;
- table->user_data[i]=0;
- table->count--;
- return 0;
- }
- }
- return -1;
-}
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/ortp.h"
-#include "rtptimer.h"
-
-void rtp_timer_set_interval(RtpTimer *timer, struct timeval *interval)
-{
- if (timer->state==RTP_TIMER_RUNNING){
- ortp_warning("Cannot change timer interval while it is running.\n");
- return;
- }
- timer->interval.tv_sec=interval->tv_sec;
- timer->interval.tv_usec=interval->tv_usec;
-}
-
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef RTPTIMER_H
-#define RTPTIMER_H
-
-#if !defined(_WIN32) && !defined(_WIN32_WCE)
-#include <sys/time.h>
-#else
-#include <time.h>
-#include "winsock2.h"
-#endif
-
-#include <ortp/port.h>
-
-
-typedef void (*RtpTimerFunc)(void);
-
-struct _RtpTimer
-{
- int state;
-#define RTP_TIMER_RUNNING 1
-#define RTP_TIMER_STOPPED 0
- RtpTimerFunc timer_init;
- RtpTimerFunc timer_do;
- RtpTimerFunc timer_uninit;
- struct timeval interval;
-};
-
-typedef struct _RtpTimer RtpTimer;
-
-void rtp_timer_set_interval(RtpTimer *timer, struct timeval *interval);
-
-extern RtpTimer posix_timer;
-
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include "utils.h"
-#include "scheduler.h"
-#include "rtpsession_priv.h"
-
-// To avoid warning during compile
-extern void rtp_session_process (RtpSession * session, uint32_t time, RtpScheduler *sched);
-
-
-void rtp_scheduler_init(RtpScheduler *sched)
-{
- sched->list=0;
- sched->time_=0;
- /* default to the posix timer */
- rtp_scheduler_set_timer(sched,&posix_timer);
- ortp_mutex_init(&sched->lock,NULL);
- ortp_cond_init(&sched->unblock_select_cond,NULL);
- sched->max_sessions=sizeof(SessionSet)*8;
- session_set_init(&sched->all_sessions);
- sched->all_max=0;
- session_set_init(&sched->r_sessions);
- sched->r_max=0;
- session_set_init(&sched->w_sessions);
- sched->w_max=0;
- session_set_init(&sched->e_sessions);
- sched->e_max=0;
-}
-
-RtpScheduler * rtp_scheduler_new()
-{
- RtpScheduler *sched=(RtpScheduler *) ortp_malloc(sizeof(RtpScheduler));
- memset(sched,0,sizeof(RtpScheduler));
- rtp_scheduler_init(sched);
- return sched;
-}
-
-void rtp_scheduler_set_timer(RtpScheduler *sched,RtpTimer *timer)
-{
- if (sched->thread_running){
- ortp_warning("Cannot change timer while the scheduler is running !!");
- return;
- }
- sched->timer=timer;
- /* report the timer increment */
- sched->timer_inc=(timer->interval.tv_usec/1000) + (timer->interval.tv_sec*1000);
-}
-
-void rtp_scheduler_start(RtpScheduler *sched)
-{
- if (sched->thread_running==0){
- sched->thread_running=1;
- ortp_mutex_lock(&sched->lock);
- ortp_thread_create(&sched->thread, NULL, rtp_scheduler_schedule,(void*)sched);
- ortp_cond_wait(&sched->unblock_select_cond,&sched->lock);
- ortp_mutex_unlock(&sched->lock);
- }
- else ortp_warning("Scheduler thread already running.");
-
-}
-void rtp_scheduler_stop(RtpScheduler *sched)
-{
- if (sched->thread_running==1)
- {
- sched->thread_running=0;
- ortp_thread_join(sched->thread, NULL);
- }
- else ortp_warning("Scheduler thread is not running.");
-}
-
-void rtp_scheduler_destroy(RtpScheduler *sched)
-{
- if (sched->thread_running) rtp_scheduler_stop(sched);
- ortp_mutex_destroy(&sched->lock);
- //g_mutex_free(sched->unblock_select_mutex);
- ortp_cond_destroy(&sched->unblock_select_cond);
- ortp_free(sched);
-}
-
-void * rtp_scheduler_schedule(void * psched)
-{
- RtpScheduler *sched=(RtpScheduler*) psched;
- RtpTimer *timer=sched->timer;
- RtpSession *current;
-
- /* take this lock to prevent the thread to start until g_thread_create() returns
- because we need sched->thread to be initialized */
- ortp_mutex_lock(&sched->lock);
- ortp_cond_signal(&sched->unblock_select_cond); /* unblock the starting thread */
- ortp_mutex_unlock(&sched->lock);
- timer->timer_init();
- while(sched->thread_running)
- {
- /* do the processing here: */
- ortp_mutex_lock(&sched->lock);
-
- current=sched->list;
- /* processing all scheduled rtp sessions */
- while (current!=NULL)
- {
- ortp_debug("scheduler: processing session=0x%x.\n",current);
- rtp_session_process(current,sched->time_,sched);
- current=current->next;
- }
- /* wake up all the threads that are sleeping in _select() */
- ortp_cond_broadcast(&sched->unblock_select_cond);
- ortp_mutex_unlock(&sched->lock);
-
- /* now while the scheduler is going to sleep, the other threads can compute their
- result mask and see if they have to leave, or to wait for next tick*/
- //ortp_message("scheduler: sleeping.");
- timer->timer_do();
- sched->time_+=sched->timer_inc;
- }
- /* when leaving the thread, stop the timer */
- timer->timer_uninit();
- return NULL;
-}
-
-void rtp_scheduler_add_session(RtpScheduler *sched, RtpSession *session)
-{
- RtpSession *oldfirst;
- int i;
- if (session->flags & RTP_SESSION_IN_SCHEDULER){
- /* the rtp session is already scheduled, so return silently */
- return;
- }
- rtp_scheduler_lock(sched);
- /* enqueue the session to the list of scheduled sessions */
- oldfirst=sched->list;
- sched->list=session;
- session->next=oldfirst;
- if (sched->max_sessions==0){
- ortp_error("rtp_scheduler_add_session: max_session=0 !");
- }
- /* find a free pos in the session mask*/
- for (i=0;i<sched->max_sessions;i++){
- if (!ORTP_FD_ISSET(i,&sched->all_sessions.rtpset)){
- session->mask_pos=i;
- session_set_set(&sched->all_sessions,session);
- /* make a new session scheduled not blockable if it has not started*/
- if (session->flags & RTP_SESSION_RECV_NOT_STARTED)
- session_set_set(&sched->r_sessions,session);
- if (session->flags & RTP_SESSION_SEND_NOT_STARTED)
- session_set_set(&sched->w_sessions,session);
- if (i>sched->all_max){
- sched->all_max=i;
- }
- break;
- }
- }
-
- rtp_session_set_flag(session,RTP_SESSION_IN_SCHEDULER);
- rtp_scheduler_unlock(sched);
-}
-
-void rtp_scheduler_remove_session(RtpScheduler *sched, RtpSession *session)
-{
- RtpSession *tmp;
- int cond=1;
- return_if_fail(session!=NULL);
- if (!(session->flags & RTP_SESSION_IN_SCHEDULER)){
- /* the rtp session is not scheduled, so return silently */
- return;
- }
-
- rtp_scheduler_lock(sched);
- tmp=sched->list;
- if (tmp==session){
- sched->list=tmp->next;
- rtp_session_unset_flag(session,RTP_SESSION_IN_SCHEDULER);
- session_set_clr(&sched->all_sessions,session);
- rtp_scheduler_unlock(sched);
- return;
- }
- /* go the position of session in the list */
- while(cond){
- if (tmp!=NULL){
- if (tmp->next==session){
- tmp->next=tmp->next->next;
- cond=0;
- }
- else tmp=tmp->next;
- }else {
- /* the session was not found ! */
- ortp_warning("rtp_scheduler_remove_session: the session was not found in the scheduler list!");
- cond=0;
- }
- }
- rtp_session_unset_flag(session,RTP_SESSION_IN_SCHEDULER);
- /* delete the bit in the mask */
- session_set_clr(&sched->all_sessions,session);
- rtp_scheduler_unlock(sched);
-}
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef SCHEDULER_H
-#define SCHEDULER_H
-
-#include "ortp/rtpsession.h"
-#include "ortp/sessionset.h"
-#include "rtptimer.h"
-
-
-struct _RtpScheduler {
-
- RtpSession *list; /* list of scheduled sessions*/
- SessionSet all_sessions; /* mask of scheduled sessions */
- int all_max; /* the highest pos in the all mask */
- SessionSet r_sessions; /* mask of sessions that have a recv event */
- int r_max;
- SessionSet w_sessions; /* mask of sessions that have a send event */
- int w_max;
- SessionSet e_sessions; /* mask of session that have error event */
- int e_max;
- int max_sessions; /* the number of position in the masks */
- /* GMutex *unblock_select_mutex; */
- ortp_cond_t unblock_select_cond;
- ortp_mutex_t lock;
- ortp_thread_t thread;
- int thread_running;
- struct _RtpTimer *timer;
- uint32_t time_; /*number of miliseconds elapsed since the start of the thread */
- uint32_t timer_inc; /* the timer increment in milisec */
-};
-
-typedef struct _RtpScheduler RtpScheduler;
-
-RtpScheduler * rtp_scheduler_new(void);
-void rtp_scheduler_set_timer(RtpScheduler *sched,RtpTimer *timer);
-void rtp_scheduler_start(RtpScheduler *sched);
-void rtp_scheduler_stop(RtpScheduler *sched);
-void rtp_scheduler_destroy(RtpScheduler *sched);
-
-void rtp_scheduler_add_session(RtpScheduler *sched, RtpSession *session);
-void rtp_scheduler_remove_session(RtpScheduler *sched, RtpSession *session);
-
-void * rtp_scheduler_schedule(void * sched);
-
-#define rtp_scheduler_lock(sched) ortp_mutex_lock(&(sched)->lock)
-#define rtp_scheduler_unlock(sched) ortp_mutex_unlock(&(sched)->lock)
-
-/* void rtp_scheduler_add_set(RtpScheduler *sched, SessionSet *set); */
-
-RtpScheduler * ortp_get_scheduler(void);
-#endif
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include <ortp/sessionset.h>
-#include "scheduler.h"
-
-
-/**
- * Allocates and initialize a new empty session set.
- *
- * @return the empty session set.
-**/
-SessionSet * session_set_new()
-{
- SessionSet *set=(SessionSet *) ortp_malloc(sizeof(SessionSet));
- session_set_init(set);
- return set;
-}
-
-
-/**
- * Destroys a session set.
- *
-**/
-
-void session_set_destroy(SessionSet *set)
-{
- ortp_free(set);
-}
-
-int session_set_and(SessionSet *sched_set, int maxs, SessionSet *user_set, SessionSet *result_set)
-{
- uint32_t *mask1,*mask2,*mask3;
- int i=0;
- int j,ret=0;
- mask1=(uint32_t*)(void*)&sched_set->rtpset;
- mask2=(uint32_t*)(void*)&user_set->rtpset;
- mask3=(uint32_t*)(void*)&result_set->rtpset;
- while(i<maxs+1){
- *mask3=(*mask1) & (*mask2); /* computes the AND between the two masks*/
- /* and unset the sessions that have been found from the sched_set */
- *mask1=(*mask1) & (~(*mask3));
- if ((*mask3)!=0){
- for (j=0;j<32;j++){
- if ( ((*mask3)>>j) & 1){
- ret++;
- }
- }
- }
- i+=32;
- mask1++;
- mask2++;
- mask3++;
- }
- //printf("session_set_and: ret=%i\n",ret);
- return ret;
-}
-
-/**
- * This function performs similarly as libc select() function, but performs on #RtpSession
- * instead of file descriptors.
- * session_set_select() suspends the calling process until some events arrive on one of the
- * three sets passed in argument. Two of the sets can be NULL.
- * The first set @recvs is interpreted as a set of RtpSession waiting for receive events:
- * a new buffer (perhaps empty) is availlable on one or more sessions of the set, or the last
- * receive operation with rtp_session_recv_with_ts() would have finished if it were in
- * blocking mode.
- * The second set is interpreted as a set of RtpSession waiting for send events, i.e. the last
- * rtp_session_send_with_ts() call on a session would have finished if it were in blocking mode.
- *
- * When some events arrived on some of sets, then the function returns and sets are changed
- * to indicate the sessions where events happened.
- * Sessions can be added to sets using session_set_set(), a session has to be tested to be
- * part of a set using session_set_is_set().
- *
- * @param recvs a set of rtp sessions to be watched for read events
- * @param sends a set of rtp sessions to be watched for write events
- * @param errors a set of rtp sessions to be watched for errors
- * @return: the number of sessions on which the selected events happened.
-**/
-int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors)
-{
- int ret=0,bits;
- SessionSet temp;
- RtpScheduler *sched=ortp_get_scheduler();
-
- /*lock the scheduler to not read the masks while they are being modified by the scheduler*/
- rtp_scheduler_lock(sched);
-
- while(1){
- /* computes the SessionSet intersection (in the other words mask intersection) between
- the mask given by the user and scheduler masks */
- if (recvs!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->r_sessions,sched->all_max,recvs,&temp);
- ret+=bits;
- /* copy the result set in the given user set (might be empty) */
- if (ret>0) session_set_copy(recvs,&temp);
- }
- if (sends!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->w_sessions,sched->all_max,sends,&temp);
- ret+=bits;
- if (ret>0){
- /* copy the result set in the given user set (might be empty)*/
- session_set_copy(sends,&temp);
- }
- }
- if (errors!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->e_sessions,sched->all_max,errors,&temp);
- ret+=bits;
- if (ret>0){
- /* copy the result set in the given user set */
- session_set_copy(errors,&temp);
- }
- }
- if (ret>0){
- /* there are set file descriptors, return immediately */
- //printf("There are %i sessions set, returning.\n",ret);
- rtp_scheduler_unlock(sched);
- return ret;
- }
- //printf("There are %i sessions set.\n",ret);
- /* else we wait until the next loop of the scheduler*/
- ortp_cond_wait(&sched->unblock_select_cond,&sched->lock);
- }
-
- return -1;
-}
-
-int session_set_timedselect(SessionSet *recvs, SessionSet *sends, SessionSet *errors, struct timeval *timeout)
-{
- int ret=0,bits;
- int remainingTime; // duration in ms
- SessionSet temp;
- RtpScheduler *sched;
- if (timeout==NULL)
- return session_set_select(recvs, sends, errors);
- sched=ortp_get_scheduler();
- remainingTime = timeout->tv_usec/1000 + timeout->tv_sec*1000;
-
- /*lock the scheduler to not read the masks while they are being modified by the scheduler*/
- rtp_scheduler_lock(sched);
-
- do {
- /* computes the SessionSet intersection (in the other words mask intersection) between
- the mask given by the user and scheduler masks */
- if (recvs!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->r_sessions,sched->all_max,recvs,&temp);
- ret+=bits;
- /* copy the result set in the given user set (might be empty) */
- if (ret>0) session_set_copy(recvs,&temp);
- }
- if (sends!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->w_sessions,sched->all_max,sends,&temp);
- ret+=bits;
- if (ret>0){
- /* copy the result set in the given user set (might be empty)*/
- session_set_copy(sends,&temp);
- }
- }
- if (errors!=NULL){
- session_set_init(&temp);
- bits=session_set_and(&sched->e_sessions,sched->all_max,errors,&temp);
- ret+=bits;
- if (ret>0){
- /* copy the result set in the given user set */
- session_set_copy(errors,&temp);
- }
- }
- if (ret>0){
- /* there are set file descriptors, return immediately */
- //printf("There are %i sessions set, returning.\n",ret);
- rtp_scheduler_unlock(sched);
- return ret;
- }
- //printf("There are %i sessions set.\n",ret);
- /* else we wait until the next loop of the scheduler*/
- ortp_cond_wait(&sched->unblock_select_cond,&sched->lock);
- remainingTime -= sched->timer_inc;
- } while (remainingTime>0);
-
- return -1;
-}
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#if defined(_MSC_VER) && (defined(WIN32) || defined(_WIN32_WCE))
-#include "ortp-config-win32.h"
-#else
-#include "ortp-config.h"
-#endif
-#include "ortp/ortp.h"
-
-#ifdef HAVE_SRTP
-
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-
-#include "ortp/srtp.h"
-
-#define SRTP_PAD_BYTES 64 /*?? */
-
-static int srtp_sendto(RtpTransport *t, mblk_t *m, int flags, const struct sockaddr *to, socklen_t tolen){
- srtp_t srtp=(srtp_t)t->data;
- int slen;
- err_status_t err;
- /* enlarge the buffer for srtp to write its data */
- msgpullup(m,msgdsize(m)+SRTP_PAD_BYTES);
- slen=m->b_wptr-m->b_rptr;
- err=srtp_protect(srtp,m->b_rptr,&slen);
- if (err==err_status_ok){
- return sendto(t->session->rtp.socket,m->b_rptr,slen,flags,to,tolen);
- }
- ortp_error("srtp_protect() failed");
- return -1;
-}
-
-static int srtp_recvfrom(RtpTransport *t, mblk_t *m, int flags, struct sockaddr *from, socklen_t *fromlen){
- srtp_t srtp=(srtp_t)t->data;
- int err;
- int slen;
- err=recvfrom(t->session->rtp.socket,m->b_wptr,m->b_datap->db_lim-m->b_datap->db_base,flags,from,fromlen);
- if (err>0){
-
- /* keep NON-RTP data unencrypted */
- rtp_header_t *rtp;
- if (err>=RTP_FIXED_HEADER_SIZE)
- {
- rtp = (rtp_header_t*)m->b_wptr;
- if (rtp->version!=2)
- {
- return err;
- }
- }
-
- slen=err;
- if (srtp_unprotect(srtp,m->b_wptr,&slen)==err_status_ok)
- return slen;
- else {
- ortp_error("srtp_unprotect() failed");
- return -1;
- }
- }
- return err;
-}
-
-static int srtcp_sendto(RtpTransport *t, mblk_t *m, int flags, const struct sockaddr *to, socklen_t tolen){
- srtp_t srtp=(srtp_t)t->data;
- int slen;
- /* enlarge the buffer for srtp to write its data */
- msgpullup(m,msgdsize(m)+SRTP_PAD_BYTES);
- slen=m->b_wptr-m->b_rptr;
- if (srtp_protect_rtcp(srtp,m->b_rptr,&slen)==err_status_ok){
- return sendto(t->session->rtcp.socket,m->b_rptr,slen,flags,to,tolen);
- }
- ortp_error("srtp_protect_rtcp() failed");
- return -1;
-}
-
-static int srtcp_recvfrom(RtpTransport *t, mblk_t *m, int flags, struct sockaddr *from, socklen_t *fromlen){
- srtp_t srtp=(srtp_t)t->data;
- int err;
- int slen;
- err=recvfrom(t->session->rtcp.socket,m->b_wptr,m->b_datap->db_lim-m->b_datap->db_base,flags,from,fromlen);
- if (err>0){
- slen=err;
- if (srtp_unprotect_rtcp(srtp,m->b_wptr,&slen)==err_status_ok)
- return slen;
- else {
- ortp_error("srtp_unprotect_rtcp() failed");
- return -1;
- }
- }
- return err;
-}
-
-ortp_socket_t
-srtp_getsocket(RtpTransport *t)
-{
- return t->session->rtp.socket;
-}
-
-ortp_socket_t
-srtcp_getsocket(RtpTransport *t)
-{
- return t->session->rtcp.socket;
-}
-
-/**
- * Creates a pair of Secure-RTP/Secure-RTCP RtpTransport's.
- * oRTP relies on libsrtp (see http://srtp.sf.net ) for secure RTP encryption.
- * This function creates a RtpTransport object to be used to the RtpSession using
- * rtp_session_set_transport().
- * @srtp: the srtp_t session to be used
- *
-**/
-int srtp_transport_new(srtp_t srtp, RtpTransport **rtpt, RtpTransport **rtcpt ){
- if (rtpt) {
- (*rtpt)=ortp_new(RtpTransport,1);
- (*rtpt)->data=srtp;
- (*rtpt)->t_getsocket=srtp_getsocket;
- (*rtpt)->t_sendto=srtp_sendto;
- (*rtpt)->t_recvfrom=srtp_recvfrom;
- }
- if (rtcpt) {
- (*rtcpt)=ortp_new(RtpTransport,1);
- (*rtcpt)->data=srtp;
- (*rtcpt)->t_getsocket=srtcp_getsocket;
- (*rtcpt)->t_sendto=srtcp_sendto;
- (*rtcpt)->t_recvfrom=srtcp_recvfrom;
- }
- return 0;
-}
-
-err_status_t ortp_srtp_init(void)
-{
- return srtp_init();
-}
-
-err_status_t ortp_srtp_create(srtp_t *session, const srtp_policy_t *policy)
-{
- int i;
- i = srtp_create(session, policy);
- return i;
-}
-
-err_status_t ortp_srtp_dealloc(srtp_t session)
-{
- return srtp_dealloc(session);
-}
-
-err_status_t ortp_srtp_add_stream(srtp_t session, const srtp_policy_t *policy)
-{
- return srtp_add_stream(session, policy);
-}
-
-bool_t ortp_srtp_supported(void){
- return TRUE;
-}
-
-#else
-
-int srtp_transport_new(void *i, RtpTransport **rtpt, RtpTransport **rtcpt ){
- ortp_error("srtp_transport_new: oRTP has not been compiled with SRTP support.");
- return -1;
-}
-
-bool_t ortp_srtp_supported(void){
- return FALSE;
-}
-
-int ortp_srtp_create(void *i, const void *policy)
-{
- return -1;
-}
-
-int ortp_srtp_dealloc(void *session)
-{
- return -1;
-}
-
-int ortp_srtp_add_stream(void *session, const void *policy)
-{
- return -1;
-}
-
-#endif
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/ortp.h"
-#include "ortp/rtp.h"
-#include "ortp/str_utils.h"
-#include "utils.h"
-
-void qinit(queue_t *q){
- mblk_init(&q->_q_stopper);
- q->_q_stopper.b_next=&q->_q_stopper;
- q->_q_stopper.b_prev=&q->_q_stopper;
- q->q_mcount=0;
-}
-
-void mblk_init(mblk_t *mp)
-{
- mp->b_cont=mp->b_prev=mp->b_next=NULL;
- mp->b_rptr=mp->b_wptr=NULL;
- mp->reserved1=0;
- mp->reserved2=0;
-}
-
-dblk_t *datab_alloc(int size){
- dblk_t *db;
- int total_size=sizeof(dblk_t)+size;
- db=(dblk_t *) ortp_malloc(total_size);
- db->db_base=(uint8_t*)db+sizeof(dblk_t);
- db->db_lim=db->db_base+size;
- db->db_ref=1;
- db->db_freefn=NULL; /* the buffer pointed by db_base must never be freed !*/
- return db;
-}
-
-static inline void datab_ref(dblk_t *d){
- d->db_ref++;
-}
-
-static inline void datab_unref(dblk_t *d){
- d->db_ref--;
- if (d->db_ref==0){
- if (d->db_freefn!=NULL)
- d->db_freefn(d->db_base);
- ortp_free(d);
- }
-}
-
-
-mblk_t *allocb(int size, int pri)
-{
- mblk_t *mp;
- dblk_t *datab;
-
- mp=(mblk_t *) ortp_malloc(sizeof(mblk_t));
- mblk_init(mp);
- datab=datab_alloc(size);
-
- mp->b_datap=datab;
- mp->b_rptr=mp->b_wptr=datab->db_base;
- mp->b_next=mp->b_prev=mp->b_cont=NULL;
- return mp;
-}
-
-mblk_t *esballoc(uint8_t *buf, int size, int pri, void (*freefn)(void*) )
-{
- mblk_t *mp;
- dblk_t *datab;
-
- mp=(mblk_t *) ortp_malloc(sizeof(mblk_t));
- mblk_init(mp);
- datab=(dblk_t *) ortp_malloc(sizeof(dblk_t));
-
-
- datab->db_base=buf;
- datab->db_lim=buf+size;
- datab->db_ref=1;
- datab->db_freefn=freefn;
-
- mp->b_datap=datab;
- mp->b_rptr=mp->b_wptr=buf;
- mp->b_next=mp->b_prev=mp->b_cont=NULL;
- return mp;
-}
-
-
-void freeb(mblk_t *mp)
-{
- return_if_fail(mp->b_datap!=NULL);
- return_if_fail(mp->b_datap->db_base!=NULL);
-
- datab_unref(mp->b_datap);
- ortp_free(mp);
-}
-
-void freemsg(mblk_t *mp)
-{
- mblk_t *tmp1,*tmp2;
- tmp1=mp;
- while(tmp1!=NULL)
- {
- tmp2=tmp1->b_cont;
- freeb(tmp1);
- tmp1=tmp2;
- }
-}
-
-mblk_t *dupb(mblk_t *mp)
-{
- mblk_t *newm;
- return_val_if_fail(mp->b_datap!=NULL,NULL);
- return_val_if_fail(mp->b_datap->db_base!=NULL,NULL);
-
- datab_ref(mp->b_datap);
- newm=(mblk_t *) ortp_malloc(sizeof(mblk_t));
- mblk_init(newm);
- newm->reserved1=mp->reserved1;
- newm->reserved2=mp->reserved2;
- newm->b_datap=mp->b_datap;
- newm->b_rptr=mp->b_rptr;
- newm->b_wptr=mp->b_wptr;
- return newm;
-}
-
-/* duplicates a complex mblk_t */
-mblk_t *dupmsg(mblk_t* m)
-{
- mblk_t *newm=NULL,*mp,*prev;
- prev=newm=dupb(m);
- m=m->b_cont;
- while (m!=NULL){
- mp=dupb(m);
- prev->b_cont=mp;
- prev=mp;
- m=m->b_cont;
- }
- return newm;
-}
-
-void putq(queue_t *q,mblk_t *mp)
-{
- q->_q_stopper.b_prev->b_next=mp;
- mp->b_prev=q->_q_stopper.b_prev;
- mp->b_next=&q->_q_stopper;
- q->_q_stopper.b_prev=mp;
- q->q_mcount++;
-}
-
-mblk_t *getq(queue_t *q)
-{
- mblk_t *tmp;
- tmp=q->_q_stopper.b_next;
- if (tmp==&q->_q_stopper) return NULL;
- q->_q_stopper.b_next=tmp->b_next;
- tmp->b_next->b_prev=&q->_q_stopper;
- tmp->b_prev=NULL;
- tmp->b_next=NULL;
- q->q_mcount--;
- return tmp;
-}
-
-mblk_t * peekq(queue_t *q){
- mblk_t *tmp;
- tmp=q->_q_stopper.b_next;
- if (tmp==&q->_q_stopper) return NULL;
- return tmp;
-}
-
-/* insert mp in q just before emp */
-void insq(queue_t *q,mblk_t *emp, mblk_t *mp)
-{
- if (emp==NULL){
- putq(q,mp);
- return;
- }
- q->q_mcount++;
- emp->b_prev->b_next=mp;
- mp->b_prev=emp->b_prev;
- emp->b_prev=mp;
- mp->b_next=emp;
-}
-
-void remq(queue_t *q, mblk_t *mp){
- q->q_mcount--;
- mp->b_prev->b_next=mp->b_next;
- mp->b_next->b_prev=mp->b_prev;
- mp->b_next=NULL;
- mp->b_prev=NULL;
-}
-
-/* remove and free all messages in the q */
-void flushq(queue_t *q, int how)
-{
- mblk_t *mp;
-
- while ((mp=getq(q))!=NULL)
- {
- freemsg(mp);
- }
-}
-
-int msgdsize(const mblk_t *mp)
-{
- int msgsize=0;
- while(mp!=NULL){
- msgsize+=(int) (mp->b_wptr-mp->b_rptr);
- mp=mp->b_cont;
- }
- return msgsize;
-}
-
-void msgpullup(mblk_t *mp,int len)
-{
- mblk_t *firstm=mp;
- dblk_t *db;
- int wlen=0;
-
- if (mp->b_cont==NULL && len==-1) return; /*nothing to do, message is not fragmented */
-
- if (len==-1) len=msgdsize(mp);
- db=datab_alloc(len);
- while(wlen<len && mp!=NULL){
- int remain=len-wlen;
- int mlen=mp->b_wptr-mp->b_rptr;
- if (mlen<=remain){
- memcpy(&db->db_base[wlen],mp->b_rptr,mlen);
- wlen+=mlen;
- mp=mp->b_cont;
- }else{
- memcpy(&db->db_base[wlen],mp->b_rptr,remain);
- wlen+=remain;
- }
- }
- /*set firstm to point to the new datab */
- freemsg(firstm->b_cont);
- firstm->b_cont=NULL;
- datab_unref(firstm->b_datap);
- firstm->b_datap=db;
- firstm->b_rptr=db->db_base;
- firstm->b_wptr=firstm->b_rptr+wlen;
-}
-
-
-mblk_t *copyb(mblk_t *mp)
-{
- mblk_t *newm;
- int len=(int) (mp->b_wptr-mp->b_rptr);
- newm=allocb(len,BPRI_MED);
- memcpy(newm->b_wptr,mp->b_rptr,len);
- newm->b_wptr+=len;
- return newm;
-}
-
-mblk_t *copymsg(mblk_t *mp)
-{
- mblk_t *newm=0,*m;
- m=newm=copyb(mp);
- mp=mp->b_cont;
- while(mp!=NULL){
- m->b_cont=copyb(mp);
- m=m->b_cont;
- mp=mp->b_cont;
- }
- return newm;
-}
-
-mblk_t * appendb(mblk_t *mp, const char *data, int size, bool_t pad){
- int padcnt=0;
- int i;
- if (pad){
- padcnt= (int)(4L-( (long)(((long)mp->b_wptr)+size) % 4L)) % 4L;
- }
- if ((mp->b_wptr + size +padcnt) > mp->b_datap->db_lim){
- /* buffer is not large enough: append a new block (with the same size ?)*/
- int plen=(int)((char*)mp->b_datap->db_lim - (char*) mp->b_datap->db_base);
- mp->b_cont=allocb(MAX(plen,size),0);
- mp=mp->b_cont;
- }
- if (size) memcpy(mp->b_wptr,data,size);
- mp->b_wptr+=size;
- for (i=0;i<padcnt;i++){
- mp->b_wptr[0]=0;
- mp->b_wptr++;
- }
- return mp;
-}
-
-void msgappend(mblk_t *mp, const char *data, int size, bool_t pad){
- while(mp->b_cont!=NULL) mp=mp->b_cont;
- appendb(mp,data,size,pad);
-}
-
-mblk_t *concatb(mblk_t *mp, mblk_t *newm){
- while (mp->b_cont!=NULL) mp=mp->b_cont;
- mp->b_cont=newm;
- while(newm->b_cont!=NULL) newm=newm->b_cont;
- return newm;
-}
-
-void msgb_allocator_init(msgb_allocator_t *a){
- qinit(&a->q);
-}
-
-mblk_t *msgb_allocator_alloc(msgb_allocator_t *a, int size){
- queue_t *q=&a->q;
- mblk_t *m,*found=NULL;
-
- /*lookup for an unused msgb (data block with ref count ==1)*/
- for(m=qbegin(q);!qend(q,m);m=qnext(q,m)){
- if (m->b_datap->db_ref==1 && m->b_datap->db_lim-m->b_datap->db_base>=size){
- found=m;
- break;
- }
- }
- if (found==NULL){
- found=allocb(size,0);
- putq(q,found);
- }
- return dupb(found);
-}
-
-void msgb_allocator_uninit(msgb_allocator_t *a){
- flushq(&a->q,-1);
-}
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* ====================================================================
- * The Vovida Software License, Version 1.0
- *
- * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The names "VOCAL", "Vovida Open Communication Application Library",
- * and "Vovida Open Communication Application Library (VOCAL)" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact vocal@vovida.org.
- *
- * 4. Products derived from this software may not be called "VOCAL", nor
- * may "VOCAL" appear in their name, without prior written
- * permission of Vovida Networks, Inc.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
- * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
- * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
- * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * ====================================================================
- *
- * This software consists of voluntary contributions made by Vovida
- * Networks, Inc. and many individuals on behalf of Vovida Networks,
- * Inc. For more information on Vovida Networks, Inc., please see
- * <http://www.vovida.org/>.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "ortp-config.h"
-#endif
-
-#ifndef _WIN32_WCE
-#include <errno.h>
-#endif
-
-#include <assert.h>
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#include <winsock2.h>
-#include <stdlib.h>
-/* #include <io.h> */
-#include <time.h>
-#include <ctype.h> /*for isdigit() */
-#else
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include <net/if.h>
-
-#endif
-
-
-#if !defined(HAVE_OPENSSL_HMAC_H) || !defined(HAVE_OPENSSL_MD5_H)
-#define NOSSL 1
-#endif
-
-#include "ortp/stun_udp.h"
-#include "ortp/stun.h"
-#include "ortp/ortp.h"
-
-static char *ipaddr(const StunAddress4 *addr)
-{
- static char tmp[512];
- struct in_addr inaddr;
- char *atmp;
- inaddr.s_addr = htonl(addr->addr);
- atmp = (char *)inet_ntoa(inaddr);
-
- snprintf(tmp, 512, "%s:%i", atmp, addr->port);
- return tmp;
-}
-
-static bool_t
-stunParseAtrAddress( char* body, unsigned int hdrLen, StunAtrAddress4 *result )
-{
- if ( hdrLen != 8 )
- {
- ortp_error("stun: hdrLen wrong for Address\n");
- return FALSE;
- }
- result->pad = *body++;
- result->family = *body++;
- if (result->family == IPv4Family)
- {
- uint16_t nport;
- uint32_t naddr;
- memcpy(&nport, body, 2); body+=2;
- result->ipv4.port = ntohs(nport);
-
- memcpy(&naddr, body, 4); body+=4;
- result->ipv4.addr = ntohl(naddr);
- return TRUE;
- }
- else if (result->family == IPv6Family)
- {
- ortp_error("stun: ipv6 not supported\n");
- }
- else
- {
- ortp_error("stun: bad address family: %i\n", result->family);
- }
-
- return FALSE;
-}
-
-static bool_t
-stunParseAtrChangeRequest( char* body, unsigned int hdrLen, StunAtrChangeRequest *result )
-{
- if ( hdrLen != 4 )
- {
- /* ortp_error("stun: hdr length = %i expecting %i\n",hdrLen, sizeof(result)); */
-
- ortp_error("stun: Incorrect size for SA_CHANGEREQUEST");
- return FALSE;
- }
- else
- {
- memcpy(&result->value, body, 4);
- result->value = ntohl(result->value);
- return TRUE;
- }
-}
-
-static bool_t
-stunParseAtrError( char* body, unsigned int hdrLen, StunAtrError *result )
-{
- if ( hdrLen < 4 || hdrLen >= 128+4)
- {
- ortp_error("stun: Incorrect size for SA_ERRORCODE");
- return FALSE;
- }
- else
- {
- memcpy(&result->pad, body, 2); body+=2;
- result->pad = ntohs(result->pad);
- result->errorClass = *body++;
- result->number = *body++;
-
- result->sizeReason = hdrLen - 4;
- memcpy(&result->reason, body, result->sizeReason);
- result->reason[result->sizeReason] = 0;
- return TRUE;
- }
-}
-
-static bool_t
-stunParseAtrUnknown( char* body, unsigned int hdrLen, StunAtrUnknown *result )
-{
- if ( hdrLen >= sizeof(result) )
- {
- ortp_error("stun: Incorrect size for SA_UNKNOWNATTRIBUTE");
- return FALSE;
- }
- else
- {
- int i;
- if (hdrLen % 4 != 0) return FALSE;
- result->numAttributes = hdrLen / 4;
- for (i=0; i<result->numAttributes; i++)
- {
- memcpy(&result->attrType[i], body, 2); body+=2;
- result->attrType[i] = ntohs(result->attrType[i]);
- }
- return TRUE;
- }
-}
-
-static bool_t
-stunParseAtrString( char* body, unsigned int hdrLen, StunAtrString *result )
-{
- if ( hdrLen >= STUN_MAX_STRING )
- {
- ortp_error("stun: String is too large");
- return FALSE;
- }
- else
- {
- result->sizeValue = hdrLen;
- memcpy(&result->value, body, hdrLen);
- result->value[hdrLen] = 0;
- return TRUE;
- }
-}
-
-
-static bool_t
-stunParseAtrIntegrity( char* body, unsigned int hdrLen, StunAtrIntegrity *result )
-{
- if ( hdrLen != 20)
- {
- ortp_error("stun: SA_MESSAGEINTEGRITY must be 20 bytes");
- return FALSE;
- }
- else
- {
- memcpy(&result->hash, body, hdrLen);
- return TRUE;
- }
-}
-
-static bool_t
-turnParseAtrChannelNumber( char* body, unsigned int hdrLen, TurnAtrChannelNumber *result )
-{
- if ( hdrLen >= sizeof(result) )
- {
- ortp_error("stun: Incorrect size for TA_CHANNELNUMBER");
- return FALSE;
- }
- else
- {
- if (hdrLen % 4 != 0) return FALSE;
- memcpy(&result->channelNumber, body, 2);
- body+=2;
- result->channelNumber = ntohs(result->channelNumber);
- memcpy(&result->rffu, body, 2);
- body+=2;
- result->rffu = ntohs(result->rffu);
- return TRUE;
- }
-}
-
-static bool_t
-turnParseAtrLifetime( char* body, unsigned int hdrLen, TurnAtrLifetime *result )
-{
- if ( hdrLen != sizeof(result) )
- {
- ortp_error("stun: Incorrect size for TA_LIFETIME");
- return FALSE;
- }
- else
- {
- memcpy(&result->lifetime, body, 4);
- result->lifetime = ntohl(result->lifetime);
- return TRUE;
- }
-}
-
-static bool_t
-turnParseAtrData( char* body, unsigned int hdrLen, TurnAtrData *result )
-{
- if ( hdrLen >= 1500 )
- {
- ortp_error("stun: Incorrect size for TA_DATA");
- return FALSE;
- }
- else
- {
- result->sizeValue = hdrLen;
- memcpy(&result->value, body, hdrLen);
- result->value[hdrLen] = 0;
- return TRUE;
- }
-}
-
-static bool_t
-turnParseAtrRequestedTransport( char* body, unsigned int hdrLen, TurnAtrRequestedTransport *result )
-{
- if ( hdrLen != 4 )
- {
- ortp_error("stun: Incorrect size for TA_REQUESTEDTRANSPORT");
- return FALSE;
- }
- result->proto = *body++;
- result->pad1 = *body++;
- result->pad2 = *body++;
- result->pad3 = *body++;
- return TRUE;
-}
-
-#if defined(htonq)
-#elif defined(ORTP_BIGENDIAN)
-#define htonq(n) n
-#define ntohq(n) n
-#else /* little endian */
-static inline uint64_t
-htonq (uint64_t v)
-{
- return htonl ((uint32_t) (v >> 32))
- | (uint64_t) htonl ((uint32_t) v) << 32;
-}
-static inline uint64_t
-ntohq (uint64_t v)
-{
- return ntohl ((uint32_t) (v >> 32))
- | (uint64_t) ntohl ((uint32_t) v) << 32;
-}
-#endif /* little endian */
-
-static bool_t
-turnParseAtrReservationToken( char* body, unsigned int hdrLen, TurnAtrReservationToken *result )
-{
- if ( hdrLen != 8 )
- {
- ortp_error("stun: Incorrect size for TA_RESERVATIONTOKEN");
- return FALSE;
- }
- memcpy(&result->value, body, 8);
- result->value = ntohq(result->value);
- return TRUE;
-}
-
-static bool_t
-stunParseAtrFingerprint( char* body, unsigned int hdrLen, StunAtrFingerprint *result )
-{
- if ( hdrLen != 4 )
- {
- ortp_error("stun: Incorrect size for SA_FINGERPRINT");
- return FALSE;
- }
-
- memcpy(&result->fingerprint, body, 4);
- result->fingerprint = ntohl(result->fingerprint);
- return TRUE;
-}
-
-static bool_t
-iceParseAtrPriority( char* body, unsigned int hdrLen, IceAtrPriority *result )
-{
- if ( hdrLen != 4 )
- {
- ortp_error("stun: Incorrect size for ICEA_PRIORITY");
- return FALSE;
- }
-
- memcpy(&result->priority, body, 4);
- result->priority = ntohl(result->priority);
- return TRUE;
-}
-
-static bool_t
-iceParseAtrIceControll( char* body, unsigned int hdrLen, IceAtrIceControll *result )
-{
- if ( hdrLen != 8 )
- {
- ortp_error("stun: Incorrect size for ICEA_ICECONTROLLED/ICEA_ICECONTROLLING");
- return FALSE;
- }
- memcpy(&result->value, body, 8);
- result->value = ntohq(result->value);
- return TRUE;
-}
-
-bool_t
-stunParseMessage( char* buf, unsigned int bufLen, StunMessage *msg)
-{
- char* body;
- unsigned int size;
- ortp_debug("stun: Received stun message: %i bytes\n", bufLen);
- memset(msg, 0, sizeof(msg));
-
- if (sizeof(StunMsgHdr) > bufLen)
- {
- ortp_warning("stun: message too short\n");
- return FALSE;
- }
-
- memcpy(&msg->msgHdr, buf, sizeof(StunMsgHdr));
- msg->msgHdr.msgType = ntohs(msg->msgHdr.msgType);
- msg->msgHdr.msgLength = ntohs(msg->msgHdr.msgLength);
-
- if (msg->msgHdr.msgLength + sizeof(StunMsgHdr) != bufLen)
- {
- ortp_warning("stun: Message header length doesn't match message size: %i - %i\n", msg->msgHdr.msgLength, bufLen);
- return FALSE;
- }
-
- body = buf + sizeof(StunMsgHdr);
- size = msg->msgHdr.msgLength;
-
- /*ortp_message("stun: bytes after header = %i\n", size); */
-
- while ( size > 0 )
- {
- /* !jf! should check that there are enough bytes left in the buffer */
-
- StunAtrHdr* attr = (StunAtrHdr*)body; /*reinterpret_cast<StunAtrHdr*>(body);*/
-
- unsigned int attrLen = ntohs(attr->length);
- int atrType = ntohs(attr->type);
-
- if ( attrLen+4 > size )
- {
- ortp_error("stun: claims attribute is larger than size of message (attribute type=%i)\n", atrType);
- return FALSE;
- }
-
- body += 4; /* skip the length and type in attribute header */
- size -= 4;
-
- if (atrType == SA_MAPPEDADDRESS)
- {
- msg->hasMappedAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->mappedAddress )== FALSE )
- {
- ortp_error("stun: problem parsing SA_MAPPEDADDRESS\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_MAPPEDADDRESS = %s\n", ipaddr(&msg->mappedAddress.ipv4));
- }
-
- }
- else if (atrType == SA_RESPONSEADDRESS)
- {
- msg->hasResponseAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->responseAddress )== FALSE )
- {
- ortp_error("stun: problem parsing SA_RESPONSEADDRESS");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_RESPONSEADDRESS = %s\n", ipaddr(&msg->responseAddress.ipv4));
- }
- }
- else if (atrType == SA_CHANGEREQUEST)
- {
- msg->hasChangeRequest = TRUE;
- if (stunParseAtrChangeRequest( body, attrLen, &msg->changeRequest) == FALSE)
- {
- ortp_error("stun: problem parsing SA_CHANGEREQUEST\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_CHANGEREQUEST = %i\n", msg->changeRequest.value);
- }
- }
- else if (atrType == SA_SOURCEADDRESS)
- {
- msg->hasSourceAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->sourceAddress )== FALSE )
- {
- ortp_error("stun: problem parsing SA_SOURCEADDRESS\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_SOURCEADDRESS = %s\n", ipaddr(&msg->sourceAddress.ipv4) );
- }
- }
- else if (atrType == SA_CHANGEDADDRESS)
- {
- msg->hasChangedAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->changedAddress )== FALSE )
- {
- ortp_error("stun: problem parsing SA_CHANGEDADDRESS\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_CHANGEDADDRESS = %s\n", ipaddr(&msg->changedAddress.ipv4));
- }
- }
- else if (atrType == SA_USERNAME)
- {
- msg->hasUsername = TRUE;
- if (stunParseAtrString( body, attrLen, &msg->username) == FALSE)
- {
- ortp_error("stun: problem parsing SA_USERNAME");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_USERNAME = %s\n", msg->username.value );
- }
- }
- else if (atrType == SA_PASSWORD)
- {
- msg->hasPassword = TRUE;
- if (stunParseAtrString( body, attrLen, &msg->password) == FALSE)
- {
- ortp_error("stun: problem parsing SA_PASSWORD");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_PASSWORD = %s\n", msg->password.value );
- }
- }
- else if (atrType == SA_MESSAGEINTEGRITY)
- {
- msg->hasMessageIntegrity = TRUE;
- if (stunParseAtrIntegrity( body, attrLen, &msg->messageIntegrity) == FALSE)
- {
- ortp_error("stun: problem parsing SA_MESSAGEINTEGRITY");
- return FALSE;
- }
- }
- else if (atrType == SA_ERRORCODE)
- {
- msg->hasErrorCode = TRUE;
- if (stunParseAtrError(body, attrLen, &msg->errorCode) == FALSE)
- {
- ortp_error("stun: problem parsing SA_ERRORCODE");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_ERRORCODE = %i %i %s\n",
- msg->errorCode.errorClass ,
- msg->errorCode.number ,
- msg->errorCode.reason );
- }
-
- }
- else if (atrType == SA_UNKNOWNATTRIBUTE)
- {
- msg->hasUnknownAttributes = TRUE;
- if (stunParseAtrUnknown(body, attrLen, &msg->unknownAttributes) == FALSE)
- {
- ortp_error("stun: problem parsing SA_UNKNOWNATTRIBUTE");
- return FALSE;
- }
- }
- else if (atrType == SA_REFLECTEDFROM)
- {
- msg->hasReflectedFrom = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->reflectedFrom ) == FALSE )
- {
- ortp_error("stun: problem parsing SA_REFLECTEDFROM");
- return FALSE;
- }
- }
- else if (atrType == SA_REALM)
- {
- msg->hasRealm = TRUE;
- if (stunParseAtrString( body, attrLen, &msg->realmName) == FALSE)
- {
- ortp_error("stun: problem parsing SA_REALM");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_REALM = %s\n", msg->realmName.value );
- }
- }
- else if (atrType == SA_NONCE)
- {
- msg->hasNonce = TRUE;
- if (stunParseAtrString( body, attrLen, &msg->nonceName) == FALSE)
- {
- ortp_error("stun: problem parsing SA_NONCE");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_NONCE = %s\n", msg->nonceName.value );
- }
- }
- else if (atrType == SA_XORMAPPEDADDRESS || atrType == SA_XORMAPPEDADDRESS2)
- {
- msg->hasXorMappedAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->xorMappedAddress ) == FALSE )
- {
- ortp_error("stun: problem parsing SA_XORMAPPEDADDRESS");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_XORMAPPEDADDRESS = %s\n", ipaddr(&msg->xorMappedAddress.ipv4) );
- }
- }
- else if (atrType == SA_XORONLY)
- {
- ortp_warning("stun: SA_XORONLY - non standard extension ignored\n" );
- }
- else if (atrType == SA_SECONDARYADDRESS)
- {
- ortp_debug("stun: SA_SECONDARYADDRESS - non standard extension ignored\n" );
- }
- else if (atrType == SA_SOFTWARE)
- {
- msg->hasSoftware = TRUE;
- if (stunParseAtrString( body, attrLen, &msg->softwareName) == FALSE)
- {
- ortp_error("stun: problem parsing SA_SOFTWARE");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_SOFTWARE = %s\n", msg->softwareName.value );
- }
- }
- else if (atrType == TA_CHANNELNUMBER)
- {
- msg->hasChannelNumberAttributes = TRUE;
- if (turnParseAtrChannelNumber(body, attrLen, &msg->channelNumberAttributes) == FALSE)
- {
- ortp_error("stun: problem parsing TA_CHANNELNUMBER");
- return FALSE;
- }
- }
- else if (atrType == TA_LIFETIME)
- {
- msg->hasLifetimeAttributes = TRUE;
- if (turnParseAtrLifetime(body, attrLen, &msg->lifetimeAttributes) == FALSE)
- {
- ortp_error("stun: problem parsing TA_LIFETIME");
- return FALSE;
- }
- }
- else if (atrType == TA_DEPRECATEDBANDWIDTH)
- {
- ortp_warning("stun: deprecated attribute TA_DEPRECATEDBANDWIDTH");
- }
- else if (atrType == TA_XORPEERADDRESS)
- {
- msg->hasXorPeerAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->xorPeerAddress )== FALSE )
- {
- ortp_error("stun: problem parsing SA_XORPEERADDRESS\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: SA_XORPEERADDRESS = %s\n", ipaddr(&msg->xorPeerAddress.ipv4));
- }
- }
- else if (atrType == TA_DATA)
- {
- msg->hasData = TRUE;
- if (turnParseAtrData( body, attrLen, &msg->data) == FALSE)
- {
- ortp_error("stun: problem parsing TA_DATA");
- return FALSE;
- }
- else
- {
- }
- }
- else if (atrType == TA_XORRELAYEDADDRESS)
- {
- msg->hasXorRelayedAddress = TRUE;
- if ( stunParseAtrAddress( body, attrLen, &msg->xorRelayedAddress )== FALSE )
- {
- ortp_error("stun: problem parsing TA_XORRELAYEDADDRESS\n");
- return FALSE;
- }
- else
- {
- ortp_debug("stun: TA_XORRELAYEDADDRESS = %s\n", ipaddr(&msg->xorRelayedAddress.ipv4));
- }
- }
- else if (atrType == TA_EVENPORT)
- {
- ortp_warning("stun: do we need this... TA_EVENPORT");
- }
- else if (atrType == TA_REQUESTEDTRANSPORT)
- {
- msg->hasRequestedTransport = TRUE;
- if ( turnParseAtrRequestedTransport( body, attrLen, &msg->requestedTransport )== FALSE )
- {
- ortp_error("stun: problem parsing TA_REQUESTEDTRANSPORT\n");
- return FALSE;
- }
- }
- else if (atrType == TA_DONTFRAGMENT)
- {
- msg->hasDontFragment = TRUE;
- }
- else if (atrType == TA_DEPRECATEDTIMERVAL)
- {
- ortp_warning("stun: deprecated attribute TA_DEPRECATEDTIMERVAL");
- }
- else if (atrType == TA_RESERVATIONTOKEN)
- {
- msg->hasReservationToken = TRUE;
- if ( turnParseAtrReservationToken( body, attrLen, &msg->reservationToken)== FALSE )
- {
- ortp_error("stun: problem parsing TA_RESERVATIONTOKEN\n");
- return FALSE;
- }
- }
- else if (atrType == SA_FINGERPRINT)
- {
- msg->hasFingerprint = TRUE;
- if ( stunParseAtrFingerprint( body, attrLen, &msg->fingerprint)== FALSE )
- {
- ortp_error("stun: problem parsing SA_FINGERPRINT\n");
- return FALSE;
- }
- }
- else if (atrType == ICEA_PRIORITY)
- {
- msg->hasPriority = TRUE;
- if (iceParseAtrPriority(body, attrLen, &msg->priority) == FALSE)
- {
- ortp_error("stun: problem parsing ICEA_PRIORITY");
- return FALSE;
- }
- }
- else if (atrType == ICEA_USECANDIDATE)
- {
- msg->hasUseCandidate = TRUE;
- }
- else if (atrType == ICEA_ICECONTROLLED)
- {
- msg->hasIceControlled = TRUE;
- if (iceParseAtrIceControll(body, attrLen, &msg->iceControlled) == FALSE)
- {
- ortp_error("stun: problem parsing ICEA_ICECONTROLLED");
- return FALSE;
- }
- }
- else if (atrType == ICEA_ICECONTROLLING)
- {
- msg->hasIceControlling = TRUE;
- if (iceParseAtrIceControll(body, attrLen, &msg->iceControlling) == FALSE)
- {
- ortp_error("stun: problem parsing ICEA_ICECONTROLLING");
- return FALSE;
- }
- }
- else
- {
- if ( atrType <= 0x7FFF )
- {
- ortp_error("stun: Unknown Comprehension-Required attribute: %04x\n", atrType );
- return FALSE;
- }
- else
- ortp_warning("stun: Unknown attribute: %04x\n", atrType );
- }
-
- if (attrLen%4>0)
- attrLen += (4-(attrLen%4));
-
- body += attrLen;
- size -= attrLen;
- }
-
- return TRUE;
-}
-
-
-static char*
-encode16(char* buf, uint16_t data)
-{
- uint16_t ndata = htons(data);
- memcpy(buf, &ndata, sizeof(uint16_t));
- return buf + sizeof(uint16_t);
-}
-
-static char*
-encode32(char* buf, uint32_t data)
-{
- uint32_t ndata = htonl(data);
- memcpy(buf, &ndata, sizeof(uint32_t));
- return buf + sizeof(uint32_t);
-}
-
-static char*
-encode64(char* buf, uint64_t data)
-{
- uint64_t ndata = htonq(data);
- memcpy(buf, &ndata, sizeof(uint64_t));
- return buf + sizeof(uint64_t);
-}
-
-static char*
-encode(char* buf, const char* data, unsigned int length)
-{
- memcpy(buf, data, length);
- return buf + length;
-}
-
-
-static char*
-encodeAtrAddress4(char* ptr, uint16_t type, const StunAtrAddress4 *atr)
-{
- ptr = encode16(ptr, type);
- ptr = encode16(ptr, 8);
- *ptr++ = atr->pad;
- *ptr++ = IPv4Family;
- ptr = encode16(ptr, atr->ipv4.port);
- ptr = encode32(ptr, atr->ipv4.addr);
-
- return ptr;
-}
-
-static char*
-encodeAtrChangeRequest(char* ptr, const StunAtrChangeRequest *atr)
-{
- ptr = encode16(ptr, SA_CHANGEREQUEST);
- ptr = encode16(ptr, 4);
- ptr = encode32(ptr, atr->value);
- return ptr;
-}
-
-static char*
-encodeAtrError(char* ptr, const StunAtrError *atr)
-{
- int padding;
- int i;
-
- ptr = encode16(ptr, SA_ERRORCODE);
- ptr = encode16(ptr, 4 + atr->sizeReason);
- ptr = encode16(ptr, atr->pad);
- *ptr++ = atr->errorClass;
- *ptr++ = atr->number;
- ptr = encode(ptr, atr->reason, atr->sizeReason);
-
- padding = (atr->sizeReason+4) % 4;
- if (padding>0)
- {
- for (i=0;i<4-padding;i++)
- {
- *ptr++ = 0;
- }
- }
- return ptr;
-}
-
-
-static char*
-encodeAtrUnknown(char* ptr, const StunAtrUnknown *atr)
-{
- int i;
- ptr = encode16(ptr, SA_UNKNOWNATTRIBUTE);
- ptr = encode16(ptr, 2+2*atr->numAttributes);
- for (i=0; i<atr->numAttributes; i++)
- {
- ptr = encode16(ptr, atr->attrType[i]);
- }
- return ptr;
-}
-
-static char*
-encodeAtrString(char* ptr, uint16_t type, const StunAtrString *atr)
-{
- int padding;
- int i;
-
- ptr = encode16(ptr, type);
- ptr = encode16(ptr, atr->sizeValue);
- ptr = encode(ptr, atr->value, atr->sizeValue);
-
- padding = atr->sizeValue % 4;
- if (padding>0)
- {
- for (i=0;i<4-padding;i++)
- {
- *ptr++ = 0;
- }
- }
- return ptr;
-}
-
-
-static char*
-encodeAtrIntegrity(char* ptr, const StunAtrIntegrity *atr)
-{
- ptr = encode16(ptr, SA_MESSAGEINTEGRITY);
- ptr = encode16(ptr, 20);
- ptr = encode(ptr, atr->hash, sizeof(atr->hash));
- return ptr;
-}
-
-static char*
-encodeAtrFingerprint(char* ptr, const StunAtrFingerprint *atr)
-{
- uint32_t val;
- ptr = encode16(ptr, SA_FINGERPRINT);
- ptr = encode16(ptr, 4);
-
- val = atr->fingerprint;
- val ^= 0x5354554E;
- ptr = encode32(ptr, val);
- return ptr;
-}
-
-static char*
-encodeAtrRequestedTransport(char* ptr, const TurnAtrRequestedTransport *atr)
-{
- ptr = encode16(ptr, TA_REQUESTEDTRANSPORT);
- ptr = encode16(ptr, 4);
- *ptr++ = atr->proto;
- *ptr++ = atr->pad1;
- *ptr++ = atr->pad2;
- *ptr++ = atr->pad3;
- return ptr;
-}
-
-static char*
-encodeAtrLifeTime(char* ptr, const TurnAtrLifetime *atr)
-{
- ptr = encode16(ptr, TA_LIFETIME);
- ptr = encode16(ptr, 4);
- ptr = encode32(ptr, atr->lifetime);
- return ptr;
-}
-
-static char*
-encodeAtrDontFragment(char* ptr)
-{
- ptr = encode16(ptr, TA_DONTFRAGMENT);
- ptr = encode16(ptr, 0);
- return ptr;
-}
-
-static char*
-encodeAtrUseCandidate(char* ptr)
-{
- ptr = encode16(ptr, ICEA_USECANDIDATE);
- ptr = encode16(ptr, 0);
- return ptr;
-}
-
-static char*
-encodeAtrPriority(char* ptr, const IceAtrPriority *atr)
-{
- ptr = encode16(ptr, ICEA_PRIORITY);
- ptr = encode16(ptr, 4);
- ptr = encode32(ptr, atr->priority);
- return ptr;
-}
-
-static char*
-encodeAtrIceControll(char* ptr, uint16_t type, const IceAtrIceControll *atr)
-{
- ptr = encode16(ptr, type);
- ptr = encode16(ptr, 8);
- ptr = encode64(ptr, atr->value);
- return ptr;
-}
-
-unsigned int
-stunEncodeMessage( const StunMessage *msg,
- char* buf,
- unsigned int bufLen,
- const StunAtrString *password)
-{
- char* ptr = buf;
- char* lengthp;
- ptr = encode16(ptr, msg->msgHdr.msgType);
- lengthp = ptr;
- ptr = encode16(ptr, 0);
- ptr = encode32(ptr, msg->msgHdr.magic_cookie);
- ptr = encode(ptr, (const char*)msg->msgHdr.tr_id.octet, sizeof(msg->msgHdr.tr_id));
-
- ortp_debug("stun: Encoding stun message: ");
-
- if (msg->hasRequestedTransport)
- {
- ortp_debug("stun: Encoding TA_REQUESTEDTRANSPORT: %i\n", msg->requestedTransport.proto );
- ptr = encodeAtrRequestedTransport (ptr, &msg->requestedTransport);
- }
- if (msg->hasLifetimeAttributes)
- {
- ortp_debug("stun: Encoding TA_LIFETIME: %i\n", msg->lifetimeAttributes.lifetime );
- ptr = encodeAtrLifeTime (ptr, &msg->lifetimeAttributes);
- }
- if (msg->hasDontFragment)
- {
- ortp_debug("stun: Encoding TA_DONTFRAGMENT: DF\n");
- ptr = encodeAtrDontFragment (ptr);
- }
- if (msg->hasMappedAddress)
- {
- ortp_debug("stun: Encoding SA_MAPPEDADDRESS: %s\n", ipaddr(&msg->mappedAddress.ipv4) );
- ptr = encodeAtrAddress4 (ptr, SA_MAPPEDADDRESS, &msg->mappedAddress);
- }
- if (msg->hasResponseAddress)
- {
- ortp_debug("stun: Encoding SA_RESPONSEADDRESS: %s\n", ipaddr(&msg->responseAddress.ipv4) );
- ptr = encodeAtrAddress4(ptr, SA_RESPONSEADDRESS, &msg->responseAddress);
- }
- if (msg->hasChangeRequest)
- {
- ortp_debug("stun: Encoding SA_CHANGEREQUEST: %i\n", msg->changeRequest.value );
- ptr = encodeAtrChangeRequest(ptr, &msg->changeRequest);
- }
- if (msg->hasSourceAddress)
- {
- ortp_debug("stun: Encoding SA_SOURCEADDRESS: %s\n", ipaddr(&msg->sourceAddress.ipv4) );
- ptr = encodeAtrAddress4(ptr, SA_SOURCEADDRESS, &msg->sourceAddress);
- }
- if (msg->hasChangedAddress)
- {
- ortp_debug("stun: Encoding SA_CHANGEDADDRESS: %s\n", ipaddr(&msg->changedAddress.ipv4) );
- ptr = encodeAtrAddress4(ptr, SA_CHANGEDADDRESS, &msg->changedAddress);
- }
- if (msg->hasUsername)
- {
- ortp_debug("stun: Encoding SA_USERNAME: %s\n", msg->username.value );
- ptr = encodeAtrString(ptr, SA_USERNAME, &msg->username);
- }
- //if (msg->hasPassword)
- //{
- // ortp_debug("stun: Encoding SA_PASSWORD: %s\n", msg->password.value );
- // ptr = encodeAtrString(ptr, SA_PASSWORD, &msg->password);
- //}
- if (msg->hasErrorCode)
- {
- ortp_debug("stun: Encoding SA_ERRORCODE: class=%i number=%i reason=%s\n"
- , msg->errorCode.errorClass
- , msg->errorCode.number
- , msg->errorCode.reason );
-
- ptr = encodeAtrError(ptr, &msg->errorCode);
- }
- if (msg->hasUnknownAttributes)
- {
- ortp_debug("stun: Encoding SA_UNKNOWNATTRIBUTE: ???");
- ptr = encodeAtrUnknown(ptr, &msg->unknownAttributes);
- }
- if (msg->hasReflectedFrom)
- {
- ortp_debug("stun: Encoding SA_REFLECTEDFROM: %s\n", ipaddr(&msg->reflectedFrom.ipv4) );
- ptr = encodeAtrAddress4(ptr, SA_REFLECTEDFROM, &msg->reflectedFrom);
- }
- if (msg->hasNonce)
- {
- ortp_debug("stun: Encoding SA_NONCE: %s\n", msg->nonceName.value );
- ptr = encodeAtrString(ptr, SA_NONCE, &msg->nonceName);
- }
- if (msg->hasRealm)
- {
- ortp_debug("stun: Encoding SA_REALM: %s\n", msg->realmName.value );
- ptr = encodeAtrString(ptr, SA_REALM, &msg->realmName);
- }
-
- if (msg->hasXorMappedAddress)
- {
- ortp_debug("stun: Encoding SA_XORMAPPEDADDRESS: %s\n", ipaddr(&msg->xorMappedAddress.ipv4) );
- ptr = encodeAtrAddress4 (ptr, SA_XORMAPPEDADDRESS, &msg->xorMappedAddress);
- }
-
- if (msg->hasPriority)
- {
- ortp_debug("stun: Encoding ICEA_PRIORITY\n");
- ptr = encodeAtrPriority (ptr, &msg->priority);
- }
- if (msg->hasUseCandidate)
- {
- ortp_debug("stun: Encoding ICEA_USECANDIDATE\n");
- ptr = encodeAtrUseCandidate (ptr);
- }
- if (msg->hasIceControlled)
- {
- ortp_debug("stun: Encoding ICEA_ICECONTROLLED\n");
- ptr = encodeAtrIceControll (ptr, ICEA_ICECONTROLLED, &msg->iceControlled);
- }
- if (msg->hasIceControlling)
- {
- ortp_debug("stun: Encoding ICEA_ICECONTROLLING\n");
- ptr = encodeAtrIceControll (ptr, ICEA_ICECONTROLLING, &msg->iceControlling);
- }
-
- if (msg->hasSoftware)
- {
- ortp_debug("stun: Encoding SA_SOFTWARE: %s\n", msg->softwareName.value );
- ptr = encodeAtrString(ptr, SA_SOFTWARE, &msg->softwareName);
- }
-
- if (msg->hasMessageIntegrity
- &&password!=NULL && password->sizeValue > 0
- &&msg->username.sizeValue>0
- &&msg->realmName.sizeValue>0)
- {
- StunAtrIntegrity integrity;
- //ortp_debug("stun: HMAC with password: %s\n", password->value );
-
- encode16(lengthp, (uint16_t)(ptr - buf - sizeof(StunMsgHdr)+24));
- stunCalculateIntegrity_longterm(integrity.hash, buf, (int)(ptr-buf) ,
- msg->username.value, msg->realmName.value, password->value);
- ptr = encodeAtrIntegrity(ptr, &integrity);
- }
- else if (msg->hasMessageIntegrity
- &&password!=NULL && password->sizeValue > 0
- &&msg->username.sizeValue>0)
- {
- StunAtrIntegrity integrity;
- //ortp_debug("stun: HMAC with password: %s\n", password->value );
-
- encode16(lengthp, (uint16_t)(ptr - buf - sizeof(StunMsgHdr)+24));
- stunCalculateIntegrity_shortterm(integrity.hash, buf, (int)(ptr-buf) ,
- password->value);
- ptr = encodeAtrIntegrity(ptr, &integrity);
- }
-
- if (msg->hasFingerprint)
- {
- StunAtrFingerprint fingerprint;
- //ortp_debug("stun: HMAC with password: %s\n", password->value );
-
- encode16(lengthp, (uint16_t)(ptr - buf - sizeof(StunMsgHdr)+8));
- fingerprint.fingerprint = stunCalculateFingerprint(buf, (int)(ptr-buf));
- ptr = encodeAtrFingerprint(ptr, &fingerprint);
- }
- encode16(lengthp, (uint16_t)(ptr - buf - sizeof(StunMsgHdr)));
- return (int)(ptr - buf);
-}
-
-int
-stunRand(void)
-{
- /* return 32 bits of random stuff */
- /* assert( sizeof(int) == 4 ); */
- static bool_t init=FALSE;
- if ( !init )
- {
- uint64_t tick;
- int seed;
- init = TRUE;
-
-#if defined(_WIN32_WCE)
- tick = GetTickCount ();
-#elif defined(_MSC_VER)
- {
- volatile unsigned int lowtick=0,hightick=0;
- __asm
- {
- rdtsc
- mov lowtick, eax
- mov hightick, edx
- }
- tick = hightick;
- tick <<= 32;
- tick |= lowtick;
- }
-#elif defined(__MACH__)
- {
- int fd=open("/dev/random",O_RDONLY);
- read(fd,&tick,sizeof(tick));
- closesocket(fd);
- }
-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
- asm("rdtsc" : "=A" (tick));
-#elif defined(__GNUC__) && defined(__amd64__)
- asm("rdtsc" : "=A" (tick));
-#elif defined (__SUNPRO_CC) && defined( __sparc__ )
- tick = gethrtime();
-#elif defined(__linux) || defined(HAVE_DEV_RANDOM)
- {
- fd_set fdSet;
- int maxFd=0;
- struct timeval tv;
- int e;
-
- int fd=open("/dev/random",O_RDONLY);
-
- if (fd<0)
- {
- ortp_message("stun: Failed to open random device\n");
- return random();
- }
- FD_ZERO(&fdSet);
- FD_SET(fd,&fdSet);
- maxFd=fd+1;
-
- tv.tv_sec = 0;
- tv.tv_usec = 500;
-
- e = select( maxFd, &fdSet, NULL,NULL, &tv );
- if (e <= 0)
- {
- ortp_error("stun: Failed to get data from random device\n");
- closesocket(fd);
- return random();
- }
- read(fd,&tick,sizeof(tick));
- closesocket(fd);
- }
-#else
-# error Need some way to seed the random number generator
-#endif
- seed = (int)(tick);
-#if defined(_WIN32) || defined(_WIN32_WCE)
- srand(seed);
-#else
- srandom(seed);
-#endif
- }
-
-#if defined(_WIN32) || defined(_WIN32_WCE)
- /* assert( RAND_MAX == 0x7fff ); */
- {
- int r1 = rand();
- int r2 = rand();
- int ret = (r1<<16) + r2;
-
- return ret;
- }
-#else
- return random();
-#endif
-}
-
-
-/* return a random number to use as a port */
-static int
-randomPort()
-{
- int min=0x4000;
- int max=0x7FFF;
-
- int ret = stunRand();
- ret = ret|min;
- ret = ret&max;
-
- return ret;
-}
-
-
-#ifdef NOSSL
-void
-stunCalculateIntegrity_longterm(char* hmac, const char* input, int length,
- const char *username, const char *realm, const char *password)
-{
- strncpy(hmac,"hmac-not-implemented",20);
-}
-void
-stunCalculateIntegrity_shortterm(char* hmac, const char* input, int length, const char* key)
-{
- strncpy(hmac,"hmac-not-implemented",20);
-}
-
-#else
-#include <openssl/hmac.h>
-#include <openssl/md5.h>
-
-void
-stunCalculateIntegrity_longterm(char* hmac, const char* input, int length,
- const char *username, const char *realm, const char *password)
-{
- unsigned int resultSize=0;
- unsigned char HA1[16];
- char HA1_text[1024];
-
- snprintf(HA1_text, sizeof(HA1_text), "%s:%s:%s", username, realm, password);
- MD5((unsigned char *)HA1_text, strlen(HA1_text), HA1);
-
- HMAC(EVP_sha1(),
- HA1, 16,
- (const unsigned char*) input, length,
- (unsigned char*)hmac, &resultSize);
-}
-
-void
-stunCalculateIntegrity_shortterm(char* hmac, const char* input, int length, const char* key)
-{
- unsigned int resultSize=0;
- HMAC(EVP_sha1(),
- key, strlen(key),
- (const unsigned char*) input, length,
- (unsigned char*)hmac, &resultSize);
-}
-
-#endif
-
-uint32_t
-stunCalculateFingerprint(const char* input, int length)
-{
- /*-
- 2 * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
- 3 * code or tables extracted from it, as desired without restriction.
- 4 */
- static uint32_t crc32_tab[] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
- };
- const uint8_t *p = (uint8_t*)input;
- uint32_t crc;
-
- crc = ~0U;
- while (length--)
- crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
- return crc ^ ~0U;
-}
-
-uint64_t
-stunGetSystemTimeSecs(void)
-{
- uint64_t time=0;
-#if defined(_WIN32) || defined(_WIN32_WCE)
- SYSTEMTIME t;
- /* CJ TODO - this probably has bug on wrap around every 24 hours */
- GetSystemTime( &t );
- time = (t.wHour*60+t.wMinute)*60+t.wSecond;
-#else
- struct timeval now;
- gettimeofday( &now , NULL );
- /* assert( now ); */
- time = now.tv_sec;
-#endif
- return time;
-}
-
-
-/* returns TRUE if it scucceeded */
-bool_t
-stunParseHostName( const char* peerName,
- uint32_t* ip,
- uint16_t* portVal,
- uint16_t defaultPort )
-{
- struct in_addr sin_addr;
-
- char host[512];
- char* port = NULL;
- int portNum = defaultPort;
- char* sep;
- struct hostent* h;
-
- strncpy(host,peerName,512);
- host[512-1]='\0';
-
- /* pull out the port part if present. */
- sep = strchr(host,':');
-
- if ( sep == NULL )
- {
- portNum = defaultPort;
- }
- else
- {
- char* endPtr=NULL;
- *sep = '\0';
- port = sep + 1;
- /* set port part */
-
-
- portNum = strtol(port,&endPtr,10);
-
- if ( endPtr != NULL )
- {
- if ( *endPtr != '\0' )
- {
- portNum = defaultPort;
- }
- }
- }
-
- if ( portNum < 1024 ) return FALSE;
- if ( portNum >= 0xFFFF ) return FALSE;
-
- /* figure out the host part */
-
-#if defined(_WIN32) || defined(_WIN32_WCE)
- /* assert( strlen(host) >= 1 ); */
- if ( isdigit( host[0] ) )
- {
- /* assume it is a ip address */
- unsigned long a = inet_addr(host);
- /* cerr << "a=0x" << hex << a << dec ); */
-
- *ip = ntohl( a );
- }
- else
- {
- /* assume it is a host name */
- h = gethostbyname( host );
-
- if ( h == NULL )
- {
- /*int err = getErrno();*/
-
- /* ortp_message("stun: error was %i\n", err); */
- /* std::cerr << "error was " << err << std::endl; */
- /* assert( err != WSANOTINITIALISED ); */
-
- *ip = ntohl( 0x7F000001L );
-
- return FALSE;
- }
- else
- {
- sin_addr = *(struct in_addr*)h->h_addr;
- *ip = ntohl( sin_addr.s_addr );
- }
- }
-
-#else
- h = gethostbyname( host );
- if ( h == NULL )
- {
- /*
- int err = getErrno();
- ortp_message("stun: error was %i\n", err);
- */
- *ip = ntohl( 0x7F000001L );
- return FALSE;
- }
- else
- {
- sin_addr = *(struct in_addr*)h->h_addr;
- *ip = ntohl( sin_addr.s_addr );
- }
-#endif
-
- *portVal = portNum;
-
- return TRUE;
-}
-
-
-bool_t
-stunParseServerName( const char* name, StunAddress4 *addr)
-{
- /* assert(name); */
-
- /* TODO - put in DNS SRV stuff. */
-
- bool_t ret = stunParseHostName( name, &addr->addr, &addr->port, 3478);
- if ( ret != TRUE )
- {
- addr->port=0xFFFF;
- }
- return ret;
-}
-
-
-static void
-stunCreateErrorResponse(StunMessage *response, int cl, int number, const char* msg)
-{
- response->msgHdr.msgType = (STUN_METHOD_BINDING | STUN_ERR_RESP);
- response->hasErrorCode = TRUE;
- response->errorCode.errorClass = cl;
- response->errorCode.number = number;
- strcpy(response->errorCode.reason, msg);
-}
-
-#if 0
-static void
-stunCreateSharedSecretErrorResponse(StunMessage& response, int cl, int number, const char* msg)
-{
- response.msgHdr.msgType = SharedSecretErrorResponseMsg;
- response.hasErrorCode = TRUE;
- response.errorCode.errorClass = cl;
- response.errorCode.number = number;
- strcpy(response.errorCode.reason, msg);
-}
-#endif
-
-#if 0
-static void
-stunCreateSharedSecretResponse(const StunMessage *request, const StunAddress4 *source, StunMessage *response)
-{
- response->msgHdr.msgType = SharedSecretResponseMsg;
- response->msgHdr.tr_id = request->msgHdr.tr_id;
-
- response->hasUsername = TRUE;
- stunCreateUserName( source, &response->username);
-
- response->hasPassword = TRUE;
- stunCreatePassword( &response->username, &response->password);
-}
-#endif
-
-/* This funtion takes a single message sent to a stun server, parses
- and constructs an apropriate repsonse - returns TRUE if message is
- valid */
-bool_t
-stunServerProcessMsg( char* buf,
- unsigned int bufLen,
- StunAddress4 *from,
- StunAddress4 *myAddr,
- StunAddress4 *altAddr,
- StunMessage *resp,
- StunAddress4 *destination,
- StunAtrString *hmacPassword,
- bool_t* changePort,
- bool_t* changeIp)
-{
- int i;
- StunMessage req;
- StunAddress4 mapped;
- StunAddress4 respondTo;
- uint32_t flags;
- bool_t ok;
- /* set up information for default response */
-
- memset( &req, 0 , sizeof(req) );
- memset( resp, 0 , sizeof(*resp) );
-
- *changeIp = FALSE;
- *changePort = FALSE;
-
- ok = stunParseMessage( buf,bufLen, &req);
-
- if (!ok) /* Complete garbage, drop it on the floor */
- {
- ortp_error("stun: Request did not parse");
- return FALSE;
- }
- //ortp_debug("stun: Request parsed ok");
-
- mapped = req.mappedAddress.ipv4;
- respondTo = req.responseAddress.ipv4;
- flags = req.changeRequest.value;
-
- if (req.msgHdr.msgType==(STUN_METHOD_BINDING|STUN_REQUEST))
- {
- if (!req.hasMessageIntegrity)
- {
- //ortp_debug("stun: BindRequest does not contain SA_MESSAGEINTEGRITY");
-
- if (0) /* !jf! mustAuthenticate */
- {
- ortp_error("stun: Received BindRequest with no SA_MESSAGEINTEGRITY. Sending 401.");
- stunCreateErrorResponse(resp, 4, 1, "Missing SA_MESSAGEINTEGRITY");
- return TRUE;
- }
- }
- else
- {
- if (!req.hasUsername)
- {
- ortp_error("stun: No UserName. Send 432.");
- stunCreateErrorResponse(resp, 4, 32, "No UserName and contains SA_MESSAGEINTEGRITY");
- return TRUE;
- }
- else
- {
- //ortp_debug("stun: Validating username: %s", req.username.value );
- /* !jf! could retrieve associated password from provisioning here */
- if (strcmp(req.username.value, "test") == 0)
- {
- if (0)
- {
- /* !jf! if the credentials are stale */
- stunCreateErrorResponse(resp, 4, 30, "Stale credentials on BindRequest");
- return TRUE;
- }
- else
- {
- unsigned char hmac[20];
- //ortp_debug("stun: Validating SA_MESSAGEINTEGRITY");
- /* need access to shared secret */
-
-#ifndef NOSSL
- {
- unsigned int hmacSize=20;
-
- HMAC(EVP_sha1(),
- "1234", 4,
- (const unsigned char*) buf, bufLen-20-4,
- hmac, &hmacSize);
- }
-#endif
-
- if (memcmp(buf, hmac, 20) != 0)
- {
- ortp_error("stun: SA_MESSAGEINTEGRITY is bad. Sending ");
- stunCreateErrorResponse(resp, 4, 3, "Unknown username. Try test with password 1234");
- return TRUE;
- }
-
- /* need to compute this later after message is filled in */
- resp->hasMessageIntegrity = TRUE;
- /* assert(req.hasUsername); */
- resp->hasUsername = TRUE;
- resp->username = req.username; /* copy username in */
- }
- }
- else
- {
- ortp_error("stun: Invalid username: %s Send 430", req.username.value);
- }
- }
- }
-
- /* TODO !jf! should check for unknown attributes here and send 420 listing the
- unknown attributes. */
-
- if ( respondTo.port == 0 )
- {
- /* respondTo = from; */
- memcpy(&respondTo, from, sizeof(StunAddress4));
- }
- if ( mapped.port == 0 )
- {
- /* mapped = from; */
- memcpy(&mapped, from, sizeof(StunAddress4));
- }
-
- *changeIp = ( flags & ChangeIpFlag )?TRUE:FALSE;
- *changePort = ( flags & ChangePortFlag )?TRUE:FALSE;
-
- //ortp_debug("stun: Request is valid:\n");
- //ortp_debug("stun: \t flags= %i\n", flags );
- //ortp_debug("stun: \t changeIp= %i\n", *changeIp );
- //ortp_debug("stun: \t changePort=%i\n", *changePort );
- //ortp_debug("stun: \t from= %i\n", from->addr );
- //ortp_debug("stun: \t respond to= %i\n", respondTo.addr );
- //ortp_debug("stun: \t mapped= %i\n", mapped.addr );
-
- /* form the outgoing message */
- resp->msgHdr.msgType = (STUN_METHOD_BINDING | STUN_SUCCESS_RESP);
- resp->msgHdr.magic_cookie = ntohl(req.msgHdr.magic_cookie);
- for (i=0; i<12; i++ )
- {
- resp->msgHdr.tr_id.octet[i] = req.msgHdr.tr_id.octet[i];
- }
-
- if (1) /* do xorMapped address or not */
- {
- uint32_t cookie = 0x2112A442;
- resp->hasXorMappedAddress = TRUE;
- resp->xorMappedAddress.ipv4.port = mapped.port^(cookie>>16);
- resp->xorMappedAddress.ipv4.addr = mapped.addr^cookie;
- }
-
- resp->hasSourceAddress = TRUE;
- resp->sourceAddress.ipv4.port = (*changePort) ? altAddr->port : myAddr->port;
- resp->sourceAddress.ipv4.addr = (*changeIp) ? altAddr->addr : myAddr->addr;
-
- resp->hasChangedAddress = TRUE;
- resp->changedAddress.ipv4.port = altAddr->port;
- resp->changedAddress.ipv4.addr = altAddr->addr;
-
- if ( req.hasUsername && req.username.sizeValue > 0 )
- {
- /* copy username in */
- resp->hasUsername = TRUE;
- /* assert( req.username.sizeValue % 4 == 0 ); */
- /* assert( req.username.sizeValue < STUN_MAX_STRING ); */
- memcpy( resp->username.value, req.username.value, req.username.sizeValue );
- resp->username.sizeValue = req.username.sizeValue;
- }
-
- if (1) /* add ServerName */
- {
- const char serverName[] = "oRTP " STUN_VERSION; /* must pad to mult of 4 */
- resp->hasSoftware = TRUE;
-
- /* assert( sizeof(serverName) < STUN_MAX_STRING ); */
- /* cerr << "sizeof serverName is " << sizeof(serverName) ); */
- /* assert( sizeof(serverName)%4 == 0 ); */
- memcpy( resp->softwareName.value, serverName, sizeof(serverName));
- resp->softwareName.sizeValue = sizeof(serverName);
- }
-
-#if 0
- if ( req.hasMessageIntegrity & req.hasUsername )
- {
- /* this creates the password that will be used in the HMAC when then */
- /* messages is sent */
- stunCreatePassword( &req.username, hmacPassword );
- }
-#endif
-
- if (req.hasUsername && (req.username.sizeValue > 64 ) )
- {
- uint32_t source;
- /* assert( sizeof(int) == sizeof(uint32_t) ); */
-
- sscanf(req.username.value, "%x", &source);
- resp->hasReflectedFrom = TRUE;
- resp->reflectedFrom.ipv4.port = 0;
- resp->reflectedFrom.ipv4.addr = source;
- }
-
- destination->port = respondTo.port;
- destination->addr = respondTo.addr;
-
- return TRUE;
- }
- else
- {
- ortp_error("stun: Unknown or unsupported request ");
- return FALSE;
- }
-
- /* assert(0); */
- return FALSE;
-}
-
-bool_t
-stunInitServer(StunServerInfo *info, const StunAddress4 *myAddr, const StunAddress4 *altAddr, int startMediaPort)
-{
- /* assert( myAddr.port != 0 ); */
- /* assert( altAddr.port!= 0 ); */
- /* assert( myAddr.addr != 0 ); */
- /* assert( altAddr.addr != 0 ); */
-
- /* info->myAddr = myAddr; */
- info->myAddr.port = myAddr->port;
- info->myAddr.addr = myAddr->addr;
-
- /* info->altAddr = altAddr; */
- info->altAddr.port = altAddr->port;
- info->altAddr.addr = altAddr->addr;
-
- info->myFd = INVALID_SOCKET;
- info->altPortFd = INVALID_SOCKET;
- info->altIpFd = INVALID_SOCKET;
- info->altIpPortFd = INVALID_SOCKET;
-
- memset(info->relays, 0, sizeof(info->relays));
- if (startMediaPort > 0)
- {
- int i;
- info->relay = TRUE;
-
- for (i=0; i<MAX_MEDIA_RELAYS; ++i)
- {
- StunMediaRelay* relay = &info->relays[i];
- relay->relayPort = startMediaPort+i;
- relay->fd = 0;
- relay->expireTime = 0;
- }
- }
- else
- {
- info->relay = FALSE;
- }
-
- if ((info->myFd = openPort(myAddr->port, myAddr->addr)) == INVALID_SOCKET)
- {
- ortp_error("stun: Can't open %i\n", myAddr->addr );
- stunStopServer(info);
-
- return FALSE;
- }
-
- if ((info->altPortFd = openPort(altAddr->port,myAddr->addr)) == INVALID_SOCKET)
- {
- ortp_error("stun: Can't open %i\n", myAddr->addr );
- stunStopServer(info);
- return FALSE;
- }
-
-
- info->altIpFd = INVALID_SOCKET;
- if ( altAddr->addr != 0 )
- {
- if ((info->altIpFd = openPort( myAddr->port, altAddr->addr)) == INVALID_SOCKET)
- {
- ortp_error("stun: Can't open %i\n", altAddr->addr );
- stunStopServer(info);
- return FALSE;
- }
- }
-
- info->altIpPortFd = INVALID_SOCKET;
- if ( altAddr->addr != 0 )
- { if ((info->altIpPortFd = openPort(altAddr->port, altAddr->addr)) == INVALID_SOCKET)
- {
- ortp_error("stun: Can't open %i\n", altAddr->addr );
- stunStopServer(info);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-void
-stunStopServer(StunServerInfo *info)
-{
- if (info->myFd > 0) closesocket(info->myFd);
- if (info->altPortFd > 0) closesocket(info->altPortFd);
- if (info->altIpFd > 0) closesocket(info->altIpFd);
- if (info->altIpPortFd > 0) closesocket(info->altIpPortFd);
-
- if (info->relay)
- {
- int i;
- for (i=0; i<MAX_MEDIA_RELAYS; ++i)
- {
- StunMediaRelay* relay = &info->relays[i];
- if (relay->fd)
- {
- closesocket(relay->fd);
- relay->fd = 0;
- }
- }
- }
-}
-
-int
-stunFindLocalInterfaces(uint32_t* addresses,int maxRet)
-{
-#if defined(WIN32) || defined(_WIN32_WCE) || defined(__sparc__)
- return 0;
-#else
- struct ifconf ifc;
- int e;
-
- int s = socket( AF_INET, SOCK_DGRAM, 0 );
- int len = 100 * sizeof(struct ifreq);
-
- char buf[ 100 * sizeof(struct ifreq) ];
- char *ptr;
- int tl;
- int count=0;
-
- ifc.ifc_len = len;
- ifc.ifc_buf = buf;
-
- e = ioctl(s,SIOCGIFCONF,&ifc);
- ptr = buf;
- tl = ifc.ifc_len;
-
- while ( (tl > 0) && ( count < maxRet) )
- {
- struct ifreq* ifr = (struct ifreq *)ptr;
- struct ifreq ifr2;
- struct sockaddr a;
- struct sockaddr_in* addr;
-
- uint32_t ai;
- int si = sizeof(ifr->ifr_name) + sizeof(struct sockaddr);
- tl -= si;
- ptr += si;
- /* char* name = ifr->ifr_ifrn.ifrn_name; */
- /* cerr << "name = " << name ); */
-
- ifr2 = *ifr;
-
- e = ioctl(s,SIOCGIFADDR,&ifr2);
- if ( e == -1 )
- {
- break;
- }
-
- /* cerr << "ioctl addr e = " << e ; */
-
- a = ifr2.ifr_addr;
- addr = (struct sockaddr_in*) &a;
-
- ai = ntohl( addr->sin_addr.s_addr );
- if ((int)((ai>>24)&0xFF) != 127)
- {
- addresses[count++] = ai;
- }
-
- }
-
- closesocket(s);
-
- return count;
-#endif
-}
-
-
-void
-stunBuildReqSimple( StunMessage* msg,
- const StunAtrString *username,
- bool_t changePort, bool_t changeIp, unsigned int id )
-{
- int i;
- /* assert( msg ); */
- memset( msg , 0 , sizeof(*msg) );
-
- msg->msgHdr.msgType = (STUN_METHOD_BINDING|STUN_REQUEST);
-
- msg->msgHdr.magic_cookie = 0x2112A442;
- for ( i=0; i<12; i=i+4 )
- {
- /* assert(i+3<16); */
- int r = stunRand();
- msg->msgHdr.tr_id.octet[i+0]= r>>0;
- msg->msgHdr.tr_id.octet[i+1]= r>>8;
- msg->msgHdr.tr_id.octet[i+2]= r>>16;
- msg->msgHdr.tr_id.octet[i+3]= r>>24;
- }
-
- if ( id != 0 )
- {
- msg->msgHdr.tr_id.octet[0] = id;
- }
-
- if (changePort==TRUE || changeIp==TRUE)
- {
- msg->hasChangeRequest = TRUE;
- msg->changeRequest.value =(changeIp?ChangeIpFlag:0) |
- (changePort?ChangePortFlag:0);
- }
-
- if ( username!=NULL && username->sizeValue > 0 )
- {
- msg->hasUsername = TRUE;
- /* msg->username = username; */
- memcpy(&msg->username, username, sizeof(StunAtrString));
- }
-}
-
-
-static void
-stunSendTest( Socket myFd, StunAddress4 *dest,
- const StunAtrString *username, const StunAtrString *password,
- int testNum )
-{
- /* assert( dest.addr != 0 ); */
- /* assert( dest.port != 0 ); */
-
- bool_t changePort=FALSE;
- bool_t changeIP=FALSE;
- bool_t discard=FALSE;
-
- StunMessage req;
- char buf[STUN_MAX_MESSAGE_SIZE];
- int len = STUN_MAX_MESSAGE_SIZE;
-
- switch (testNum)
- {
- case 1:
- case 10:
- case 11:
- break;
- case 2:
- /* changePort=TRUE; */
- changeIP=TRUE;
- break;
- case 3:
- changePort=TRUE;
- break;
- case 4:
- changeIP=TRUE;
- break;
- case 5:
- discard=TRUE;
- break;
- default:
- ortp_error("stun: Test %i is unkown\n", testNum);
- return ; /* error */
- }
-
- memset(&req, 0, sizeof(StunMessage));
-
- stunBuildReqSimple( &req, username,
- changePort , changeIP ,
- testNum );
-
- len = stunEncodeMessage( &req, buf, len, password );
-
- //ortp_debug("stun: About to send msg of len %i to %s\n", len, ipaddr(dest) );
-
- sendMessage( myFd, buf, len, dest->addr, dest->port );
-
- /* add some delay so the packets don't get sent too quickly */
-#if defined(_WIN32_WCE)
- Sleep (10);
-#elif defined(WIN32)/* !cj! TODO - should fix this up in windows */
- {
- clock_t now = clock();
- /* assert( CLOCKS_PER_SEC == 1000 ); */
- while ( clock() <= now+10 ) { };
- }
-#else
- usleep(10*1000);
-#endif
-
-}
-
-
-#if 0
-void
-stunGetUserNameAndPassword( const StunAddress4 *dest,
- StunAtrString* username,
- StunAtrString* password)
-{
- /* !cj! This is totally bogus - need to make TLS connection to dest and get a */
- /* username and password to use */
- stunCreateUserName(dest, username);
- stunCreatePassword(username, password);
-}
-#endif
-
-int
-stunTest( StunAddress4 *dest, int testNum, StunAddress4* sAddr , StunAddress4 *sMappedAddr, StunAddress4* sChangedAddr)
-{
- /* assert( dest.addr != 0 ); */
- /* assert( dest.port != 0 ); */
-
- int port = randomPort();
- uint32_t interfaceIp=0;
- Socket myFd;
- StunAtrString username;
- StunAtrString password;
- char msg[STUN_MAX_MESSAGE_SIZE];
- int msgLen = STUN_MAX_MESSAGE_SIZE;
- StunAddress4 from;
- StunMessage resp;
- bool_t ok;
-
- if (sAddr)
- {
- interfaceIp = sAddr->addr;
- if ( sAddr->port != 0 )
- {
- port = sAddr->port;
- }
- }
- myFd = openPort(port,interfaceIp);
- if ( myFd == INVALID_SOCKET)
- return -1;
-
- username.sizeValue = 0;
- password.sizeValue = 0;
-
-#if 0
- stunGetUserNameAndPassword( dest, &username, &password );
-#endif
-
- stunSendTest( myFd, dest, &username, &password, testNum );
-
- ok = getMessage( myFd,
- msg,
- &msgLen,
- &from.addr,
- &from.port );
- closesocket(myFd);
- if (!ok)
- return -1;
-
- memset(&resp, 0, sizeof(StunMessage));
-
- //ortp_debug("stun: Got a response");
- ok = stunParseMessage( msg,msgLen, &resp );
-
- //ortp_debug("stun: \t ok=%i\n", ok );
- //ortp_debug("stun: \t SA_MAPPEDADDRESS=%i\n", resp.mappedAddress.ipv4.addr );
- //ortp_debug("stun: \t SA_CHANGEDADDRESS=%i\n", resp.changedAddress.ipv4.addr );
-
- if (sAddr)
- {
- sAddr->port = port;
- }
-
- if (sMappedAddr)
- {
- sMappedAddr->port = resp.mappedAddress.ipv4.port;
- sMappedAddr->addr = resp.mappedAddress.ipv4.addr;
- }
-
- if (sChangedAddr)
- {
- sChangedAddr->port = resp.changedAddress.ipv4.port;
- sChangedAddr->addr = resp.changedAddress.ipv4.addr;
- }
-
- if (ok)
- return 0;
- else
- return -1;
-}
-
-
-
-
-NatType
-stunNatType( StunAddress4 *dest,
- bool_t* preservePort, /* if set, is return for if NAT preservers ports or not */
- bool_t* hairpin, /* if set, is the return for if NAT will hairpin packets */
- int port, /* port to use for the test, 0 to choose random port */
- StunAddress4* sAddr /* NIC to use */
- )
-{
- /* assert( dest.addr != 0 ); */
- /* assert( dest.port != 0 ); */
- uint32_t interfaceIp=0;
- Socket myFd1;
- Socket myFd2;
-
- bool_t respTestI=FALSE;
- bool_t isNat=TRUE;
- StunAddress4 testIchangedAddr;
- StunAddress4 testImappedAddr;
- bool_t respTestI2=FALSE;
- bool_t mappedIpSame = TRUE;
- StunAddress4 testI2mappedAddr;
- /* StunAddress4 testI2dest=dest; */
- StunAddress4 testI2dest;
- bool_t respTestII=FALSE;
- bool_t respTestIII=FALSE;
- bool_t respTestHairpin=FALSE;
- StunAtrString username;
- StunAtrString password;
- int count=0;
- uint64_t second_started;
- uint64_t second_elapsed;
- Socket s;
-
- if ( hairpin )
- {
- *hairpin = FALSE;
- }
-
- if ( port == 0 )
- {
- port = randomPort();
- }
-
- if (sAddr)
- {
- interfaceIp = sAddr->addr;
- }
- myFd1 = openPort(port,interfaceIp);
- myFd2 = openPort(port+1,interfaceIp);
-
- if ( ( myFd1 == INVALID_SOCKET) || ( myFd2 == INVALID_SOCKET) )
- {
- ortp_error("stun: Some problem opening port/interface to send on\n");
- return StunTypeFailure;
- }
-
- /* assert( myFd1 != INVALID_SOCKET ); */
- /* assert( myFd2 != INVALID_SOCKET ); */
-
- memcpy(&testI2dest, dest, sizeof(StunAddress4));
-
- memset(&testImappedAddr,0,sizeof(testImappedAddr));
-
- username.sizeValue = 0;
- password.sizeValue = 0;
-
-#if 0
- stunGetUserNameAndPassword( dest, username, password );
-#endif
-
- /* stunSendTest( myFd1, dest, username, password, 1 ); */
-
-
- second_started = stunGetSystemTimeSecs();
- second_elapsed = 1;
-
- while ( count < 3 && second_elapsed < 5)
- {
- struct timeval tv;
- fd_set fdSet;
- int err;
- int e;
-
-#if defined(WIN32) || defined(_WIN32_WCE)
- unsigned int fdSetSize;
-#else
- int fdSetSize;
-#endif
-
- second_elapsed = stunGetSystemTimeSecs() - second_started ;
-
- FD_ZERO(&fdSet); fdSetSize=0;
- FD_SET(myFd1,&fdSet); fdSetSize = (myFd1+1>fdSetSize) ? myFd1+1 : fdSetSize;
- FD_SET(myFd2,&fdSet); fdSetSize = (myFd2+1>fdSetSize) ? myFd2+1 : fdSetSize;
- tv.tv_sec=0;
- tv.tv_usec=500*1000; /* 150 ms */
- if ( count == 0 ) tv.tv_usec=0;
-
- err = select(fdSetSize, &fdSet, NULL, NULL, &tv);
- e = getErrno();
- if ( err == SOCKET_ERROR )
- {
- /* error occured */
-#if !defined(_WIN32_WCE)
- ortp_error("stun: Error %i %s in select\n", e, strerror(e));
-#else
- ortp_error("stun: Error %i in select\n", e);
-#endif
- closesocket(myFd1); /* AMD */
- closesocket(myFd2); /* AMD */
- return StunTypeFailure;
- }
- else if ( err == 0 )
- {
- /* timeout occured */
- count++;
- if ( !respTestI )
- {
- stunSendTest( myFd1, dest, &username, &password, 1 );
- }
-
- if ( (!respTestI2) && respTestI )
- {
- /* check the address to send to if valid */
- if ( ( testI2dest.addr != 0 ) &&
- ( testI2dest.port != 0 ) )
- {
- stunSendTest( myFd1, &testI2dest, &username, &password, 10 );
- }
- }
-
- if ( !respTestII )
- {
- stunSendTest( myFd2, dest, &username, &password, 2 );
- }
-
- if ( !respTestIII )
- {
- stunSendTest( myFd2, dest, &username, &password, 3 );
- }
-
- if ( respTestI && (!respTestHairpin) )
- {
- if ( ( testImappedAddr.addr != 0 ) &&
- ( testImappedAddr.port != 0 ) )
- {
- stunSendTest( myFd1, &testImappedAddr, &username, &password, 11 );
- }
- }
-
- }
- else
- {
- int i;
- /* data is avialbe on some fd */
-
- for ( i=0; i<2; i++)
- {
- Socket myFd;
- if ( i==0 )
- {
- myFd=myFd1;
- }
- else
- {
- myFd=myFd2;
- }
-
- if ( myFd!=INVALID_SOCKET )
- {
- if ( FD_ISSET(myFd,&fdSet) )
- {
- char msg[STUN_MAX_MESSAGE_SIZE];
- int msgLen = sizeof(msg);
-
- StunAddress4 from;
- StunMessage resp;
-
- getMessage( myFd,
- msg,
- &msgLen,
- &from.addr,
- &from.port );
-
- memset(&resp, 0, sizeof(StunMessage));
-
- stunParseMessage( msg,msgLen, &resp );
-
- //ortp_debug("stun: Received message of type %i id=%i\n",
- //resp.msgHdr.msgType,
- //(int)(resp.msgHdr.tr_id.octet[0]) );
-
- switch( resp.msgHdr.tr_id.octet[0] )
- {
- case 1:
- {
- if ( !respTestI )
- {
-
- testIchangedAddr.addr = resp.changedAddress.ipv4.addr;
- testIchangedAddr.port = resp.changedAddress.ipv4.port;
- testImappedAddr.addr = resp.mappedAddress.ipv4.addr;
- testImappedAddr.port = resp.mappedAddress.ipv4.port;
-
- if ( preservePort )
- {
- *preservePort = ( testImappedAddr.port == port );
- }
-
- testI2dest.addr = resp.changedAddress.ipv4.addr;
-
- if (sAddr)
- {
- sAddr->port = testImappedAddr.port;
- sAddr->addr = testImappedAddr.addr;
- }
-
- count = 0;
- }
- respTestI=TRUE;
- }
- break;
- case 2:
- {
- respTestII=TRUE;
- }
- break;
- case 3:
- {
- respTestIII=TRUE;
- }
- break;
- case 10:
- {
- if ( !respTestI2 )
- {
- testI2mappedAddr.addr = resp.mappedAddress.ipv4.addr;
- testI2mappedAddr.port = resp.mappedAddress.ipv4.port;
-
- mappedIpSame = FALSE;
- if ( (testI2mappedAddr.addr == testImappedAddr.addr ) &&
- (testI2mappedAddr.port == testImappedAddr.port ))
- {
- mappedIpSame = TRUE;
- }
-
-
- }
- respTestI2=TRUE;
- }
- break;
- case 11:
- {
-
- if ( hairpin )
- {
- *hairpin = TRUE;
- }
- respTestHairpin = TRUE;
- }
- break;
- }
- }
- }
- }
- }
- }
-
- closesocket(myFd1); /* AMD */
- closesocket(myFd2); /* AMD */
-
- /* see if we can bind to this address */
- /* cerr << "try binding to " << testImappedAddr ); */
- s = openPort( 0/*use ephemeral*/, testImappedAddr.addr );
- if ( s != INVALID_SOCKET )
- {
- isNat = FALSE;
- /* cerr << "binding worked"); */
- }
- else
- {
- isNat = TRUE;
- /* cerr << "binding failed"); */
- }
-
- closesocket(s); /* AMD */
-
- //ortp_debug("stun: test I = %i\n", respTestI );
- //ortp_debug("stun: test II = %i\n", respTestII );
- //ortp_debug("stun: test III = %i\n", respTestIII );
- //ortp_debug("stun: test I(2) = %i\n", respTestI2 );
- ortp_debug("stun: is nat = %i\n", isNat);
- ortp_debug("stun: mapped IP same = %i\n", mappedIpSame );
-
- /* implement logic flow chart from draft RFC */
- if ( respTestI )
- {
- if ( isNat )
- {
- if (respTestII)
- {
- return StunTypeConeNat;
- }
- else
- {
- if ( mappedIpSame )
- {
- if ( respTestIII )
- {
- return StunTypeRestrictedNat;
- }
- else
- {
- return StunTypePortRestrictedNat;
- }
- }
- else
- {
- return StunTypeSymNat;
- }
- }
- }
- else
- {
- if (respTestII)
- {
- return StunTypeOpen;
- }
- else
- {
- return StunTypeSymFirewall;
- }
- }
- }
- else
- {
- return StunTypeBlocked;
- }
-
- return StunTypeUnknown;
-}
-
-int
-stunOpenSocket( StunAddress4 *dest, StunAddress4* mapAddr,
- int port, StunAddress4* srcAddr )
-{
- /* assert( dest.addr != 0 ); */
- /* assert( dest.port != 0 ); */
- /* assert( mapAddr );*/
- unsigned int interfaceIp = 0;
- Socket myFd;
- char msg[STUN_MAX_MESSAGE_SIZE];
- int msgLen = sizeof(msg);
-
- StunAtrString username;
- StunAtrString password;
-
- StunAddress4 from;
- StunMessage resp;
- bool_t ok;
- StunAddress4 mappedAddr;
-
- if ( port == 0 )
- {
- port = randomPort();
- }
-
- if ( srcAddr )
- {
- interfaceIp = srcAddr->addr;
- }
-
- myFd = openPort(port,interfaceIp);
- if (myFd == INVALID_SOCKET)
- {
- return myFd;
- }
-
- username.sizeValue = 0;
- password.sizeValue = 0;
-
-#if 0
- stunGetUserNameAndPassword( dest, username, password );
-#endif
-
- stunSendTest(myFd, dest, &username, &password, 1 );
-
- getMessage( myFd, msg, &msgLen, &from.addr, &from.port );
-
- memset(&resp, 0, sizeof(StunMessage));
-
- ok = stunParseMessage( msg, msgLen, &resp );
- if (!ok)
- {
- closesocket(myFd);
- return -1;
- }
-
- if (resp.hasXorMappedAddress==TRUE)
- {
- uint32_t cookie = 0x2112A442;
- uint16_t cookie16 = 0x2112A442 >> 16;
- mappedAddr.port = resp.xorMappedAddress.ipv4.port^cookie16;
- mappedAddr.addr = resp.xorMappedAddress.ipv4.addr^cookie;
- }
- else
- mappedAddr = resp.mappedAddress.ipv4;
-
- /*
- ortp_message("stun: --- stunOpenSocket --- ");
- ortp_message("stun: \treq id=" << req.id );
- ortp_message("stun: \tresp id=" << id );
- ortp_message("stun: \tmappedAddr=" << mappedAddr );
- */
-
- *mapAddr = mappedAddr;
-
- return myFd;
-}
-
-
-bool_t
-stunOpenSocketPair(StunAddress4 *dest,
- StunAddress4* mapAddr_rtp,
- StunAddress4* mapAddr_rtcp,
- int* fd1, int* fd2,
- int port, StunAddress4* srcAddr )
-{
- /* assert( dest.addr!= 0 ); */
- /* assert( dest.port != 0 ); */
- /* assert( mapAddr ); */
-
- const int NUM=2;
- char msg[STUN_MAX_MESSAGE_SIZE];
- int msgLen =sizeof(msg);
-
- StunAddress4 from;
- int fd[2/*NUM*/];
- int i;
-
- unsigned int interfaceIp = 0;
-
- StunAtrString username;
- StunAtrString password;
-
- StunAddress4 mappedAddr[2/*NUM*/];
-
- if ( port == 0 )
- {
- port = randomPort();
- }
-
- *fd1=-1;
- *fd2=-1;
-
- if ( srcAddr )
- {
- interfaceIp = srcAddr->addr;
- }
-
- for( i=0; i<NUM; i++)
- {
- fd[i] = openPort( (port == 0) ? 0 : (port + i), interfaceIp);
- if (fd[i] < 0)
- {
- while (i > 0)
- {
- closesocket(fd[--i]);
- }
- return FALSE;
- }
- }
-
- username.sizeValue = 0;
- password.sizeValue = 0;
-
-#if 0
- stunGetUserNameAndPassword( dest, username, password );
-#endif
-
- for( i=0; i<NUM; i++)
- {
- stunSendTest(fd[i], dest, &username, &password, 1/*testNum*/ );
- }
-
- for( i=0; i<NUM; i++)
- {
- StunMessage resp;
- bool_t ok;
- msgLen = sizeof(msg)/sizeof(*msg);
- getMessage( fd[i],
- msg,
- &msgLen,
- &from.addr,
- &from.port);
-
- memset(&resp, 0, sizeof(StunMessage));
-
- ok = stunParseMessage( msg, msgLen, &resp );
- if (!ok)
- {
- for( i=0; i<NUM; i++)
- {
- closesocket(fd[i]);
- }
- return FALSE;
- }
-
- if (resp.hasXorMappedAddress==TRUE)
- {
- uint32_t cookie = 0x2112A442;
- uint16_t cookie16 = 0x2112A442 >> 16;
- mappedAddr[i].port = resp.xorMappedAddress.ipv4.port^cookie16;
- mappedAddr[i].addr = resp.xorMappedAddress.ipv4.addr^cookie;
- }
- else
- mappedAddr[i] = resp.mappedAddress.ipv4;
- }
-
- //ortp_debug("stun: --- stunOpenSocketPair --- \n");
- for( i=0; i<NUM; i++)
- {
- //ortp_debug("stun: \t mappedAddr=%s\n", ipaddr(&mappedAddr[i]) );
- }
-
- *mapAddr_rtp = mappedAddr[0];
- *mapAddr_rtcp = mappedAddr[1];
- *fd1 = fd[0];
- *fd2 = fd[1];
-
- for( i=0; i<NUM; i++)
- {
- closesocket( fd[i] );
- }
-
- return TRUE;
-}
-
-static void
-turnSendAllocate( Socket myFd, StunAddress4 *dest,
- const StunAtrString *username, const StunAtrString *password,
- StunMessage *resp)
-{
- StunMessage req;
- char buf[STUN_MAX_MESSAGE_SIZE];
- int len = STUN_MAX_MESSAGE_SIZE;
- const char serverName[] = "oRTP " STUN_VERSION; /* must pad to mult of 4 */
-
- memset(&req, 0, sizeof(StunMessage));
-
- stunBuildReqSimple( &req, username,
- FALSE , FALSE ,
- 0 );
- req.msgHdr.msgType = (TURN_MEDHOD_ALLOCATE|STUN_REQUEST);
-
- req.hasSoftware = TRUE;
- memcpy( req.softwareName.value, serverName, sizeof(serverName));
- req.softwareName.sizeValue = sizeof(serverName);
-
- req.hasRequestedTransport = TRUE;
- memset(&req.requestedTransport, 0, sizeof(req.requestedTransport));
- req.requestedTransport.proto = IPPROTO_UDP;
-
- req.hasDontFragment = TRUE;
-
- if (resp!=NULL
- && username!=NULL && username->sizeValue>0
- && password!=NULL && password->sizeValue>0
- && resp->hasRealm==TRUE
- && resp->hasNonce==TRUE)
- {
- req.hasUsername = TRUE;
- memcpy( req.username.value, username->value, username->sizeValue );
- req.username.sizeValue = username->sizeValue;
-
- req.hasNonce = TRUE;
- memcpy( &req.nonceName, &resp->nonceName, sizeof(resp->nonceName));
-
- req.hasRealm = TRUE;
- memcpy( &req.realmName, &resp->realmName, sizeof(resp->realmName));
-
- req.hasMessageIntegrity = TRUE;
- }
-
- len = stunEncodeMessage( &req, buf, len, password );
-
- ortp_debug("stun: About to send msg of len %i to %s\n", len, ipaddr(dest) );
-
- sendMessage( myFd, buf, len, dest->addr, dest->port);
-
- /* add some delay so the packets don't get sent too quickly */
-#if defined(_WIN32_WCE)
- Sleep (10);
-#elif defined(WIN32)/* !cj! TODO - should fix this up in windows */
- {
- clock_t now = clock();
- /* assert( CLOCKS_PER_SEC == 1000 ); */
- while ( clock() <= now+10 ) { };
- }
-#else
- usleep(10*1000);
-#endif
-}
-
-bool_t
-turnAllocateSocketPair(StunAddress4 *dest,
- StunAddress4* mapAddr_rtp,
- StunAddress4* mapAddr_rtcp,
- int* fd1, int* fd2,
- int port, StunAddress4* srcAddr)
-{
- const int NUM=2;
- char msg[STUN_MAX_MESSAGE_SIZE];
- int msgLen =sizeof(msg);
-
- StunAddress4 from;
- int fd[2/*NUM*/];
- int i;
-
- unsigned int interfaceIp = 0;
-
- StunAtrString username;
- StunAtrString password;
-
- StunAddress4 mappedAddr[2/*NUM*/];
-
- if ( port == 0 )
- {
- port = randomPort();
- }
-
- *fd1=-1;
- *fd2=-1;
-
- if ( srcAddr )
- {
- interfaceIp = srcAddr->addr;
- }
-
- for( i=0; i<NUM; i++)
- {
- fd[i] = openPort( (port == 0) ? 0 : (port + i),
- interfaceIp);
- if (fd[i] < 0)
- {
- while (i > 0)
- {
- closesocket(fd[--i]);
- }
- return FALSE;
- }
- }
-
- snprintf(username.value, sizeof(username.value), "antisip");
- username.sizeValue = strlen(username.value);
- snprintf(password.value, sizeof(password.value), "exosip");
- password.sizeValue = strlen(password.value);
-
- for( i=0; i<NUM; i++)
- {
- turnSendAllocate(fd[i], dest, NULL, NULL, NULL );
- }
-
- for( i=0; i<NUM; i++)
- {
- StunMessage resp;
- bool_t ok;
- msgLen = sizeof(msg)/sizeof(*msg);
- getMessage( fd[i],
- msg,
- &msgLen,
- &from.addr,
- &from.port);
-
- memset(&resp, 0, sizeof(StunMessage));
-
- ok = stunParseMessage( msg, msgLen, &resp );
- if (!ok)
- {
- for( i=0; i<NUM; i++)
- {
- closesocket(fd[i]);
- }
- return FALSE;
- }
-
- if (STUN_IS_ERR_RESP(resp.msgHdr.msgType))
- {
- /* check if we need to authenticate */
- if (resp.hasErrorCode==TRUE
- && resp.errorCode.errorClass==4 && resp.errorCode.number==1
- && resp.hasNonce == TRUE
- && resp.hasRealm == TRUE)
- {
- turnSendAllocate(fd[i], dest, &username, &password, &resp);
- i--;
- }
- }
- else if (STUN_IS_SUCCESS_RESP(resp.msgHdr.msgType))
- {
- if (resp.hasXorRelayedAddress==TRUE)
- {
- uint32_t cookie = 0x2112A442;
- uint16_t cookie16 = 0x2112A442 >> 16;
- mappedAddr[i].port = resp.xorRelayedAddress.ipv4.port^cookie16;
- mappedAddr[i].addr = resp.xorRelayedAddress.ipv4.addr^cookie;
- }
- else
- {
- for( i=0; i<NUM; i++)
- {
- closesocket(fd[i]);
- }
- return FALSE;
- }
- }
- }
-
- for( i=0; i<NUM; i++)
- {
- ortp_message("stun: stunOpenSocketPair mappedAddr=%s\n", ipaddr(&mappedAddr[i]) );
- }
-
- *mapAddr_rtp = mappedAddr[0];
- *mapAddr_rtcp = mappedAddr[1];
- *fd1 = fd[0];
- *fd2 = fd[1];
-
- for( i=0; i<NUM; i++)
- {
- closesocket( fd[i] );
- }
-
- return TRUE;
-}
-
-/* Local Variables:
- mode:c
- c-file-style:"ellemtel"
- c-file-offsets:((case-label . +))
- indent-tabs-mode:nil
- End:
-*/
-
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* ====================================================================
- * The Vovida Software License, Version 1.0
- *
- * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The names "VOCAL", "Vovida Open Communication Application Library",
- * and "Vovida Open Communication Application Library (VOCAL)" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact vocal@vovida.org.
- *
- * 4. Products derived from this software may not be called "VOCAL", nor
- * may "VOCAL" appear in their name, without prior written
- * permission of Vovida Networks, Inc.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
- * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
- * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
- * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * ====================================================================
- *
- * This software consists of voluntary contributions made by Vovida
- * Networks, Inc. and many individuals on behalf of Vovida Networks,
- * Inc. For more information on Vovida Networks, Inc., please see
- * <http://www.vovida.org/>.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include <net/if.h>
-#endif
-#include <assert.h>
-
-#include <time.h>
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-
-#include <winsock2.h>
-#include <stdlib.h>
-/* #include <io.h> */
-
-#else
-
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <string.h>
-#include <unistd.h>
-
-#endif
-
-#include <string.h>
-
-#include "ortp/stun_udp.h"
-#include "ortp/ortp.h"
-
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-int getErrno() { return errno; }
-#else
-int getErrno() { return WSAGetLastError(); }
-#endif
-
-Socket
-openPort( unsigned short port, unsigned int interfaceIp )
-{
- struct sockaddr_in addr;
- Socket fd;
-
- fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if ( fd == INVALID_SOCKET )
- {
- ortp_error("stun_udp: Could not create a UDP socket");
- return INVALID_SOCKET;
- }
-
- memset((char*) &(addr),0, sizeof((addr)));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- addr.sin_port = htons(port);
-
- if ( (interfaceIp != 0) &&
- ( interfaceIp != 0x100007f ) )
- {
- addr.sin_addr.s_addr = htonl(interfaceIp);
- //ortp_debug("Binding to interface 0x%lu\n",(unsigned long) htonl(interfaceIp));
- }
-
- if ( bind( fd,(struct sockaddr*)&addr, sizeof(addr)) != 0 )
- {
- int e = getErrno();
-
- switch (e)
- {
- case 0:
- {
- ortp_error("stun_udp: Could not bind socket");;
- return INVALID_SOCKET;
- }
- case EADDRINUSE:
- {
- ortp_error("stun_udp: Port %i for receiving UDP is in use", port);
- return INVALID_SOCKET;
- }
- break;
- case EADDRNOTAVAIL:
- {
- ortp_error("stun_udp: Cannot assign requested address");
- return INVALID_SOCKET;
- }
- break;
- default:
- {
-#if !defined(_WIN32_WCE)
- ortp_error("stun_udp: Could not bind UDP receive port Error=%i %s",
- e, strerror(e));
-#else
- ortp_error("stun_udp: Could not bind UDP receive port Error=%i",
- e);
-#endif
- return INVALID_SOCKET;
- }
- break;
- }
- }
-
- ortp_debug("stun: opened port %i with fd %i\n", port, fd);
-
- /* assert( fd != INVALID_SOCKET ); */
-
- return fd;
-}
-
-
-bool_t
-getMessage( Socket fd, char* buf, int* len,
- unsigned int* srcIp, unsigned short* srcPort)
-{
- /* assert( fd != INVALID_SOCKET ); */
-
- int originalSize = *len;
- struct sockaddr_in from;
- int fromLen = sizeof(from);
-
-
- int err;
- struct timeval tv;
- fd_set fdSet;
-#if defined(WIN32) || defined(_WIN32_WCE)
- unsigned int fdSetSize;
-#else
- int fdSetSize;
-#endif
-
- if (originalSize <= 0)
- {
- return FALSE;
- }
-
- tv.tv_sec=1;
- tv.tv_usec=0; /* 150 ms */
- FD_ZERO(&fdSet); fdSetSize=0;
- FD_SET(fd,&fdSet); fdSetSize = fd+1;
-
- err = select(fdSetSize, &fdSet, NULL, NULL, &tv);
- if ( err == SOCKET_ERROR )
- {
- int e = getErrno();
- switch (e)
- {
- case ENOTSOCK:
- ortp_error("stun_udp: Error fd not a socket");
- break;
- case ECONNRESET:
- ortp_error("stun_udp: Error connection reset - host not reachable");
- break;
-
- default:
- ortp_error("stun_udp: Socket Error=%i", e);
- }
- return FALSE;
- }
-
- if (err==0)
- {
- ortp_error("stun_udp: Connection timeout with stun server!");
- *len = 0;
- return FALSE;
- }
-
- if (FD_ISSET (fd, &fdSet))
- {
- *len = recvfrom(fd,
- buf,
- originalSize,
- 0,
- (struct sockaddr *)&from,
- (socklen_t*)&fromLen);
-
- if ( *len == SOCKET_ERROR )
- {
- int e = getErrno();
-
- switch (e)
- {
- case ENOTSOCK:
- ortp_error("stun_udp: Error fd not a socket");
- break;
- case ECONNRESET:
- ortp_error("stun_udp: Error connection reset - host not reachable");
- break;
-
- default:
- ortp_error("stun_udp: Socket Error=%i", e);
- }
-
- return FALSE;
- }
-
- if ( *len < 0 )
- {
- ortp_error("stun_udp: socket closed? negative len");
- return FALSE;
- }
-
- if ( *len == 0 )
- {
- ortp_error("stun_udp: socket closed? zero len");
- return FALSE;
- }
-
- *srcPort = ntohs(from.sin_port);
- *srcIp = ntohl(from.sin_addr.s_addr);
-
- if ( (*len)+1 >= originalSize )
- {
- ortp_error("stun_udp: Received a message that was too large");
- return FALSE;
- }
- buf[*len]=0;
-
- return TRUE;
- }
- return FALSE;
-}
-
-
-bool_t
-sendMessage( Socket fd, char* buf, int l,
- unsigned int dstIp, unsigned short dstPort)
-{
- int s;
-
- if (fd == INVALID_SOCKET)
- return FALSE;
-
- if ( dstPort == 0 )
- {
- /* sending on a connected port */
- s = send(fd,buf,l,0);
- }
- else
- {
- struct sockaddr_in to;
- int toLen = sizeof(to);
- if (dstIp == 0)
- {
- ortp_error("stun_udp: invalid IP provided (dstIP==0)");
- return FALSE;
- }
-
- memset(&to,0,toLen);
-
- to.sin_family = AF_INET;
- to.sin_port = htons(dstPort);
- to.sin_addr.s_addr = htonl(dstIp);
-
- s = sendto(fd, buf, l, 0,(struct sockaddr*)&to, toLen);
- }
-
- if ( s == SOCKET_ERROR )
- {
- int e = getErrno();
- switch (e)
- {
- case ECONNREFUSED:
- case EHOSTDOWN:
- case EHOSTUNREACH:
- {
- /* quietly ignore this */
- }
- break;
- case EAFNOSUPPORT:
- {
- ortp_error("stun_udp: err EAFNOSUPPORT in send");
- }
- break;
- default:
- {
-#if !defined(_WIN32_WCE)
- ortp_error("stun_udp: err %i %s in send", e, strerror(e));
-#else
- ortp_error("stun_udp: err %i in send", e);
-#endif
- }
- }
- return FALSE;
- }
-
- if ( s == 0 )
- {
- ortp_error("stun_udp: no data sent in send");
- return FALSE;
- }
-
- if ( s != l )
- {
- ortp_error("stun_udp: only %i out of %i bytes sent", s, l);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-void
-initNetwork()
-{
-#if defined(WIN32) || defined(_WIN32_WCE)
- WORD wVersionRequested = MAKEWORD( 2, 2 );
- WSADATA wsaData;
- int err;
-
- err = WSAStartup( wVersionRequested, &wsaData );
- if ( err != 0 )
- {
- /* could not find a usable WinSock DLL */
- ortp_error("stun_udp: Could not load winsock");
- }
-
- /* Confirm that the WinSock DLL supports 2.2.*/
- /* Note that if the DLL supports versions greater */
- /* than 2.2 in addition to 2.2, it will still return */
- /* 2.2 in wVersion since that is the version we */
- /* requested. */
-
- if ( LOBYTE( wsaData.wVersion ) != 2 ||
- HIBYTE( wsaData.wVersion ) != 2 )
- {
- /* Tell the user that we could not find a usable */
- /* WinSock DLL. */
- WSACleanup( );
- ortp_error("stun_udp: Wrong winsock (!= 2.2) version");
- }
-#endif
-}
-
-
-/* ====================================================================
- * The Vovida Software License, Version 1.0
- *
- * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The names "VOCAL", "Vovida Open Communication Application Library",
- * and "Vovida Open Communication Application Library (VOCAL)" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact vocal@vovida.org.
- *
- * 4. Products derived from this software may not be called "VOCAL", nor
- * may "VOCAL" appear in their name, without prior written
- * permission of Vovida Networks, Inc.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
- * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
- * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
- * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * ====================================================================
- *
- * This software consists of voluntary contributions made by Vovida
- * Networks, Inc. and many individuals on behalf of Vovida Networks,
- * Inc. For more information on Vovida Networks, Inc., please see
- * <http://www.vovida.org/>.
- *
- */
-
-/* Local Variables:
- mode:c
- c-file-style:"ellemtel"
- c-file-offsets:((case-label . +))
- indent-tabs-mode:nil
- End:
-*/
+++ /dev/null
-*############################################################
-*#
-*# $Header: /sources/linphone/linphone/oRTP/src/system,v 1.1 2002/02/25 08:41:53 smorlat Exp $
-*#
-*# $Source: /sources/linphone/linphone/oRTP/src/system,v $
-*# $Revision: 1.1 $
-*# $Locker: $
-*#
-*############################################################
-$VERSION 1
-$CONFIGURE Y
-$LOADABLE Y
-$TUNABLE
-$$$
-
+++ /dev/null
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/telephonyevents.h>
-#include "utils.h"
-#include "rtpsession_priv.h"
-#include <ortp/ortp.h>
-
-PayloadType payload_type_telephone_event={
- PAYLOAD_AUDIO_PACKETIZED, /*type */
- 8000, /*clock rate */
- 0, /* bytes per sample N/A */
- NULL, /* zero pattern N/A*/
- 0, /*pattern_length N/A */
- 0, /* normal_bitrate */
- "telephone-event", /* MIME subtype */
- 0, /* Audio Channels N/A */
- 0 /*flags */
-};
-
-/**
- * Tells whether telephony events payload type is supported within the
- * context of the rtp session.
- * @param session a rtp session
- *
- * @return the payload type number used for telephony events if found, -1 if not found.
-**/
-int rtp_session_telephone_events_supported(RtpSession *session)
-{
- /* search for a telephony event payload in the current profile */
- session->snd.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->snd.profile,"telephone-event");
- session->rcv.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->rcv.profile,"telephone-event");
- /*printf("Telephone event pt is %i\n",session->telephone_events_pt);*/
- return session->snd.telephone_events_pt;
-}
-
-
-/**
- * Tells whether telephone event payload type is supported for send within the
- * context of the rtp session.
- * @param session a rtp session
- *
- * @return the payload type number used for telephony events if found, -1 if not found.
-**/
-int rtp_session_send_telephone_events_supported(RtpSession *session)
-{
- /* search for a telephony event payload in the current profile */
- session->snd.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->snd.profile,"telephone-event");
- /*printf("Telephone event pt is %i\n",session->telephone_events_pt);*/
- return session->snd.telephone_events_pt;
-}
-
-/**
- * Tells whether telephone event payload type is supported for receiving within the
- * context of the rtp session.
- * @param session a rtp session
- *
- * @return the payload type number used for telephony events if found, -1 if not found.
-**/int rtp_session_recv_telephone_events_supported(RtpSession *session)
-{
- /* search for a telephony event payload in the current profile */
- session->rcv.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->rcv.profile,"telephone-event");
- /*printf("Telephone event pt is %i\n",session->telephone_events_pt);*/
- return session->snd.telephone_events_pt;
-}
-
-
-/**
- * Allocates a new rtp packet to be used to add named telephony events. The application can use
- * then rtp_session_add_telephone_event() to add named events to the packet.
- * Finally the packet has to be sent with rtp_session_sendm_with_ts().
- *
- * @param session a rtp session.
- * @param start boolean to indicate if the marker bit should be set.
- *
- * @return a message block containing the rtp packet if successfull, NULL if the rtp session
- *cannot support telephony event (because the rtp profile it is bound to does not include
- *a telephony event payload type).
-**/
-mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start)
-{
- mblk_t *mp;
- rtp_header_t *rtp;
-
- return_val_if_fail(session->snd.telephone_events_pt!=-1,NULL);
-
- mp=allocb(RTP_FIXED_HEADER_SIZE+TELEPHONY_EVENTS_ALLOCATED_SIZE,BPRI_MED);
- if (mp==NULL) return NULL;
- rtp=(rtp_header_t*)mp->b_rptr;
- rtp->version = 2;
- rtp->markbit=start;
- rtp->padbit = 0;
- rtp->extbit = 0;
- rtp->cc = 0;
- rtp->ssrc = session->snd.ssrc;
- /* timestamp set later, when packet is sended */
- /*seq number set later, when packet is sended */
-
- /*set the payload type */
- rtp->paytype=session->snd.telephone_events_pt;
-
- /*copy the payload */
- mp->b_wptr+=RTP_FIXED_HEADER_SIZE;
- return mp;
-}
-
-
-/**
- *@param session a rtp session.
- *@param packet a rtp packet as a mblk_t
- *@param event the event type as described in rfc2833, ie one of the TEV_* macros.
- *@param end a boolean to indicate if the end bit should be set. (end of tone)
- *@param volume the volume of the telephony tone, as described in rfc2833
- *@param duration the duration of the telephony tone, in timestamp unit.
- *
- * Adds a named telephony event to a rtp packet previously allocated using
- * rtp_session_create_telephone_event_packet().
- *
- *@return 0 on success.
-**/
-int rtp_session_add_telephone_event(RtpSession *session,
- mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration)
-{
- mblk_t *mp=packet;
- telephone_event_t *event_hdr;
-
-
- /* find the place where to add the new telephony event to the packet */
- while(mp->b_cont!=NULL) mp=mp->b_cont;
- /* see if we need to allocate a new mblk_t */
- if ( ( mp->b_wptr) >= (mp->b_datap->db_lim)){
- mblk_t *newm=allocb(TELEPHONY_EVENTS_ALLOCATED_SIZE,BPRI_MED);
- mp->b_cont=newm;
- mp=mp->b_cont;
- }
- if (mp==NULL) return -1;
- event_hdr=(telephone_event_t*)mp->b_wptr;
- event_hdr->event=event;
- event_hdr->R=0;
- event_hdr->E=end;
- event_hdr->volume=volume;
- event_hdr->duration=htons(duration);
- mp->b_wptr+=sizeof(telephone_event_t);
- return 0;
-}
-/**
- * This functions creates telephony events packets for dtmf and sends them.
- * It uses rtp_session_create_telephone_event_packet() and
- * rtp_session_add_telephone_event() to create them and finally
- * rtp_session_sendm_with_ts() to send them.
- *
- * @param session a rtp session
- * @param dtmf a character meaning the dtmf (ex: '1', '#' , '9' ...)
- * @param userts the timestamp
- * @return 0 if successfull, -1 if the session cannot support telephony events or if the dtmf given as argument is not valid.
-**/
-int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts)
-{
- return rtp_session_send_dtmf2(session, dtmf, userts, 480);
-}
-
-/**
- * A variation of rtp_session_send_dtmf() with duration specified.
- *
- * @param session a rtp session
- * @param dtmf a character meaning the dtmf (ex: '1', '#' , '9' ...)
- * @param userts the timestamp
- * @param duration duration of the dtmf in timestamp units
- * @return 0 if successfull, -1 if the session cannot support telephony events or if the dtmf given as argument is not valid.
-**/
-int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration)
-{
- mblk_t *m1,*m2,*m3;
- int tev_type;
- int durationtier = duration/3;
-
- /* create the first telephony event packet */
- switch (dtmf){
- case '1':
- tev_type=TEV_DTMF_1;
- break;
- case '2':
- tev_type=TEV_DTMF_2;
- break;
- case '3':
- tev_type=TEV_DTMF_3;
- break;
- case '4':
- tev_type=TEV_DTMF_4;
- break;
- case '5':
- tev_type=TEV_DTMF_5;
- break;
- case '6':
- tev_type=TEV_DTMF_6;
- break;
- case '7':
- tev_type=TEV_DTMF_7;
- break;
- case '8':
- tev_type=TEV_DTMF_8;
- break;
- case '9':
- tev_type=TEV_DTMF_9;
- break;
- case '*':
- tev_type=TEV_DTMF_STAR;
- break;
- case '0':
- tev_type=TEV_DTMF_0;
- break;
- case '#':
- tev_type=TEV_DTMF_POUND;
- break;
-
- case 'A':
- case 'a':
- tev_type=TEV_DTMF_A;
- break;
-
-
- case 'B':
- case 'b':
- tev_type=TEV_DTMF_B;
- break;
-
- case 'C':
- case 'c':
- tev_type=TEV_DTMF_C;
- break;
-
- case 'D':
- case 'd':
- tev_type=TEV_DTMF_D;
- break;
-
- case '!':
- tev_type=TEV_FLASH;
- break;
-
-
- default:
- ortp_warning("Bad dtmf: %c.",dtmf);
- return -1;
- }
-
- m1=rtp_session_create_telephone_event_packet(session,1);
- if (m1==NULL) return -1;
- rtp_session_add_telephone_event(session,m1,tev_type,0,10,durationtier);
- /* create a second packet */
- m2=rtp_session_create_telephone_event_packet(session,0);
- if (m2==NULL) return -1;
- rtp_session_add_telephone_event(session,m2,tev_type,0,10, durationtier+durationtier);
-
- /* create a third and final packet */
- m3=rtp_session_create_telephone_event_packet(session,0);
- if (m3==NULL) return -1;
- rtp_session_add_telephone_event(session,m3,tev_type,1,10,duration);
-
- /* and now sends them */
- rtp_session_sendm_with_ts(session,m1,userts);
- rtp_session_sendm_with_ts(session,m2,userts);
- /* the last packet is sent three times in order to improve reliability*/
- m1=copymsg(m3);
- m2=copymsg(m3);
- /* NOTE: */
- /* we need to copymsg() instead of dupmsg() because the buffers are modified when
- the packet is sended because of the host-to-network conversion of timestamp,ssrc, csrc, and
- seq number.
- */
- rtp_session_sendm_with_ts(session,m3,userts);
- session->rtp.snd_seq--;
- rtp_session_sendm_with_ts(session,m1,userts);
- session->rtp.snd_seq--;
- rtp_session_sendm_with_ts(session,m2,userts);
- return 0;
-}
-
-
-/**
- * Reads telephony events from a rtp packet. *@tab points to the beginning of the event buffer.
- *
- * @param session a rtp session from which telephony events are received.
- * @param packet a rtp packet as a mblk_t.
- * @param tab the address of a pointer.
- * @return the number of events in the packet if successfull, 0 if the packet did not contain telephony events.
-**/
-int rtp_session_read_telephone_event(RtpSession *session,
- mblk_t *packet,telephone_event_t **tab)
-{
- int datasize;
- int num;
- int i;
- telephone_event_t *tev;
- rtp_header_t *hdr=(rtp_header_t*)packet->b_rptr;
- unsigned char *payload;
- if (hdr->paytype!=session->rcv.telephone_events_pt) return 0; /* this is not tel ev.*/
- datasize=rtp_get_payload(packet,&payload);
- tev=*tab=(telephone_event_t*)payload;
- /* convert from network to host order what should be */
- num=datasize/sizeof(telephone_event_t);
- for (i=0;i<num;i++)
- {
- tev[i].duration=ntohs(tev[i].duration);
- }
- return num;
-}
-
-static void notify_tev(RtpSession *session, telephone_event_t *event){
- OrtpEvent *ev;
- OrtpEventData *evd;
- rtp_signal_table_emit2(&session->on_telephone_event,(long)(long)event[0].event);
- if (session->eventqs!=NULL){
- ev=ortp_event_new(ORTP_EVENT_TELEPHONE_EVENT);
- evd=ortp_event_get_data(ev);
- evd->packet=dupmsg(session->current_tev);
- evd->info.telephone_event=event[0].event;
- rtp_session_dispatch_event(session,ev);
- }
-}
-
-static void notify_events_ended(RtpSession *session, telephone_event_t *events, int num){
- int i;
- for (i=0;i<num;i++){
- if (events[i].E==1){
- notify_tev(session, &events[i]);
- }
- }
-}
-
-/* for high level telephony event callback */
-void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0)
-{
- telephone_event_t *events,*evbuf;
- int num,num2;
- int i;
- rtp_header_t *hdr;
- mblk_t *cur_tev;
- unsigned char *payload;
- int datasize;
-
- hdr=(rtp_header_t*)m0->b_rptr;
-
- datasize=rtp_get_payload(m0,&payload);
-
- num=datasize/sizeof(telephone_event_t);
- events=(telephone_event_t*)payload;
-
-
- if (hdr->markbit==1)
- {
- /* this is a start of new events. Store the event buffer for later use*/
- if (session->current_tev!=NULL) {
- freemsg(session->current_tev);
- session->current_tev=NULL;
- }
- session->current_tev=copymsg(m0);
- /* handle the case where the events are short enough to end within the packet that has the marker bit*/
- notify_events_ended(session,events,num);
- }
- /* whatever there is a markbit set or not, we parse the packet and compare it to previously received one */
- cur_tev=session->current_tev;
- if (cur_tev!=NULL)
- {
- /* first compare timestamp, they must be identical */
- if (((rtp_header_t*)cur_tev->b_rptr)->timestamp==
- ((rtp_header_t*)m0->b_rptr)->timestamp)
- {
- datasize=rtp_get_payload(cur_tev,&payload);
- num2=datasize/sizeof(telephone_event_t);
- evbuf=(telephone_event_t*)payload;
- for (i=0;i<MIN(num,num2);i++)
- {
- if (events[i].E==1)
- {
- /* update events that have ended */
- if (evbuf[i].E==0){
- evbuf[i].E=1;
- /* this is a end of event, report it */
- notify_tev(session,&events[i]);
- }
- }
- }
- }
- else
- {
- /* timestamp are not identical: this is not the same events*/
- if (session->current_tev!=NULL) {
- freemsg(session->current_tev);
- session->current_tev=NULL;
- }
- session->current_tev=copymsg(m0);
- notify_events_ended(session,events,num);
- }
- }
- else
- {
- /* there is no pending events, but we did not received marked bit packet
- either the sending implementation is not compliant, either it has been lost,
- we must deal with it anyway.*/
- session->current_tev=copymsg(m0);
- /* inform the application if there are tone ends */
- notify_events_ended(session,events,num);
- }
-}
+++ /dev/null
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
-mrtprecv
-mrtpsend
-rtpmemtest
-rtprecv
-rtpsend
-test_timer
-tevmrtprecv
-tevrtprecv
-tevrtpsend
-rtpsend_stupid
+++ /dev/null
-SUBDIRS=win_receiver win_sender
-
-if BUILD_TESTS
-
-noinst_PROGRAMS= rtpsend rtprecv mrtpsend mrtprecv test_timer rtpmemtest tevrtpsend tevrtprecv tevmrtprecv rtpsend_stupid
-
-rtpsend_SOURCES= rtpsend.c
-
-rtprecv_SOURCES= rtprecv.c
-
-mrtpsend_SOURCES= mrtpsend.c
-
-mrtprecv_SOURCES= mrtprecv.c
-
-rtpmemtest_SOURCES= rtpmemtest.c
-
-test_timer_SOURCES= test_timer.c
-
-tevrtpsend_SOURCES= tevrtpsend.c
-
-tevrtprecv_SOURCES= tevrtprecv.c
-
-tevmrtprecv_SOURCES= tevmrtprecv.c
-
-rtpsend_stupid_SOURCES=rtpsend_stupid.c
-
-endif
-
-AM_CFLAGS= -D_ORTP_SOURCE $(PTHREAD_CFLAGS)
-AM_LDFLAGS= $(PTHREAD_LDFLAGS)
-LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS)
-INCLUDES=-I$(top_srcdir)/include/
+++ /dev/null
-/*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* this program shows how to receive streams in paralel using the SessionSet api
- and two threads only. */
-
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <fcntl.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#endif
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: mrtprecv file_prefix local_port number_of_streams \n"
- "Receives multiples rtp streams on local_port+2*k, k={0..number_of_streams}\n";
-
-#define STREAMS_COUNT 1000
-
-/* malloc'd in order to detect buffer overflows with efence */
-static uint8_t* recvbuf=0;
-
-int rtp2disk(RtpSession *session,uint32_t ts, int fd)
-{
- int err,havemore=1;
- while (havemore){
- err=rtp_session_recv_with_ts(session,recvbuf,160,ts,&havemore);
- if (havemore) printf("warning: havemore=%i!\n",havemore);
- if (err>0){
- rtp_session_set_data(session,(void*)1);
- /* to indicate that (for the application) the stream has started, so we can start
- recording on disk */
- }
- if (session->user_data != NULL) {
- size_t ret = write(fd,recvbuf,err);
- assert( ret == err );
- }
- }
- return 0;
-}
-
-
-int main(int argc, char *argv[])
-{
- RtpSession *session[STREAMS_COUNT];
- int i;
- int filefd[STREAMS_COUNT];
- int port;
- uint32_t user_ts=0;
- int channels;
- SessionSet *set;
- char *filename;
-
- if (argc<4){
- printf("%s",help);
- return -1;
- }
-
- channels=atoi(argv[3]);
- if (channels==0){
- printf("%s",help);
- return -1;
- }
-
- ortp_init();
- ortp_scheduler_init();
-
- port=atoi(argv[2]);
- recvbuf=ortp_malloc(160);
-
- for (i=0;i<channels;i++){
-
- session[i]=rtp_session_new(RTP_SESSION_RECVONLY);
- rtp_session_set_scheduling_mode(session[i],1);
- rtp_session_set_blocking_mode(session[i],0);
- rtp_session_set_local_addr(session[i],"0.0.0.0",port);
- rtp_session_set_payload_type(session[i],0);
- rtp_session_enable_adaptive_jitter_compensation(session[i], TRUE);
- rtp_session_set_recv_buf_size(session[i],256);
- port+=2;
- }
-
- filename=ortp_malloc(strlen(argv[1])+15);
- for (i=0;i<channels;i++){
- sprintf(filename,"%s%4.4d.dat",argv[1],i);
- #ifndef _WIN32
- filefd[i]=open(filename,O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
- #else
- filefd[i]=open(filename,_O_BINARY | O_WRONLY | O_CREAT | O_TRUNC);
- #endif
- if (filefd[i]<0) ortp_error("Could not open %s for writing: %s",filename,strerror(errno));
- }
- signal(SIGINT,stophandler);
- /* create a set */
- set=session_set_new();
- while(runcond)
- {
- int k;
-
- for (k=0;k<channels;k++){
- /* add the session to the set */
- session_set_set(set,session[k]);
- //printf("session_set_set %d\n", k);
- }
- /* and then suspend the process by selecting() */
- k=session_set_select(set,NULL,NULL);
- if (k==0) printf("warning: session_set_select() is returning 0...\n");
- for (k=0;k<channels;k++){
- if (session_set_is_set(set,session[k])){
- rtp2disk(session[k],user_ts,filefd[k]);
- //printf("session_set_is_set %d\n", k);
- } else {
- //printf("warning: session %i is not set !\n",k);
- }
- }
- user_ts+=160;
- }
- printf("Exiting\n");
- for (i=0;i<channels;i++){
- close(filefd[i]);
- rtp_session_destroy(session[i]);
- }
- session_set_destroy(set);
- ortp_free(filename);
- ortp_exit();
- ortp_global_stats_display();
- ortp_free(recvbuf);
- return 0;
-}
+++ /dev/null
- /*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* this program shows how to send streams in paralel using the SessionSet api
- and two threads only. */
-
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifndef _WIN32
-#include <sys/types.h>
-#include <sys/time.h>
-#endif
-
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: mrtpsend filename ip port nstreams [--packet-size size] [--ts-inc value]\n";
-
-#define STREAMS_COUNT 1000
-
-
-
-int main(int argc, char *argv[])
-{
- RtpSession *session[STREAMS_COUNT];
- unsigned char *buffer;
- int packet_size=160;
- int ts_inc=160;
- int i;
- FILE *infile;
- char *ssrc;
- int port;
- uint32_t user_ts=0;
- int channels;
- SessionSet *set;
-
- if (argc<5){
- printf("%s",help);
- return -1;
- }
-
- channels=atoi(argv[4]);
- if (channels==0){
- printf("%s",help);
- return -1;
- }
-
- /* look at command line options */
- for (i=5;i<argc;i++)
- {
- if (strcmp(argv[i],"--packet-size")==0)
- {
- if ( i+1 < argc ){
- packet_size=atoi(argv[i+1]);
- }
- else {
- printf("%s",help);
- return -1;
- }
- if (packet_size==0) {
- printf("Packet size can't be %s.\n",argv[i+1]);
- return -1;
- }
- i+=1;
-
- }
- else if (strcmp(argv[i],"--ts-inc")==0)
- {
- if ( i+1 < argc ){
- ts_inc=atoi(argv[i+1]);
- }
- else {
- printf("%s",help);
- return -1;
- }
- if (ts_inc==0) {
- printf("Timestanp increment can't be %s.\n",argv[i+1]);
- return -1;
- }
- i+=1;
-
- }
- }
- printf("Timestamp increment will be %i\n",ts_inc);
- printf("Packet size will be %i\n",packet_size);
- buffer=ortp_malloc(packet_size);
- ortp_init();
- ortp_scheduler_init();
- printf("scheduler initialized\n");
- ssrc=getenv("SSRC");
- port=atoi(argv[3]);
- for (i=0;i<channels;i++){
- printf("channel %d\n", i);
- session[i]=rtp_session_new(RTP_SESSION_SENDONLY);
- rtp_session_set_scheduling_mode(session[i],1);
- rtp_session_set_blocking_mode(session[i],0);
- rtp_session_set_remote_addr(session[i],argv[2],port);
- rtp_session_set_payload_type(session[i],0);
- if (ssrc!=NULL) rtp_session_set_ssrc(session[i],atoi(ssrc));
- port+=2;
- }
-
- #ifndef _WIN32
- infile=fopen(argv[1],"r");
- #else
- infile=fopen(argv[1],"rb");
- #endif
- if (infile==NULL) {
- perror("Cannot open file");
- return -1;
- }
- printf("open file\n");
- signal(SIGINT,stophandler);
- /* create a set */
- set=session_set_new();
- while( ((i=fread(buffer,1,packet_size,infile))>0) && (runcond) )
- {
- int k;
- //ortp_message("Sending packet.");
- for (k=0;k<channels;k++){
- /* add the session to the set */
- session_set_set(set,session[k]);
- }
- /* and then suspend the process by selecting() */
- session_set_select(NULL,set,NULL);
- for (k=0;k<channels;k++){
- /* this is stupid to do this test, because all session work the same way,
- as the same user_ts is used for all sessions, here. */
- if (session_set_is_set(set,session[k])){
- rtp_session_send_with_ts(session[k],buffer,i,user_ts);
- //ortp_message("packet sended !");
- }
- }
- user_ts+=ts_inc;
- }
- fclose(infile);
- printf("close file\n");
- /*sleep a little to wait last packets to be sent */
- #ifndef _WIN32
- sleep(1);
- #else
- Sleep(1);
- #endif
- for (i=0;i<channels;i++)
- rtp_session_destroy(session[i]);
- session_set_destroy(set);
- ortp_free(buffer);
- ortp_exit();
- ortp_global_stats_display();
- return 0;
-}
+++ /dev/null
- /*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* this program shows how to receive streams in paralel using the SessionSet api
- and two threads only. */
-
-#include <ortp/ortp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#ifndef _WIN32
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#else
-//#include <time.h>
-#endif
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: mrtprecv file_prefix local_port number_of_streams \n"
- "Receives multiples rtp streams on local_port+2*k, k={0..number_of_streams}\n";
-
-#define STREAMS_COUNT 1000
-
-int rtp2disk(RtpSession *session,uint32_t ts, int fd)
-{
- unsigned char buffer[160];
- int err,havemore=1;
- while (havemore){
- err=rtp_session_recv_with_ts(session,buffer,160,ts,&havemore);
- if (err>0){
- rtp_session_set_data(session,(void*)1);
- /* to indicate that (for the application) the stream has started, so we can start
- recording on disk */
- }
- if (session->user_data != NULL) {
- size_t ret = write(fd,buffer,err);
- assert( ret == err );
- }
- }
- return 0;
-}
-
-
-int main(int argc, char *argv[])
-{
- RtpSession *session[STREAMS_COUNT];
- int i;
- int filefd[STREAMS_COUNT];
- int port;
- uint32_t user_ts=0;
- int channels;
- SessionSet *set;
- char *filename;
-
- argc=4;
- argv[1]="/tmp/output";
- argv[2]="8000";
- argv[3]="100";
-
- if (argc<4){
- printf("%s",help);
- return -1;
- }
-
- channels=atoi(argv[3]);
- if (channels==0){
- printf("%s",help);
- return -1;
- }
-
- ortp_init();
- ortp_scheduler_init();
-
- port=atoi(argv[2]);
- for (i=0;i<channels;i++){
- session[i]=rtp_session_new(RTP_SESSION_RECVONLY);
- rtp_session_set_scheduling_mode(session[i],1);
- rtp_session_set_blocking_mode(session[i],0);
-#ifdef ORTP_INET6
- rtp_session_set_local_addr(session[i],"::",port);
-#else
- rtp_session_set_local_addr(session[i],"0.0.0.0",port);
-#endif
- rtp_session_set_payload_type(session[i],0);
- rtp_session_set_recv_buf_size(session[i],256);
- port+=2;
- }
-
- filename=ortp_malloc(strlen(argv[1])+8);
- for (i=0;i<channels;i++){
- sprintf(filename,"%s%4.4d.dat",argv[1],i);
- filefd[i]=open(filename,O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
- if (filefd[i]<0) ortp_error("Could not open %s for writing: %s",filename,strerror(errno));
- }
- ortp_free(filename);
- signal(SIGINT,stophandler);
- /* create a set */
- set=session_set_new();
- while(runcond)
- {
- int k;
-
- for (k=0;k<channels;k++){
- /* add the session to the set */
- session_set_set(set,session[k]);
- //printf("session[k]->setflags=%i\n",session[k]->setflags);
- }
- /* and then suspend the process by selecting() */
- session_set_select(set,NULL,NULL);
- for (k=0;k<channels;k++){
- if (session_set_is_set(set,session[k])){
- rtp2disk(session[k],user_ts,filefd[k]);
- }
- }
- user_ts+=160;
- }
- for (i=0;i<channels;i++){
- close(filefd[i]);
- rtp_session_destroy(session[i]);
- }
- session_set_destroy(set);
- ortp_global_stats_display();
- ortp_exit();
- return 0;
-}
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack..
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdlib.h>
-#ifndef _WIN32
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-#endif
-
-int cond=1;
-
-void stop_handler(int signum)
-{
- cond=0;
-}
-
-void ssrc_cb(RtpSession *session)
-{
- printf("hey, the ssrc has changed !\n");
-}
-
-static char *help="usage: rtprecv filename loc_port [--format format] [--soundcard] [--noadapt] [--with-jitter <milliseconds>]\n";
-
-#define MULAW 0
-#define ALAW 1
-
-#if defined(__hpux) && HAVE_SYS_AUDIO_H
-
-#include <sys/audio.h>
-
-int sound_init(int format)
-{
- int fd;
- fd=open("/dev/audio",O_WRONLY);
- if (fd<0){
- perror("Can't open /dev/audio");
- return -1;
- }
- ioctl(fd,AUDIO_RESET,0);
- ioctl(fd,AUDIO_SET_SAMPLE_RATE,8000);
- ioctl(fd,AUDIO_SET_CHANNELS,1);
- if (format==MULAW)
- ioctl(fd,AUDIO_SET_DATA_FORMAT,AUDIO_FORMAT_ULAW);
- else ioctl(fd,AUDIO_SET_DATA_FORMAT,AUDIO_FORMAT_ALAW);
- return fd;
-}
-#else
-int sound_init(int format)
-{
- return -1;
-}
-#endif
-
-int main(int argc, char*argv[])
-{
- RtpSession *session;
- unsigned char buffer[160];
- int err;
- uint32_t ts=0;
- int stream_received=0;
- FILE *outfile;
- int local_port;
- int have_more;
- int i;
- int format=0;
- int soundcard=0;
- int sound_fd=0;
- int jittcomp=40;
- bool_t adapt=TRUE;
-
- /* init the lib */
- if (argc<3){
- printf("%s",help);
- return -1;
- }
- local_port=atoi(argv[2]);
- if (local_port<=0) {
- printf("%s",help);
- return -1;
- }
- for (i=3;i<argc;i++)
- {
- if (strcmp(argv[i],"--noadapt")==0) adapt=FALSE;
- if (strcmp(argv[i],"--format")==0){
- i++;
- if (i<argc){
- if (strcmp(argv[i],"mulaw")==0){
- format=MULAW;
- }else
- if (strcmp(argv[i],"alaw")==0){
- format=ALAW;
- }else{
- printf("Unsupported format %s\n",argv[i]);
- return -1;
- }
- }
- }
- else if (strcmp(argv[i],"--soundcard")==0){
- soundcard=1;
- }
- else if (strcmp(argv[i],"--with-jitter")==0){
- i++;
- if (i<argc){
- jittcomp=atoi(argv[i]);
- printf("Using a jitter buffer of %i milliseconds.\n",jittcomp);
- }
- }
- }
-
- outfile=fopen(argv[1],"wb");
- if (outfile==NULL) {
- perror("Cannot open file for writing");
- return -1;
- }
-
-
- if (soundcard){
- sound_fd=sound_init(format);
- }
-
- ortp_init();
- ortp_scheduler_init();
- ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
- signal(SIGINT,stop_handler);
- session=rtp_session_new(RTP_SESSION_RECVONLY);
- rtp_session_set_scheduling_mode(session,1);
- rtp_session_set_blocking_mode(session,1);
- rtp_session_set_local_addr(session,"0.0.0.0",atoi(argv[2]));
- rtp_session_set_connected_mode(session,TRUE);
- rtp_session_set_symmetric_rtp(session,TRUE);
- rtp_session_enable_adaptive_jitter_compensation(session,adapt);
- rtp_session_set_jitter_compensation(session,jittcomp);
- rtp_session_set_payload_type(session,0);
- rtp_session_signal_connect(session,"ssrc_changed",(RtpCallback)ssrc_cb,0);
- rtp_session_signal_connect(session,"ssrc_changed",(RtpCallback)rtp_session_reset,0);
-
- while(cond)
- {
- have_more=1;
- while (have_more){
- err=rtp_session_recv_with_ts(session,buffer,160,ts,&have_more);
- if (err>0) stream_received=1;
- /* this is to avoid to write to disk some silence before the first RTP packet is returned*/
- if ((stream_received) && (err>0)) {
- size_t ret = fwrite(buffer,1,err,outfile);
- if (sound_fd>0)
- ret = write(sound_fd,buffer,err);
- }
- }
- ts+=160;
- //ortp_message("Receiving packet.");
- }
-
- rtp_session_destroy(session);
- ortp_exit();
-
- ortp_global_stats_display();
-
- return 0;
-}
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdlib.h>
-
-#ifndef _WIN32
-#include <sys/types.h>
-#include <sys/time.h>
-#include <stdio.h>
-#endif
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static const char *help="usage: rtpsend filename dest_ip4addr dest_port [ --with-clockslide <value> ] [ --with-jitter <milliseconds>]\n";
-
-int main(int argc, char *argv[])
-{
- RtpSession *session;
- unsigned char buffer[160];
- int i;
- FILE *infile;
- char *ssrc;
- uint32_t user_ts=0;
- int clockslide=0;
- int jitter=0;
- if (argc<4){
- printf("%s", help);
- return -1;
- }
- for(i=4;i<argc;i++){
- if (strcmp(argv[i],"--with-clockslide")==0){
- i++;
- if (i>=argc) {
- printf("%s", help);
- return -1;
- }
- clockslide=atoi(argv[i]);
- ortp_message("Using clockslide of %i milisecond every 50 packets.",clockslide);
- }else if (strcmp(argv[i],"--with-jitter")==0){
- ortp_message("Jitter will be added to outgoing stream.");
- i++;
- if (i>=argc) {
- printf("%s", help);
- return -1;
- }
- jitter=atoi(argv[i]);
- }
- }
-
- ortp_init();
- ortp_scheduler_init();
- ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
- session=rtp_session_new(RTP_SESSION_SENDONLY);
-
- rtp_session_set_scheduling_mode(session,1);
- rtp_session_set_blocking_mode(session,1);
- rtp_session_set_connected_mode(session,TRUE);
- rtp_session_set_remote_addr(session,argv[2],atoi(argv[3]));
- rtp_session_set_payload_type(session,0);
-
- ssrc=getenv("SSRC");
- if (ssrc!=NULL) {
- printf("using SSRC=%i.\n",atoi(ssrc));
- rtp_session_set_ssrc(session,atoi(ssrc));
- }
-
- #ifndef _WIN32
- infile=fopen(argv[1],"r");
- #else
- infile=fopen(argv[1],"rb");
- #endif
-
- if (infile==NULL) {
- perror("Cannot open file");
- return -1;
- }
-
- signal(SIGINT,stophandler);
- while( ((i=fread(buffer,1,160,infile))>0) && (runcond) )
- {
- rtp_session_send_with_ts(session,buffer,i,user_ts);
- user_ts+=160;
- if (clockslide!=0 && user_ts%(160*50)==0){
- ortp_message("Clock sliding of %i miliseconds now",clockslide);
- rtp_session_make_time_distorsion(session,clockslide);
- }
- /*this will simulate a burst of late packets */
- if (jitter && (user_ts%(8000)==0)) {
- struct timespec pausetime, remtime;
- ortp_message("Simulating late packets now (%i milliseconds)",jitter);
- pausetime.tv_sec=jitter/1000;
- pausetime.tv_nsec=(jitter%1000)*1000000;
- while(nanosleep(&pausetime,&remtime)==-1 && errno==EINTR){
- pausetime=remtime;
- }
- }
- }
-
- fclose(infile);
- rtp_session_destroy(session);
- ortp_exit();
- ortp_global_stats_display();
-
- return 0;
-}
+++ /dev/null
- /*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdlib.h>
-
-#ifndef _WIN32
-#include <sys/types.h>
-#include <sys/time.h>
-#include <stdio.h>
-#endif
-/*defined in library, but not declared in public headers (this method is only useful for tests)*/
-extern int __rtp_session_sendm_with_ts(RtpSession *session, mblk_t *packet, uint32_t packet_ts, uint32_t send_ts);
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: rtpsend filename dest_ip4addr dest_port [ --with-clockslide <value> ] [ --with-ptime <milliseconds>]\n";
-
-int main(int argc, char *argv[])
-{
- RtpSession *session;
- unsigned char buffer[160];
- int i;
- FILE *infile;
- char *ssrc;
- uint32_t packet_ts=0,send_ts=0;
- uint32_t send_ts_inc=160;
- int clockslide=0;
- int jitter=0;
- if (argc<4){
- printf("%s",help);
- return -1;
- }
- for(i=4;i<argc;i++){
- if (strcmp(argv[i],"--with-clockslide")==0){
- i++;
- if (i>=argc) {
- printf("%s",help);
- return -1;
- }
- clockslide=atoi(argv[i]);
- ortp_message("Using clockslide of %i milisecond every 50 packets.",clockslide);
- }else if (strcmp(argv[i],"--with-ptime")==0){
- ortp_message("Ptime related jitter will be added to outgoing stream.");
- i++;
- if (i>=argc) {
- printf("%s",help);
- return -1;
- }
- jitter=atoi(argv[i]);
- send_ts_inc=jitter*8;
- }
- }
-
- ortp_init();
- ortp_scheduler_init();
- ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
- session=rtp_session_new(RTP_SESSION_SENDONLY);
-
- rtp_session_set_scheduling_mode(session,1);
- rtp_session_set_blocking_mode(session,1);
- rtp_session_set_connected_mode(session,TRUE);
- rtp_session_set_remote_addr(session,argv[2],atoi(argv[3]));
- rtp_session_set_payload_type(session,0);
-
- ssrc=getenv("SSRC");
- if (ssrc!=NULL) {
- printf("using SSRC=%i.\n",atoi(ssrc));
- rtp_session_set_ssrc(session,atoi(ssrc));
- }
-
- #ifndef _WIN32
- infile=fopen(argv[1],"r");
- #else
- infile=fopen(argv[1],"rb");
- #endif
-
- if (infile==NULL) {
- perror("Cannot open file");
- return -1;
- }
-
- signal(SIGINT,stophandler);
- while( ((i=fread(buffer,1,160,infile))>0) && (runcond) )
- {
- mblk_t *m=rtp_session_create_packet(session,RTP_FIXED_HEADER_SIZE,buffer,i);
- __rtp_session_sendm_with_ts(session,m,packet_ts,send_ts);
- packet_ts+=160;
- if ((send_ts+send_ts_inc)<=packet_ts){
- send_ts+=send_ts_inc;
- }
- if (clockslide!=0 && send_ts%(160*50)==0){
- ortp_message("Clock sliding of %i miliseconds now",clockslide);
- rtp_session_make_time_distorsion(session,clockslide);
- }
- }
-
- fclose(infile);
- rtp_session_destroy(session);
- ortp_exit();
- ortp_global_stats_display();
-
- return 0;
-}
+++ /dev/null
- /*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-
-#include "../rtptimer.h"
-#include <stdio.h>
-
-int main(int argc, char *argv[])
-{
- RtpTimer *timer=&posix_timer;
- int i;
- struct timeval interval;
-
- interval.tv_sec=0;
- interval.tv_usec=500000;
-
- rtp_timer_set_interval(timer,&interval);
-
- timer->timer_init();
- for (i=0;i<10;i++)
- {
- printf("doing something...\n");
- timer->timer_do();
- }
- timer->timer_uninit();
- return 0;
-}
+++ /dev/null
- /*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-/* this program shows how to receive streams in paralel using the SessionSet api
- and two threads only. */
-
-#include <ortp/ortp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#ifndef _WIN32
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#else
-//#include <time.h>
-#endif
-
-#include <ortp/telephonyevents.h>
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'};
-
-static int *p_channel_id;
-
-int dtmf_count=0;
-
-static char *help="usage: tevmrtprecv file_prefix local_port number_of_streams \n"
- "Receives multiples rtp streams with telephone events on local_port+2*k, k={0..number_of_streams}\n";
-
-#define STREAMS_COUNT 1000
-
-
-void recv_tev_cb(RtpSession *session,int type,long user_data)
-{
- //printf("Receiving telephony event:%i\n",type);
- if (type<16) printf("This is dtmf %c on channel %d\n",dtmf_tab[type],*(int *)user_data);
- dtmf_count++;
-}
-
-int rtp2disk(RtpSession *session,uint32_t ts, int fd)
-{
- unsigned char buffer[160];
- int err,havemore=1;
- while (havemore){
- err=rtp_session_recv_with_ts(session,buffer,160,ts,&havemore);
- if (err>0){
- rtp_session_set_data(session,(void*)1);
- /* to indicate that (for the application) the stream has started, so we can start
- recording on disk */
- }
- if (session->user_data != NULL) {
- size_t ret = write(fd,buffer,err);
- assert( ret == err );
- }
- }
- return 0;
-}
-
-
-int main(int argc, char *argv[])
-{
- RtpSession *session[STREAMS_COUNT];
- int i;
- int filefd[STREAMS_COUNT];
- int port;
- uint32_t user_ts=0;
- int channels;
- SessionSet *set;
- char *filename;
-
- if (argc<4){
- printf("%s",help);
- return -1;
- }
-
- channels=atoi(argv[3]);
- if (channels==0){
- printf("%s",help);
- return -1;
- }
-
- ortp_init();
- ortp_scheduler_init();
-
- /* set the telephony event payload type to 96 in the av profile.*/
- rtp_profile_set_payload(&av_profile,96,&payload_type_telephone_event);
-
- port=atoi(argv[2]);
- p_channel_id = (int *)ortp_malloc(channels*sizeof(int));
- for (i=0;i<channels;i++){
- session[i]=rtp_session_new(RTP_SESSION_RECVONLY);
- rtp_session_set_scheduling_mode(session[i],1);
- rtp_session_set_blocking_mode(session[i],0);
-
- rtp_session_set_local_addr(session[i],"0.0.0.0",port);
- rtp_session_set_recv_payload_type(session[i],0);
- rtp_session_set_recv_buf_size(session[i],256);
-
- p_channel_id[i] = i;
- /* register for telephony events */
- rtp_session_signal_connect(session[i],"telephone-event",(RtpCallback)recv_tev_cb,(long)&p_channel_id[i]);
-
- port+=2;
- }
-
- filename=ortp_malloc(strlen(argv[1])+8);
- for (i=0;i<channels;i++){
- sprintf(filename,"%s%4.4d.dat",argv[1],i);
- #ifndef _WIN32
- filefd[i]=open(filename,O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
- #else
- filefd[i]=open(filename,_O_BINARY | O_WRONLY | O_CREAT | O_TRUNC);
- #endif
- if (filefd[i]<0) ortp_error("Could not open %s for writing: %s",filename,strerror(errno));
- }
- signal(SIGINT,stophandler);
- /* create a set */
- set=session_set_new();
- while(runcond)
- {
- int k;
-
- for (k=0;k<channels;k++){
- /* add the session to the set */
- session_set_set(set,session[k]);
-
- }
- /* and then suspend the process by selecting() */
- session_set_select(set,NULL,NULL);
- for (k=0;k<channels;k++){
- if (session_set_is_set(set,session[k])){
- rtp2disk(session[k],user_ts,filefd[k]);
- }
- }
- user_ts+=160;
- }
- for (i=0;i<channels;i++){
- close(filefd[i]);
- rtp_session_destroy(session[i]);
- }
- session_set_destroy(set);
- ortp_free(p_channel_id);
- ortp_free(filename);
- ortp_exit();
- ortp_global_stats_display();
- return 0;
-}
+++ /dev/null
-/*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include <ortp/telephonyevents.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#include <stdio.h>
-
-int runcond=1;
-
-static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'};
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: test_tevrecv filename loc_port\n";
-
-int dtmf_count=0;
-
-void recv_tev_cb(RtpSession *session,int type,long user_data)
-{
- printf("Receiving telephony event:%i\n",type);
- if (type<16) printf("This is dtmf %c\n",dtmf_tab[type]);
- dtmf_count++;
-}
-
-int main(int argc, char *argv[])
-{
- RtpSession *session;
- unsigned char buffer[160];
- int err;
- FILE *outfile;
- uint32_t ts=0;
- int have_more;
-
- if (argc<3){
- printf("%s",help);
- return -1;
- }
-
- ortp_init();
- ortp_scheduler_init();
-
- /* set the telephony event payload type to 96 in the av profile.*/
- rtp_profile_set_payload(&av_profile,96,&payload_type_telephone_event);
-
- session=rtp_session_new(RTP_SESSION_RECVONLY);
-
- rtp_session_set_scheduling_mode(session,1);
- rtp_session_set_blocking_mode(session,1);
- rtp_session_set_local_addr(session,"0.0.0.0",atoi(argv[2]));
- rtp_session_set_payload_type(session,0);
-
- /* register for telephony events */
- rtp_session_signal_connect(session,"telephone-event",(RtpCallback)recv_tev_cb,0);
-
- outfile=fopen(argv[1],"wb");
- if (outfile==NULL) {
- perror("Cannot open file");
- return -1;
- }
- signal(SIGINT,stophandler);
- while(runcond)
- {
- have_more=1;
- while (have_more){
- err=rtp_session_recv_with_ts(session,buffer,160,ts,&have_more);
- if (err>0) {
- size_t ret = fwrite(buffer,1,err,outfile);
- assert( ret == err );
- }
- }
- ts+=160;
- //ortp_message("Receiving packet.");
- }
- fclose(outfile);
- rtp_session_destroy(session);
- ortp_exit();
- ortp_global_stats_display();
- printf("Total dtmf events received: %i\n",dtmf_count);
- return 0;
-}
+++ /dev/null
-/*
- The oRTP LinPhone RTP library intends to provide basics for a RTP stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include <ortp/ortp.h>
-#include <ortp/telephonyevents.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#include <stdio.h>
-
-int runcond=1;
-
-void stophandler(int signum)
-{
- runcond=0;
-}
-
-static char *help="usage: test_tevsend filename dest_ip4addr dest_port\n";
-
-int main(int argc, char *argv[])
-{
- RtpSession *session;
- unsigned char buffer[160];
- int i;
- FILE *infile;
- char *ssrc;
- uint32_t user_ts=0;
- int tel=0;
-
- if (argc<4){
- printf("%s",help);
- return -1;
- }
-
- ortp_init();
- ortp_scheduler_init();
-
- /* set the telephony event payload type to 96 in the av profile.*/
- rtp_profile_set_payload(&av_profile,96,&payload_type_telephone_event);
-
- session=rtp_session_new(RTP_SESSION_SENDONLY);
-
- rtp_session_set_scheduling_mode(session,1);
- rtp_session_set_blocking_mode(session,1);
- rtp_session_set_remote_addr(session,argv[2],atoi(argv[3]));
- rtp_session_set_send_payload_type(session,0);
-
- ssrc=getenv("SSRC");
- if (ssrc!=NULL) {
- printf("using SSRC=%i.\n",atoi(ssrc));
- rtp_session_set_ssrc(session,atoi(ssrc));
- }
-
- infile=fopen(argv[1],"rb");
- if (infile==NULL) {
- perror("Cannot open file");
- return -1;
- }
- signal(SIGINT,stophandler);
- while( ((i=fread(buffer,1,160,infile))>0) && (runcond) )
- {
- //ortp_message("Sending packet.");
- rtp_session_send_with_ts(session,buffer,i,user_ts);
- user_ts+=160;
- tel++;
- if (tel==50){
- tel=0;
- ortp_message("Sending telephony event packet.");
- rtp_session_send_dtmf(session,'*',user_ts);
- user_ts+=160+160+160; /* the duration of the dtmf */
- }
- }
- fclose(infile);
- rtp_session_destroy(session);
- ortp_exit();
- ortp_global_stats_display();
- return 0;
-}
+++ /dev/null
-Makefile.in
-Makefile
+++ /dev/null
-EXTRA_DIST=RTPReceiver.cpp RTPReceiver.vcproj
-
+++ /dev/null
-#include <ortp/ortp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-
-#define STREAMS_COUNT 1000
-
-BOOL m_bExit = FALSE;
-
-static char *help="usage: mrtprecv file_prefix local_port number_of_streams \n"
- "Receives multiples rtp streams on local_port+2*k, k={0..number_of_streams}\n";
-
-
-void ProductVersion()
-{
- char strBuffer[255];
-
- printf("====================================\n");
- printf("Author : Simon Morlat =\n");
- printf("Porting : Yann STEPHAN =\n");
- printf("====================================\n");
-
- memset(&strBuffer, 0x0, sizeof(strBuffer));
-
- sprintf((char *) &strBuffer, "= RTPReceiver V1.0 - Date : %s - %s\n", __DATE__, __TIME__);
- printf(strBuffer);
-
- printf("====================================\n");
-}
-
-BOOL ctrlHandlerFunction(DWORD fdwCtrlType)
-{
- switch (fdwCtrlType)
- {
- // Handle the CTRL+C signal.
- // CTRL+CLOSE: confirm that the user wants to exit.
- case CTRL_C_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_LOGOFF_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- m_bExit = TRUE;
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
-int rtp2disk(RtpSession *session,uint32_t ts, FILE * fd)
-{
- char buffer[160];
- int err,havemore=1;
-
- while (havemore)
- {
- err=rtp_session_recv_with_ts(session,buffer,160,ts,&havemore);
-
- if (havemore)
- printf("==> Warning: havemore=1!\n");
-
- if (err>0)
- {
- rtp_session_set_data(session,(void*)1);
- /* to indicate that (for the application) the stream has started, so we can start
- recording on disk */
- }
-
- if (session->user_data != NULL)
- {
- fwrite(&buffer,1,160, fd);
- }
- }
- return 0;
-}
-
-int GetSystemInformation()
-{
- SYSTEM_INFO SystemInfo;
-
- GetSystemInfo(&SystemInfo);
-
- return SystemInfo.dwNumberOfProcessors;
-}
-
-int __cdecl main(int argc, char *argv[])
-{
- RtpSession * session[STREAMS_COUNT];
- FILE * filefd[STREAMS_COUNT];
- SessionSet * set;
-
- uint32_t user_ts = 0;
-
- int port = 0;
- int channels = 0;
- int i = 0;
- int nCPUCount = 0;
- int nSchedulerCPU = 2;
-
- char strFilename[MAX_PATH];
-
- ProductVersion();
-
- if (argc<4)
- {
- printf(help);
- return -1;
- }
-
- channels=atoi(argv[3]);
- if (channels==0){
- printf(help);
- return -1;
- }
-
- // Now it's time to use the power of multiple CPUs
- nCPUCount = GetSystemInformation();
-
- printf("==> # of CPU detected : %d\n", nCPUCount);
-
- ortp_init();
- ortp_scheduler_init();
-
- if (nCPUCount > 1)
- {
- if (nCPUCount > 2)
- {
- nSchedulerCPU = 3;
- }
-
-/* if (ortp_bind_scheduler_to_cpu(nSchedulerCPU) != -1)
- {
- printf("==> Scheduler has been binded to CPU %d\n", nSchedulerCPU);
- }
- else
- {
- printf("==> Scheduler still binded to CPU 1\n");
- }
-*/
- }
-
- port=atoi(argv[2]);
-
- for (i=0;i<channels;i++)
- {
- session[i]=rtp_session_new(RTP_SESSION_RECVONLY);
- rtp_session_set_scheduling_mode(session[i],1);
- rtp_session_set_blocking_mode(session[i],0);
- rtp_session_set_local_addr(session[i],"0.0.0.0",port);
- rtp_session_set_send_payload_type(session[i],0);
- rtp_session_enable_adaptive_jitter_compensation(session[i], TRUE);
- rtp_session_set_recv_buf_size(session[i],256);
- port+=2;
- }
-
- memset(strFilename, 0x0, sizeof(strFilename));
-
- for (i=0;i<channels;i++)
- {
- sprintf(strFilename,"%s%4.4d.dat",argv[1],i);
-
- filefd[i]=fopen(strFilename, "wb");
-
- if (filefd[i]<0)
- {
- printf("Could not open %s for writing: %s",strFilename,strerror(errno));
- }
- }
-
- // =============== INSTALL THE CONTROL HANDLER ===============
- if (SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ctrlHandlerFunction, TRUE) == 0)
- {
- printf("==> Cannot handle the CTRL-C...\n");
- }
-
- /* create a set */
- set=session_set_new();
- printf("==> RTP Receiver started\n");
-
- while(m_bExit == FALSE)
- {
- int k;
-
- for (k=0;k<channels;k++){
- /* add the session to the set */
- session_set_set(set,session[k]);
- //printf("session_set_set %d\n", k);
- }
- /* and then suspend the process by selecting() */
- k=session_set_select(set,NULL,NULL);
- //printf("session_set_select\n");
- if (k==0)
- {
- printf("==> Warning: session_set_select() is returning 0...\n");
- }
-
- for (k=0;k<channels;k++){
- if (session_set_is_set(set,session[k]))
- {
- rtp2disk(session[k],user_ts,filefd[k]);
- //printf("==> Session_set_is_set %d\n", k);
- }
- else
- {
- //printf("warning: session %i is not set !\n",k);
- }
- }
- user_ts+=160;
- }
-
- printf("==> Exiting\n");
-
- for (i=0;i<channels;i++)
- {
- fclose(filefd[i]);
- rtp_session_destroy(session[i]);
- }
- session_set_destroy(set);
-
- ortp_exit();
-
- ortp_global_stats_display();
-
- printf("Waiting for exit : ");
-
- for (i = 0; i < 4*5; i++)
- {
- printf(".");
- Sleep(250);
- }
-
- return 0;
-}
-
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="RTPReceiver"
- ProjectGUID="{14A51171-516C-4D50-A88C-953B9B09F34F}"
- RootNamespace="HPRTP_DIRECTX_oRTPReceiver"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- UseOfMFC="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)include";"$(SolutionDir)include\ortp";"$(SolutionDir)src";"$(SolutionDir)build\win32native\include""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- CallingConvention="0"
- CompileAs="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="oRTP.lib Ws2_32.lib Winmm.lib"
- OutputFile="$(SolutionDir)Final/Exe/Debug/RTPReceiver.exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="$(SolutionDir)Final/Lib/Debug"
- IgnoreAllDefaultLibraries="false"
- IgnoreDefaultLibraryNames="libcmtd"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/RTPReceiver.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(SolutionDir)include";"$(SolutionDir)include\ortp";"$(SolutionDir)src";"$(SolutionDir)build\win32native\include""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="0"
- CallingConvention="0"
- CompileAs="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="oRTP.lib Ws2_32.lib Winmm.lib"
- OutputFile="$(SolutionDir)Final/Exe/Release/RTPReceiver.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="$(SolutionDir)Final/Lib/Release"
- IgnoreAllDefaultLibraries="false"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\RTPReceiver.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-Makefile.in
-Makefile
+++ /dev/null
-EXTRA_DIST=RTPSender.cpp RTPSender.vcproj
-
+++ /dev/null
-#include <ortp/ortp.h>
-#include <string.h>
-
-#define STREAMS_COUNT 1000
-
-enum
-{
- EVENT_STOP,
- EVENT_RTP,
- EVENT_COUNT // Always last
-};
-
-
-RtpSession * m_Session[STREAMS_COUNT];
-
-int m_nPacket_Size = 160;
-int m_nTimestamp_Inc = 160;
-
-char * m_pBuffer = NULL;
-char * m_SSRC = NULL;
-
-int m_nChannels = 0;
-int m_nPort = 0;
-
-HANDLE m_hEvents[EVENT_COUNT];
-
-BOOL m_bExit = FALSE;
-
-static char *help="usage: mrtpsend filename ip port nstreams [--packet-size size] [--ts-inc value]\n";
-
-BOOL ctrlHandlerFunction(DWORD fdwCtrlType)
-{
- switch (fdwCtrlType)
- {
- // Handle the CTRL+C signal.
- // CTRL+CLOSE: confirm that the user wants to exit.
- case CTRL_C_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_LOGOFF_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- m_bExit = TRUE;
- SetEvent(m_hEvents[EVENT_STOP]);
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
-int GetCommandArguments(int argc, char *argv[])
-{
- int nCounter;
-
- // Check the number of arguments
- if (argc<5)
- {
- printf(help);
- return -1;
- }
-
- m_nChannels = atoi(argv[4]);
-
- // Get the number of channels
- if (m_nChannels == 0)
- {
- printf(help);
- return -1;
- }
-
- /* look at command line options */
- for (nCounter=5; nCounter<argc; nCounter++)
- {
- if (strcmp(argv[nCounter],"--packet-size")==0)
- {
- if ( nCounter+1 < argc ){
- m_nPacket_Size=atoi(argv[nCounter+1]);
- }
- else {
- printf(help);
- return -1;
- }
- if (m_nPacket_Size==0)
- {
- printf("Packet size can't be %s.\n",argv[nCounter+1]);
- return -1;
- }
- nCounter+=1;
-
- }
- else if (strcmp(argv[nCounter],"--ts-inc")==0)
- {
- if ( nCounter+1 < argc )
- {
- m_nTimestamp_Inc=atoi(argv[nCounter+1]);
- }
- else {
- printf(help);
- return -1;
- }
- if (m_nTimestamp_Inc==0)
- {
- printf("Timestanp increment can't be %s.\n",argv[nCounter+1]);
- return -1;
- }
-
- nCounter+=1;
- }
- }
-
- return 0;
-}
-
-void ProductVersion()
-{
- char strBuffer[255];
-
- printf("====================================\n");
- printf("Author : Simon Morlat =\n");
- printf("Porting : Yann STEPHAN =\n");
- printf("====================================\n");
-
- memset(&strBuffer, 0x0, sizeof(strBuffer));
-
- sprintf((char *) &strBuffer, "= RTPSender V1.0 - Date : %s - %s\n", __DATE__, __TIME__);
- printf(strBuffer);
-
- printf("====================================\n");
-}
-
-int __cdecl main(int argc, char *argv[])
-{
- FILE * infile = NULL;
- SessionSet * pSessionSet = NULL;
- int nCounter = 0;
- UINT32 m_nUser_Timestamp = 0;
-
- ProductVersion();
-
- if (GetCommandArguments(argc, argv) != 0)
- {
- printf("==> Sorry dude...\n");
- Sleep(1000);
- return -1;
- }
-
- printf("==> Starting the RTP Sender test\n");
-
-
- // =============== INSTALL THE CONTROL HANDLER ===============
- if (SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ctrlHandlerFunction, TRUE) == 0)
- {
- printf("==> Cannot handle the CTRL-C...\n");
- }
-
-
- printf("==> Timestamp increment will be %i\n" , m_nTimestamp_Inc);
- printf("==> Packet size will be %i\n" , m_nPacket_Size);
-
- m_pBuffer = (char *) ortp_malloc(m_nPacket_Size);
-
- ortp_init();
- ortp_scheduler_init();
- printf("==> Scheduler initialized\n");
-
- m_SSRC = getenv("SSRC");
- m_nPort = atoi(argv[3]);
-
- for (nCounter=0; nCounter < m_nChannels; nCounter++)
- {
- //printf("==> Channel [#%d]\n", nCounter);
-
- m_Session[nCounter] = rtp_session_new(RTP_SESSION_SENDONLY);
-
- rtp_session_set_scheduling_mode(m_Session[nCounter],1);
- rtp_session_set_blocking_mode(m_Session[nCounter],0);
- rtp_session_set_remote_addr(m_Session[nCounter],argv[2], m_nPort);
- rtp_session_set_send_payload_type(m_Session[nCounter],0);
-
- if (m_SSRC != NULL)
- {
- rtp_session_set_ssrc(m_Session[nCounter],atoi(m_SSRC));
- }
-
- m_nPort+=2;
- }
-
- infile=fopen(argv[1],"rb");
-
- if (infile==NULL)
- {
- printf("==> Cannot open file !!!!");
- Sleep(1000);
- return -1;
- }
-
-// printf("==> Open file\n");
-
- /* Create a set */
- pSessionSet = session_set_new();
-// printf("==> Session set\n");
-
- while( ((nCounter= (int) fread(m_pBuffer,1,m_nPacket_Size,infile))>0) && (m_bExit == FALSE) )
- {
- int k;
- //g_message("Sending packet.");
- for (k=0;k<m_nChannels;k++){
- /* add the session to the set */
- session_set_set(pSessionSet,m_Session[k]);
- //printf("==> Session set set %d\n", k);
- }
- /* and then suspend the process by selecting() */
- session_set_select(NULL,pSessionSet,NULL);
- //printf("==> Session set select\n");
-
- for (k=0;k<m_nChannels;k++)
- {
- //printf("---\n");
- /* this is stupid to do this test, because all session work the same way,
- as the same user_ts is used for all sessions, here. */
- if (session_set_is_set(pSessionSet,m_Session[k]))
- {
- //printf("==> Session set is set %d\n", k);
- rtp_session_send_with_ts(m_Session[k],m_pBuffer,nCounter,m_nUser_Timestamp);
- //g_message("packet sended !");
- }
- }
- m_nUser_Timestamp+=m_nTimestamp_Inc;
- }
-
- fclose(infile);
- printf("==> Close file\n");
-
-
-
- for(nCounter=0;nCounter<m_nChannels;nCounter++)
- {
- rtp_session_destroy(m_Session[nCounter]);
- }
-
- session_set_destroy(pSessionSet);
-
- // Give us some time
- Sleep(250);
-
- ortp_exit();
- ortp_global_stats_display();
-
- ortp_free(m_pBuffer);
-
- printf("==> Remove the CTRL-C handler...\n");
- SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ctrlHandlerFunction, FALSE);
-
- // Wait for an input key
- printf("Waiting for exit : ");
-
- for (nCounter = 0; nCounter < 4*5; nCounter++)
- {
- printf(".");
- Sleep(250);
- }
-
- return 0;
-}
-
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="RTPSender"
- ProjectGUID="{14A51171-516C-4D50-A88C-953B9B09F33F}"
- RootNamespace="HPRTP_DIRECTX_oRTPSender"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- UseOfMFC="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)include";"$(SolutionDir)include\ortp";"$(SolutionDir)src";"$(SolutionDir)build\win32native\include""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- CallingConvention="0"
- CompileAs="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="oRTP.lib Ws2_32.lib Winmm.lib"
- OutputFile="$(SolutionDir)Final/Exe/Debug/RTPSender.exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="$(SolutionDir)Final/Lib/Debug"
- IgnoreAllDefaultLibraries="false"
- IgnoreDefaultLibraryNames="libcmtd"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/RTPSender.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(SolutionDir)include";"$(SolutionDir)include\ortp";"$(SolutionDir)src";"$(SolutionDir)build\win32native\include""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="0"
- CallingConvention="0"
- CompileAs="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="oRTP.lib Ws2_32.lib Winmm.lib"
- OutputFile="$(SolutionDir)Final/Exe/Release/RTPSender.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="$(SolutionDir)Final/Lib/Release"
- IgnoreAllDefaultLibraries="false"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\RTPSender.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-/***************************************************************************
- * utils.c
- *
- * Wed Feb 23 14:15:36 2005
- * Copyright 2005 Simon Morlat
- * Email simon.morlat@linphone.org
- ****************************************************************************/
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#include "ortp/port.h"
-#include "utils.h"
-
-OList *o_list_new(void *data){
- OList *new_elem=(OList*)ortp_new0(OList,1);
- new_elem->data=data;
- return new_elem;
-}
-
-OList * o_list_append(OList *elem, void * data){
- OList *new_elem=o_list_new(data);
- OList *it=elem;
- if (elem==NULL) return new_elem;
- while (it->next!=NULL) it=o_list_next(it);
- it->next=new_elem;
- new_elem->prev=it;
- return elem;
-}
-
-OList * o_list_free(OList *list){
- OList *elem = list;
- OList *tmp;
- return_val_if_fail(list, list);
- while(elem->next!=NULL) {
- tmp = elem;
- elem = elem->next;
- ortp_free(tmp);
- }
- ortp_free(elem);
- return NULL;
-}
-
-OList *o_list_remove_link(OList *list, OList *elem){
- OList *ret;
- if (elem==list){
- ret=elem->next;
- elem->prev=NULL;
- elem->next=NULL;
- if (ret!=NULL) ret->prev=NULL;
- ortp_free(elem);
- return ret;
- }
- elem->prev->next=elem->next;
- if (elem->next!=NULL) elem->next->prev=elem->prev;
- elem->next=NULL;
- elem->prev=NULL;
- ortp_free(elem);
- return list;
-}
-
-OList * o_list_remove(OList *list, void *data){
- OList *it;
- for(it=list;it!=NULL;it=it->next){
- if (it->data==data){
- return o_list_remove_link(list,it);
- }
- }
- return list;
-}
-
+++ /dev/null
-/***************************************************************************
- * utils.h
- *
- * Wed Feb 23 14:15:36 2005
- * Copyright 2005 Simon Morlat
- * Email simon.morlat@linphone.org
- ****************************************************************************/
-/*
- The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
- Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
-
- 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
-*/
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include "ortp/event.h"
-
-struct _OList {
- struct _OList *next;
- struct _OList *prev;
- void *data;
-};
-
-typedef struct _OList OList;
-
-
-#define o_list_next(elem) ((elem)->next)
-
-OList * o_list_append(OList *elem, void * data);
-OList * o_list_remove(OList *list, void *data);
-OList * o_list_free(OList *elem);
-
-#ifndef MIN
-#define MIN(a,b) (((a)>(b)) ? (b) : (a))
-#endif
-#ifndef MAX
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-#endif
-
-#define return_if_fail(expr) if (!(expr)) {printf("%s:%i- assertion"#expr "failed\n",__FILE__,__LINE__); return;}
-#define return_val_if_fail(expr,ret) if (!(expr)) {printf("%s:%i- assertion" #expr "failed\n",__FILE__,__LINE__); return (ret);}
-
-
-#define INT_TO_POINTER(truc) ((long)(long)(truc))
-#define POINTER_TO_INT(truc) ((int)(long)(truc))
-
-typedef struct _dwsplit_t{
-#ifdef ORTP_BIGENDIAN
- uint16_t hi;
- uint16_t lo;
-#else
- uint16_t lo;
- uint16_t hi;
-#endif
-} dwsplit_t;
-
-typedef union{
- dwsplit_t split;
- uint32_t one;
-} poly32_t;
-
-#ifdef ORTP_BIGENDIAN
-#define hton24(x) (x)
-#else
-#define hton24(x) ((( (x) & 0x00ff0000) >>16) | (( (x) & 0x000000ff) <<16) | ( (x) & 0x0000ff00) )
-#endif
-#define ntoh24(x) hton24(x)
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-#define is_would_block_error(errnum) (errnum==WSAEWOULDBLOCK)
-#else
-#define is_would_block_error(errnum) (errnum==EWOULDBLOCK || errnum==EAGAIN)
-#endif
-
-void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev);
-
-#endif