Commit 74fdb400 authored by Ghislain MARY's avatar Ghislain MARY Committed by Benjamin REIS

Improve xsd integration.

parent 4905a3fa
......@@ -59,13 +59,6 @@ if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}")
endif()
if(APPLE)
set(XSDCXX_DEFAULT_ROOT_PATH "/usr/local")
else ()
set(XSDCXX_DEFAULT_ROOT_PATH "/usr")
endif()
set(XSDCXX_ROOT_PATH ${XSDCXX_DEFAULT_ROOT_PATH} CACHE STRING "Path of where the bin/xsdcxx executable will be found. Comes from http://www.codesynthesis.com/products/xsd/download.xhtml. On mac use 'brew install xsd'")
set(SYSCONF_INSTALL_DIR ${CMAKE_INSTALL_FULL_SYSCONFDIR} CACHE STRING "Config directory, the place where flexisip expects its flexisip.conf file to reside" )
......@@ -92,25 +85,7 @@ endif()
find_package(BcToolbox 0.0.3 REQUIRED)
find_program(XSDCXX_PROG NAMES "xsdcxx" "xsd"
HINTS ${XSDCXX_ROOT_PATH}/bin
)
if(XSDCXX_PROG)
set(ENABLE_XSD 1)
message(STATUS "XSD found at ${XSDCXX_PROG}, enabling XSD")
# TODO: check XSD is the correct executable
find_library(XERCES_LIBS NAMES xerces-c)
if(NOT XERCES_LIBS)
message(FATAL_ERROR "Failed to find the Xerces library.")
endif()
find_path(XERCES_INCLUDE_DIRS NAMES xercesc/util/XercesDefs.hpp)
if(NOT XERCES_INCLUDE_DIRS)
message(FATAL_ERROR "Failed to find the Xerces includes.")
endif()
else()
set(ENABLE_XSD 0)
message(STATUS "Program 'xsdcxx' could not be found in ${XSDCXX_ROOT_PATH}/bin, disabling XSD features")
endif()
find_package(LibXsd)
check_function_exists(arc4random HAVE_ARC4RANDOM)
find_file(HAVE_SYS_PRCTL_H NAMES sys/prctl.h)
......
############################################################################
# FindLibXsd.cmake
# Copyright (C) 2017 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
#
# - Find the libxsd library
#
# LIBXSD_FOUND - system has libxsd
# LIBXSD_INCLUDE_DIRS - the libxsd include directory
# LIBXSD_LIBRARIES - The libraries needed to use libxsd
find_package(XercesC)
find_path(LIBXSD_INCLUDE_DIRS
NAMES xsd/cxx/config.hxx
PATH_SUFFIXES include
)
if(LIBXSD_INCLUDE_DIRS)
list(APPEND LIBXSD_INCLUDE_DIRS ${XercesC_INCLUDE_DIRS})
endif()
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibXsd
DEFAULT_MSG
LIBXSD_INCLUDE_DIRS LIBXSD_LIBRARIES
)
mark_as_advanced(LIBXSD_INCLUDE_DIRS LIBXSD_LIBRARIES)
......@@ -20,7 +20,7 @@
#
############################################################################
set(FLEXISIP_LIBS ${ORTP_LIBRARIES} ${SOFIASIPUA_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} )
set(FLEXISIP_LIBS ${ORTP_LIBRARIES} ${SOFIASIPUA_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} )
set(FLEXISIP_INCLUDES )
......@@ -91,36 +91,12 @@ add_custom_target(flexisip-git-version
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/flexisip_gitversion.h"
)
function(ADD_XSD_WRAPPERS file _comment)
set(destinations ${CMAKE_CURRENT_BINARY_DIR}/xml/${file}.hxx ${CMAKE_CURRENT_BINARY_DIR}/xml/${file}.cxx)
set(source ${CMAKE_CURRENT_LIST_DIR}/xml/${file}.xsd)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/xml")
set(regex "%http://.+/(.+)%\\\$$1%")
add_custom_command(OUTPUT ${destinations}
COMMAND "${XSDCXX_PROG}" "cxx-tree" "--generate-wildcard"
"--generate-serialization" "--generate-ostream"
"--generate-detach" "--std" "c++11" "--type-naming" "java"
"--function-naming" "java" "--location-regex-trace" "--show-sloc"
"--location-regex" "\"${regex}\""
"--output-dir" "${CMAKE_CURRENT_BINARY_DIR}/xml" "${source}"
COMMENT "${_comment}")
add_custom_target(${file} DEPENDS ${destinations} SOURCES ${source})
set_source_files_properties(${destinations} PROPERTIES GENERATED ON)
set(FLEXISIP_SOURCES ${FLEXISIP_SOURCES} ${destinations} PARENT_SCOPE)
endfunction()
list(APPEND FLEXISIP_INCLUDES ${BCTOOLBOX_INCLUDE_DIRS})
if(ENABLE_XSD)
list(APPEND FLEXISIP_LIBS ${XERCES_LIBS})
list(APPEND FLEXISIP_INCLUDES ${XERCES_INCLUDE_DIRS} ${XSDCXX_ROOT_PATH}/libxsd ${CMAKE_CURRENT_BINARY_DIR}/xml)
list(APPEND FLEXISIP_DEPENDENCIES fthttp)
ADD_XSD_WRAPPERS(fthttp "Generating XSD for FTHTTP")
if(LIBXSD_FOUND)
list(APPEND FLEXISIP_LIBS ${LIBXSD_LIBRARIES})
list(APPEND FLEXISIP_INCLUDES ${LIBXSD_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/xml)
list(APPEND FLEXISIP_SOURCES xml/fthttp.cc xml/fthttp.hh)
endif()
if(ENABLE_MSGPACK)
......@@ -183,31 +159,66 @@ if(ENABLE_PRESENCE OR ENABLE_MDNS)
endif()
if(ENABLE_PRESENCE)
if (NOT ENABLE_XSD)
if(NOT LIBXSD_FOUND)
message(FATAL_ERROR "Presence asked but XSD not enabled! Please enable it first.")
endif()
file(GLOB PRESENCE_SRCS presence/*.cc presence/*.hh)
list(APPEND FLEXISIP_SOURCES ${PRESENCE_SRCS})
list(APPEND FLEXISIP_LIBS ${XERCES_LIBS})
list(APPEND FLEXISIP_INCLUDES presence)
ADD_XSD_WRAPPERS(xml "Presence XSD - xml.xsd")
list(APPEND FLEXISIP_SOURCES xml/xml.xsd)
ADD_XSD_WRAPPERS(pidf+xml "Presence XSD - pidf+xml.xsd")
list(APPEND FLEXISIP_SOURCES xml/pidf+xml.xsd)
ADD_XSD_WRAPPERS(rlmi+xml "Presence XSD - rlmi+xml.xsd")
list(APPEND FLEXISIP_SOURCES xml/rlmi+xml.xsd)
ADD_XSD_WRAPPERS(resource-lists "Presence XSD - resource-lists.xsd")
list(APPEND FLEXISIP_SOURCES xml/resource-lists.xsd)
ADD_XSD_WRAPPERS(rpid "RPID XSD - rpid.xsd")
list(APPEND FLEXISIP_SOURCES xml/rpid.xsd)
ADD_XSD_WRAPPERS(data-model "Data model XSD - data-model.xsd")
list(APPEND FLEXISIP_SOURCES xml/data-model.xsd)
list(APPEND FLEXISIP_DEPENDENCIES xml pidf+xml rlmi+xml resource-lists rpid data-model)
add_definitions(-DBELLE_SIP_USE_STL ${BELLE_SIP_CFLAGS})
list(APPEND FLEXISIP_LIBS ${BELLESIP_LIBRARIES} ${XERCES_LIBS})
list(APPEND FLEXISIP_INCLUDES ${BELLESIP_INCLUDE_DIRS} presence)
list(APPEND FLEXISIP_SOURCES
presence/bellesip-signaling-exception.cc
presence/bellesip-signaling-exception.hh
presence/etag-manager.hh
presence/file-resource-list-manager.cc
presence/file-resource-list-manager.hh
presence/list-subscription.cc
presence/list-subscription.hh
presence/presence-configmanager.cc
presence/presence-configmanager.hh
presence/presence-longterm.cc
presence/presence-longterm.hh
presence/presence-server.cc
presence/presence-server.hh
presence/presentity-manager.hh
presence/presentity-presenceinformation.cc
presence/presentity-presenceinformation.hh
presence/subscription.cc
presence/subscription.hh
xml/data-model.cc
xml/data-model.hh
xml/pidf+xml.cc
xml/pidf+xml.hh
xml/resource-lists.cc
xml/resource-lists.hh
xml/rlmi+xml.cc
xml/rlmi+xml.hh
xml/rpid.cc
xml/rpid.hh
xml/xml.cc
xml/xml.hh
)
endif()
if(ENABLE_PUSHNOTIFICATION)
file(GLOB PUSHNOTIFICATION_SRCS pushnotification/*.cc pushnotification/*.hh)
list(APPEND FLEXISIP_SOURCES module-pushnotification.cc ${PUSHNOTIFICATION_SRCS})
list(APPEND FLEXISIP_SOURCES
module-pushnotification.cc
pushnotification/applepush.cc
pushnotification/applepush.hh
pushnotification/firebasepush.cc
pushnotification/firebasepush.hh
pushnotification/genericpush.cc
pushnotification/genericpush.hh
pushnotification/googlepush.cc
pushnotification/googlepush.hh
pushnotification/microsoftpush.cc
pushnotification/microsoftpush.hh
pushnotification/pushnotificationclient.cc
pushnotification/pushnotificationclient.hh
pushnotification/pushnotificationclient_wp.cc
pushnotification/pushnotificationclient_wp.hh
pushnotification/pushnotificationservice.cc
pushnotification/pushnotificationservice.hh
)
endif()
list(APPEND FLEXISIP_LIBS ${OPENSSL_LIBRARIES})
list(APPEND FLEXISIP_INCLUDES ${OPENSSL_INCLUDE_DIR})
......
......@@ -25,9 +25,8 @@
#if ENABLE_XSD
#include "xml/fthttp.hxx"
#include "xml/fthttp.h"
#include <xercesc/util/PlatformUtils.hpp>
using namespace fthttp;
#endif
......@@ -213,23 +212,23 @@ void ForkMessageContext::onNewBranch(const shared_ptr<BranchInfo> &br) {
xercesc::XMLPlatformUtils::Initialize();
if (payload) {
std::unique_ptr<fthttp::File> file_transfer_infos;
std::unique_ptr<Xsd::Fthttp::File> file_transfer_infos;
char *file_url = NULL;
try {
istringstream data(payload->pl_data);
file_transfer_infos = parseFile(data, xml_schema::Flags::dont_validate);
} catch (const xml_schema::Exception &e) {
file_transfer_infos = Xsd::Fthttp::parseFile(data, Xsd::XmlSchema::Flags::dont_validate);
} catch (const Xsd::XmlSchema::Exception &e) {
SLOGE << "Can't parse the content of the message";
}
if (file_transfer_infos) {
File::File_infoSequence &infos = file_transfer_infos->getFile_info();
Xsd::Fthttp::File::FileInfoSequence &infos = file_transfer_infos->getFileInfo();
if (infos.size() >= 1) {
for (File::File_infoConstIterator i(infos.begin()); i != infos.end(); ++i) {
const File::File_infoType &info = (*i);
const File_info::DataType &data = info.getData();
const Data::UrlType &url = data.getUrl();
for (Xsd::Fthttp::File::FileInfoConstIterator i(infos.begin()); i != infos.end(); ++i) {
const Xsd::Fthttp::File::FileInfoType &info = (*i);
const Xsd::Fthttp::FileInfo::DataType &data = info.getData();
const Xsd::Fthttp::Data::UrlType &url = data.getUrl();
file_url = (char *)url.c_str();
break;
}
......
......@@ -20,9 +20,9 @@
#include "belle-sip/belle-sip.h"
#include "bellesip-signaling-exception.hh"
#include "log/logmanager.hh"
#include "resource-lists.hxx"
#include "resource-lists.hh"
#include <chrono>
#include "rlmi+xml.hxx"
#include "rlmi+xml.hh"
#include "belle-sip/bodyhandler.h"
#include <algorithm>
......@@ -49,20 +49,20 @@ ListSubscription::ListSubscription(unsigned int expires, belle_sip_server_transa
if (!belle_sip_message_get_body(BELLE_SIP_MESSAGE(request))) {
throw BELLESIP_SIGNALING_EXCEPTION_1(400, belle_sip_header_create("Warning", "Empty body")) << "Empty body";
}
::std::unique_ptr<resource_lists::Resource_lists> resource_list_body = NULL;
::std::unique_ptr<Xsd::ResourceLists::ResourceLists> resource_list_body = NULL;
try {
istringstream data(belle_sip_message_get_body(BELLE_SIP_MESSAGE(request)));
resource_list_body = resource_lists::parseResource_lists(data, xml_schema::Flags::dont_validate);
} catch (const xml_schema::Exception &e) {
resource_list_body = Xsd::ResourceLists::parseResourceLists(data, Xsd::XmlSchema::Flags::dont_validate);
} catch (const Xsd::XmlSchema::Exception &e) {
ostringstream os;
os << "Cannot parse body caused by [" << e << "]";
// todo check error code
throw BELLESIP_SIGNALING_EXCEPTION_1(400, belle_sip_header_create("Warning", os.str().c_str())) << os.str();
}
for (::resource_lists::List::ListConstIterator listIt = resource_list_body->getList().begin();
for (Xsd::ResourceLists::List::ListConstIterator listIt = resource_list_body->getList().begin();
listIt != resource_list_body->getList().end(); listIt++) {
for (::resource_lists::List::EntryConstIterator entryIt = listIt->getEntry().begin();
for (Xsd::ResourceLists::List::EntryConstIterator entryIt = listIt->getEntry().begin();
entryIt != listIt->getEntry().end(); entryIt++) {
//fixme until we have a fast uri parser
//belle_sip_uri_t *uri = belle_sip_uri_parse(entryIt->getUri().c_str());
......@@ -106,12 +106,12 @@ ListSubscription::~ListSubscription() {
SLOGD << "List souscription ["<< this <<"] deleted";
};
void ListSubscription::addInstanceToResource(rlmi::Resource &resource, list<belle_sip_body_handler_t *> &multipartList,
void ListSubscription::addInstanceToResource(Xsd::Rlmi::Resource &resource, list<belle_sip_body_handler_t *> &multipartList,
PresentityPresenceInformation &presentityInformation, bool extended) {
// we have a resource instance
// subscription state is always active until we implement ACL
rlmi::Instance instance("1", rlmi::State::active);
Xsd::Rlmi::Instance instance("1", Xsd::Rlmi::State::active);
char cid_rand_part[8];
belle_sip_random_token(cid_rand_part, sizeof(cid_rand_part));
ostringstream cid;
......@@ -157,7 +157,7 @@ void ListSubscription::notify(bool isFullState) {
*/
SLOGE << "First NOTIFY sent in subscription [" << mName << "] MUST contain full state";
}
rlmi::List resourceList(string(uri), mVersion, isFullState);
Xsd::Rlmi::List resourceList(string(uri), mVersion, isFullState);
belle_sip_free(uri);
list<belle_sip_body_handler_t *> multipartList;
......@@ -165,7 +165,7 @@ void ListSubscription::notify(bool isFullState) {
SLOGI << "Building full state rlmi for list name [" << mName << "]";
for (shared_ptr<PresentityPresenceInformationListener> &resourceListener : mListeners) {
char *presentityUri = belle_sip_uri_to_string(resourceListener->getPresentityUri());
rlmi::Resource resource(presentityUri);
Xsd::Rlmi::Resource resource(presentityUri);
belle_sip_free(presentityUri);
PendingStateType::iterator it = mPendingStates.find(resourceListener->getPresentityUri());
if (it != mPendingStates.end() && it->second.first->isKnown()) {
......@@ -183,7 +183,7 @@ void ListSubscription::notify(bool isFullState) {
if (presenceInformationPair.second.first->isKnown()) { /* only notify for entity with known state*/
shared_ptr<PresentityPresenceInformation> presenceInformation = presenceInformationPair.second.first;
char *presentityUri = belle_sip_uri_to_string(presenceInformation->getEntity());
rlmi::Resource resource(presentityUri);
Xsd::Rlmi::Resource resource(presentityUri);
belle_sip_free(presentityUri);
addInstanceToResource(resource, multipartList, *presenceInformation, presenceInformationPair.second.second);
resourceList.getResource().push_back(resource);
......@@ -199,10 +199,10 @@ void ListSubscription::notify(bool isFullState) {
// Serialize the object model to XML.
//
xml_schema::NamespaceInfomap map;
Xsd::XmlSchema::NamespaceInfomap map;
map[""].name = "urn:ietf:params:xml:ns:rlmi";
stringstream out;
rlmi::serializeList(out, resourceList, map);
Xsd::Rlmi::serializeList(out, resourceList, map);
belle_sip_memory_body_handler_t *firstBodyPart = belle_sip_memory_body_handler_new_copy_from_buffer(
(void *)out.str().c_str(), out.str().length(), NULL, NULL);
......@@ -224,7 +224,7 @@ void ListSubscription::notify(bool isFullState) {
mVersion++;
mLastNotify = chrono::system_clock::now();
mPendingStates.clear();
} catch (const xml_schema::Serialization &e) {
} catch (const Xsd::XmlSchema::Serialization &e) {
throw FLEXISIP_EXCEPTION << "serialization error: " << e.diagnostics();
} catch (exception &e) {
throw FLEXISIP_EXCEPTION << "Cannot get build list notidy for [" << mName << "]error [" << e.what() << "]";
......
......@@ -19,13 +19,11 @@
#ifndef flexisip_rls_subscription_hh
#define flexisip_rls_subscription_hh
#include "subscription.hh"
#include "rlmi+xml.hh"
#include <unordered_map>
#include <chrono>
typedef struct _belle_sip_uri belle_sip_uri_t;
typedef struct belle_sip_server_transaction belle_sip_server_transaction_t;
namespace rlmi {
class Resource;
}
namespace flexisip {
class ListSubscription;
......@@ -76,7 +74,7 @@ class ListSubscription : public Subscription {
ListSubscription(const ListSubscription &);
// return true if a real notify can be sent.
bool isTimeToNotify();
void addInstanceToResource(rlmi::Resource &resource, std::list<belle_sip_body_handler_t *> &multipartList,
void addInstanceToResource(Xsd::Rlmi::Resource &resource, std::list<belle_sip_body_handler_t *> &multipartList,
PresentityPresenceInformation &presentityInformation, bool extended);
std::list<std::shared_ptr<PresentityPresenceInformationListener>> mListeners;
......
......@@ -18,8 +18,8 @@
#include "presence-server.hh"
#include "belle-sip/belle-sip.h"
#include "pidf+xml.hxx"
#include "resource-lists.hxx"
#include "pidf+xml.hh"
#include "resource-lists.hh"
#include "presentity-presenceinformation.hh"
#include "list-subscription.hh"
#include "bellesip-signaling-exception.hh"
......@@ -410,11 +410,11 @@ void PresenceServer::processPublishRequestEvent(const belle_sip_request_event_t
// At that point, we are safe
if (belle_sip_message_get_body_size(BELLE_SIP_MESSAGE(request)) > 0) {
::std::unique_ptr<pidf::Presence> presence_body = NULL;
::std::unique_ptr<Xsd::Pidf::Presence> presence_body = NULL;
try {
istringstream data(belle_sip_message_get_body(BELLE_SIP_MESSAGE(request)));
presence_body = parsePresence(data, xml_schema::Flags::dont_validate);
} catch (const xml_schema::Exception &e) {
presence_body = Xsd::Pidf::parsePresence(data, Xsd::XmlSchema::Flags::dont_validate);
} catch (const Xsd::XmlSchema::Exception &e) {
ostringstream os;
os << "Cannot parse body caused by [" << e << "]";
// todo check error code
......
......@@ -20,8 +20,8 @@
#define PRESENCETUPLE_HH_
#include <map>
#include "pidf+xml.hxx"
//#include "data-model.hxx"
#include "pidf+xml.hh"
//#include "data-model.hh"
#include <list>
#include "utils/flexisip-exception.hh"
......@@ -32,16 +32,16 @@ namespace flexisip {
class PresentityManager;
class PresenceInformationElement {
public:
PresenceInformationElement(pidf::Presence::TupleSequence *tuples, data_model::Person *person,
PresenceInformationElement(Xsd::Pidf::Presence::TupleSequence *tuples, Xsd::DataModel::Person *person,
belle_sip_main_loop_t *mainLoop);
// create an information element with a default tuple set to closed.
PresenceInformationElement(const belle_sip_uri_t *contact);
~PresenceInformationElement();
time_t getExpitationTime() const;
void setExpiresTimer(belle_sip_source_t *timer);
const std::unique_ptr<pidf::Tuple> &getTuple(const std::string &id) const;
const std::list<std::unique_ptr<pidf::Tuple>> &getTuples() const;
const data_model::Person getPerson() const;
const std::unique_ptr<Xsd::Pidf::Tuple> &getTuple(const std::string &id) const;
const std::list<std::unique_ptr<Xsd::Pidf::Tuple>> &getTuples() const;
const Xsd::DataModel::Person getPerson() const;
// void addTuple(pidf::Tuple*);
// void removeTuple(pidf::Tuple*);
void clearTuples();
......@@ -49,9 +49,9 @@ class PresenceInformationElement {
void setEtag(const std::string &eTag);
private:
std::list<std::unique_ptr<pidf::Tuple>> mTuples;
data_model::Person mPerson = data_model::Person("");
::xml_schema::dom::unique_ptr<xercesc::DOMDocument> mDomDocument; // needed to store extension nodes
std::list<std::unique_ptr<Xsd::Pidf::Tuple>> mTuples;
Xsd::DataModel::Person mPerson = Xsd::DataModel::Person("");
Xsd::XmlSchema::dom::unique_ptr<xercesc::DOMDocument> mDomDocument; // needed to store extension nodes
belle_sip_main_loop_t *mBelleSipMainloop;
belle_sip_source_t *mTimer;
std::string mEtag;
......@@ -99,7 +99,7 @@ class PresentityPresenceInformation : public std::enable_shared_from_this<Presen
* store tuples a new tupple;
* @return new eTag
* */
std::string putTuples(pidf::Presence::TupleSequence &tuples, data_model::Person &person, int expires);
std::string putTuples(Xsd::Pidf::Presence::TupleSequence &tuples, Xsd::DataModel::Person &person, int expires);
void setDefaultElement(const char* contact = NULL);
......@@ -117,8 +117,7 @@ class PresentityPresenceInformation : public std::enable_shared_from_this<Presen
*
* @return new eTag
* */
std::string updateTuples(pidf::Presence::TupleSequence &tuples, data_model::Person &person, std::string &eTag,
int expires);
std::string updateTuples(Xsd::Pidf::Presence::TupleSequence &tuples, Xsd::DataModel::Person &person, std::string &eTag, int expires);
/*
* refresh a publish
......@@ -157,12 +156,12 @@ class PresentityPresenceInformation : public std::enable_shared_from_this<Presen
* return true if a presence info is already known from a publish
*/
bool isKnown();
/*
* return true if a presence info has a default presence value previously set by setDefaultElement
*/
bool hasDefaultElement();
/*
* return number of current listeners (I.E subscriber)
*/
......@@ -188,8 +187,8 @@ class PresentityPresenceInformation : public std::enable_shared_from_this<Presen
/*
* tuples may be null
*/
std::string setOrUpdate(pidf::Presence::TupleSequence *tuples, data_model::Person *, const std::string *eTag,
int expires);
std::string setOrUpdate(Xsd::Pidf::Presence::TupleSequence *tuples, Xsd::DataModel::Person *, const std::string *eTag, int expires);
/*
*Notify all listener
*/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/python
# Copyright (C) 2017 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
from distutils.spawn import find_executable
import os
import sys
from subprocess import Popen, PIPE
def find_xsdcxx():
xsdcxx = find_executable("xsdcxx")
if xsdcxx is not None:
return xsdcxx
xsdcxx = find_executable("xsd")
return xsdcxx
def generate(name):
xsdcxx = find_xsdcxx()
if xsdcxx is None:
print("Cannot find xsdcxx (or xsd) program in the PATH")
return -1
print("Using " + xsdcxx)
cwd = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
source_file = name + ".xsd"
print("Generating code from " + source_file)
source_file = os.path.join("xml", source_file)
prologue_file = os.path.join("xml", "prologue.txt")
epilogue_file = os.path.join("xml", "epilogue.txt")
work_dir = os.path.join(script_dir, "..")
os.chdir(work_dir)
p = Popen([xsdcxx,
"cxx-tree",
"--generate-wildcard",
"--generate-serialization",
"--generate-ostream",
"--generate-detach",
"--std", "c++11",
"--type-naming", "java",
"--function-naming", "java",
"--hxx-suffix", ".hh",
"--ixx-suffix", ".hh",
"--cxx-suffix", ".cc",
"--location-regex", "%http://.+/(.+)%$1%",
"--output-dir", "xml",
"--show-sloc",
"--prologue-file", prologue_file,
"--epilogue-file", epilogue_file,
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-([^,-]+)-?([^,-]*)%\\u$1\\u$2\\u$3\\u$4%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-?([^,-]*)%\\u$1\\u$2\\u$3%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-?([^,-]*)%\\u$1\\u$2%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-([^,-]+)-?([^,-]*),([^,]+)%\\u$1\\u$2\\u$3\\u$4\\l\\u$5%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-?([^,-]*),([^,]+)%\\u$1\\u$2\\u$3\\l\\u$4%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-?([^,-]*),([^,]+)%\\u$1\\u$2\\l\\u$3%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+)%\\u$1\\u$2\\u$3\\u$4\\l\\u$5\\u$6%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+)%\\u$1\\u$2\\u$3\\l\\u$4\\u$5%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-?([^,-]*),([^,]+),([^,]+)%\\u$1\\u$2\\l\\u$3\\u$4%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+),([^,]+)%\\u$1\\u$2\\u$3\\u$4\\l\\u$5\\u$6\\u$7%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+),([^,]+)%\\u$1\\u$2\\u$3\\l\\u$4\\u$5\\u$6%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-?([^,-]*),([^,]+),([^,]+),([^,]+)%\\u$1\\u$2\\l\\u$3\\u$4\\u$5%",
"--accessor-regex", "%([^,-]+)-([^,-]+)-?([^,-]*)%get\\u$1\\u$2\\u$3%",
"--accessor-regex", "%([^,-]+)-?([^,-]*)%get\\u$1\\u$2%",
"--accessor-regex", "%([^,-]+)-([^,-]+)-?([^,-]*),([^,]+)%get\\u$1\\u$2\\u$3\\l\\u$4%",
"--accessor-regex", "%([^,-]+)-?([^,-]*),([^,]+)%get\\u$1\\u$2\\l\\u$3%",
"--accessor-regex", "%([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+)%get\\u$1\\u$2\\u$3\\l\\u$4\\u$5%",
"--accessor-regex", "%([^,-]+)-?([^,-]*),([^,]+),([^,]+)%get\\u$1\\u$2\\l\\u$3\\u$4%",
"--modifier-regex", "%([^,-]+)-([^,-]+)-?([^,-]*)%set\\u$1\\u$2\\u$3%",
"--modifier-regex", "%([^,-]+)-?([^,-]*)%set\\u$1\\u$2%",
"--modifier-regex", "%([^,-]+)-([^,-]+)-?([^,-]*),([^,]+)%set\\u$1\\u$2\\u$3\\l\\u$4%",
"--modifier-regex", "%([^,-]+)-?([^,-]*),([^,]+)%set\\u$1\\u$2\\l\\u$3%",
"--modifier-regex", "%([^,-]+)-([^,-]+)-?([^,-]*),([^,]+),([^,]+)%set\\u$1\\u$2\\u$3\\l\\u$4\\u$5%",
"--modifier-regex", "%([^,-]+)-?([^,-]*),([^,]+),([^,]+)%set\\u$1\\u$2\\l\\u$3\\u$4%",
"--parser-regex", "%([^-]+)-?([^-]*)%parse\\u$1\\u$2%",
"--serializer-regex", "%([^-]+)-?([^-]*)%serialize\\u$1\\u$2%",
"--namespace-map", "http://www.w3.org/2001/XMLSchema=Xsd::XmlSchema",
"--namespace-map", "urn:ietf:params:xml:ns:pidf:data-model=Xsd::DataModel",
"--namespace-map", "urn:gsma:params:xml:ns:rcs:rcs:fthttp=Xsd::Fthttp",
"--namespace-map", "urn:ietf:params:xml:ns:pidf=Xsd::Pidf",
"--namespace-map", "urn:ietf:params:xml:ns:resource-lists=Xsd::ResourceLists",
"--namespace-map", "urn:ietf:params:xml:ns:rlmi=Xsd::Rlmi",
"--namespace-map", "urn:ietf:params:xml:ns:pidf:rpid=Xsd::Rpid",
source_file
], shell=False)
p.communicate()
os.chdir(cwd)
return 0
def main(argv = None):
generate("xml")
generate("common-schema")
generate("data-model")
generate("fthttp")
generate("pidf+xml")
generate("resource-lists")
generate("rlmi+xml")
generate("rpid")
if __name__ == "__main__":
sys.exit(main())
This diff is collapsed.
This diff is collapsed.
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#ifndef __ANDROID__
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment