Commit 961a2f86 authored by jehan's avatar jehan

refactor presence server to use xsd instead of xsde

parent b8718173
......@@ -13,6 +13,7 @@ AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
m4_include([m4/ax_compare_version.m4])
m4_include([m4/ax_xsdcxx.m4])
# Checks for programs.
# Favor g++ 4.4 (the one in centos stable version)
......@@ -21,6 +22,8 @@ m4_include([m4/ax_compare_version.m4])
AC_PROG_CC(["xcrun clang" gcc-4.4 gcc-4.7 gcc])
AC_PROG_CXX(["xcrun clang++" g++-4.4 g++-4.7 g++ ])
AC_PROG_LIBTOOL
# use for xml data binding
AX_XSDCXX
AC_ARG_ENABLE(snmp,
AC_HELP_STRING([--disable-snmp],
......@@ -446,34 +449,16 @@ AC_ARG_ENABLE(presence,
)
AC_ARG_WITH( xsde,
[ --with-xsde Set prefix where libxsde can be found (ex:/usr or /usr/local)[default=PREFIX] ],
[ xsde_prefix=${withval}],[ xsde_prefix=${prefix} ])
found_xsde=no
if test x$presence = xyes ; then
if test "$xsde_prefix" != "NONE" ; then
XSDE_CPPFLAGS="-I${xsde_prefix}/include"
XSDE_LIBS="-L${xsde_prefix}/lib"
fi
XSDE_LIBS="$XSDE_LIBS -lxsde"
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CFLAGS $XSDE_CPPFLAGS"
AC_CHECK_HEADER(xsde/cxx/pre.hxx,[found_xsde=yes], [AC_MSG_ERROR(Couldn't find XSDe xml data binding dev )])
CPPFLAGS=$CPPFLAGS_save
AC_SUBST(XSDE_CPPFLAGS)
AC_SUBST(XSDE_LIBS)
if test "x$XSDCXX" = x; then
AC_MSG_ERROR([CodeSynthesis XSD required for presence server.])]
fi
PKG_CHECK_MODULES(BELLESIP, [belle-sip >= 1.2.4])
PKG_CHECK_MODULES(XERCESC, [xerces-c >= 3.0.0])
AC_DEFINE([ENABLE_PRESENCE],1, [enable presence module])
fi
AM_CONDITIONAL([BUILD_PRESENCE], [test x$found_xsde$presence = xyesyes])
AM_CONDITIONAL([BUILD_PRESENCE], [test x$presence = xyes])
......@@ -486,6 +471,7 @@ scripts/debian/Makefile
scripts/redhat/Makefile
src/Makefile
src/presence/Makefile
src/presence/xml/Makefile
doc/Makefile
debian/Makefile
flexisip.spec
......
This diff is collapsed.
......@@ -2,7 +2,7 @@ GITVERSION_FILE=flexisip_gitversion.h
GITVERSION_FILE_TMP=flexisip_gitversion.h.tmp
GITDESCRIBE=`git describe`
GITREVISION=`git rev-parse HEAD`
AUTOMAKE_OPTIONS = subdir-objects
AUTOMAKE_OPTIONS = subdir-objects
ECHO=/bin/echo
......@@ -71,11 +71,6 @@ endif
flexisip_LDADD=$(SOFIA_LIBS) $(ORTP_LIBS) $(LIBODB_MYSQL_LIBS) $(MEDIASTREAMER_LIBS) $(HIREDIS_LIBS) $(PROTOBUF_LIBS) $(NETSNMPAGENT_LIBS)
if BUILD_PRESENCE
#module cannot be statically initialized in shared lib
thesources+=module-presence.cc
flexisip_LDADD += presence/libflexisip-presence.la
endif
AM_CXXFLAGS=$(SOFIA_CFLAGS) $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) $(HIREDIS_CFLAGS) $(PROTOBUF_CFLAGS) $(LIBODB_MYSQL_CFLAGS) $(MYSQL_CFLAGS)\
-DCONFIG_DIR=\"$(CONFIG_DIR)\" -DORTP_DEBUG_MODE $(WARNINGCXXFLAGS)
......@@ -83,6 +78,13 @@ AM_CFLAGS=$(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) -DORTP_DEBUG_MODE
AM_LDFLAGS=-no-undefined
if BUILD_PRESENCE
#module cannot be statically initialized in shared lib
thesources+=module-presence.cc
flexisip_LDADD += presence/libflexisip-presence.la
AM_CXXFLAGS+= -DBELLE_SIP_USE_STL $(BELLESIP_CFLAGS)
endif
if USE_MONOTONIC_CLOCK
AM_CXXFLAGS+=-DUSE_MONOTONIC_CLOCK
endif
......@@ -175,7 +177,7 @@ nodist_flexisip_binder_SOURCES=$(nodistsources)
noinst_PROGRAMS=expr
expr_SOURCES=test/expr.cc expressionparser.cc expressionparser.hh sipattrextractor.hh
expr_CXXFLAGS=-DTEST_BOOL_EXPR -DNO_SOFIA $(MEDIASTREAMER_CFLAGS)
expr_CXXFLAGS=-DTEST_BOOL_EXPR -DNO_SOFIA $(MEDIASTREAMER_CFLAGS) $(ORTP_CFLAGS)
expr_LDADD=$(flexisip_LDADD)
......
......@@ -35,7 +35,7 @@ FlexisipException e;
FlexisipException::FlexisipException(const char* message): mOffset(1){
mSize = backtrace(mArray, sizeof(mArray)/sizeof(void*));
if (message) *this << message;
if (message) mOs << message;
#if __clang
if (get_terminate() != uncaught_handler)
#endif
......@@ -77,16 +77,12 @@ FlexisipException::FlexisipException(const FlexisipException& other ) {
mOs << other.str();
mWhat=other.mWhat;
}
const char* FlexisipException::what() throw (){
mWhat=mOs.str();
return mWhat.c_str();
}
void FlexisipException::printStackTrace() const {
void FlexisipException::printStackTrace() const {
backtrace_symbols_fd(mArray+mOffset, mSize-mOffset, STDERR_FILENO);
}
void FlexisipException::printStackTrace(std::ostream & os) const {
void FlexisipException::printStackTrace(std::ostream & os) const {
char** bt = backtrace_symbols(mArray,mSize);
for (unsigned int i = mOffset; i < mSize; ++i) {
os << bt[i] <<endl;
......@@ -97,105 +93,36 @@ const char* FlexisipException::what() throw (){
const std::string FlexisipException::str() const {
return mOs.str();
}
FlexisipException& FlexisipException::operator<< (const char *val) {
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<< (const string& val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(bool val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(short val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(unsigned short val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(int val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(unsigned int val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(long val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(unsigned long val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(long long val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(unsigned long long val){
mOs<<val;
return *this;
const char* FlexisipException::what() throw () {
mWhat=mOs.str();
return mWhat.c_str();
}
FlexisipException& FlexisipException::operator<<(float val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(double val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(long double val){
mOs<<val;
return *this;
}
FlexisipException& FlexisipException::operator<<(void* val){
mOs<<val;
return *this;
//Class Flexisip
std::ostream& operator<<(std::ostream& __os,const FlexisipException& e) {
__os << e.str() << std::endl;
e.printStackTrace(__os);
return __os;
}
FlexisipException& FlexisipException::operator<<(streambuf* sb ){
mOs<<sb;
return *this;
/*
FlexisipException::FlexisipException() :FlexisipExceptionBase(){
}
FlexisipException& FlexisipException::operator<<(ostream& (*pf)(ostream&)){
mOs<<pf;
return *this;
FlexisipException::FlexisipException(string& message):FlexisipExceptionBase(message){
}
FlexisipException& FlexisipException::operator<<(ios& (*pf)(ios&)){
mOs<<pf;
return *this;
FlexisipException::FlexisipException(const char* message):FlexisipExceptionBase<FlexisipException>(message){
}
FlexisipException& FlexisipException::operator<<(ios_base& (*pf)(ios_base&)){
mOs<<pf;
return *this;
FlexisipException::~FlexisipException() throw (){
}
std::ostream& operator<<(std::ostream& __os,const FlexisipException& e) {
__os << e.str() << std::endl;
e.printStackTrace(__os);
return __os;
FlexisipException::FlexisipException(const FlexisipException& other ) : FlexisipExceptionBase(other){
}
*/
......@@ -30,11 +30,10 @@ using namespace std;
class FlexisipException: public exception {
public:
explicit FlexisipException();
explicit FlexisipException(string& message);
explicit FlexisipException(const char* message);
FlexisipException();
FlexisipException(string& message);
FlexisipException(const char* message);
virtual ~FlexisipException() throw ();
//FlexisipException(FlexisipException&& other );
FlexisipException(const FlexisipException& other );
/**
* print stack strace to stderr
......@@ -47,26 +46,10 @@ public:
const std::string str() const;
/* same as osstringstream, but as osstream does not have cp contructor, FlexisipException can't hinerite from osstream*/
FlexisipException& operator<< (const char *val);
FlexisipException& operator<< (const string& val);
FlexisipException& operator<<(bool val);
FlexisipException& operator<<(short val);
FlexisipException& operator<<(unsigned short val);
FlexisipException& operator<<(int val);
FlexisipException& operator<<(unsigned int val);
FlexisipException& operator<<(long val);
FlexisipException& operator<<(unsigned long val);
FlexisipException& operator<<(long long val);
FlexisipException& operator<<(unsigned long long val);
FlexisipException& operator<<(float val);
FlexisipException& operator<<(double val);
FlexisipException& operator<<(long double val);
FlexisipException& operator<<(void* val);
FlexisipException& operator<<(streambuf* sb );
FlexisipException& operator<<(ostream& (*pf)(ostream&));
FlexisipException& operator<<(ios& (*pf)(ios&));
FlexisipException& operator<<(ios_base& (*pf)(ios_base&));
template<typename T2> FlexisipException& operator<< (const T2& val){
mOs << val;
return *this;
}
protected:
int mOffset; /*to hide last stack traces*/
private:
......@@ -75,8 +58,7 @@ private:
string mWhat;
ostringstream mOs;
};
std::ostream& operator<<(std::ostream& __os,const FlexisipException&);
std::ostream& operator<<(std::ostream& __os,const FlexisipException& e);
#define FLEXISIP_EXCEPTION FlexisipException() << " " << __FILE__ << ":"<< __LINE__ << " "
#endif /* FLEXISIPEXCEPTION_H_ */
AUTOMAKE_OPTIONS = subdir-objects
if BUILD_PRESENCE
SUBDIRS= xml
lib_LTLIBRARIES = libflexisip-presence.la
libflexisip_presence_la_SOURCES = presence-server.cc \
presentity-presenceinformation.cc \
file-resource-list-manager.cc \
signaling-exception.cc \
resource-list/resource-lists-pimpl.cxx \
resource-list/resource-lists-pskel.cxx \
resource-list/resource-lists.cxx \
application_pidf+xml/pidf+xml-pimpl.cxx \
application_pidf+xml/pidf+xml-pskel.cxx \
application_pidf+xml/pidf+xml.cxx \
application_pidf+xml/pidf+xml-simpl.cxx \
application_pidf+xml/pidf+xml-sskel.cxx \
xml/xml-pimpl.cxx \
xml/xml-pskel.cxx \
xml/xml.cxx \
xml/xml-simpl.cxx \
xml/xml-sskel.cxx \
subscription.cc
presentity-presenceinformation.cc \
signaling-exception.cc \
subscription.cc
libflexisip_presence_la_LIBADD= $(XSDE_LIBS) $(BELLESIP_LIBS)
libflexisip_presence_la_LIBADD= xml/libpresence_generated.la $(ORTP_LIBS) $(BELLESIP_LIBS) $(XERCESC_LIBS)
AM_CPPFLAGS= -I $(abs_srcdir)/../ -I$(abs_srcdir)/xml -I$(abs_srcdir)/resource-list -I$(abs_srcdir)/application_pidf+xml $(XSDE_CPPFLAGS) $(SOFIA_CFLAGS) $(BELLESIP_CFLAGS)
AM_LDFLAGS=
AM_CPPFLAGS= -I $(abs_srcdir)/../ -I$(builddir)/xml $(SOFIA_CFLAGS) -DBELLE_SIP_USE_STL=1 $(BELLESIP_CFLAGS) $(ORTP_CFLAGS) $(XSDCXX_CPPFLAGS) $(XERCESC_CFLAGS)
AM_LDFLAGS=
endif
// Copyright (c) 2005-2011 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD/e, an XML Schema
// to C++ data binding compiler for embedded systems.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
//
// Begin prologue.
//
//
// End prologue.
#include "pidf+xml-pimpl.hxx"
#include <xsde/cxx/parser/validating/string-common.hxx>
namespace pidf
{
// note_pimpl
//
note_pimpl::
note_pimpl ()
: note_pskel (&base_impl_)
{
}
void note_pimpl::
pre ()
{
this->base_impl_.pre ();
this->note_pimpl_state_.note_ = ::pidf::note ();
}
void note_pimpl::
lang (const ::namespace_::lang& x)
{
this->note_pimpl_state_.note_.lang (x);
}
::pidf::note note_pimpl::
post_note ()
{
static_cast< ::std::string& > (this->note_pimpl_state_.note_) =
this->base_impl_.post_string ();
return this->note_pimpl_state_.note_;
}
// presence_pimpl
//
presence_pimpl::
presence_pimpl (bool b)
{
this->presence_pimpl_base_ = b;
this->presence_pimpl_state_.presence_ = 0;
}
presence_pimpl::
~presence_pimpl ()
{
if (!this->presence_pimpl_base_ && this->presence_pimpl_state_.presence_)
delete this->presence_pimpl_state_.presence_;
}
void presence_pimpl::
_reset ()
{
presence_pskel::_reset ();
if (!this->presence_pimpl_base_ && this->presence_pimpl_state_.presence_)
{
delete this->presence_pimpl_state_.presence_;
this->presence_pimpl_state_.presence_ = 0;
}
}
void presence_pimpl::
pre_impl (::pidf::presence* x)
{
this->presence_pimpl_state_.presence_ = x;
}
void presence_pimpl::
pre ()
{
::pidf::presence* x = new ::pidf::presence;
this->pre_impl (x);
}
void presence_pimpl::
entity (const ::std::string& x)
{
this->presence_pimpl_state_.presence_->entity (x);
}
void presence_pimpl::
tuple (::pidf::tuple* x)
{
this->presence_pimpl_state_.presence_->tuple ().push_back (x);
}
void presence_pimpl::
note (const ::pidf::note& x)
{
this->presence_pimpl_state_.presence_->note ().push_back (x);
}
::pidf::presence* presence_pimpl::
post_presence ()
{
::pidf::presence* r = this->presence_pimpl_state_.presence_;
this->presence_pimpl_state_.presence_ = 0;
return r;
}
// basic_pimpl
//
basic_pimpl::
basic_pimpl ()
: basic_pskel (0)
{
}
void basic_pimpl::
pre ()
{
this->basic_pimpl_state_.str_.clear ();
}
void basic_pimpl::
_characters (const ::xsde::cxx::ro_string& s)
{
if (this->_facets ().whitespace_ == 2 &&
this->basic_pimpl_state_.str_.size () == 0)
{
::xsde::cxx::ro_string tmp (s.data (), s.size ());
if (::xsde::cxx::trim_left (tmp) != 0)
{
this->basic_pimpl_state_.str_ += tmp;
}
}
else
this->basic_pimpl_state_.str_ += s;
}
void basic_pimpl::
_post ()
{
::xsde::cxx::parser::validating::string_common::validate_facets (
this->basic_pimpl_state_.str_,
this->_facets (),
this->_context ());
}
::pidf::basic basic_pimpl::
post_basic ()
{
::pidf::basic::value_type v =
static_cast< ::pidf::basic::value_type > (0);
const char* s = this->basic_pimpl_state_.str_.c_str ();
if (strcmp (s, "open") == 0)
v = ::pidf::basic::open;
else if (strcmp (s, "closed") == 0)
v = ::pidf::basic::closed;
::pidf::basic r (v);
return r;
}
// status_pimpl
//
void status_pimpl::
pre ()
{
this->status_pimpl_state_.status_ = ::pidf::status ();
}
void status_pimpl::
basic (const ::pidf::basic& x)
{
this->status_pimpl_state_.status_.basic (x);
}
::pidf::status status_pimpl::
post_status ()
{
return this->status_pimpl_state_.status_;
}
// qvalue_pimpl
//
qvalue_pimpl::
qvalue_pimpl ()
: qvalue_pskel (&base_impl_)
{
}
void qvalue_pimpl::
pre ()
{
this->base_impl_.pre ();
this->qvalue_pimpl_state_.qvalue_ = ::pidf::qvalue ();
}
::pidf::qvalue qvalue_pimpl::
post_qvalue ()
{
static_cast< ::xml_schema::decimal_base& > (this->qvalue_pimpl_state_.qvalue_) =
this->base_impl_.post_decimal ();
return this->qvalue_pimpl_state_.qvalue_;
}
// contact_pimpl
//
contact_pimpl::
contact_pimpl ()
: contact_pskel (&base_impl_)
{
}
void contact_pimpl::
pre ()
{
this->base_impl_.pre ();
this->contact_pimpl_state_.contact_ = ::pidf::contact ();
}
void contact_pimpl::
priority (const ::pidf::qvalue& x)
{
this->contact_pimpl_state_.contact_.priority (x);
}
::pidf::contact contact_pimpl::
post_contact ()
{
static_cast< ::std::string& > (this->contact_pimpl_state_.contact_) =
this->base_impl_.post_uri ();
return this->contact_pimpl_state_.contact_;
}
// tuple_pimpl
//
tuple_pimpl::
tuple_pimpl (bool b)
{
this->tuple_pimpl_base_ = b;
this->tuple_pimpl_state_.tuple_ = 0;
}
tuple_pimpl::
~tuple_pimpl ()
{
if (!this->tuple_pimpl_base_ && this->tuple_pimpl_state_.tuple_)
delete this->tuple_pimpl_state_.tuple_;
}
void tuple_pimpl::
_reset ()
{
tuple_pskel::_reset ();
if (!this->tuple_pimpl_base_ && this->tuple_pimpl_state_.tuple_)
{
delete this->tuple_pimpl_state_.tuple_;
this->tuple_pimpl_state_.tuple_ = 0;
}
}
void tuple_pimpl::
pre_impl (::pidf::tuple* x)
{
this->tuple_pimpl_state_.tuple_ = x;
}
void tuple_pimpl::
pre ()
{
::pidf::tuple* x = new ::pidf::tuple;
this->pre_impl (x);
}
void tuple_pimpl::
id (const ::std::string& x)
{
this->tuple_pimpl_state_.tuple_->id (x);
}
void tuple_pimpl::
status (const ::pidf::status& x)
{
this->tuple_pimpl_state_.tuple_->status (x);
}
void tuple_pimpl::
contact (const ::pidf::contact& x)
{
this->tuple_pimpl_state_.tuple_->contact (x);
}
void tuple_pimpl::
note (const ::pidf::note& x)
{
this->tuple_pimpl_state_.tuple_->note ().push_back (x);
}
void tuple_pimpl::
timestamp (const ::xml_schema::date_time& x)
{
this->tuple_pimpl_state_.tuple_->timestamp (x);
}
::pidf::tuple* tuple_pimpl::
post_tuple ()
{
::pidf::tuple* r = this->tuple_pimpl_state_.tuple_;
this->tuple_pimpl_state_.tuple_ = 0;
return r;
}
}
namespace pidf
{
// presence_paggr
//
presence_paggr::
presence_paggr ()
{
this->status_p_.parsers (this->basic_p_);
this->contact_p_.parsers (this->qvalue_p_);
this->note_p_.parsers (this->lang_p_);
this->presence_p_.parsers (this->uri_p_,
this->tuple_p_,
this->note_p_);
this->tuple_p_.parsers (this->id_p_,