提交 fc355b6c authored 作者: Anthony Minessale's avatar Anthony Minessale

update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@144 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 82d953c6
libtool
config.status
config.guess
config.sub
ltconfig
ltmain.sh
install-sh
mkinstalldirs
missing
aclocal.m4
configure
config.h.in
stamp-h.in
Makefile.in
config.log
config.cache
Makefile
stamp-h
libtool
iax.spec
iax-config
差异被折叠。
差异被折叠。
libiax
======
version 0.2.3:
* Allow password to be passed in connect
version 0.2.2 (Nov 13th, 2001):
* HTML Unlink requests
* HTML Reject link requests
* Text frames
version 0.2.1 (Oct 20th, 2001):
* More space for challenge in IAX
* Fixed strncpy security bug
* Accept larger packets
* Handle out of order packets better
* Implemented send_url
* Added an iax-config script :-)
version 0.2.0 (Oct 10th, 2001):
* Initial Public Release
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 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=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX 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=DIR' 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.
SUBDIRS = src
bin_SCRIPTS=iax-config
BUILT_SCOURCES=iax-config
EXTRA_DIST=iax.spec libiax2.vcproj
iax-config: iax-config.in
libiax
======
0.2.3:
0.2.2:
0.2.1:
0.2.0 (Oct 10th, 2001):
Initial Release. Hooray! Rejoice! :)
libiax: An implementation of the Inter-Asterisk eXchange protocol distributed
under the terms of the GNU Lesser General Public License
Written by Mark Spencer <markster@linux-support.net>
echo If this fails you probably need to download the latest
echo libtool,aclocal,autoconf and automake
libtoolize --force
aclocal --force
autoconf -f
automake -acf
echo configuring automake
./bootstrap.sh
echo configuring libiax2
./configure --enable-newjb
echo building libiax2
make
echo
echo
echo '##################################################################'
echo '# #'
echo '# If all is well, enter "make install" to complete installation. #'
echo '# #'
echo '##################################################################'
dnl Yo Yo Yo
AC_INIT(src/iax.c)
AM_INIT_AUTOMAKE([iax], [0.2.3])
dnl Check for various goodies
AC_PROG_CC
AM_PROG_LIBTOOL
dnl LIBTOOL="$LIBTOOL --silent"
AC_PROG_INSTALL
dnl Check for libraries
dnl None available
dnl Check header files
AC_HEADER_STDC
AC_SUBST(LIBS)
AC_ARG_ENABLE(snomhack, [ --enable-snomhack Use slower memset for SNOM phoneem ],,enable_snomhack=no)
AC_ARG_ENABLE(extreme_debug, [ --enable-extreme-debug Compile with extreme debugging code enabled ],,enable_extreme_debug=no)
AC_ARG_ENABLE(newjb, [ --enable-newjb Use new jitter buffer ], [CFLAGS="$CFLAGS -DNEWJB"])
if test "$enable_snomhack" = yes ; then
AC_DEFINE(SNOM_HACK)
fi
if test "$enable_extreme_debug" = yes ; then
AC_DEFINE(EXTREME_DEBUG)
fi
AC_SUBST(IAX_VERSION)
AC_OUTPUT([
Makefile
src/Makefile
iax.spec
iax-config],[case "$CONFIG_FILES" in
*iax-config*)chmod +x iax-config;;
esac])
#!/bin/sh
iax_libs="-L/usr/lib -liax"
iax_cflags=""
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
usage="\
Usage: iax-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo @VERSION@
;;
--cflags)
# if test ${prefix}/include/iax != /usr/include/iax ; then
includes=-I${prefix}/include/iax
for i in $iax_cflags ; do
if test $i = -I${prefix}/include ; then
includes=""
fi
done
# fi
echo $includes $iax_cflags
;;
--libs)
my_iax_libs=
libdirs=-L${exec_prefix}/lib
for i in $iax_libs ; do
if test $i != -L${exec_prefix}/lib ; then
if test -z "$my_iax_libs" ; then
my_iax_libs="$i"
else
my_iax_libs="$my_iax_libs $i"
fi
fi
done
echo $libdirs $my_iax_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
%define name @PACKAGE@
%define version @VERSION@
%define release 1
%define prefix /usr
Summary: IAX (Inter Asterisk eXchange) Library
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: LGPL
Group: Development/Libraries
Source: %{name}-%{version}.tar.gz
URL: http://www.linux-support.net/
Distribution: RedHat Linux
Vendor: Linux Support Services
Packager: Rob Flynn <rob@linux-support.net>
BuildRoot: /var/tmp/%{name}-%{version}-root
%description
Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the protocol used by the Asterisk PBX
system for inter-asterisk-communication. Other applications may use libiax to communicate with each other
and other asterisk servers. IAX is a high performance, feature rich protocol unrelated
to SIP or H.323. Its single-socket design allows it to interoperate with NAT and PAT
masquerade firewalls. It supports internationalization, remote dialplans,
and voice, HTML, image, DTMF, and video content. For more information see
http://www.gnophone.com.
%package devel
Summary: IAX (Inter Asterisk eXchange) Development Package
Group: Development/Libraries
Requires: iax
%description devel
Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the protocol used by the Asterisk PBX
system for inter-asterisk-communication. Other applications may use libiax to communicate with each other
and other asterisk servers. IAX is a high performance, feature rich protocol unrelated
to SIP or H.323. Its single-socket design allows it to interoperate with NAT and PAT
masquerade firewalls. It supports internationalization, remote dialplans,
and voice, HTML, image, DTMF, and video content. For more information see
http://www.gnophone.com.
This package contains all of the development files that you will need in order to compile IAX applications.
%prep
%setup
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --enable-autoupdate
make
%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{prefix} install-strip
%files
%defattr(-,root,root)
%doc NEWS COPYING AUTHORS README
%{prefix}/lib
%files devel
%defattr(-,root,root)
%{prefix}/include/iax
%{prefix}/bin/*
%clean
rm -r $RPM_BUILD_ROOT
%changelog
* Tue Nov 13 2001 Rob Flynn <rob@linux-support.net> (0.2.2 release)
- HTML Unlink requests
- HTML Reject link requests
- Text frames
* Sat Oct 20 2001 Rob Flynn <rob@linux-support.net> (0.2.1 release)
- More space for challenge in IAX
- Fixed strncpy security bug
- Accept larger packets
- Handle out of order packets better
- Implemented send_url
- Added an iax-config script :-)
* Wed Oct 10 2001 Rob Flynn <rob@linux-support.net> (0.2.0 release)
- Initial public release
%post
%preun
%postun
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2004-12-17.09
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libiax2"
ProjectGUID="{5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E}"
RootNamespace="libiax2"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
InlineFunctionExpansion="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LIBIAX;DEBUG_SUPPORT;_CRT_SECURE_NO_DEPRECATE;NEWJB;WIN32_TIME_GET_TIME"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LIBIAX"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</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\iax.c"
>
</File>
<File
RelativePath=".\src\iax2-parser.c"
>
</File>
<File
RelativePath=".\src\jitterbuf.c"
>
</File>
<File
RelativePath=".\src\md5.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\answer.h"
>
</File>
<File
RelativePath=".\src\busy.h"
>
</File>
<File
RelativePath=".\src\dialtone.h"
>
</File>
<File
RelativePath=".\src\frame.h"
>
</File>
<File
RelativePath=".\src\iax-client.h"
>
</File>
<File
RelativePath=".\src\iax.h"
>
</File>
<File
RelativePath=".\src\iax2-parser.h"
>
</File>
<File
RelativePath=".\src\iax2.h"
>
</File>
<File
RelativePath=".\src\jitterbuf.h"
>
</File>
<File
RelativePath=".\src\md5.h"
>
</File>
<File
RelativePath=".\src\miniphone.h"
>
</File>
<File
RelativePath=".\src\options.h"
>
</File>
<File
RelativePath=".\src\ring10.h"
>
</File>
<File
RelativePath=".\src\ringtone.h"
>
</File>
<File
RelativePath=".\src\winpoop.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
Makefile.in
Makefile
.deps
.libs
iax.lo
md5.lo
libiax.la
AM_CFLAGS = -Wall -O2
AM_CFLAGS += -g -Wall -Wstrict-prototypes -I .
AM_CFLAGS += -DDEBUG_SUPPORT -DLIBIAX
AM_CFLAGS += -fsigned-char
# -DDEBUG_DEFAULT
AM_CFLAGS += $(UCFLAGS)
pkgdir = $(libdir)
pkg_LTLIBRARIES=libiax.la
libiax_la_SOURCES = iax2-parser.c iax.c md5.c jitterbuf.c
EXTRA_DIST = md5.h frame.h iax-client.h iax2.h iax2-parser.h jitterbuf.h
install-data-local:
mkdir -p $(includedir)/iax
install -m 644 md5.h $(includedir)/iax
install -m 644 frame.h $(includedir)/iax
install -m 644 iax.h $(includedir)/iax
install -m 644 iax2.h $(includedir)/iax
install -m 644 iax2-parser.h $(includedir)/iax
install -m 644 iax-client.h $(includedir)/iax
差异被折叠。
差异被折叠。
/* busy.h: Generated from frequencies 480 and 620
by gensound. 400 samples */
static short busy[400] = {
0, 13697, 24766, 31109, 31585, 26222, 16198, 3569,
-9162, -19575, -25812, -26935, -23069, -15322, -5493, 4339,
12277, 16985, 17934, 15440, 10519, 4585, -908, -4827,
-6592, -6269, -4489, -2220, -467, 30, -983, -3203,
-5839, -7844, -8215, -6301, -2035, 3975, 10543, 16141,
19260, 18787, 14322, 6338, -3845, -14296, -22858, -27611,
-27309, -21691, -11585, 1213, 14285, 25068, 31388, 31915,
26457, 16010, 2568, -11282, -22885, -30054, -31509, -27120,
-17908, -5805, 6760, 17379, 24147, 26028, 23020, 16094,
6931, -2478, -10279, -15136, -16474, -14538, -10253, -4949,
0, 3515, 5052, 4688, 3045, 1069, -268, -272,
1269, 3996, 7067, 9381, 9889, 7910, 3365, -3123,
-10320, -16622, -20424, -20510, -16384, -8448, 2006, 13026,
22383, 28040, 28613, 23696, 13996, 1232, -12193, -23670,
-30918, -32459, -27935, -18190, -5103, 8795, 20838, 28764,
31164, 27753, 19395, 7893, -4412, -15136, -22342, -24909,
-22717, -16609, -8143, 780, 8361, 13272, 14909, 13455,
9758, 5067, 678, -2387, -3624, -3133, -1538, 224,
1209, 751, -1315, -4580, -8145, -10848, -11585, -9628,
-4878, 2038, 9844, 16867, 21403, 22124, 18429, 10638,
0, -11524, -21643, -28211, -29702, -25561, -16364, -3737,
9946, 22044, 30180, 32733, 29182, 20210, 7573, -6269,
-18655, -27259, -30558, -28117, -20645, -9807, 2148, 12878,
20426, 23599, 22173, 16865, 9117, 731, -6552, -11426,
-13269, -12216, -9050, -4941, -1118, 1460, 2335, 1635,
0, -1635, -2335, -1460, 1118, 4941, 9050, 12216,
13269, 11426, 6552, -731, -9117, -16865, -22173, -23599,
-20426, -12878, -2148, 9807, 20645, 28117, 30558, 27259,
18655, 6269, -7573, -20210, -29182, -32733, -30180, -22044,
-9946, 3737, 16364, 25561, 29702, 28211, 21643, 11524,
0, -10638, -18429, -22124, -21403, -16867, -9844, -2038,
4878, 9628, 11585, 10848, 8145, 4580, 1315, -751,
-1209, -224, 1538, 3133, 3624, 2387, -678, -5067,
-9758, -13455, -14909, -13272, -8361, -780, 8143, 16609,
22717, 24909, 22342, 15136, 4412, -7893, -19395, -27753,
-31164, -28764, -20838, -8795, 5103, 18190, 27935, 32459,
30918, 23670, 12193, -1232, -13996, -23696, -28613, -28040,
-22383, -13026, -2006, 8448, 16384, 20510, 20424, 16622,
10320, 3123, -3365, -7910, -9889, -9381, -7067, -3996,
-1269, 272, 268, -1069, -3045, -4688, -5052, -3515,
0, 4949, 10253, 14538, 16474, 15136, 10279, 2478,
-6931, -16094, -23020, -26028, -24147, -17379, -6760, 5805,
17908, 27120, 31509, 30054, 22885, 11282, -2568, -16010,
-26457, -31915, -31388, -25068, -14285, -1213, 11585, 21691,
27309, 27611, 22858, 14296, 3845, -6338, -14322, -18787,
-19260, -16141, -10543, -3975, 2035, 6301, 8215, 7844,
5839, 3203, 983, -30, 467, 2220, 4489, 6269,
6592, 4827, 908, -4585, -10519, -15440, -17934, -16985,
-12277, -4339, 5493, 15322, 23069, 26935, 25812, 19575,
9162, -3569, -16198, -26222, -31585, -31109, -24766, -13697,
};
/* dialtone.h: Generated from frequencies 350 and 440
by gensound. 800 samples */
static short dialtone[800] = {
0, 9997, 19004, 26133, 30692, 32251, 30690, 26206,
19286, 10657, 1206, -8116, -16396, -22848, -26895, -28221,
-26797, -22878, -16960, -9723, -1954, 5545, 12044, 16954,
19887, 20687, 19434, 16420, 12107, 7061, 1881, -2866,
-6721, -9365, -10657, -10634, -9491, -7547, -5190, -2822,
-801, 607, 1263, 1168, 454, -633, -1784, -2669,
-2993, -2548, -1247, 855, 3558, 6538, 9388, 11665,
12955, 12933, 11408, 8370, 3996, -1349, -7152, -12797,
-17635, -21060, -22583, -21895, -18914, -13807, -6985, 934,
9180, 16913, 23309, 27654, 29422, 28342, 24429, 17998,
9630, 123, -9589, -18538, -25813, -30667, -32588, -31360,
-27088, -20185, -11332, -1411, 8594, 17694, 24997, 29805,
31675, 30473, 26374, 19844, 11585, 2455, -6618, -14745,
-21156, -25284, -26815, -25713, -22213, -16785, -10073, -2824,
4203, 10318, 14969, 17794, 18653, 17628, 14998, 11197,
6753, 2217, -1899, -5189, -7386, -8388, -8261, -7212,
-5555, -3657, -1881, -536, 169, 157, -515, -1664,
-3009, -4217, -4954, -4940, -3996, -2080, 697, 4081,
7689, 11059, 13710, 15199, 15187, 13489, 10114, 5272,
-630, -7031, -13263, -18632, -22491, -24320, -23794, -20823,
-15582, -8498, -218, 8457, 16651, 23507, 28276, 30407,
29606, 25876, 19524, 11134, 1511, -8401, -17616, -25208,
-30406, -32682, -31800, -27845, -21215, -12576, -2796, 7150,
16278, 23700, 28713, 30868, 30015, 26312, 20199, 12351,
3598, -5164, -13071, -19378, -23531, -25223, -24413, -21318,
-16384, -10218, -3526, 2980, 8655, 12985, 15642, 16505,
15661, 13381, 10073, 6228, 2348, -1110, -3796, -5495,
-6152, -5863, -4853, -3434, -1954, -744, -62, -60,
-757, -2037, -3664, -5317, -6637, -7283, -6985, -5590,
-3096, 334, 4390, 8631, 12544, 15605, 17339, 17393,
15582, 11928, 6672, 258, -6705, -13506, -19403, -23711,
-25879, -25558, -22653, -17341, -10061, -1480, 7570, 16185,
23475, 28661, 31164, 30670, 27167, 20951, 12603, 2930,
-7116, -16540, -24401, -29915, -32533, -32003, -28391, -22075,
-13704, -4128, 5690, 14781, 22262, 27432, 29838, 29319,
26014, 20339, 12940, 4614, -3777, -11401, -17540, -21660,
-23463, -22908, -20199, -15755, -10150, -4044, 1898, 7079,
11030, 13459, 14268, 13555, 11585, 8745, 5487, 2268,
-511, -2559, -3716, -3975, -3468, -2440, -1206, -101,
578, 618, -78, -1470, -3382, -5524, -7531, -9018,
-9630, -9103, -7308, -4280, -226, 4483, 9357, 13829,
17329, 19352, 19524, 17659, 13788, 8177, 1302, -6184,
-13528, -19945, -24710, -27240, -27167, -24381, -19058, -11646,
-2830, 6539, 15528, 23219, 28806, 31685, 31520, 28282,
22254, 14010, 4355, -5759, -15331, -23411, -29203, -32144,
-31966, -28714, -22748, -14695, -5384, 4241, 13228, 20707,
25981, 28600, 28391, 25479, 20256, 13337, 5482, -2482,
-9761, -15668, -19694, -21556, -21215, -18865, -14902, -9864,
-4366, 975, 5614, 9130, 11270, 11967, 11332, 9628,
7223, 4536, 1976, -113, -1495, -2071, -1882, -1102,
0, 1102, 1882, 2071, 1495, 113, -1976, -4536,
-7223, -9628, -11332, -11967, -11270, -9130, -5614, -975,
4366, 9864, 14902, 18865, 21215, 21556, 19694, 15668,
9761, 2482, -5482, -13337, -20256, -25479, -28391, -28600,
-25981, -20707, -13228, -4241, 5384, 14695, 22748, 28714,
31966, 32144, 29203, 23411, 15331, 5759, -4355, -14010,
-22254, -28282, -31520, -31685, -28806, -23219, -15528, -6539,
2830, 11646, 19058, 24381, 27167, 27240, 24710, 19945,
13528, 6184, -1302, -8177, -13788, -17659, -19524, -19352,
-17329, -13829, -9357, -4483, 226, 4280, 7308, 9103,
9630, 9018, 7531, 5524, 3382, 1470, 78, -618,
-578, 101, 1206, 2440, 3468, 3975, 3716, 2559,
511, -2268, -5487, -8745, -11585, -13555, -14268, -13459,
-11030, -7079, -1898, 4044, 10150, 15755, 20199, 22908,
23463, 21660, 17540, 11401, 3777, -4614, -12940, -20339,
-26014, -29319, -29838, -27432, -22262, -14781, -5690, 4128,
13704, 22075, 28391, 32003, 32533, 29915, 24401, 16540,
7116, -2930, -12603, -20951, -27167, -30670, -31164, -28661,
-23475, -16185, -7570, 1480, 10061, 17341, 22653, 25558,
25879, 23711, 19403, 13506, 6705, -258, -6672, -11928,
-15582, -17393, -17339, -15605, -12544, -8631, -4390, -334,
3096, 5590, 6985, 7283, 6637, 5317, 3664, 2037,
757, 60, 62, 744, 1954, 3434, 4853, 5863,
6152, 5495, 3796, 1110, -2348, -6228, -10073, -13381,
-15661, -16505, -15642, -12985, -8655, -2980, 3526, 10218,
16384, 21318, 24413, 25223, 23531, 19378, 13071, 5164,
-3598, -12351, -20199, -26312, -30015, -30868, -28713, -23700,
-16278, -7150, 2796, 12576, 21215, 27845, 31800, 32682,
30406, 25208, 17616, 8401, -1511, -11134, -19524, -25876,
-29606, -30407, -28276, -23507, -16651, -8457, 218, 8498,
15582, 20823, 23794, 24320, 22491, 18632, 13263, 7031,
630, -5272, -10114, -13489, -15187, -15199, -13710, -11059,
-7689, -4081, -697, 2080, 3996, 4940, 4954, 4217,
3009, 1664, 515, -157, -169, 536, 1881, 3657,
5555, 7212, 8261, 8388, 7386, 5189, 1899, -2217,
-6753, -11197, -14998, -17628, -18653, -17794, -14969, -10318,
-4203, 2824, 10073, 16785, 22213, 25713, 26815, 25284,
21156, 14745, 6618, -2455, -11585, -19844, -26374, -30473,
-31675, -29805, -24997, -17694, -8594, 1411, 11332, 20185,
27088, 31360, 32588, 30667, 25813, 18538, 9589, -123,
-9630, -17998, -24429, -28342, -29422, -27654, -23309, -16913,
-9180, -934, 6985, 13807, 18914, 21895, 22583, 21060,
17635, 12797, 7152, 1349, -3996, -8370, -11408, -12933,
-12955, -11665, -9388, -6538, -3558, -855, 1247, 2548,
2993, 2669, 1784, 633, -454, -1168, -1263, -607,
801, 2822, 5190, 7547, 9491, 10634, 10657, 9365,
6721, 2866, -1881, -7061, -12107, -16420, -19434, -20687,
-19887, -16954, -12044, -5545, 1954, 9723, 16960, 22878,
26797, 28221, 26895, 22848, 16396, 8116, -1206, -10657,
-19286, -26206, -30690, -32251, -30692, -26133, -19004, -9997,
};
/*
* libiax: An implementation of the Inter-Asterisk eXchange protocol
*
* Asterisk internal frame definitions.
*
* Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
* This program is free software, distributed under the terms of
* the GNU Lesser General Public License. Other components of
* Asterisk are distributed under The GNU General Public License
* only.
*/
#ifndef _LIBIAX_FRAME_H
#define _LIBIAX_FRAME_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/* Frame types */
#define AST_FRAME_DTMF 1 /* A DTMF digit, subclass is the digit */
#define AST_FRAME_VOICE 2 /* Voice data, subclass is AST_FORMAT_* */
#define AST_FRAME_VIDEO 3 /* Video frame, maybe?? :) */
#define AST_FRAME_CONTROL 4 /* A control frame, subclass is AST_CONTROL_* */
#define AST_FRAME_NULL 5 /* An empty, useless frame */
#define AST_FRAME_IAX 6 /* Inter Aterisk Exchange private frame type */
#define AST_FRAME_TEXT 7 /* Text messages */
#define AST_FRAME_IMAGE 8 /* Image Frames */
#define AST_FRAME_HTML 9 /* HTML Frames */
#define AST_FRAME_CNG 10 /* Comfort Noise frame (subclass is level of CNG in -dBov) */
/* HTML subclasses */
#define AST_HTML_URL 1 /* Sending a URL */
#define AST_HTML_DATA 2 /* Data frame */
#define AST_HTML_BEGIN 4 /* Beginning frame */
#define AST_HTML_END 8 /* End frame */
#define AST_HTML_LDCOMPLETE 16 /* Load is complete */
#define AST_HTML_NOSUPPORT 17 /* Peer is unable to support HTML */
#define AST_HTML_LINKURL 18 /* Send URL and track */
#define AST_HTML_UNLINK 19 /* Request no more linkage */
#define AST_HTML_LINKREJECT 20 /* Reject LINKURL */
/* Data formats for capabilities and frames alike */
/*! G.723.1 compression */
#define AST_FORMAT_G723_1 (1 << 0)
/*! GSM compression */
#define AST_FORMAT_GSM (1 << 1)
/*! Raw mu-law data (G.711) */
#define AST_FORMAT_ULAW (1 << 2)
/*! Raw A-law data (G.711) */
#define AST_FORMAT_ALAW (1 << 3)
/*! ADPCM (G.726, 32kbps) */
#define AST_FORMAT_G726 (1 << 4)
/*! ADPCM (IMA) */
#define AST_FORMAT_ADPCM (1 << 5)
/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
#define AST_FORMAT_SLINEAR (1 << 6)
/*! LPC10, 180 samples/frame */
#define AST_FORMAT_LPC10 (1 << 7)
/*! G.729A audio */
#define AST_FORMAT_G729A (1 << 8)
/*! SpeeX Free Compression */
#define AST_FORMAT_SPEEX (1 << 9)
/*! iLBC Free Compression */
#define AST_FORMAT_ILBC (1 << 10)
/*! Maximum audio format */
#define AST_FORMAT_MAX_AUDIO (1 << 15)
/*! JPEG Images */
#define AST_FORMAT_JPEG (1 << 16)
/*! PNG Images */
#define AST_FORMAT_PNG (1 << 17)
/*! H.261 Video */
#define AST_FORMAT_H261 (1 << 18)
/*! H.263 Video */
#define AST_FORMAT_H263 (1 << 19)
/*! Max one */
#define AST_FORMAT_MAX_VIDEO (1 << 24)
/* Control frame types */
#define AST_CONTROL_HANGUP 1 /* Other end has hungup */
#define AST_CONTROL_RING 2 /* Local ring */
#define AST_CONTROL_RINGING 3 /* Remote end is ringing */
#define AST_CONTROL_ANSWER 4 /* Remote end has answered */
#define AST_CONTROL_BUSY 5 /* Remote end is busy */
#define AST_CONTROL_TAKEOFFHOOK 6 /* Make it go off hook */
#define AST_CONTROL_OFFHOOK 7 /* Line is off hook */
#define AST_CONTROL_CONGESTION 8 /* Congestion (circuits busy) */
#define AST_CONTROL_FLASH 9 /* Flash hook */
#define AST_CONTROL_WINK 10 /* Wink */
#define AST_CONTROL_OPTION 11 /* Set an option */
#define AST_FRIENDLY_OFFSET 64 /* Reserved header space */
struct ast_frame {
/*! Kind of frame */
int frametype;
/*! Subclass, frame dependent */
int subclass;
/*! Length of data */
int datalen;
/*! Number of 8khz samples in this frame */
int samples;
/*! Was the data malloc'd? i.e. should we free it when we discard the f
rame? */
int mallocd;
/*! How far into "data" the data really starts */
int offset;
/*! Optional source of frame for debugging */
char *src;
/*! Pointer to actual data */
void *data;
/*! Next/Prev for linking stand alone frames */
struct ast_frame *prev;
/*! Next/Prev for linking stand alone frames */
struct ast_frame *next;
/* Unused except
if debugging is turned on, but left
in the struct
so that it can be turned on without
requiring a r
ecompile of the whole thing */
};
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Implementation of Inter-Asterisk eXchange
*
* Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
* This program is free software, distributed under the terms of
* the GNU Lesser General Public License (LGPL)
*/
#ifndef _ASTERISK_IAX_CLIENT_H
#define _ASTERISK_IAX_CLIENT_H
#ifdef WIN32_TIME_GET_TIME
#include <Mmsystem.h>
#endif
#if defined(_MSC_VER)
/* disable zero-sized array in struct/union warning */
#pragma warning(disable:4200)
#endif
#ifndef LINUX
#define socklen_t int
#endif
#include "frame.h"
#include "iax2.h"
#include "iax2-parser.h"
#define MAXSTRLEN 80
#define IAX_AUTHMETHOD_PLAINTEXT IAX_AUTH_PLAINTEXT
#define IAX_AUTHMETHOD_MD5 IAX_AUTH_MD5
extern char iax_errstr[];
struct iax_session;
#define IAX_EVENT_CONNECT 0 /* Connect a new call */
#define IAX_EVENT_ACCEPT 1 /* Accept a call */
#define IAX_EVENT_HANGUP 2 /* Hang up a call */
#define IAX_EVENT_REJECT 3 /* Rejected call */
#define IAX_EVENT_VOICE 4 /* Voice Data */
#define IAX_EVENT_DTMF 5 /* A DTMF Tone */
#define IAX_EVENT_TIMEOUT 6 /* Connection timeout... session will be
a pointer to free()'d memory! */
#define IAX_EVENT_LAGRQ 7 /* Lag request -- Internal use only */
#define IAX_EVENT_LAGRP 8 /* Lag Measurement. See event.lag */
#define IAX_EVENT_RINGA 9 /* Announce we/they are ringing */
#define IAX_EVENT_PING 10 /* Ping -- internal use only */
#define IAX_EVENT_PONG 11 /* Pong -- internal use only */
#define IAX_EVENT_BUSY 12 /* Report a line busy */
#define IAX_EVENT_ANSWER 13 /* Answer the line */
#define IAX_EVENT_IMAGE 14 /* Send/Receive an image */
#define IAX_EVENT_AUTHRQ 15 /* Authentication request */
#define IAX_EVENT_AUTHRP 16 /* Authentication reply */
#define IAX_EVENT_REGREQ 17 /* Registration request */
#define IAX_EVENT_REGACK 18 /* Registration reply */
#define IAX_EVENT_URL 19 /* URL received */
#define IAX_EVENT_LDCOMPLETE 20 /* URL loading complete */
#define IAX_EVENT_TRANSFER 21 /* Transfer has taken place */
#define IAX_EVENT_DPREQ 22 /* Dialplan request */
#define IAX_EVENT_DPREP 23 /* Dialplan reply */
#define IAX_EVENT_DIAL 24 /* Dial on a TBD call */
#define IAX_EVENT_QUELCH 25 /* Quelch Audio */
#define IAX_EVENT_UNQUELCH 26 /* Unquelch Audio */
#define IAX_EVENT_UNLINK 27 /* Unlink */
#define IAX_EVENT_LINKREJECT 28 /* Link Rejection */
#define IAX_EVENT_TEXT 29 /* Text Frame :-) */
#define IAX_EVENT_REGREJ 30 /* Registration reply */
#define IAX_EVENT_LINKURL 31 /* Unlink */
#define IAX_EVENT_CNG 32 /* Comfort-noise (almost silence) */
/* moved from iax.c to support attended transfer */
#define IAX_EVENT_REREQUEST 999
#define IAX_EVENT_TXREPLY 1000
#define IAX_EVENT_TXREJECT 1001
#define IAX_EVENT_TXACCEPT 1002
#define IAX_EVENT_TXREADY 1003
#define IAX_SCHEDULE_FUZZ 0 /* ms of fuzz to drop */
#ifdef WIN32
#if defined(_MSC_VER)
typedef int (__stdcall *sendto_t)(SOCKET, const char *, int, int, const struct sockaddr *, int);
typedef int (__stdcall *recvfrom_t)(SOCKET, char *, int, int, struct sockaddr *, int *);
#else
typedef int PASCAL (*sendto_t)(SOCKET, const char *, int, int, const struct sockaddr *, int);
typedef int PASCAL (*recvfrom_t)(SOCKET, char *buf, int len, int flags, struct sockaddr *from, int *fromlen);
#endif
#else
typedef int (*sendto_t)(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
typedef int (*recvfrom_t)(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
#endif
struct iax_event {
int etype; /* Type of event */
int subclass; /* Subclass data (event specific) */
unsigned int ts; /* Timestamp */
struct iax_session *session; /* Applicable session */
int datalen; /* Length of raw data */
struct iax_ies ies; /* IE's for IAX2 frames */
unsigned char data[0]; /* Raw data if applicable */
};
#if defined(__cplusplus)
extern "C"
{
#endif
/* All functions return 0 on success and -1 on failure unless otherwise
specified */
/* Called to initialize IAX structures and sockets. Returns actual
portnumber (which it will try preferred portno first, but if not
take what it can get */
extern int iax_init(int preferredportno);
extern int iax_shutdown(void);
/* Get filedescriptor for IAX to use with select or gtk_input_add */
extern int iax_get_fd(void);
/* Find out how many milliseconds until the next scheduled event */
extern int iax_time_to_next_event(void);
/* Generate a new IAX session */
extern struct iax_session *iax_session_new(void);
/* Return exactly one iax event (if there is one pending). If blocking is
non-zero, IAX will block until some event is received */
extern struct iax_event *iax_get_event(int blocking);
extern int iax_auth_reply(struct iax_session *session, char *password,
char *challenge, int methods);
/* Free an event */
extern void iax_event_free(struct iax_event *event);
struct sockaddr_in;
/* Front ends for sending events */
extern int iax_send_dtmf(struct iax_session *session, char digit);
extern int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples);
extern int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen);
extern int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen);
extern int iax_send_url(struct iax_session *session, char *url, int link);
extern int iax_send_text(struct iax_session *session, char *text);
extern int iax_send_ping(struct iax_session *session);
extern int iax_load_complete(struct iax_session *session);
extern int iax_reject(struct iax_session *session, char *reason);
extern int iax_busy(struct iax_session *session);
extern int iax_congestion(struct iax_session *session);
extern int iax_hangup(struct iax_session *session, char *byemsg);
extern int iax_call(struct iax_session *session, char *cidnum, char *cidname, char *ich, char *lang, int wait, int format, int capability);
extern int iax_accept(struct iax_session *session, int format);
extern int iax_answer(struct iax_session *session);
extern int iax_sendurl(struct iax_session *session, char *url);
extern int iax_send_unlink(struct iax_session *session);
extern int iax_send_link_reject(struct iax_session *session);
extern int iax_ring_announce(struct iax_session *session);
extern struct sockaddr_in iax_get_peer_addr(struct iax_session *session);
extern int iax_register(struct iax_session *session, char *hostname, char *peer, char *secret, int refresh);
extern int iax_lag_request(struct iax_session *session);
extern int iax_dial(struct iax_session *session, char *number); /* Dial on a TBD call */
extern int iax_dialplan_request(struct iax_session *session, char *number); /* Request dialplan status for number */
extern int iax_quelch(struct iax_session *session);
extern int iax_unquelch(struct iax_session * session);
extern int iax_transfer(struct iax_session *session, char *number);
extern int iax_quelch_moh(struct iax_session *session, int MOH);
extern void iax_destroy(struct iax_session * session);
extern void iax_enable_debug(void);
extern void iax_disable_debug(void);
/* For attended transfer, application create a new session,
* make a call on the new session.
* On answer of the new session, call iax_setup_transfer and wait for
* IAX_EVENT_TXREADY when both sides are completed succefully or
* IAX_EVENT_TXREJECT for either side.
* If there are music on hold the it will be stopped by this library.
*/
extern int iax_setup_transfer(struct iax_session *s0, struct iax_session *s1);
struct iax_netstat {
int jitter;
int losspct;
int losscnt;
int packets;
int delay;
int dropped;
int ooo;
};
/* fills in rtt, and an iax_netstat structure for each of local/remote directions of call */
extern int iax_get_netstats(struct iax_session *s, int *rtt, struct iax_netstat *local, struct iax_netstat *remote);
extern void iax_set_private(struct iax_session *s, void *pvt);
extern void *iax_get_private(struct iax_session *s);
extern void iax_set_sendto(struct iax_session *s, sendto_t sendto);
/* to use application networking instead of internal, set call this instead of iax_init,
* and pass in sendto and recvfrom replacements. blocking reads may not be implemented */
extern void iax_set_networking(sendto_t st, recvfrom_t rf);
/* destroy an iax session */
extern void iax_session_destroy(struct iax_session **session);
/* Handle externally received frames */
struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin);
extern unsigned int iax_session_get_capability(struct iax_session *s);
extern char iax_pref_codec_add(struct iax_session *session, unsigned int format);
extern void iax_pref_codec_del(struct iax_session *session, unsigned int format);
extern int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len);
#if defined(__cplusplus)
}
#endif
#endif /* _ASTERISK_IAX_CLIENT_H */
差异被折叠。
/*
* libIAX
*
* Implementation of Inter-IAXerisk eXchange
*
* Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
#ifndef _IAX_H
#define _IAX_H
/* Max version of IAX protocol we support */
#define IAX_PROTO_VERSION 1
#define IAX_MAX_CALLS 32768
#define IAX_FLAG_FULL 0x8000
#define IAX_FLAG_SC_LOG 0x80
#define IAX_MAX_SHIFT 0x1F
/* Maximum size of an IAX frame (max size of UDP frame) */
#define IAX_MAX_BUF_SIZE 65536
/* Subclass for IAX_FRAME_IAX */
#define IAX_COMMAND_NEW 1
#define IAX_COMMAND_PING 2
#define IAX_COMMAND_PONG 3
#define IAX_COMMAND_ACK 4
#define IAX_COMMAND_HANGUP 5
#define IAX_COMMAND_REJECT 6
#define IAX_COMMAND_ACCEPT 7
#define IAX_COMMAND_AUTHREQ 8
#define IAX_COMMAND_AUTHREP 9
#define IAX_COMMAND_INVAL 10
#define IAX_COMMAND_LAGRQ 11
#define IAX_COMMAND_LAGRP 12
#define IAX_COMMAND_REGREQ 13 /* Registration request */
#define IAX_COMMAND_REGAUTH 14 /* Registration authentication required */
#define IAX_COMMAND_REGACK 15 /* Registration accepted */
#define IAX_COMMAND_REGREJ 16 /* Registration rejected */
#define IAX_COMMAND_REGREL 17 /* Force release of registration */
#define IAX_COMMAND_VNAK 18 /* If we receive voice before valid first voice frame, send this */
#define IAX_COMMAND_DPREQ 19 /* Request status of a dialplan entry */
#define IAX_COMMAND_DPREP 20 /* Request status of a dialplan entry */
#define IAX_COMMAND_DIAL 21 /* Request a dial on channel brought up TBD */
#define IAX_COMMAND_TXREQ 22 /* Transfer Request */
#define IAX_COMMAND_TXCNT 23 /* Transfer Connect */
#define IAX_COMMAND_TXACC 24 /* Transfer Accepted */
#define IAX_COMMAND_TXREADY 25 /* Transfer ready */
#define IAX_COMMAND_TXREL 26 /* Transfer release */
#define IAX_COMMAND_TXREJ 27 /* Transfer reject */
#define IAX_COMMAND_QUELCH 28 /* Stop audio/video transmission */
#define IAX_COMMAND_UNQUELCH 29 /* Resume audio/video transmission */
#define IAX_DEFAULT_REG_EXPIRE 60
#define IAX_DEFAULT_PORTNO 5036
/* Full frames are always delivered reliably */
struct iax_full_hdr {
short callno; /* Source call number -- high bit must be 1 */
short dcallno; /* Destination call number */
unsigned int ts; /* 32-bit timestamp in milliseconds */
unsigned short seqno; /* Packet number */
char type; /* Frame type */
unsigned char csub; /* Compressed subclass */
char data[0];
};
/* Mini header is used only for voice frames -- delivered unreliably */
struct iax_mini_hdr {
short callno; /* Source call number -- high bit must be 0 */
unsigned short ts; /* 16-bit Timestamp (high 16 bits from last IAX_full_hdr) */
/* Frametype implicitly VOICE_FRAME */
/* subclass implicit from last IAX_full_hdr */
char data[0];
};
#endif
差异被折叠。
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Implementation of Inter-Asterisk eXchange
*
* Copyright (C) 2003, Digium
*
* Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
#ifndef _IAX2_PARSER_H
#define _IAX2_PARSER_H
struct iax_ies {
char *called_number;
char *calling_number;
char *calling_ani;
char *calling_name;
int calling_ton;
int calling_tns;
int calling_pres;
char *called_context;
char *username;
char *password;
unsigned int capability;
unsigned int format;
char *codec_prefs;
char *language;
int version;
unsigned short adsicpe;
char *dnid;
char *rdnis;
unsigned int authmethods;
char *challenge;
char *md5_result;
char *rsa_result;
struct sockaddr_in *apparent_addr;
unsigned short refresh;
unsigned short dpstatus;
unsigned short callno;
char *cause;
unsigned char causecode;
unsigned char iax_unknown;
int msgcount;
int autoanswer;
int musiconhold;
unsigned int transferid;
unsigned int datetime;
char *devicetype;
char *serviceident;
int firmwarever;
unsigned int fwdesc;
unsigned char *fwdata;
unsigned char fwdatalen;
unsigned int provver;
unsigned short samprate;
unsigned int provverpres;
unsigned int rr_jitter;
unsigned int rr_loss;
unsigned int rr_pkts;
unsigned short rr_delay;
unsigned int rr_dropped;
unsigned int rr_ooo;
};
#define DIRECTION_INGRESS 1
#define DIRECTION_OUTGRESS 2
struct iax_frame {
#ifdef LIBIAX
struct iax_session *session;
struct iax_event *event;
#endif
/* /Our/ call number */
unsigned short callno;
/* /Their/ call number */
unsigned short dcallno;
/* Start of raw frame (outgoing only) */
void *data;
/* Length of frame (outgoing only) */
int datalen;
/* How many retries so far? */
int retries;
/* Outgoing relative timestamp (ms) */
unsigned int ts;
/* How long to wait before retrying */
int retrytime;
/* Are we received out of order? */
int outoforder;
/* Have we been sent at all yet? */
int sentyet;
/* Outgoing Packet sequence number */
int oseqno;
/* Next expected incoming packet sequence number */
int iseqno;
/* Non-zero if should be sent to transfer peer */
int transfer;
/* Non-zero if this is the final message */
int final;
/* Ingress or outgres */
int direction;
/* Retransmission ID */
int retrans;
/* Easy linking */
struct iax_frame *next;
struct iax_frame *prev;
/* Actual, isolated frame header */
struct ast_frame af;
unsigned char unused[AST_FRIENDLY_OFFSET];
unsigned char afdata[0]; /* Data for frame */
};
struct iax_ie_data {
unsigned char buf[1024];
int pos;
};
/* Choose a different function for output */
extern void iax_set_output(void (*output)(const char *data));
/* Choose a different function for errors */
extern void iax_set_error(void (*output)(const char *data));
extern void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
extern const char *iax_ie2str(int ie);
extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen);
extern int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
extern int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
extern int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, unsigned char *str);
extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
extern int iax_get_frames(void);
extern int iax_get_iframes(void);
extern int iax_get_oframes(void);
extern void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
extern struct iax_frame *iax_frame_new(int direction, int datalen);
extern void iax_frame_free(struct iax_frame *fr);
#endif
差异被折叠。
差异被折叠。
/*
* jitterbuf: an application-independent jitterbuffer
*
* Copyrights:
* Copyright (C) 2004-2005, Horizon Wimba, Inc.
*
* Contributors:
* Steve Kann <stevek@stevek.com>
*
* This program is free software, distributed under the terms of
* the GNU Lesser (Library) General Public License
*
* Copyright on this file is disclaimed to Digium for inclusion in Asterisk
*/
#ifndef _JITTERBUF_H_
#define _JITTERBUF_H_
#ifdef __cplusplus
extern "C" {
#endif
/* configuration constants */
/* Number of historical timestamps to use in calculating jitter and drift */
#define JB_HISTORY_SZ 500
/* what percentage of timestamps should we drop from the history when we examine it;
* this might eventually be something made configurable */
#define JB_HISTORY_DROPPCT 3
/* the maximum droppct we can handle (say it was configurable). */
#define JB_HISTORY_DROPPCT_MAX 4
/* the size of the buffer we use to keep the top and botton timestamps for dropping */
#define JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100
/* amount of additional jitterbuffer adjustment */
#define JB_TARGET_EXTRA 40
/* ms between growing and shrinking; may not be honored if jitterbuffer runs out of space */
#define JB_ADJUST_DELAY 40
/* return codes */
#define JB_OK 0
#define JB_EMPTY 1
#define JB_NOFRAME 2
#define JB_INTERP 3
#define JB_DROP 4
#define JB_SCHED 5
/* frame types */
#define JB_TYPE_CONTROL 0
#define JB_TYPE_VOICE 1
#define JB_TYPE_VIDEO 2 /* reserved */
#define JB_TYPE_SILENCE 3
typedef struct jb_conf {
/* settings */
long max_jitterbuf; /* defines a hard clamp to use in setting the jitter buffer delay */
long resync_threshold; /* the jb will resync when delay increases to (2 * jitter) + this param */
long max_contig_interp; /* the max interp frames to return in a row */
} jb_conf;
typedef struct jb_info {
jb_conf conf;
/* statistics */
long frames_in; /* number of frames input to the jitterbuffer.*/
long frames_out; /* number of frames output from the jitterbuffer.*/
long frames_late; /* number of frames which were too late, and dropped.*/
long frames_lost; /* number of missing frames.*/
long frames_dropped; /* number of frames dropped (shrinkage) */
long frames_ooo; /* number of frames received out-of-order */
long frames_cur; /* number of frames presently in jb, awaiting delivery.*/
long jitter; /* jitter measured within current history interval*/
long min; /* minimum lateness within current history interval */
long current; /* the present jitterbuffer adjustment */
long target; /* the target jitterbuffer adjustment */
long losspct; /* recent lost frame percentage (* 1000) */
long next_voice_ts; /* the ts of the next frame to be read from the jb - in receiver's time */
long last_voice_ms; /* the duration of the last voice frame */
long silence_begin_ts; /* the time of the last CNG frame, when in silence */
long last_adjustment; /* the time of the last adjustment */
long last_delay; /* the last now added to history */
long cnt_delay_discont; /* the count of discontinuous delays */
long resync_offset; /* the amount to offset ts to support resyncs */
long cnt_contig_interp; /* the number of contiguous interp frames returned */
} jb_info;
typedef struct jb_frame {
void *data; /* the frame data */
long ts; /* the relative delivery time expected */
long ms; /* the time covered by this frame, in sec/8000 */
int type; /* the type of frame */
struct jb_frame *next, *prev;
} jb_frame;
typedef struct jitterbuf {
jb_info info;
/* history */
long history[JB_HISTORY_SZ]; /* history */
int hist_ptr; /* points to index in history for next entry */
long hist_maxbuf[JB_HISTORY_MAXBUF_SZ]; /* a sorted buffer of the max delays (highest first) */
long hist_minbuf[JB_HISTORY_MAXBUF_SZ]; /* a sorted buffer of the min delays (lowest first) */
int hist_maxbuf_valid; /* are the "maxbuf"/minbuf valid? */
jb_frame *frames; /* queued frames */
jb_frame *free; /* free frames (avoid malloc?) */
} jitterbuf;
/* new jitterbuf */
extern jitterbuf * jb_new(void);
/* destroy jitterbuf */
extern void jb_destroy(jitterbuf *jb);
/* reset jitterbuf */
/* NOTE: The jitterbuffer should be empty before you call this, otherwise
* you will leak queued frames, and some internal structures */
extern void jb_reset(jitterbuf *jb);
/* queue a frame data=frame data, timings (in ms): ms=length of frame (for voice), ts=ts (sender's time)
* now=now (in receiver's time) return value is one of
* JB_OK: Frame added. Last call to jb_next() still valid
* JB_DROP: Drop this frame immediately
* JB_SCHED: Frame added. Call jb_next() to get a new time for the next frame
*/
extern int jb_put(jitterbuf *jb, void *data, int type, long ms, long ts, long now);
/* get a frame for time now (receiver's time) return value is one of
* JB_OK: You've got frame!
* JB_DROP: Here's an audio frame you should just drop. Ask me again for this time..
* JB_NOFRAME: There's no frame scheduled for this time.
* JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame)
* JB_EMPTY: The jb is empty.
*/
extern int jb_get(jitterbuf *jb, jb_frame *frame, long now, long interpl);
/* unconditionally get frames from jitterbuf until empty */
extern int jb_getall(jitterbuf *jb, jb_frame *frameout);
/* when is the next frame due out, in receiver's time (0=EMPTY)
* This value may change as frames are added (esp non-audio frames) */
extern long jb_next(jitterbuf *jb);
/* get jitterbuf info: only "statistics" may be valid */
extern int jb_getinfo(jitterbuf *jb, jb_info *stats);
/* set jitterbuf conf */
extern int jb_setconf(jitterbuf *jb, jb_conf *conf);
typedef void (*jb_output_function_t)(const char *fmt, ...);
extern void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
#ifdef __cplusplus
}
#endif
#endif
/* MD5 checksum routines used for authentication. Not covered by GPL, but
in the public domain as per the copyright below */
#ifdef FREEBSD
# include <machine/endian.h>
#elif defined(LINUX)
# include <endian.h>
# include <features.h>
# include <sys/types.h>
#elif defined(SOLARIS)
/* each solaris is different -- this won't work on 2.6 or 2.7 */
# include <sys/isa_defs.h> /* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */
# define __BIG_ENDIAN 4321
# define __LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321
# define LITTLE_ENDIAN 1234
# ifdef _LITTLE_ENDIAN
# define __BYTE_ORDER __LITTLE_ENDIAN
# define BYTE_ORDER LITTLE_ENDIAN
# else
# define __BYTE_ORDER __BIG_ENDIAN
# define BYTE_ORDER BIG_ENDIAN
# endif
#endif
#if __BYTE_ORDER == __BIG_ENDIAN || BYTE_ORDER == BIG_ENDIAN
# define HIGHFIRST 1
#elif __BYTE_ORDER == __LITTLE_ENDIAN || BYTE_ORDER == LITLE_ENDIAN
# undef HIGHFIRST
#else
# error "Please fix <bits/endian.h>"
#endif
/*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
#include <string.h> /* for memcpy() */
#include "md5.h"
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);
#ifndef ASM_MD5
/*
* Note: this code is harmless on little-endian machines.
*/
void byteReverse(unsigned char *buf, unsigned longs)
{
uint32 t;
do {
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(uint32 *) buf = t;
buf += 4;
} while (--longs);
}
#endif
#endif
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void MD5Init(struct MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
uint32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
memcpy(p, buf, len);
return;
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned count;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((uint32 *) ctx->in)[14] = ctx->bits[0];
((uint32 *) ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void MD5Transform(uint32 buf[4], uint32 const in[16])
{
register uint32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
#endif
差异被折叠。
差异被折叠。
#define RBUFSIZE 256
#define MAXARGS 10
#define MAXARG 256
#define MAX_SESSIONS 4
extern void parse_cmd(FILE *, int, char **);
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论