提交 70bfba5b authored 作者: Anthony Minessale's avatar Anthony Minessale

Christmas Presence

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3083 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 61e118db
...@@ -53,7 +53,7 @@ DIST_COMMON = README $(am__configure_deps) $(library_include_HEADERS) \ ...@@ -53,7 +53,7 @@ DIST_COMMON = README $(am__configure_deps) $(library_include_HEADERS) \
ChangeLog INSTALL NEWS build/config/compile \ ChangeLog INSTALL NEWS build/config/compile \
build/config/config.guess build/config/config.sub \ build/config/config.guess build/config/config.sub \
build/config/depcomp build/config/install-sh \ build/config/depcomp build/config/install-sh \
build/config/ltmain.sh build/config/missing mkinstalldirs build/config/ltmain.sh build/config/missing
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in am__aclocal_m4_deps = $(top_srcdir)/configure.in
......
...@@ -56,6 +56,12 @@ else ...@@ -56,6 +56,12 @@ else
fi fi
fi fi
if [ ! -f $root/.nothanks ] && [ $uncompressed/.complete -ot $uncompressed ] ; then
echo remove stale .complete
rm $uncompressed/.complete
cd $uncompressed && $MAKE clean distclean
fi
if [ -f $uncompressed/.complete ] ; then if [ -f $uncompressed/.complete ] ; then
echo $uncompressed already installed echo $uncompressed already installed
exit 0 exit 0
......
...@@ -17,7 +17,7 @@ AM_CFLAGS += $(shell $(APU_CONFIG) --includes) ...@@ -17,7 +17,7 @@ AM_CFLAGS += $(shell $(APU_CONFIG) --includes)
AM_LDFLAGS += $(shell $(APU_CONFIG) --link-ld --libs ) AM_LDFLAGS += $(shell $(APU_CONFIG) --link-ld --libs )
lib_LTLIBRARIES = libdingaling.la lib_LTLIBRARIES = libdingaling.la
libdingaling_la_SOURCES = src/libdingaling.c libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c
libdingaling_la_CFLAGS = $(AM_CFLAGS) libdingaling_la_CFLAGS = $(AM_CFLAGS)
libdingaling_la_LDFLAGS = libdingaling_la_LDFLAGS =
......
...@@ -39,9 +39,9 @@ build_triplet = @build@ ...@@ -39,9 +39,9 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
DIST_COMMON = README $(am__configure_deps) $(library_include_HEADERS) \ DIST_COMMON = README $(am__configure_deps) $(library_include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ $(top_srcdir)/configure $(top_srcdir)/src/config.h.in AUTHORS \
compile config.guess config.sub depcomp install-sh ltmain.sh \ COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \
missing mkinstalldirs depcomp install-sh ltmain.sh missing mkinstalldirs
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in am__aclocal_m4_deps = $(top_srcdir)/configure.in
...@@ -50,6 +50,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ...@@ -50,6 +50,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
...@@ -62,9 +63,10 @@ am__installdirs = "$(DESTDIR)$(libdir)" \ ...@@ -62,9 +63,10 @@ am__installdirs = "$(DESTDIR)$(libdir)" \
libLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libdingaling_la_LIBADD = libdingaling_la_LIBADD =
am_libdingaling_la_OBJECTS = libdingaling_la-libdingaling.lo am_libdingaling_la_OBJECTS = libdingaling_la-libdingaling.lo \
libdingaling_la-sha1.lo
libdingaling_la_OBJECTS = $(am_libdingaling_la_OBJECTS) libdingaling_la_OBJECTS = $(am_libdingaling_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
...@@ -210,7 +212,7 @@ AM_LDFLAGS = -liksemel -L$(PREFIX)/lib $(shell $(APR_CONFIG) --link-ld \ ...@@ -210,7 +212,7 @@ AM_LDFLAGS = -liksemel -L$(PREFIX)/lib $(shell $(APR_CONFIG) --link-ld \
APR_CONFIG = $(prefix)/bin/apr-1-config APR_CONFIG = $(prefix)/bin/apr-1-config
APU_CONFIG = $(prefix)/bin/apu-1-config APU_CONFIG = $(prefix)/bin/apu-1-config
lib_LTLIBRARIES = libdingaling.la lib_LTLIBRARIES = libdingaling.la
libdingaling_la_SOURCES = src/libdingaling.c libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c
libdingaling_la_CFLAGS = $(AM_CFLAGS) libdingaling_la_CFLAGS = $(AM_CFLAGS)
libdingaling_la_LDFLAGS = libdingaling_la_LDFLAGS =
library_includedir = $(prefix)/include library_includedir = $(prefix)/include
...@@ -252,6 +254,23 @@ $(top_srcdir)/configure: $(am__configure_deps) ...@@ -252,6 +254,23 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF) cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
src/config.h: src/stamp-h1
@if test ! -f $@; then \
rm -f src/stamp-h1; \
$(MAKE) src/stamp-h1; \
else :; fi
src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status
@rm -f src/stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
$(top_srcdir)/src/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f src/stamp-h1
touch $@
distclean-hdr:
-rm -f src/config.h src/stamp-h1
install-libLTLIBRARIES: $(lib_LTLIBRARIES) install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
...@@ -289,6 +308,7 @@ distclean-compile: ...@@ -289,6 +308,7 @@ distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdingaling_la-libdingaling.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdingaling_la-libdingaling.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdingaling_la-sha1.Plo@am__quote@
.c.o: .c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
...@@ -318,6 +338,13 @@ libdingaling_la-libdingaling.lo: src/libdingaling.c ...@@ -318,6 +338,13 @@ libdingaling_la-libdingaling.lo: src/libdingaling.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdingaling_la_CFLAGS) $(CFLAGS) -c -o libdingaling_la-libdingaling.lo `test -f 'src/libdingaling.c' || echo '$(srcdir)/'`src/libdingaling.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdingaling_la_CFLAGS) $(CFLAGS) -c -o libdingaling_la-libdingaling.lo `test -f 'src/libdingaling.c' || echo '$(srcdir)/'`src/libdingaling.c
libdingaling_la-sha1.lo: src/sha1.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdingaling_la_CFLAGS) $(CFLAGS) -MT libdingaling_la-sha1.lo -MD -MP -MF "$(DEPDIR)/libdingaling_la-sha1.Tpo" -c -o libdingaling_la-sha1.lo `test -f 'src/sha1.c' || echo '$(srcdir)/'`src/sha1.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdingaling_la-sha1.Tpo" "$(DEPDIR)/libdingaling_la-sha1.Plo"; else rm -f "$(DEPDIR)/libdingaling_la-sha1.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/sha1.c' object='libdingaling_la-sha1.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdingaling_la_CFLAGS) $(CFLAGS) -c -o libdingaling_la-sha1.lo `test -f 'src/sha1.c' || echo '$(srcdir)/'`src/sha1.c
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
...@@ -661,7 +688,7 @@ distclean: distclean-recursive ...@@ -661,7 +688,7 @@ distclean: distclean-recursive
-rm -rf ./$(DEPDIR) -rm -rf ./$(DEPDIR)
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags distclean-hdr distclean-libtool distclean-tags
dvi: dvi-recursive dvi: dvi-recursive
...@@ -713,11 +740,11 @@ uninstall-info: uninstall-info-recursive ...@@ -713,11 +740,11 @@ uninstall-info: uninstall-info-recursive
clean-libtool clean-recursive ctags ctags-recursive dist \ clean-libtool clean-recursive ctags ctags-recursive dist \
dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \ dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \
distcheck distclean distclean-compile distclean-generic \ distcheck distclean distclean-compile distclean-generic \
distclean-libtool distclean-recursive distclean-tags \ distclean-hdr distclean-libtool distclean-recursive \
distcleancheck distdir distuninstallcheck dvi dvi-am html \ distclean-tags distcleancheck distdir distuninstallcheck dvi \
html-am info info-am install install-am install-data \ dvi-am html html-am info info-am install install-am \
install-data-am install-exec install-exec-am install-info \ install-data install-data-am install-exec install-exec-am \
install-info-am install-libLTLIBRARIES \ install-info install-info-am install-libLTLIBRARIES \
install-library_includeHEADERS install-man install-strip \ install-library_includeHEADERS install-man install-strip \
installcheck installcheck-am installdirs installdirs-am \ installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic \ maintainer-clean maintainer-clean-generic \
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE(libdingaling,0.1) AM_INIT_AUTOMAKE(libdingaling,0.1)
AC_CONFIG_SRCDIR([src]) AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADER([src/config.h])
#AC_CONFIG_HEADER([]) #AC_CONFIG_HEADER([])
# Checks for programs. # Checks for programs.
...@@ -32,6 +33,10 @@ AC_TYPE_SIGNAL ...@@ -32,6 +33,10 @@ AC_TYPE_SIGNAL
AC_FUNC_STRFTIME AC_FUNC_STRFTIME
#AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr]) #AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr])
AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
AC_DEFINE([__LITTLE_ENDIAN],1234,[for the places where it is not defined])
AC_DEFINE([__BIG_ENDIAN],4321,[for the places where it is not defined])
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT
...@@ -50,6 +50,7 @@ extern "C" { ...@@ -50,6 +50,7 @@ extern "C" {
#define LDL_MAX_CANDIDATES 10 #define LDL_MAX_CANDIDATES 10
#define LDL_MAX_PAYLOADS 50 #define LDL_MAX_PAYLOADS 50
#define LDL_RETRY 3 #define LDL_RETRY 3
#define IKS_NS_COMPONENT "jabber:component:accept"
/*! \brief A structure to store a jingle candidate */ /*! \brief A structure to store a jingle candidate */
struct ldl_candidate { struct ldl_candidate {
...@@ -105,13 +106,14 @@ typedef enum { ...@@ -105,13 +106,14 @@ typedef enum {
LDL_FLAG_AUTHORIZED = (1 << 2), LDL_FLAG_AUTHORIZED = (1 << 2),
LDL_FLAG_READY = (1 << 3), LDL_FLAG_READY = (1 << 3),
LDL_FLAG_CONNECTED = (1 << 4), LDL_FLAG_CONNECTED = (1 << 4),
LDL_FLAG_QUEUE_RUNNING = (1 << 5), LDL_FLAG_QUEUE_RUNNING = (1 << 5)
} ldl_flag_t; } ldl_flag_t;
typedef enum { typedef enum {
LDL_FLAG_TLS = (1 << 10), LDL_FLAG_TLS = (1 << 10),
LDL_FLAG_SASL_PLAIN = (1 << 11), LDL_FLAG_SASL_PLAIN = (1 << 11),
LDL_FLAG_SASL_MD5 = (1 << 12) LDL_FLAG_SASL_MD5 = (1 << 12),
LDL_FLAG_COMPONENT = (1 << 13),
} ldl_user_flag_t; } ldl_user_flag_t;
typedef enum { typedef enum {
...@@ -121,6 +123,9 @@ typedef enum { ...@@ -121,6 +123,9 @@ typedef enum {
LDL_SIGNAL_MSG, LDL_SIGNAL_MSG,
LDL_SIGNAL_PRESENCE_IN, LDL_SIGNAL_PRESENCE_IN,
LDL_SIGNAL_PRESENCE_OUT, LDL_SIGNAL_PRESENCE_OUT,
LDL_SIGNAL_ROSTER,
LDL_SIGNAL_SUBSCRIBE,
LDL_SIGNAL_UNSUBSCRIBE,
LDL_SIGNAL_TERMINATE, LDL_SIGNAL_TERMINATE,
LDL_SIGNAL_ERROR, LDL_SIGNAL_ERROR,
LDL_SIGNAL_LOGIN_SUCCESS, LDL_SIGNAL_LOGIN_SUCCESS,
...@@ -156,7 +161,7 @@ typedef enum { ...@@ -156,7 +161,7 @@ typedef enum {
#define DL_LOG_EMERG DL_PRE, 0 #define DL_LOG_EMERG DL_PRE, 0
typedef ldl_status (*ldl_loop_callback_t)(ldl_handle_t *); typedef ldl_status (*ldl_loop_callback_t)(ldl_handle_t *);
typedef ldl_status (*ldl_session_callback_t)(ldl_handle_t *, ldl_session_t *, ldl_signal_t, char *, char *, char *); typedef ldl_status (*ldl_session_callback_t)(ldl_handle_t *, ldl_session_t *, ldl_signal_t, char *, char *, char *, char *);
typedef ldl_status (*ldl_response_callback_t)(ldl_handle_t *, char *); typedef ldl_status (*ldl_response_callback_t)(ldl_handle_t *, char *);
typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...); typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...);
...@@ -265,6 +270,13 @@ char *ldl_session_get_id(ldl_session_t *session); ...@@ -265,6 +270,13 @@ char *ldl_session_get_id(ldl_session_t *session);
*/ */
char *ldl_session_get_caller(ldl_session_t *session); char *ldl_session_get_caller(ldl_session_t *session);
/*!
\brief Get the callee name of a session
\param session the session to get the callee from
\return the callee name
*/
char *ldl_session_get_callee(ldl_session_t *session);
/*! /*!
\brief Set the ip of a session \brief Set the ip of a session
\param session the session to set the ip on \param session the session to set the ip on
...@@ -310,11 +322,23 @@ void ldl_global_set_logger(ldl_logger_t logger); ...@@ -310,11 +322,23 @@ void ldl_global_set_logger(ldl_logger_t logger);
\brief Perform a probe on a given id to resolve the proper Jingle Resource \brief Perform a probe on a given id to resolve the proper Jingle Resource
\param handle the connection handle to use. \param handle the connection handle to use.
\param id the id to probe \param id the id to probe
\param from the from string
\param buf a string to store the result
\param len the size in bytes of the string
\return a pointer to buf if a successful lookup was made otherwise NULL
*/
char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len);
/*!
\brief Perform a discovery on a given id to resolve the proper Jingle Resource
\param handle the connection handle to use.
\param id the id to probe
\param from the from string
\param buf a string to store the result \param buf a string to store the result
\param len the size in bytes of the string \param len the size in bytes of the string
\return a pointer to buf if a successful lookup was made otherwise NULL \return a pointer to buf if a successful lookup was made otherwise NULL
*/ */
char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *buf, unsigned int len); char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len);
/*! /*!
\brief Signal a termination request on a given session \brief Signal a termination request on a given session
...@@ -339,14 +363,25 @@ void *ldl_handle_get_private(ldl_handle_t *handle); ...@@ -339,14 +363,25 @@ void *ldl_handle_get_private(ldl_handle_t *handle);
*/ */
void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body); void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body);
/*!
\brief Send a presence notification to a target
\param handle the handle to send with
\param from the from address
\param to the to address
\param type the type of presence
\param message a status message
*/
void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *message);
/*! /*!
\brief Send a message \brief Send a message
\param handle the conection handle \param handle the conection handle
\param from the message sender
\param to the message recipiant \param to the message recipiant
\param subject optional subject \param subject optional subject
\param body body of the message \param body body of the message
*/ */
void ldl_handle_send_msg(ldl_handle_t *handle, char *to, char *subject, char *body); void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body);
/*! /*!
\brief Offer candidates to a potential session \brief Offer candidates to a potential session
......
/*
* libDingaLing XMPP Jingle Library
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is libDingaLing XMPP Jingle Library
*
* The Initial Developer of the Original Code is
* Steve Reid <steve@edmweb.com>
*
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Steve Reid <steve@edmweb.com>
*
* sha1.h
*
*/
/*! \file sha1.c
\brief SHA1
*/
/*
ORIGINAL HEADERS
----------------------------------------------------------------------------------------------
SHA-1 in C
By Steve Reid <steve@edmweb.com>
100% Public Domain
Test Vectors (from FIPS PUB 180-1)
"abc"
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
A million repetitions of "a"
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
*/
/* #define LITTLE_ENDIAN * This should be #define'd if true. */
/* #define SHA1HANDSOFF * Copies data before messing with it. */
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "sha1.h"
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* blk0() and blk() perform the initial expand. */
/* I got the idea of expanding during the round function from SSLeay */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|(rol(block->l[i],8)&0x00FF00FF))
#else
#define blk0(i) block->l[i]
#endif
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
/* Hash a single 512-bit block. This is the core of the algorithm. */
void SHA1Transform(unsigned long state[5], unsigned char buffer[64])
{
unsigned long a, b, c, d, e;
typedef union {
unsigned char c[64];
unsigned long l[16];
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
static unsigned char workspace[64];
block = (CHAR64LONG16*)workspace;
memcpy(block, buffer, 64);
#else
block = (CHAR64LONG16*)buffer;
#endif
/* Copy context->state[] to working vars */
a = state[0];
b = state[1];
c = state[2];
d = state[3];
e = state[4];
/* 4 rounds of 20 operations each. Loop unrolled. */
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
/* Add the working vars back into context.state[] */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
/* Wipe variables */
a = b = c = d = e = 0;
}
/* SHA1Init - Initialize new context */
void SHA1Init(sha_context_t* context)
{
/* SHA1 initialization constants */
context->state[0] = 0x67452301;
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
context->count[0] = context->count[1] = 0;
}
/* Run your data through this. */
void SHA1Update(sha_context_t* context, unsigned char* data, unsigned int len)
{
unsigned int i, j;
j = (context->count[0] >> 3) & 63;
if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++;
context->count[1] += (len >> 29);
if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j));
SHA1Transform(context->state, context->buffer);
for ( ; i + 63 < len; i += 64) {
SHA1Transform(context->state, &data[i]);
}
j = 0;
}
else i = 0;
memcpy(&context->buffer[j], &data[i], len - i);
}
/* Add padding and return the message digest. */
void SHA1Final(unsigned char digest[20], sha_context_t* context)
{
unsigned long i, j;
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
}
SHA1Update(context, (unsigned char *)"\200", 1);
while ((context->count[0] & 504) != 448) {
SHA1Update(context, (unsigned char *)"\0", 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
for (i = 0; i < 20; i++) {
digest[i] = (unsigned char)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
}
/* Wipe variables */
i = j = 0;
memset(context->buffer, 0, 64);
memset(context->state, 0, 20);
memset(context->count, 0, 8);
memset(&finalcount, 0, 8);
#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */
SHA1Transform(context->state, context->buffer);
#endif
}
/*
* libDingaLing XMPP Jingle Library
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is libDingaLing XMPP Jingle Library
*
* The Initial Developer of the Original Code is
* Steve Reid <steve@edmweb.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Steve Reid <steve@edmweb.com>
*
* sha1.h
*
*/
/*! \file sha1.h
\brief SHA1
*/
#ifndef __SHA1_H
#define __SHA1_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __STUPIDFORMATBUG__
}
#endif
typedef struct {
unsigned long state[5];
unsigned long count[2];
unsigned char buffer[64];
} sha_context_t;
void SHA1Transform(unsigned long state[5], unsigned char buffer[64]);
void SHA1Init(sha_context_t* context);
void SHA1Update(sha_context_t* context, unsigned char* data, unsigned int len);
void SHA1Final(unsigned char digest[20], sha_context_t* context);
#ifdef __cplusplus
}
#endif
#endif
...@@ -841,6 +841,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer) ...@@ -841,6 +841,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer)
\brief Initialize a codec handle \brief Initialize a codec handle
\param codec the handle to initilize \param codec the handle to initilize
\param codec_name the name of the codec module to use \param codec_name the name of the codec module to use
\param fmtp codec parameters to send
\param rate the desired rate (0 for any) \param rate the desired rate (0 for any)
\param ms the desired number of milliseconds (0 for any) \param ms the desired number of milliseconds (0 for any)
\param channels the desired number of channels (0 for any) \param channels the desired number of channels (0 for any)
......
...@@ -97,6 +97,8 @@ struct switch_event { ...@@ -97,6 +97,8 @@ struct switch_event {
void *bind_user_data; void *bind_user_data;
/*! user data from the event sender */ /*! user data from the event sender */
void *event_user_data; void *event_user_data;
/*! unique key */
unsigned long key;
struct switch_event *next; struct switch_event *next;
}; };
......
...@@ -72,6 +72,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(void); ...@@ -72,6 +72,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(void);
\param ms_per_packet time in microseconds per packet \param ms_per_packet time in microseconds per packet
\param flags flags to control behaviour \param flags flags to control behaviour
\param crypto_key optional crypto key \param crypto_key optional crypto key
\param timer_name timer interface to use
\param err a pointer to resolve error messages \param err a pointer to resolve error messages
\param pool a memory pool to use for the session \param pool a memory pool to use for the session
\return the new RTP session or NULL on failure \return the new RTP session or NULL on failure
...@@ -98,6 +99,7 @@ SWITCH_DECLARE(switch_status_t)switch_rtp_create(switch_rtp_t **new_rtp_session, ...@@ -98,6 +99,7 @@ SWITCH_DECLARE(switch_status_t)switch_rtp_create(switch_rtp_t **new_rtp_session,
\param ms_per_packet time in microseconds per packet \param ms_per_packet time in microseconds per packet
\param flags flags to control behaviour \param flags flags to control behaviour
\param crypto_key optional crypto key \param crypto_key optional crypto key
\param timer_name timer interface to use
\param err a pointer to resolve error messages \param err a pointer to resolve error messages
\param pool a memory pool to use for the session \param pool a memory pool to use for the session
\return the new RTP session or NULL on failure \return the new RTP session or NULL on failure
......
...@@ -659,6 +659,7 @@ typedef enum { ...@@ -659,6 +659,7 @@ typedef enum {
SWITCH_EVENT_MESSAGE, SWITCH_EVENT_MESSAGE,
SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_PRESENCE_IN,
SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_PRESENCE_OUT,
SWITCH_EVENT_ROSTER,
SWITCH_EVENT_CODEC, SWITCH_EVENT_CODEC,
SWITCH_EVENT_BACKGROUND_JOB, SWITCH_EVENT_BACKGROUND_JOB,
SWITCH_EVENT_ALL SWITCH_EVENT_ALL
......
...@@ -1315,19 +1315,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core ...@@ -1315,19 +1315,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core
if (endpoint_interface->io_routines->outgoing_channel) { if (endpoint_interface->io_routines->outgoing_channel) {
if (session) { if (session) {
char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
if (caller_profile) {
char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name");
ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"); if (ecaller_id_name || ecaller_id_number) {
ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
if (ecaller_id_name || ecaller_id_number) {
if (caller_profile) {
outgoing_profile = switch_caller_profile_new(switch_core_session_get_pool(session), outgoing_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
caller_profile->username, caller_profile->username,
caller_profile->dialplan, caller_profile->dialplan,
ecaller_id_name ? ecaller_id_name : caller_profile->caller_id_name, ecaller_id_name,
ecaller_id_number ? ecaller_id_number : caller_profile->caller_id_number, ecaller_id_number,
caller_profile->network_addr, caller_profile->network_addr,
caller_profile->ani, caller_profile->ani,
caller_profile->aniii, caller_profile->aniii,
...@@ -1336,7 +1336,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core ...@@ -1336,7 +1336,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core
caller_profile->context, caller_profile->context,
caller_profile->destination_number); caller_profile->destination_number);
outgoing_profile->flags = caller_profile->flags; outgoing_profile->flags = caller_profile->flags;
} }
}
if (!outgoing_profile) {
outgoing_profile = switch_channel_get_caller_profile(channel);
} }
} }
...@@ -1361,14 +1364,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core ...@@ -1361,14 +1364,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core
if (*new_session) { if (*new_session) {
switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL; switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
switch_channel_t *peer_channel = NULL;
switch_event_t *event; switch_event_t *event;
switch_channel_t *new_channel = switch_core_session_get_channel(*new_session); switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session);
if (session && channel) { if (session && channel) {
profile = switch_channel_get_caller_profile(channel); profile = switch_channel_get_caller_profile(channel);
} }
if ((peer_channel = switch_core_session_get_channel(*new_session)) != 0) { if (peer_channel) {
peer_profile = switch_channel_get_caller_profile(peer_channel); peer_profile = switch_channel_get_caller_profile(peer_channel);
} }
...@@ -1386,7 +1388,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core ...@@ -1386,7 +1388,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core
} }
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_OUTGOING) == SWITCH_STATUS_SUCCESS) { if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_OUTGOING) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(new_channel, event); switch_channel_event_set_data(peer_channel, event);
switch_event_fire(&event); switch_event_fire(&event);
} }
} }
......
...@@ -125,6 +125,7 @@ static char *EVENT_NAMES[] = { ...@@ -125,6 +125,7 @@ static char *EVENT_NAMES[] = {
"MESSAGE", "MESSAGE",
"PRESENCE_IN", "PRESENCE_IN",
"PRESENCE_OUT", "PRESENCE_OUT",
"ROSTER",
"CODEC", "CODEC",
"BACKGROUND_JOB", "BACKGROUND_JOB",
"ALL" "ALL"
...@@ -587,6 +588,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_ ...@@ -587,6 +588,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_
(*event)->body = DUP(todup->body); (*event)->body = DUP(todup->body);
} }
(*event)->key = todup->key;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
...@@ -1823,6 +1823,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -1823,6 +1823,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
caller_caller_profile->source, caller_caller_profile->source,
caller_caller_profile->context, caller_caller_profile->context,
chan_data); chan_data);
caller_profiles[i]->flags = caller_caller_profile->flags;
pool = NULL; pool = NULL;
} else { } else {
if (!cid_name_override) { if (!cid_name_override) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论