Merge remote-tracking branch 'origin/dev_conference_info' into dev_refactor_cpp

This commit is contained in:
Ghislain MARY 2017-09-18 17:20:26 +02:00
commit 2b8291c3f1
28 changed files with 20032 additions and 17 deletions

View file

@ -133,6 +133,7 @@ else()
find_package(Belr REQUIRED)
endif()
find_package(XML2 REQUIRED)
find_package(LibXsd REQUIRED)
find_package(Soci)
find_package(Zlib)
if(ENABLE_TUNNEL)

View file

@ -33,7 +33,6 @@ if(ANDROID)
find_package(Support REQUIRED)
endif()
list(APPEND LINPHONE_PRIVATE_HEADER_FILES
bellesip_sal/sal_impl.h
carddav.h
@ -121,6 +120,7 @@ set(LINPHONE_SOURCE_FILES_C
set(LINPHONE_SOURCE_FILES_CXX
conference.cc
)
set(LINPHONE_INCLUDE_DIRS ${LINPHONE_INCLUDE_DIRS})
if(ANDROID)
list(APPEND LINPHONE_SOURCE_FILES_CXX linphonecore_jni.cc)
set_source_files_properties(linphonecore_jni.cc PROPERTIES COMPILE_DEFINITIONS "USE_JAVAH")
@ -157,6 +157,7 @@ set(LIBS
${ORTP_LIBRARIES}
${XML2_LIBRARIES}
${BELR_LIBRARIES}
${LIBXSD_LIBRARIES}
)
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS "Ws2_32")

View file

@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mediastreamer2/msjpegwriter.h"
#include "mediastreamer2/msogl.h"
#include "mediastreamer2/msvolume.h"
#include "conference/remote-conference-event-handler.h"
// For migration purpose.
#include "address/address-p.h"
@ -2123,12 +2124,17 @@ static void linphone_core_register_default_codecs(LinphoneCore *lc){
static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body) {
if (strcmp(notified_event, "Presence") == 0) {
const bctbx_list_t* friendLists = linphone_core_get_friends_lists(lc);
while( friendLists != NULL ){
LinphoneFriendList* list = reinterpret_cast<LinphoneFriendList *>(friendLists->data);
ms_message("notify presence for list %p", list);
for (const bctbx_list_t *it = linphone_core_get_friends_lists(lc); it; it = bctbx_list_next(it)) {
LinphoneFriendList *list = reinterpret_cast<LinphoneFriendList *>(bctbx_list_get_data(it));
ms_message("Notify presence for list %p", list);
linphone_friend_list_notify_presence_received(list, lev, body);
friendLists = friendLists->next;
}
} else if (strcmp(notified_event, "Conference") == 0) {
LinphonePrivate::RemoteConferenceEventHandler *handler =
reinterpret_cast<LinphonePrivate::RemoteConferenceEventHandler *>(linphone_event_get_user_data(lev));
if (handler) {
ms_message("Notify event for conference %s", handler->getConfId().c_str());
handler->notifyReceived((char *)linphone_content_get_buffer(body));
}
}
}
@ -2136,6 +2142,8 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
if (strcasecmp(linphone_event_get_name(lev), "Presence") == 0) {
linphone_friend_list_subscription_state_changed(lc, lev, state);
} else if (strcmp(linphone_event_get_name(lev), "Conference") == 0) {
}
}

View file

@ -53,6 +53,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/conference-listener.h
conference/conference.h
conference/local-conference.h
conference/local-conference-event-handler.h
conference/params/call-session-params-p.h
conference/params/call-session-params.h
conference/params/media-session-params-p.h
@ -60,6 +61,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/participant-p.h
conference/participant.h
conference/remote-conference.h
conference/remote-conference-event-handler.h
conference/session/call-session-listener.h
conference/session/call-session-p.h
conference/session/call-session.h
@ -93,6 +95,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
object/singleton.h
utils/payload-type-handler.h
variant/variant.h
xml/conference-info.h
xml/xml.h
)
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
@ -122,10 +126,12 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/real-time-text-chat-room.cpp
conference/conference.cpp
conference/local-conference.cpp
conference/local-conference-event-handler.cpp
conference/params/call-session-params.cpp
conference/params/media-session-params.cpp
conference/participant.cpp
conference/remote-conference.cpp
conference/remote-conference-event-handler.cpp
conference/session/call-session.cpp
conference/session/media-session.cpp
content/content-type.cpp
@ -150,8 +156,15 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
utils/payload-type-handler.cpp
utils/utils.cpp
variant/variant.cpp
xml/conference-info.cpp
xml/xml.cpp
)
ADD_XSD_WRAPPERS(xml/xml "XML XSD - xml.xsd")
ADD_XSD_WRAPPERS(xml/conference-info "Conference info XSD - conference-info.xsd")
ADD_XSD_WRAPPERS(xml/resource-lists "Resourece lists XSD - resource-lists.xsd")
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS})
set(LINPHONE_CXX_OBJECTS_DEFINITIONS "-DLIBLINPHONE_EXPORTS")
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})

View file

@ -19,19 +19,22 @@
#ifndef _CONFERENCE_LISTENER_H_
#define _CONFERENCE_LISTENER_H_
#include "address/address.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ConferenceListener {
public:
virtual void onConferenceCreated (LinphoneAddress *addr) = 0;
virtual void onConferenceTerminated (LinphoneAddress *addr) = 0;
virtual void onParticipantAdded (LinphoneAddress *addr) = 0;
virtual void onParticipantRemoved (LinphoneAddress *addr) = 0;
virtual void onParticipantSetAdmin (LinphoneAddress *addr, bool isAdmin) = 0;
virtual void onConferenceCreated (const Address &addr) = 0;
virtual void onConferenceTerminated (const Address &addr) = 0;
virtual void onParticipantAdded (const Address &addr) = 0;
virtual void onParticipantRemoved (const Address &addr) = 0;
virtual void onParticipantSetAdmin (const Address &addr, bool isAdmin) = 0;
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CONFERENCE_LISTENER_H_

View file

@ -141,4 +141,14 @@ void Conference::onResetFirstVideoFrameDecoded (const CallSession &session) {
callListener->onResetFirstVideoFrameDecoded();
}
// -----------------------------------------------------------------------------
std::shared_ptr<Participant> Conference::findParticipant (const Address &addr) {
for (const auto &participant : participants) {
if (addr.equal(participant->getAddress()))
return participant;
}
return nullptr;
}
LINPHONE_END_NAMESPACE

View file

@ -78,6 +78,8 @@ private:
protected:
explicit Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
std::shared_ptr<Participant> findParticipant (const Address &addr);
protected:
LinphoneCore *core = nullptr;
CallListener *callListener = nullptr;

View file

@ -0,0 +1,165 @@
/*
* local-conference-event-handler.cpp
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "conference/local-conference.h"
#include "conference/participant.h"
#include "local-conference-event-handler.h"
#include "object/object-p.h"
#include "xml/conference-info.h"
#include "private.h"
using namespace std;
using namespace conference_info;
using namespace LinphonePrivate;
LINPHONE_BEGIN_NAMESPACE
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
public:
void notifyFullState(string notify, LinphoneEvent *lev);
void notifyAllExcept(string notify, const Address &addr);
LinphoneCore *core = nullptr;
LocalConference *conf = nullptr;
};
LINPHONE_END_NAMESPACE
void LocalConferenceEventHandlerPrivate::notifyFullState(string notify, LinphoneEvent *lev) {
LinphoneContent *content = linphone_core_create_content(lev->lc);
linphone_content_set_buffer(content, notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(lev, content);
linphone_content_unref(content);
// linphone_event_unref(lev); ??
}
void LocalConferenceEventHandlerPrivate::notifyAllExcept(string notify, const Address &addr) {
for (const auto &participant : conf->getParticipants()) {
if (!addr.equal(participant->getAddress())) {
LinphoneAddress *cAddr = linphone_address_new(participant->getAddress().asString().c_str());
LinphoneEvent *lev = linphone_core_create_notify(core, cAddr, "Conference");
linphone_address_unref(cAddr);
LinphoneContent *content = linphone_core_create_content(lev->lc);
linphone_content_set_buffer(content, notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(lev, content);
linphone_content_unref(content);
linphone_event_unref(lev);
}
}
}
// -------- Conference::LocalConferenceEventHandler public methods ---------
LocalConferenceEventHandler::LocalConferenceEventHandler(LinphoneCore *core, LocalConference *localConf) : Object(*new LocalConferenceEventHandlerPrivate) {
L_D(LocalConferenceEventHandler);
xercesc::XMLPlatformUtils::Initialize();
d->conf = localConf;
d->core = core; // conf->getCore() ?
}
LocalConferenceEventHandler::~LocalConferenceEventHandler() {
xercesc::XMLPlatformUtils::Terminate();
}
string LocalConferenceEventHandler::subscribeReceived(LinphoneEvent *lev) {
L_D(LocalConferenceEventHandler);
string entity = d->conf->getMe()->getAddress().asStringUriOnly();
Conference_type confInfo = Conference_type(entity);
Users_type users;
confInfo.setUsers(users);
xml_schema::NamespaceInfomap map;
map[""].name = "urn:ietf:params:xml:ns:conference-info";
for (const auto &participant : d->conf->getParticipants()) {
User_type user = User_type();
User_roles_type roles;
user.setRoles(roles);
user.setEntity(participant->getAddress().asStringUriOnly());
user.getRoles()->getEntry().push_back(participant->isAdmin() ? "admin" : "participant");
user.setState("full");
confInfo.getUsers()->getUser().push_back(user);
}
stringstream notify;
serializeConference_info(notify, confInfo, map);
//d->notifyFullState(notify.str(), lev);
return notify.str();
}
string LocalConferenceEventHandler::notifyParticipantAdded(const Address &addr) {
L_D(LocalConferenceEventHandler);
string entity = d->conf->getMe()->getAddress().asStringUriOnly();
Conference_type confInfo = Conference_type(entity);
Users_type users;
confInfo.setUsers(users);
User_type user = User_type();
User_roles_type roles;
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState("full");
confInfo.getUsers()->getUser().push_back(user);
xml_schema::NamespaceInfomap map;
stringstream notify;
serializeConference_info(notify, confInfo, map);
//d->notifyAllExcept(notify.str(), addr);
return notify.str();
}
string LocalConferenceEventHandler::notifyParticipantRemoved(const Address &addr) {
L_D(LocalConferenceEventHandler);
string entity = d->conf->getMe()->getAddress().asStringUriOnly();
Conference_type confInfo = Conference_type(entity);
Users_type users;
confInfo.setUsers(users);
User_type user = User_type();
user.setEntity(addr.asStringUriOnly());
user.setState("deleted");
confInfo.getUsers()->getUser().push_back(user);
xml_schema::NamespaceInfomap map;
stringstream notify;
serializeConference_info(notify, confInfo, map);
//d->notifyAllExcept(notify.str(), addr);
return notify.str();
}
string LocalConferenceEventHandler::notifyParticipantSetAdmin(const Address &addr, bool isAdmin) {
L_D(LocalConferenceEventHandler);
string entity = d->conf->getMe()->getAddress().asStringUriOnly();
Conference_type confInfo = Conference_type(entity);
Users_type users;
confInfo.setUsers(users);
User_type user = User_type();
User_roles_type roles;
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back(isAdmin ? "admin" : "participant");
user.setState("partial");
confInfo.getUsers()->getUser().push_back(user);
xml_schema::NamespaceInfomap map;
stringstream notify;
serializeConference_info(notify, confInfo, map);
//d->notifyAllExcept(notify.str(), addr);
return notify.str();
}

View file

@ -0,0 +1,51 @@
/*
* local-conference-event-handler.h
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#define _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#include <string>
#include "linphone/types.h"
#include "address/address.h"
#include "object/object.h"
LINPHONE_BEGIN_NAMESPACE
class LocalConference;
class LocalConferenceEventHandlerPrivate;
class LocalConferenceEventHandler : public Object {
public:
LocalConferenceEventHandler(LinphoneCore *core, LocalConference *localConf);
~LocalConferenceEventHandler();
std::string subscribeReceived(LinphoneEvent *lev);
std::string notifyParticipantAdded(const Address &addr);
std::string notifyParticipantRemoved(const Address &addr);
std::string notifyParticipantSetAdmin(const Address &addr, bool isAdmin);
private:
L_DECLARE_PRIVATE(LocalConferenceEventHandler);
L_DISABLE_COPY(LocalConferenceEventHandler);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_

View file

@ -17,12 +17,67 @@
*/
#include "local-conference.h"
#include "participant-p.h"
LINPHONE_BEGIN_NAMESPACE
using namespace std;
using namespace LinphonePrivate;
// =============================================================================
LocalConference::LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener)
: Conference(core, myAddress, listener) {}
: Conference(core, myAddress, listener) {
eventHandler = new LocalConferenceEventHandler(core, this);
}
LINPHONE_END_NAMESPACE
LocalConference::~LocalConference () {
delete eventHandler;
}
// -----------------------------------------------------------------------------
shared_ptr<Participant> LocalConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
shared_ptr<Participant> participant = findParticipant(addr);
if (participant)
return participant;
participant = make_shared<Participant>(addr);
participant->getPrivate()->createSession(*this, params, hasMedia, this);
participants.push_back(participant);
activeParticipant = participant;
return participant;
}
void LocalConference::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
for (const auto &addr : addresses)
addParticipant(addr, params, hasMedia);
}
bool LocalConference::canHandleParticipants () const {
return true;
}
const string& LocalConference::getId () const {
return id;
}
int LocalConference::getNbParticipants () const {
participants.size();
return 1;
}
list<shared_ptr<Participant>> LocalConference::getParticipants () const {
return participants;
}
void LocalConference::removeParticipant (const shared_ptr<Participant> participant) {
for (const auto &p : participants) {
if (participant->getAddress().equal(p->getAddress())) {
participants.remove(p);
return;
}
}
}
void LocalConference::removeParticipants (const list<shared_ptr<Participant>> participants) {
for (const auto &p : participants)
removeParticipant(p);
}

View file

@ -20,6 +20,7 @@
#define _LOCAL_CONFERENCE_H_
#include "conference.h"
#include "local-conference-event-handler.h"
// =============================================================================
@ -28,10 +29,25 @@ LINPHONE_BEGIN_NAMESPACE
class LocalConference : public Conference {
public:
LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
virtual ~LocalConference() = default;
virtual ~LocalConference();
LocalConferenceEventHandler * getEventHandler() const { return eventHandler; }
public:
/* ConferenceInterface */
virtual std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia);
virtual void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia);
virtual bool canHandleParticipants () const;
virtual const std::string& getId () const;
virtual int getNbParticipants () const;
virtual std::list<std::shared_ptr<Participant>> getParticipants () const;
virtual void removeParticipant (const std::shared_ptr<Participant> participant);
virtual void removeParticipants (const std::list<std::shared_ptr<Participant>> participants);
private:
L_DISABLE_COPY(LocalConference);
LocalConferenceEventHandler *eventHandler = nullptr;
};
LINPHONE_END_NAMESPACE

View file

@ -36,6 +36,7 @@ class Participant : public Object {
friend class CallPrivate;
friend class ClientGroupChatRoom;
friend class Conference;
friend class LocalConference;
friend class MediaSessionPrivate;
public:

View file

@ -0,0 +1,107 @@
/*
* remote-conference-event-handler.cpp
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "remote-conference-event-handler.h"
#include "xml/conference-info.h"
#include "private.h"
#include "object/object-p.h"
using namespace std;
using namespace conference_info;
using namespace LinphonePrivate;
LINPHONE_BEGIN_NAMESPACE
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
public:
LinphoneCore *core = nullptr;
ConferenceListener *listener = nullptr;
Address confAddr;
string confId;
LinphoneEvent *lev = nullptr;
};
LINPHONE_END_NAMESPACE
// -------- RemoteConferenceEventHandler public methods ---------
RemoteConferenceEventHandler::RemoteConferenceEventHandler(LinphoneCore *core, ConferenceListener *listener, const Address &confAddr) : Object(*new RemoteConferenceEventHandlerPrivate) {
L_D(RemoteConferenceEventHandler);
xercesc::XMLPlatformUtils::Initialize();
d->core = core;
d->listener = listener;
d->confAddr = confAddr;
}
RemoteConferenceEventHandler::~RemoteConferenceEventHandler() {
L_D(RemoteConferenceEventHandler);
xercesc::XMLPlatformUtils::Terminate();
if (d->lev)
linphone_event_unref(d->lev);
}
void RemoteConferenceEventHandler::subscribe(string confId) {
L_D(RemoteConferenceEventHandler);
d->confId = confId;
LinphoneAddress *addr = linphone_address_new(d->confAddr.asString().c_str());
d->lev = linphone_core_create_subscribe(d->core, addr, "Conference", 600);
linphone_address_unref(addr);
linphone_event_ref(d->lev);
linphone_event_set_internal(d->lev, TRUE);
linphone_event_set_user_data(d->lev, this);
linphone_event_add_custom_header(d->lev, "Conf-id", d->confId.c_str()); // TODO : ???
linphone_event_send_subscribe(d->lev, nullptr);
}
void RemoteConferenceEventHandler::unsubscribe() {
L_D(RemoteConferenceEventHandler);
linphone_event_terminate(d->lev);
}
void RemoteConferenceEventHandler::notifyReceived(string xmlBody) {
L_D(RemoteConferenceEventHandler);
istringstream data(xmlBody);
unique_ptr<Conference_type> confInfo = parseConference_info(data, xml_schema::Flags::dont_validate);
if (confInfo->getEntity() == d->confAddr.asString()) {
for (const auto &user : confInfo->getUsers()->getUser()) {
LinphoneAddress *cAddr = linphone_core_interpret_url(d->core, user.getEntity()->c_str());
Address addr(linphone_address_as_string(cAddr));
if (user.getState() == "deleted")
d->listener->onParticipantRemoved(addr);
else {
bool isAdmin = false;
if (user.getRoles()) {
for (const auto &entry : user.getRoles()->getEntry()) {
if (entry == "admin") {
isAdmin = true;
break;
}
}
}
if (user.getState() == "full")
d->listener->onParticipantAdded(addr);
d->listener->onParticipantSetAdmin(addr, isAdmin);
}
linphone_address_unref(cAddr);
}
}
}
string RemoteConferenceEventHandler::getConfId() {
L_D(RemoteConferenceEventHandler);
return d->confId;
}

View file

@ -0,0 +1,51 @@
/*
* remote-conference-event-handler.h
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_H_
#define _REMOTE_CONFERENCE_EVENT_HANDLER_H_
#include <string>
#include "linphone/types.h"
#include "object/object.h"
#include "conference-listener.h"
LINPHONE_BEGIN_NAMESPACE
class RemoteConferenceEventHandlerPrivate;
class RemoteConferenceEventHandler : public Object {
public:
RemoteConferenceEventHandler(LinphoneCore *core, ConferenceListener *listener, const Address &confAddr);
~RemoteConferenceEventHandler();
void subscribe(std::string confId);
void notifyReceived(std::string xmlBody);
void unsubscribe();
std::string getConfId();
private:
L_DECLARE_PRIVATE(RemoteConferenceEventHandler);
L_DISABLE_COPY(RemoteConferenceEventHandler);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_H_

9272
src/xml/conference-info.cpp Normal file

File diff suppressed because it is too large Load diff

3862
src/xml/conference-info.h Normal file

File diff suppressed because it is too large Load diff

387
src/xml/conference-info.xsd Normal file
View file

@ -0,0 +1,387 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
targetNamespace="urn:ietf:params:xml:ns:conference-info"
xmlns:tns="urn:ietf:params:xml:ns:conference-info"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="urn:ietf:params:xml:ns:conference-info"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<!--
This imports the xml:language definition
-->
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
<!--
CONFERENCE ELEMENT
-->
<xs:element name="conference-info" type="conference-type"/>
<!--
CONFERENCE TYPE
-->
<xs:complexType name="conference-type">
<xs:sequence>
<xs:element name="conference-description"
type="conference-description-type" minOccurs="0"/>
<xs:element name="host-info"
type="host-type" minOccurs="0"/>
<xs:element name="conference-state"
type="conference-state-type" minOccurs="0"/>
<xs:element name="users"
type="users-type" minOccurs="0"/>
<xs:element name="sidebars-by-ref"
type="uris-type" minOccurs="0"/>
<xs:element name="sidebars-by-val"
type="sidebars-by-val-type" minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="entity"
type="xs:anyURI" use="required"/>
<xs:attribute name="state"
type="state-type" use="optional" default="full"/>
<xs:attribute name="version"
type="xs:unsignedInt" use="optional"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
STATE TYPE
-->
<xs:simpleType name="state-type">
<xs:restriction base="xs:string">
<xs:enumeration value="full"/>
<xs:enumeration value="partial"/>
<xs:enumeration value="deleted"/>
</xs:restriction>
</xs:simpleType>
<!--
CONFERENCE DESCRIPTION TYPE
-->
<xs:complexType name="conference-description-type">
<xs:sequence>
<xs:element name="display-text"
type="xs:string" minOccurs="0"/>
<xs:element name="subject"
type="xs:string" minOccurs="0"/>
<xs:element name="free-text"
type="xs:string" minOccurs="0"/>
<xs:element name="keywords"
type="keywords-type" minOccurs="0"/>
<xs:element name="conf-uris"
type="uris-type" minOccurs="0"/>
<xs:element name="service-uris"
type="uris-type" minOccurs="0"/>
<xs:element name="maximum-user-count"
type="xs:unsignedInt" minOccurs="0"/>
<xs:element name="available-media"
type="conference-media-type" minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
HOST TYPE
-->
<xs:complexType name="host-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="web-page" type="xs:anyURI"
minOccurs="0"/>
<xs:element name="uris" type="uris-type"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
CONFERENCE STATE TYPE
-->
<xs:complexType name="conference-state-type">
<xs:sequence>
<xs:element name="user-count" type="xs:unsignedInt"
minOccurs="0"/>
<xs:element name="active" type="xs:boolean"
minOccurs="0"/>
<xs:element name="locked" type="xs:boolean"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
CONFERENCE MEDIA TYPE
-->
<xs:complexType name="conference-media-type">
<xs:sequence>
<xs:element name="entry" type="conference-medium-type"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
CONFERENCE MEDIUM TYPE
-->
<xs:complexType name="conference-medium-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="type" type="xs:string"/>
<xs:element name="status" type="media-status-type"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="label" type="xs:string"
use="required"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
URIs TYPE
-->
<xs:complexType name="uris-type">
<xs:sequence>
<xs:element name="entry" type="uri-type"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="state" type="state-type"
use="optional" default="full"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
URI TYPE
-->
<xs:complexType name="uri-type">
<xs:sequence>
<xs:element name="uri" type="xs:anyURI"/>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="purpose" type="xs:string"
minOccurs="0"/>
<xs:element name="modified" type="execution-type"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
KEYWORDS TYPE
-->
<xs:simpleType name="keywords-type">
<xs:list itemType="xs:string"/>
</xs:simpleType>
<!--
USERS TYPE
-->
<xs:complexType name="users-type">
<xs:sequence>
<xs:element name="user" type="user-type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="state" type="state-type"
use="optional" default="full"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
USER TYPE
-->
<xs:complexType name="user-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="associated-aors" type="uris-type"
minOccurs="0"/>
<xs:element name="roles" type="user-roles-type"
minOccurs="0"/>
<xs:element name="languages" type="user-languages-type"
minOccurs="0"/>
<xs:element name="cascaded-focus" type="xs:anyURI"
minOccurs="0"/>
<xs:element name="endpoint" type="endpoint-type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="entity" type="xs:anyURI"/>
<xs:attribute name="state" type="state-type"
use="optional" default="full"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
USER ROLES TYPE
-->
<xs:complexType name="user-roles-type">
<xs:sequence>
<xs:element name="entry" type="xs:string"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
USER LANGUAGES TYPE
-->
<xs:simpleType name="user-languages-type">
<xs:list itemType="xs:language"/>
</xs:simpleType>
<!--
ENDPOINT TYPE
-->
<xs:complexType name="endpoint-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="referred" type="execution-type"
minOccurs="0"/>
<xs:element name="status" type="endpoint-status-type"
minOccurs="0"/>
<xs:element name="joining-method" type="joining-type"
minOccurs="0"/>
<xs:element name="joining-info"
type="execution-type"
minOccurs="0"/>
<xs:element name="disconnection-method"
type="disconnection-type"
minOccurs="0"/>
<xs:element name="disconnection-info"
type="execution-type"
minOccurs="0"/>
<xs:element name="media" type="media-type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="call-info" type="call-type"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="entity" type="xs:string"/>
<xs:attribute name="state" type="state-type"
use="optional" default="full"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
ENDPOINT STATUS TYPE
-->
<xs:simpleType name="endpoint-status-type">
<xs:restriction base="xs:string">
<xs:enumeration value="pending"/>
<xs:enumeration value="dialing-out"/>
<xs:enumeration value="dialing-in"/>
<xs:enumeration value="alerting"/>
<xs:enumeration value="on-hold"/>
<xs:enumeration value="connected"/>
<xs:enumeration value="muted-via-focus"/>
<xs:enumeration value="disconnecting"/>
<xs:enumeration value="disconnected"/>
</xs:restriction>
</xs:simpleType>
<!--
JOINING TYPE
-->
<xs:simpleType name="joining-type">
<xs:restriction base="xs:string">
<xs:enumeration value="dialed-in"/>
<xs:enumeration value="dialed-out"/>
<xs:enumeration value="focus-owner"/>
</xs:restriction>
</xs:simpleType>
<!--
DISCONNECTION TYPE
-->
<xs:simpleType name="disconnection-type">
<xs:restriction base="xs:string">
<xs:enumeration value="departed"/>
<xs:enumeration value="booted"/>
<xs:enumeration value="failed"/>
<xs:enumeration value="busy"/>
</xs:restriction>
</xs:simpleType>
<!--
EXECUTION TYPE
-->
<xs:complexType name="execution-type">
<xs:sequence>
<xs:element name="when" type="xs:dateTime"
minOccurs="0"/>
<xs:element name="reason" type="xs:string"
minOccurs="0"/>
<xs:element name="by" type="xs:anyURI"
minOccurs="0"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
CALL TYPE
-->
<xs:complexType name="call-type">
<xs:choice>
<xs:element name="sip" type="sip-dialog-id-type"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
SIP DIALOG ID TYPE
-->
<xs:complexType name="sip-dialog-id-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="call-id" type="xs:string"/>
<xs:element name="from-tag" type="xs:string"/>
<xs:element name="to-tag" type="xs:string"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
MEDIA TYPE
-->
<xs:complexType name="media-type">
<xs:sequence>
<xs:element name="display-text" type="xs:string"
minOccurs="0"/>
<xs:element name="type" type="xs:string"
minOccurs="0"/>
<xs:element name="label" type="xs:string"
minOccurs="0"/>
<xs:element name="src-id" type="xs:string"
minOccurs="0"/>
<xs:element name="status" type="media-status-type"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string"
use="required"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!--
MEDIA STATUS TYPE
-->
<xs:simpleType name="media-status-type">
<xs:restriction base="xs:string">
<xs:enumeration value="recvonly"/>
<xs:enumeration value="sendonly"/>
<xs:enumeration value="sendrecv"/>
<xs:enumeration value="inactive"/>
</xs:restriction>
</xs:simpleType>
<!--
SIDEBARS BY VAL TYPE
-->
<xs:complexType name="sidebars-by-val-type">
<xs:sequence>
<xs:element name="entry" type="conference-type"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="state" type="state-type"
use="optional" default="full"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
</xs:schema>

2451
src/xml/resource-lists.cpp Normal file

File diff suppressed because it is too large Load diff

1254
src/xml/resource-lists.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:ietf:params:xml:ns:resource-lists"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="urn:ietf:params:xml:ns:resource-lists"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
<xs:complexType name="listType">
<xs:sequence>
<xs:element name="display-name" type="display-nameType"
minOccurs="0"/>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="list">
<xs:complexType>
<xs:complexContent>
<xs:extension base="listType"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="external" type="externalType"/>
<xs:element name="entry" type="entryType"/>
<xs:element name="entry-ref" type="entry-refType"/>
</xs:choice>
</xs:sequence>
<xs:any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:complexType name="entryType">
<xs:sequence>
<xs:element name="display-name" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="display-nameType"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="uri" type="xs:anyURI" use="required"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:complexType name="entry-refType">
<xs:sequence>
<xs:element name="display-name" type="display-nameType"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ref" type="xs:anyURI" use="required"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:complexType name="externalType">
<xs:sequence>
<xs:element name="display-name" type="display-nameType"
minOccurs="0"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="anchor" type="xs:anyURI"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="resource-lists">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="list" type="listType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="display-nameType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="xml:lang"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

451
src/xml/xml.cpp Normal file
View file

@ -0,0 +1,451 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// 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
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
// Begin prologue.
//
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "xml.h"
namespace namespace_
{
// Lang
//
Lang::
Lang (const char* s)
: ::xml_schema::String (s)
{
}
Lang::
Lang (const ::std::string& s)
: ::xml_schema::String (s)
{
}
Lang::
Lang (const Lang& o,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (o, f, c)
{
}
// Space
//
Space::
Space (Value v)
: ::xml_schema::Ncname (_xsd_Space_literals_[v])
{
}
Space::
Space (const char* v)
: ::xml_schema::Ncname (v)
{
}
Space::
Space (const ::std::string& v)
: ::xml_schema::Ncname (v)
{
}
Space::
Space (const ::xml_schema::Ncname& v)
: ::xml_schema::Ncname (v)
{
}
Space::
Space (const Space& v,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Ncname (v, f, c)
{
}
Space& Space::
operator= (Value v)
{
static_cast< ::xml_schema::Ncname& > (*this) =
::xml_schema::Ncname (_xsd_Space_literals_[v]);
return *this;
}
// Lang_member
//
Lang_member::
Lang_member (Value v)
: ::xml_schema::String (_xsd_Lang_member_literals_[v])
{
}
Lang_member::
Lang_member (const char* v)
: ::xml_schema::String (v)
{
}
Lang_member::
Lang_member (const ::std::string& v)
: ::xml_schema::String (v)
{
}
Lang_member::
Lang_member (const ::xml_schema::String& v)
: ::xml_schema::String (v)
{
}
Lang_member::
Lang_member (const Lang_member& v,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (v, f, c)
{
}
Lang_member& Lang_member::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Lang_member_literals_[v]);
return *this;
}
}
#include <xsd/cxx/xml/dom/wildcard-source.hxx>
#include <xsd/cxx/xml/dom/parsing-source.hxx>
namespace namespace_
{
// Lang
//
Lang::
Lang (const ::xercesc::DOMElement& e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (e, f, c)
{
}
Lang::
Lang (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (a, f, c)
{
}
Lang::
Lang (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (s, e, f, c)
{
}
Lang* Lang::
_clone (::xml_schema::Flags f,
::xml_schema::Container* c) const
{
return new class Lang (*this, f, c);
}
// Space
//
Space::
Space (const ::xercesc::DOMElement& e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Ncname (e, f, c)
{
_xsd_Space_convert ();
}
Space::
Space (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Ncname (a, f, c)
{
_xsd_Space_convert ();
}
Space::
Space (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Ncname (s, e, f, c)
{
_xsd_Space_convert ();
}
Space* Space::
_clone (::xml_schema::Flags f,
::xml_schema::Container* c) const
{
return new class Space (*this, f, c);
}
Space::Value Space::
_xsd_Space_convert () const
{
::xsd::cxx::tree::enum_comparator< char > c (_xsd_Space_literals_);
const Value* i (::std::lower_bound (
_xsd_Space_indexes_,
_xsd_Space_indexes_ + 2,
*this,
c));
if (i == _xsd_Space_indexes_ + 2 || _xsd_Space_literals_[*i] != *this)
{
throw ::xsd::cxx::tree::unexpected_enumerator < char > (*this);
}
return *i;
}
const char* const Space::
_xsd_Space_literals_[2] =
{
"default",
"preserve"
};
const Space::Value Space::
_xsd_Space_indexes_[2] =
{
::namespace_::Space::default_,
::namespace_::Space::preserve
};
// Lang_member
//
Lang_member::
Lang_member (const ::xercesc::DOMElement& e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (e, f, c)
{
_xsd_Lang_member_convert ();
}
Lang_member::
Lang_member (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (a, f, c)
{
_xsd_Lang_member_convert ();
}
Lang_member::
Lang_member (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (s, e, f, c)
{
_xsd_Lang_member_convert ();
}
Lang_member* Lang_member::
_clone (::xml_schema::Flags f,
::xml_schema::Container* c) const
{
return new class Lang_member (*this, f, c);
}
Lang_member::Value Lang_member::
_xsd_Lang_member_convert () const
{
::xsd::cxx::tree::enum_comparator< char > c (_xsd_Lang_member_literals_);
const Value* i (::std::lower_bound (
_xsd_Lang_member_indexes_,
_xsd_Lang_member_indexes_ + 1,
*this,
c));
if (i == _xsd_Lang_member_indexes_ + 1 || _xsd_Lang_member_literals_[*i] != *this)
{
throw ::xsd::cxx::tree::unexpected_enumerator < char > (*this);
}
return *i;
}
const char* const Lang_member::
_xsd_Lang_member_literals_[1] =
{
""
};
const Lang_member::Value Lang_member::
_xsd_Lang_member_indexes_[1] =
{
::namespace_::Lang_member::empty
};
}
#include <ostream>
namespace namespace_
{
::std::ostream&
operator<< (::std::ostream& o, const Lang& i)
{
return o << static_cast< const ::xml_schema::String& > (i);
}
::std::ostream&
operator<< (::std::ostream& o, Space::Value i)
{
return o << Space::_xsd_Space_literals_[i];
}
::std::ostream&
operator<< (::std::ostream& o, const Space& i)
{
return o << static_cast< const ::xml_schema::Ncname& > (i);
}
::std::ostream&
operator<< (::std::ostream& o, Lang_member::Value i)
{
return o << Lang_member::_xsd_Lang_member_literals_[i];
}
::std::ostream&
operator<< (::std::ostream& o, const Lang_member& i)
{
return o << static_cast< const ::xml_schema::String& > (i);
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace namespace_
{
}
#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
namespace namespace_
{
void
operator<< (::xercesc::DOMElement& e, const Lang& i)
{
e << static_cast< const ::xml_schema::String& > (i);
}
void
operator<< (::xercesc::DOMAttr& a, const Lang& i)
{
a << static_cast< const ::xml_schema::String& > (i);
}
void
operator<< (::xml_schema::ListStream& l,
const Lang& i)
{
l << static_cast< const ::xml_schema::String& > (i);
}
void
operator<< (::xercesc::DOMElement& e, const Space& i)
{
e << static_cast< const ::xml_schema::Ncname& > (i);
}
void
operator<< (::xercesc::DOMAttr& a, const Space& i)
{
a << static_cast< const ::xml_schema::Ncname& > (i);
}
void
operator<< (::xml_schema::ListStream& l,
const Space& i)
{
l << static_cast< const ::xml_schema::Ncname& > (i);
}
void
operator<< (::xercesc::DOMElement& e, const Lang_member& i)
{
e << static_cast< const ::xml_schema::String& > (i);
}
void
operator<< (::xercesc::DOMAttr& a, const Lang_member& i)
{
a << static_cast< const ::xml_schema::String& > (i);
}
void
operator<< (::xml_schema::ListStream& l,
const Lang_member& i)
{
l << static_cast< const ::xml_schema::String& > (i);
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.

503
src/xml/xml.h Normal file
View file

@ -0,0 +1,503 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// 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
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
#ifndef XML_XML_H
#define XML_XML_H
#ifndef XSD_CXX11
#define XSD_CXX11
#endif
#ifndef XSD_USE_CHAR
#define XSD_USE_CHAR
#endif
#ifndef XSD_CXX_TREE_USE_CHAR
#define XSD_CXX_TREE_USE_CHAR
#endif
// Begin prologue.
//
//
// End prologue.
#include <xsd/cxx/config.hxx>
#if (XSD_INT_VERSION != 4000000L)
#error XSD runtime version mismatch
#endif
#include <xsd/cxx/pre.hxx>
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/types.hxx>
#include <xsd/cxx/xml/error-handler.hxx>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/tree/parsing.hxx>
#include <xsd/cxx/tree/parsing/byte.hxx>
#include <xsd/cxx/tree/parsing/unsigned-byte.hxx>
#include <xsd/cxx/tree/parsing/short.hxx>
#include <xsd/cxx/tree/parsing/unsigned-short.hxx>
#include <xsd/cxx/tree/parsing/int.hxx>
#include <xsd/cxx/tree/parsing/unsigned-int.hxx>
#include <xsd/cxx/tree/parsing/long.hxx>
#include <xsd/cxx/tree/parsing/unsigned-long.hxx>
#include <xsd/cxx/tree/parsing/boolean.hxx>
#include <xsd/cxx/tree/parsing/float.hxx>
#include <xsd/cxx/tree/parsing/double.hxx>
#include <xsd/cxx/tree/parsing/decimal.hxx>
#include <xsd/cxx/xml/dom/serialization-header.hxx>
#include <xsd/cxx/tree/serialization.hxx>
#include <xsd/cxx/tree/serialization/byte.hxx>
#include <xsd/cxx/tree/serialization/unsigned-byte.hxx>
#include <xsd/cxx/tree/serialization/short.hxx>
#include <xsd/cxx/tree/serialization/unsigned-short.hxx>
#include <xsd/cxx/tree/serialization/int.hxx>
#include <xsd/cxx/tree/serialization/unsigned-int.hxx>
#include <xsd/cxx/tree/serialization/long.hxx>
#include <xsd/cxx/tree/serialization/unsigned-long.hxx>
#include <xsd/cxx/tree/serialization/boolean.hxx>
#include <xsd/cxx/tree/serialization/float.hxx>
#include <xsd/cxx/tree/serialization/double.hxx>
#include <xsd/cxx/tree/serialization/decimal.hxx>
#include <xsd/cxx/tree/std-ostream-operators.hxx>
namespace xml_schema
{
// anyType and anySimpleType.
//
typedef ::xsd::cxx::tree::type Type;
typedef ::xsd::cxx::tree::simple_type< char, Type > SimpleType;
typedef ::xsd::cxx::tree::type Container;
// 8-bit
//
typedef signed char Byte;
typedef unsigned char UnsignedByte;
// 16-bit
//
typedef short Short;
typedef unsigned short UnsignedShort;
// 32-bit
//
typedef int Int;
typedef unsigned int UnsignedInt;
// 64-bit
//
typedef long long Long;
typedef unsigned long long UnsignedLong;
// Supposed to be arbitrary-length integral types.
//
typedef long long Integer;
typedef long long NonPositiveInteger;
typedef unsigned long long NonNegativeInteger;
typedef unsigned long long PositiveInteger;
typedef long long NegativeInteger;
// Boolean.
//
typedef bool Boolean;
// Floating-point types.
//
typedef float Float;
typedef double Double;
typedef double Decimal;
// String types.
//
typedef ::xsd::cxx::tree::string< char, SimpleType > String;
typedef ::xsd::cxx::tree::normalized_string< char, String > NormalizedString;
typedef ::xsd::cxx::tree::token< char, NormalizedString > Token;
typedef ::xsd::cxx::tree::name< char, Token > Name;
typedef ::xsd::cxx::tree::nmtoken< char, Token > Nmtoken;
typedef ::xsd::cxx::tree::nmtokens< char, SimpleType, Nmtoken > Nmtokens;
typedef ::xsd::cxx::tree::ncname< char, Name > Ncname;
typedef ::xsd::cxx::tree::language< char, Token > Language;
// ID/IDREF.
//
typedef ::xsd::cxx::tree::id< char, Ncname > Id;
typedef ::xsd::cxx::tree::idref< char, Ncname, Type > Idref;
typedef ::xsd::cxx::tree::idrefs< char, SimpleType, Idref > Idrefs;
// URI.
//
typedef ::xsd::cxx::tree::uri< char, SimpleType > Uri;
// Qualified name.
//
typedef ::xsd::cxx::tree::qname< char, SimpleType, Uri, Ncname > Qname;
// Binary.
//
typedef ::xsd::cxx::tree::buffer< char > Buffer;
typedef ::xsd::cxx::tree::base64_binary< char, SimpleType > Base64Binary;
typedef ::xsd::cxx::tree::hex_binary< char, SimpleType > HexBinary;
// Date/time.
//
typedef ::xsd::cxx::tree::time_zone TimeZone;
typedef ::xsd::cxx::tree::date< char, SimpleType > Date;
typedef ::xsd::cxx::tree::date_time< char, SimpleType > DateTime;
typedef ::xsd::cxx::tree::duration< char, SimpleType > Duration;
typedef ::xsd::cxx::tree::gday< char, SimpleType > Gday;
typedef ::xsd::cxx::tree::gmonth< char, SimpleType > Gmonth;
typedef ::xsd::cxx::tree::gmonth_day< char, SimpleType > GmonthDay;
typedef ::xsd::cxx::tree::gyear< char, SimpleType > Gyear;
typedef ::xsd::cxx::tree::gyear_month< char, SimpleType > GyearMonth;
typedef ::xsd::cxx::tree::time< char, SimpleType > Time;
// Entity.
//
typedef ::xsd::cxx::tree::entity< char, Ncname > Entity;
typedef ::xsd::cxx::tree::entities< char, SimpleType, Entity > Entities;
typedef ::xsd::cxx::tree::content_order ContentOrder;
// Namespace information and list stream. Used in
// serialization functions.
//
typedef ::xsd::cxx::xml::dom::namespace_info< char > NamespaceInfo;
typedef ::xsd::cxx::xml::dom::namespace_infomap< char > NamespaceInfomap;
typedef ::xsd::cxx::tree::list_stream< char > ListStream;
typedef ::xsd::cxx::tree::as_double< Double > AsDouble;
typedef ::xsd::cxx::tree::as_decimal< Decimal > AsDecimal;
typedef ::xsd::cxx::tree::facet Facet;
// Flags and properties.
//
typedef ::xsd::cxx::tree::flags Flags;
typedef ::xsd::cxx::tree::properties< char > Properties;
// Parsing/serialization diagnostics.
//
typedef ::xsd::cxx::tree::severity Severity;
typedef ::xsd::cxx::tree::error< char > Error;
typedef ::xsd::cxx::tree::diagnostics< char > Diagnostics;
// Exceptions.
//
typedef ::xsd::cxx::tree::exception< char > Exception;
typedef ::xsd::cxx::tree::bounds< char > Bounds;
typedef ::xsd::cxx::tree::duplicate_id< char > DuplicateId;
typedef ::xsd::cxx::tree::parsing< char > Parsing;
typedef ::xsd::cxx::tree::expected_element< char > ExpectedElement;
typedef ::xsd::cxx::tree::unexpected_element< char > UnexpectedElement;
typedef ::xsd::cxx::tree::expected_attribute< char > ExpectedAttribute;
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
//
typedef ::xsd::cxx::xml::error_handler< char > ErrorHandler;
// DOM interaction.
//
namespace dom
{
// Automatic pointer for DOMDocument.
//
using ::xsd::cxx::xml::dom::unique_ptr;
#ifndef XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
#define XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
// DOM user data key for back pointers to tree nodes.
//
const XMLCh* const treeNodeKey = ::xsd::cxx::tree::user_data_keys::node;
#endif
}
}
// Forward declarations.
//
namespace namespace_
{
class Lang;
class Space;
class Lang_member;
}
#include <memory> // ::std::unique_ptr
#include <limits> // std::numeric_limits
#include <algorithm> // std::binary_search
#include <utility> // std::move
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>
#include <xsd/cxx/xml/dom/parsing-header.hxx>
#include <xsd/cxx/tree/containers-wildcard.hxx>
namespace namespace_
{
class Lang: public ::xml_schema::String
{
public:
Lang (const char* v);
Lang (const ::std::string& v);
Lang (const ::xercesc::DOMElement& e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang (const Lang& x,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
virtual Lang*
_clone (::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0) const;
};
class Space: public ::xml_schema::Ncname
{
public:
enum Value
{
default_,
preserve
};
Space (Value v);
Space (const char* v);
Space (const ::std::string& v);
Space (const ::xml_schema::Ncname& v);
Space (const ::xercesc::DOMElement& e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Space (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Space (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Space (const Space& x,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
virtual Space*
_clone (::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0) const;
Space&
operator= (Value v);
virtual
operator Value () const
{
return _xsd_Space_convert ();
}
protected:
Value
_xsd_Space_convert () const;
public:
static const char* const _xsd_Space_literals_[2];
static const Value _xsd_Space_indexes_[2];
};
class Lang_member: public ::xml_schema::String
{
public:
enum Value
{
empty
};
Lang_member (Value v);
Lang_member (const char* v);
Lang_member (const ::std::string& v);
Lang_member (const ::xml_schema::String& v);
Lang_member (const ::xercesc::DOMElement& e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang_member (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang_member (const ::std::string& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
Lang_member (const Lang_member& x,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
virtual Lang_member*
_clone (::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0) const;
Lang_member&
operator= (Value v);
virtual
operator Value () const
{
return _xsd_Lang_member_convert ();
}
protected:
Value
_xsd_Lang_member_convert () const;
public:
static const char* const _xsd_Lang_member_literals_[1];
static const Value _xsd_Lang_member_indexes_[1];
};
}
#include <iosfwd>
namespace namespace_
{
::std::ostream&
operator<< (::std::ostream&, const Lang&);
::std::ostream&
operator<< (::std::ostream&, Space::Value);
::std::ostream&
operator<< (::std::ostream&, const Space&);
::std::ostream&
operator<< (::std::ostream&, Lang_member::Value);
::std::ostream&
operator<< (::std::ostream&, const Lang_member&);
}
#include <iosfwd>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
namespace namespace_
{
}
#include <iosfwd>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
namespace namespace_
{
void
operator<< (::xercesc::DOMElement&, const Lang&);
void
operator<< (::xercesc::DOMAttr&, const Lang&);
void
operator<< (::xml_schema::ListStream&,
const Lang&);
void
operator<< (::xercesc::DOMElement&, const Space&);
void
operator<< (::xercesc::DOMAttr&, const Space&);
void
operator<< (::xml_schema::ListStream&,
const Space&);
void
operator<< (::xercesc::DOMElement&, const Lang_member&);
void
operator<< (::xercesc::DOMAttr&, const Lang_member&);
void
operator<< (::xml_schema::ListStream&,
const Lang_member&);
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.
#endif // XML_XML_H

287
src/xml/xml.xsd Normal file
View file

@ -0,0 +1,287 @@
<?xml version='1.0'?>
<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns ="http://www.w3.org/1999/xhtml"
xml:lang="en">
<xs:annotation>
<xs:documentation>
<div>
<h1>About the XML namespace</h1>
<div class="bodytext">
<p>
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
</p>
<p>
See <a href="http://www.w3.org/XML/1998/namespace.html">
http://www.w3.org/XML/1998/namespace.html</a> and
<a href="http://www.w3.org/TR/REC-xml">
http://www.w3.org/TR/REC-xml</a> for information
about this namespace.
</p>
<p>
Note that local names in this namespace are intended to be
defined only by the World Wide Web Consortium or its subgroups.
The names currently defined in this namespace are listed below.
They should not be used with conflicting semantics by any Working
Group, specification, or document instance.
</p>
<p>
See further below in this document for more information about <a
href="#usage">how to refer to this schema document from your own
XSD schema documents</a> and about <a href="#nsversioning">the
namespace-versioning policy governing this schema document</a>.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:attribute name="lang">
<xs:annotation>
<xs:documentation>
<div>
<h3>lang (as an attribute name)</h3>
<p>
denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.</p>
</div>
<div>
<h4>Notes</h4>
<p>
Attempting to install the relevant ISO 2- and 3-letter
codes as the enumerated possible values is probably never
going to be a realistic possibility.
</p>
<p>
See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
and the IANA language subtag registry at
<a href="http://www.iana.org/assignments/language-subtag-registry">
http://www.iana.org/assignments/language-subtag-registry</a>
for further information.
</p>
<p>
The union allows for the 'un-declaration' of xml:lang with
the empty string.
</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:union memberTypes="xs:language">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="space">
<xs:annotation>
<xs:documentation>
<div>
<h3>space (as an attribute name)</h3>
<p>
denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:NCName">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
<xs:documentation>
<div>
<h3>base (as an attribute name)</h3>
<p>
denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.</p>
<p>
See <a
href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="id" type="xs:ID">
<xs:annotation>
<xs:documentation>
<div>
<h3>id (as an attribute name)</h3>
<p>
denotes an attribute whose value
should be interpreted as if declared to be of type ID.
This name is reserved by virtue of its definition in the
xml:id specification.</p>
<p>
See <a
href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup name="specialAttrs">
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute ref="xml:space"/>
<xs:attribute ref="xml:id"/>
</xs:attributeGroup>
<xs:annotation>
<xs:documentation>
<div>
<h3>Father (in any context at all)</h3>
<div class="bodytext">
<p>
denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
</p>
<blockquote>
<p>
In appreciation for his vision, leadership and
dedication the W3C XML Plenary on this 10th day of
February, 2000, reserves for Jon Bosak in perpetuity
the XML name "xml:Father".
</p>
</blockquote>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div xml:id="usage" id="usage">
<h2><a name="usage">About this schema document</a></h2>
<div class="bodytext">
<p>
This schema defines attributes and an attribute group suitable
for use by schemas wishing to allow <code>xml:base</code>,
<code>xml:lang</code>, <code>xml:space</code> or
<code>xml:id</code> attributes on elements they define.
</p>
<p>
To enable this, such a schema must import this schema for
the XML namespace, e.g. as follows:
</p>
<pre>
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
</pre>
<p>
or
</p>
<pre>
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
</pre>
<p>
Subsequently, qualified reference to any of the attributes or the
group defined below will have the desired effect, e.g.
</p>
<pre>
&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>
</pre>
<p>
will define a type which will schema-validate an instance element
with any of those attributes.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div id="nsversioning" xml:id="nsversioning">
<h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
<div class="bodytext">
<p>
In keeping with the XML Schema WG's standard versioning
policy, this schema document will persist at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a>.
</p>
<p>
At the date of issue it can also be found at
<a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd</a>.
</p>
<p>
The schema document at that URI may however change in the future,
in order to remain compatible with the latest version of XML
Schema itself, or with the XML namespace itself. In other words,
if the XML Schema or XML namespaces change, the version of this
document at <a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd
</a>
will change accordingly; the version at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd
</a>
will not change.
</p>
<p>
Previous dated (and unchanging) versions of this schema
document are at:
</p>
<ul>
<li><a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a></li>
<li><a href="http://www.w3.org/2007/08/xml.xsd">
http://www.w3.org/2007/08/xml.xsd</a></li>
<li><a href="http://www.w3.org/2004/10/xml.xsd">
http://www.w3.org/2004/10/xml.xsd</a></li>
<li><a href="http://www.w3.org/2001/03/xml.xsd">
http://www.w3.org/2001/03/xml.xsd</a></li>
</ul>
</div>
</div>
</xs:documentation>
</xs:annotation>
</xs:schema>

View file

@ -197,6 +197,7 @@ set(SOURCE_FILES_C
set(SOURCE_FILES_CXX
clonable-object-tester.cpp
conference-event-tester.cpp
cpim-tester.cpp
events-db-tester.cpp
property-container-tester.cpp

View file

@ -0,0 +1,976 @@
/*
* conference-event-tester.cpp
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <map>
#include <string>
#include "linphone/core.h"
#include "private.h"
#include "liblinphone_tester.h"
#include "conference/conference-listener.h"
#include "conference/local-conference.h"
#include "conference/local-conference-event-handler.h"
#include "conference/participant.h"
#include "conference/remote-conference-event-handler.h"
using namespace LinphonePrivate;
using namespace std;
static const char *first_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:bob@example.com\" state=\"full\">"\
" <display-text>Bob Hoskins</display-text>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:bob@pc33.example.com\">"\
" <display-text>Bob's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" <!--"\
" USER"\
" -->"\
" <user entity=\"sip:alice@example.com\" state=\"full\">"\
" <display-text>Alice</display-text>"\
" <roles>"\
" <entry>admin</entry>"\
" <entry>participant</entry>"\
" </roles>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:4kfk4j392jsu@example.com;grid=433kj4j3u\">"\
" <status>connected</status>"\
" <joining-method>dialed-out</joining-method>"\
" <joining-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <by>sip:mike@example.com</by>"\
" </joining-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>534232</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *participant_added_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:frank@example.com\" state=\"full\">"\
" <display-text>Bob Hoskins</display-text>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:frank@pc33.example.com\">"\
" <display-text>Frank's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *participant_not_added_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:frank@example.com\" state=\"partial\">"\
" <display-text>Bob Hoskins</display-text>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:frank@pc33.example.com\">"\
" <display-text>Frank's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *participant_deleted_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:bob@example.com\" state=\"deleted\">"\
" <display-text>Bob Hoskins</display-text>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:bob@pc33.example.com\">"\
" <display-text>Bob's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *participant_admined_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:bob@example.com\" state=\"partial\">"\
" <display-text>Bob Hoskins</display-text>"\
" <roles>"\
" <entry>participant</entry>"\
" <entry>admin</entry>"\
" </roles>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:bob@pc33.example.com\">"\
" <display-text>Bob's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *participant_unadmined_notify = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "\
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
" <conference-description>"\
" <subject>Agenda: This month's goals</subject>"\
" <service-uris>"\
" <entry>"\
" <uri>http://sharepoint/salesgroup/</uri>"\
" <purpose>web-page</purpose>"\
" </entry>"\
" </service-uris>"\
" </conference-description>"\
" <!--"\
" CONFERENCE STATE"\
" -->"\
" <conference-state>"\
" <user-count>33</user-count>"\
" </conference-state>"\
" <!--"\
" USERS"\
" -->"\
" <users>"\
" <user entity=\"sip:alice@example.com\" state=\"partial\">"\
" <display-text>Alice Hoskins</display-text>"\
" <roles>"\
" <entry>participant</entry>"\
" </roles>"\
" <!--"\
" ENDPOINTS"\
" -->"\
" <endpoint entity=\"sip:alice@pc33.example.com\">"\
" <display-text>Alice's Laptop</display-text>"\
" <status>disconnected</status>"\
" <disconnection-method>departed</disconnection-method>"\
" <disconnection-info>"\
" <when>2005-03-04T20:00:00Z</when>"\
" <reason>bad voice quality</reason>"\
" <by>sip:mike@example.com</by>"\
" </disconnection-info>"\
" <!--"\
" MEDIA"\
" -->"\
" <media id=\"1\">"\
" <display-text>main audio</display-text>"\
" <type>audio</type>"\
" <label>34567</label>"\
" <src-id>432424</src-id>"\
" <status>sendrecv</status>"\
" </media>"\
" </endpoint>"\
" </user>"\
" </users>"\
" </conference-info>";
static const char *bobUri = "sip:bob@example.com";
static const char *aliceUri = "sip:alice@example.com";
static const char *frankUri = "sip:frank@example.com";
static const char *confUri = "sips:conf233@example.com";
class ConferenceEventTester : public ConferenceListener {
public:
ConferenceEventTester (LinphoneCore *core, const Address &confAddr);
~ConferenceEventTester ();
private:
void onConferenceCreated (const Address &addr);
void onConferenceTerminated (const Address &addr);
void onParticipantAdded (const Address &addr);
void onParticipantRemoved (const Address &addr);
void onParticipantSetAdmin (const Address &addr, bool isAdmin);
public:
RemoteConferenceEventHandler *handler;
map<string, bool> participants;
};
ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) {
handler = new RemoteConferenceEventHandler(core, this, confAddr);
}
ConferenceEventTester::~ConferenceEventTester () {
delete handler;
}
void ConferenceEventTester::onConferenceCreated (const Address &addr) {}
void ConferenceEventTester::onConferenceTerminated (const Address &addr) {}
void ConferenceEventTester::onParticipantAdded (const Address &addr) {
participants.insert(pair<string, int>(addr.asString(), false));
}
void ConferenceEventTester::onParticipantRemoved (const Address &addr) {
participants.erase(addr.asString());
}
void ConferenceEventTester::onParticipantSetAdmin (const Address &addr, bool isAdmin) {
auto it = participants.find(addr.asString());
if (it != participants.end())
it->second = isAdmin;
}
void first_notify_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char notify[strlen(first_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
}
void first_notify_parsing_wrong_conf() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, "sips:conf322@example.com");
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char notify[strlen(first_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 0, int, "%d");
BC_ASSERT_FALSE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_FALSE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
}
void participant_added_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
LinphoneAddress *frankAddr = linphone_core_interpret_url(marie->lc, frankUri);
char notify[strlen(first_notify) + strlen(confUri)];
char notify_added[strlen(participant_added_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
snprintf(notify_added, sizeof(notify_added), participant_added_notify, confUri);
tester.handler->notifyReceived(notify_added);
BC_ASSERT_EQUAL(tester.participants.size(), 3, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(frankAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(frankAddr))->second);
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_address_unref(frankAddr);
linphone_core_manager_destroy(marie);
}
void participant_not_added_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
LinphoneAddress *frankAddr = linphone_core_interpret_url(marie->lc, frankUri);
char notify[strlen(first_notify) + strlen(confUri)];
char notify_not_added[strlen(participant_not_added_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
snprintf(notify_not_added, sizeof(notify_not_added), participant_not_added_notify, confUri);
tester.handler->notifyReceived(notify_not_added);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_FALSE(tester.participants.find(linphone_address_as_string(frankAddr)) != tester.participants.end());
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_address_unref(frankAddr);
linphone_core_manager_destroy(marie);
}
void participant_deleted_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char notify[strlen(first_notify) + strlen(confUri)];
char notify_deleted[strlen(participant_deleted_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
snprintf(notify_deleted, sizeof(notify_deleted), participant_deleted_notify, confUri);
tester.handler->notifyReceived(notify_deleted);
BC_ASSERT_EQUAL(tester.participants.size(), 1, int, "%d");
BC_ASSERT_FALSE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
}
void participant_admined_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char notify[strlen(first_notify) + strlen(confUri)];
char notify_admined[strlen(participant_admined_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
snprintf(notify_admined, sizeof(notify_admined), participant_admined_notify, confUri);
tester.handler->notifyReceived(notify_admined);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr))->second);
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
}
void participant_unadmined_parsing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
char *confAddressStr = linphone_address_as_string(confAddress);
Address addr(confAddressStr);
bctbx_free(confAddressStr);
linphone_address_unref(confAddress);
ConferenceEventTester tester(marie->lc, addr);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char notify[strlen(first_notify) + strlen(confUri)];
char notify_unadmined[strlen(participant_unadmined_notify) + strlen(confUri)];
snprintf(notify, sizeof(notify), first_notify, confUri);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
snprintf(notify_unadmined, sizeof(notify_unadmined), participant_unadmined_notify, confUri);
tester.handler->notifyReceived(notify_unadmined);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(aliceAddr))->second);
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
}
void send_first_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
char *identityStr = linphone_address_as_string(pauline->identity);
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
bctbx_free(bobAddrStr);
linphone_address_unref(cBobAddr);
LinphoneAddress *cAliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char *aliceAddrStr = linphone_address_as_string(cAliceAddr);
Address aliceAddr(aliceAddrStr);
bctbx_free(aliceAddrStr);
linphone_address_unref(cAliceAddr);
CallSessionParams params;
localConf.addParticipant(bobAddr, &params, false);
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, &params, false);
alice->setAdmin(true);
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "Conference");
string notify = localConf.getEventHandler()->subscribeReceived(lev);
tester.handler->notifyReceived(notify);
linphone_event_unref(lev);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
void send_added_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
char *identityStr = linphone_address_as_string(pauline->identity);
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
bctbx_free(bobAddrStr);
linphone_address_unref(cBobAddr);
LinphoneAddress *cAliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char *aliceAddrStr = linphone_address_as_string(cAliceAddr);
Address aliceAddr(aliceAddrStr);
bctbx_free(aliceAddrStr);
linphone_address_unref(cAliceAddr);
LinphoneAddress *cFrankAddr = linphone_core_interpret_url(marie->lc, frankUri);
char *frankAddrStr = linphone_address_as_string(cFrankAddr);
Address frankAddr(frankAddrStr);
bctbx_free(frankAddrStr);
linphone_address_unref(cFrankAddr);
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "Conference");
CallSessionParams params;
localConf.addParticipant(bobAddr, &params, false);
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, &params, false);
alice->setAdmin(true);
string notify = localConf.getEventHandler()->subscribeReceived(lev);
tester.handler->notifyReceived(notify);
linphone_event_unref(lev);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
notify = localConf.getEventHandler()->notifyParticipantAdded(frankAddr);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 3, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(frankAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
BC_ASSERT_TRUE(!tester.participants.find(frankAddr.asString())->second);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
void send_removed_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
char *identityStr = linphone_address_as_string(pauline->identity);
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
bctbx_free(bobAddrStr);
linphone_address_unref(cBobAddr);
LinphoneAddress *cAliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char *aliceAddrStr = linphone_address_as_string(cAliceAddr);
Address aliceAddr(aliceAddrStr);
bctbx_free(aliceAddrStr);
linphone_address_unref(cAliceAddr);
CallSessionParams params;
localConf.addParticipant(bobAddr, &params, false);
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, &params, false);
alice->setAdmin(true);
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "Conference");
string notify = localConf.getEventHandler()->subscribeReceived(lev);
tester.handler->notifyReceived(notify);
linphone_event_unref(lev);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
notify = localConf.getEventHandler()->notifyParticipantRemoved(bobAddr);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 1, int, "%d");
BC_ASSERT_FALSE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
void send_admined_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
char *identityStr = linphone_address_as_string(pauline->identity);
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
bctbx_free(bobAddrStr);
linphone_address_unref(cBobAddr);
LinphoneAddress *cAliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char *aliceAddrStr = linphone_address_as_string(cAliceAddr);
Address aliceAddr(aliceAddrStr);
bctbx_free(aliceAddrStr);
linphone_address_unref(cAliceAddr);
CallSessionParams params;
localConf.addParticipant(bobAddr, &params, false);
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, &params, false);
alice->setAdmin(true);
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "Conference");
string notify = localConf.getEventHandler()->subscribeReceived(lev);
tester.handler->notifyReceived(notify);
linphone_event_unref(lev);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
notify = localConf.getEventHandler()->notifyParticipantSetAdmin(bobAddr, true);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString())->second);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
void send_unadmined_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
char *identityStr = linphone_address_as_string(pauline->identity);
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
bctbx_free(bobAddrStr);
linphone_address_unref(cBobAddr);
LinphoneAddress *cAliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
char *aliceAddrStr = linphone_address_as_string(cAliceAddr);
Address aliceAddr(aliceAddrStr);
bctbx_free(aliceAddrStr);
linphone_address_unref(cAliceAddr);
CallSessionParams params;
localConf.addParticipant(bobAddr, &params, false);
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, &params, false);
alice->setAdmin(true);
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "Conference");
string notify = localConf.getEventHandler()->subscribeReceived(lev);
tester.handler->notifyReceived(notify);
linphone_event_unref(lev);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
notify = localConf.getEventHandler()->notifyParticipantSetAdmin(aliceAddr, false);
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString()) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(aliceAddr.asString())->second);
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#if 0
void send_subscribe_receive_first_notify() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
ConferenceEventTester tester(marie->lc, pauline->identity);
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
string confId("conf233");
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 1, 1000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 1000));
tester.handler->subscribe(confId);
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionIncomingReceived, 1, 1000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionActive, 1, 3000));
wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_NotifyReceived, 1, 3000);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
tester.handler->unsubscribe();
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionTerminated, 1, 1000));
linphone_address_unref(bobAddr);
linphone_address_unref(aliceAddr);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#endif
test_t conference_event_tests[] = {
TEST_NO_TAG("First notify parsing", first_notify_parsing),
TEST_NO_TAG("First notify parsing wrong conf", first_notify_parsing_wrong_conf),
TEST_NO_TAG("Participant added", participant_added_parsing),
TEST_NO_TAG("Participant not added", participant_not_added_parsing),
TEST_NO_TAG("Participant deleted", participant_deleted_parsing),
TEST_NO_TAG("Participant admined", participant_admined_parsing),
TEST_NO_TAG("Participant unadmined", participant_unadmined_parsing),
TEST_NO_TAG("Send first notify", send_first_notify),
TEST_NO_TAG("Send participant added notify", send_added_notify),
TEST_NO_TAG("Send participant removed notify", send_removed_notify),
TEST_NO_TAG("Send participant admined notify", send_admined_notify),
TEST_NO_TAG("Send participant unadmined notify", send_unadmined_notify)
//TEST_NO_TAG("Send subscribe receive first notify", send_subscribe_receive_first_notify)
};
test_suite_t conference_event_test_suite = {
"Conference event",
nullptr,
nullptr,
liblinphone_tester_before_each,
liblinphone_tester_after_each,
sizeof(conference_event_tests) / sizeof(conference_event_tests[0]), conference_event_tests
};

View file

@ -82,7 +82,11 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
counters->number_of_LinphoneSubscriptionActive++;
if (linphone_event_get_subscription_dir(lev)==LinphoneSubscriptionIncoming){
mgr->lev=lev;
linphone_event_notify(lev,content);
if(strcmp(linphone_event_get_name(lev), "Conference") == 0) {
// TODO : Get LocalConfEventHandler and call handler->subscribeReceived(lev)
} else {
linphone_event_notify(lev,content);
}
}
break;
case LinphoneSubscriptionTerminated:

View file

@ -43,6 +43,7 @@ extern test_suite_t account_creator_test_suite;
extern test_suite_t call_test_suite;
extern test_suite_t call_video_test_suite;
extern test_suite_t clonable_object_test_suite;
extern test_suite_t conference_event_test_suite;
extern test_suite_t cpim_test_suite;
extern test_suite_t dtmf_test_suite;
extern test_suite_t event_test_suite;
@ -410,7 +411,7 @@ LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const
FILE *sip_start(const char *senario, const char* dest_username, const char *passwd, LinphoneAddress* dest_addres);
void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice );
void linphone_conf_event_notify(LinphoneEvent *lev);
#ifdef __cplusplus
};

View file

@ -564,6 +564,7 @@ void liblinphone_tester_add_suites() {
bc_tester_add_suite(&account_creator_test_suite);
bc_tester_add_suite(&stun_test_suite);
bc_tester_add_suite(&event_test_suite);
bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&flexisip_test_suite);
bc_tester_add_suite(&remote_provisioning_test_suite);
bc_tester_add_suite(&quality_reporting_test_suite);